Those who dualboot know the pain of re-pairing your keyboard or mouse everytime you boot to a different OS. In this tutorial I will show how to pair a LE Bluetooth mouse in both Windows 8 and Debian simultaneously.

First pair the device in Debian, then reboot in Windows and pair the device there too. Yes, this will reset the paring in Debian, just carry on. Now we need to access the pairing keys in Windows. Download psexec.exe and open a command prompt with Administrator rights.

> cd Downloads
> psexec.exe -s -i regedit /e C:\BTKeys.reg HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\BTHPORT\Parameters\Keys

The keys should be now exported to C:\BTKeys.reg. You should get something like:

Windows Registry Editor Version 5.00


7512a3185b2c is the MAC address of the Bluetooth adapter, which can also be written in standard format as 75:12:A3:18:5B:2C. 84abd4a25ee1 is the mouse address that was assigned during the pairing. We will need those numbers in the next steps.

Now boot again to Debian. The mouse wont paired automatically, because it is now assigned to a different address and with different keys. Let's fix it.

$ cd /var/lib/bluetooth/75:12:A3:18:5B:2C/
$ ls
cache 84:AB:D4:A2:5F:E1 settings

If you look closely, the mouse address is not the same as in Windows. In my case only the fifth group is different. We need the device addresses to match, so rename the file.

$ mv 84:AB:D4:A2:{5F,5E}:E1
$ cd 84:AB:D4:A2:5E:E1/
$ ls
attributes gatt info

Now open the info file for editing and update the keys values. The relation between Windows and Bluez keys format is as follows:

At the end you should get this.



Save the changes and reboot. From now on Debian and Windows will connect the mouse automatically. Awesome!