Your mouse supports pairing with only one device at a time. When you pair it with PC-A, your mouse stores a link key which is shared with PC-A and is used to establish an encrypted connection. When you are trying to use the mouse with PC-B, the link key stored inside the mouse doesn't match with the one on PC-B, so you're required to pair your mouse again, generating a new link key. This breaks the pairing with PC-A, and so on.
However, it is possible to pair your mouse with both PC-A and PC-B if you use the same link key on both. In order to do this, you'll need to fulfill two conditions:
- PC-A and PC-B should have the same Bluetooth MAC address
- PC-A, PC-B and your mouse should share the same link key
The first condition can be achieved by buying a USB Bluetooth dongle you'll carry along with your mouse and plug into PC-A and PC-B when necessary. Plug this dongle into PC-A and pair your mouse with it.
The second condition will require you to export and import the link key. To export the link key from PC-A, start regedit
and navigate to the following registry location:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Keys
The location will most probably be empty, because by default only SYSTEM
user has the right to read it. Right-click on the entry, select Permissions...
and give your user full access to Keys
.
Under Keys
, you'll find entries corresponding to Bluetooth interfaces your computer has. Identify the one corresponding to the USB dongle (it will have a single link key corresponding to your mouse, provided you didn't pair anything else yet). Export that entry to a file.
Then, you'll need to import the registry export on PC-B, which is usually done by double-clicking the .reg
file. Then restart the computer and the mouse should connect to it without pairing.
You'll need administrator rights on both computers to do this, and both computers should be using Microsoft Bluetooth stack.
I have tested this solution using hardware and software at my disposal, which is substantially different from yours:
- PC-A: an x86 laptop running Windows XP
- PC-B: a Banana Pi Pro running Debian 8 and BlueZ 5.23
- Dongle: Logilink BT0015
Best Answer
Have you tried to restart the bluetooth service with:
sudo systemctl restart bluetooth.service
after wake-up? If that works you can trigger restart with something like this:https://askubuntu.com/questions/308067/how-to-run-a-script-after-or-before-hibernate