Here I share what I learned about this, after struggled with it for quite a few days. I have a dual boot system with Windows 10 and up-to-date Debian testing, and would like to share the same Bluetooth mouse. Mine is a Razer Orochi mouse. I am giving all the credits for the following people and their work:
- http://forum.notebookreview.com/threads/dual-booting-and-bluetooth.739236/
- https://forums.solydxk.com/viewtopic.php?f=7&t=5251#p53746
- https://www.insanelymac.com/forum/topic/268837-dual-boot-bluetooth-pairing-solved/
- https://ubuntuforums.org/showthread.php?t=2390542&highlight=bluetooth+mouse+reboot (to obtain missing LinkKey in Ubuntu 18.04)
*EDIT: I discovered that a more consistent way is to pair it with Linux first, then go to Windows to change the pair key. Therefore, I am revising the answers here so it is a complete tutorial you can follow.
-- Linux First Method (so far so good!)
Before you start, I assume you have paired the mouse in both Windows and Linux at least once, so the corresponding registries are set. Boot to Linux and make sure the mouse works. I use Debian testing with KDE (Plasma 5), so it is pretty easy to pair it using the standard build-in Bluetooth packages. I am not too sure about Ubuntu, but I suppose the underlying processes are similar. Make sure the mouse is usable.
Change to root user (sudo won't do here) (just use command su or sux), navigate into the following location:
/var/lib/bluetooth/AA:AA:AA:AA:AA:AA/BB:BB:BB:BB:BB:BB
Where AAs are the adapter of your laptop, BBs are the mouse. There is one file in there called info. Edit this file with vi, nano or your favorite editor. Inside "info", you should see the following entry called LinkKey. The Key is a 32 character hex string. Copy and save this string in a text file somewhere in which both Linux and Windows can access, for example an external flash drive.
[LinkKey]
Key=XXXXXXXXXXXXXXXXXXXXXXXXXXXX
Type=4
PINLength=0
Now boot into Windows. Without using the Bluetooth mouse (turn it off or set aside), under an administrator terminal, run this: psexec -s -i regedit.exe
. You will have to download psexec first.
Navigate to the following key:
(LM)\ControlSet001\Services\BTHPORT\Parameters\Keys\(ID_Adapter)
In there, you should be able to see another ID that matches with your mouse. Right-click on the key and choose "Modify Binary Data".
Now it is time to find that file you saved and enter the 32 characters in 16 groups in the "normal order". Don't reverse the order, which is a Mac thing.
After this, close the registry and turn on the mouse! Wolla!
--- Windows First Method (not consistent, only for the record here)
First, you need to pair the mouse with Windows 10, and obtain the linkkey. To achieve this, you can either use the chntpw method in Linux (see link 1), or the psexec method in Windows. In Windows, under an administrator terminal, run this: psexec -s -i regedit.exe
. You will have to download psexec first.
Obtain and export the key from the following place. Save it to a text file you can access later in Linux.
(LM)\ControlSet001\Services\BTHPORT\Parameters\Keys
Then boot to Linux; in this case, you probably have attempted pairing the mouse at least once before. I am assuming you did.
Change to a root user, go into the following location:
/var/lib/bluetooth/AA:AA:AA:AA:AA:AA/BB:BB:BB:BB:BB:BB
Where AAs are the adapter of your laptop, BBs are the mouse. There is one file in there called info. Edit this file with vi, nano or your favorite editor.
[LinkKey]
Key=A7XXXXXXXXXXXXXXXXXXXXXXXXXXXX89
Type=4
PINLength=0
The goal is to sandwich your key (all spaces and commas removed) between A7 and 89. A7 and 89 are critical for making this work. Why the sandwich? Honestly, I have no idea, but without it, it won't work for me. The key is no longer 8 bytes, but 16 bytes! So you will have 32 characters to sandwich. The final key will have a total length of 36 characters.
Reboot your Linux with fingers crossed. Finally, yah!
I report back that after enjoying the initial success for 2 days. I lost the connection. I tried this procedure again and it won't work again, namely, I don't think we correctly understood the mechanism and why the A7 and 89 in the LinkKey, because the default length of keys are all 32 characters. – GoJian – 2015-08-25T17:04:25.920
I reversed the process by first pairing it in Linux, then going back to Windows to change the LinkKey by modifying the registry, following this link. I think I solved it this time, for now.
– GoJian – 2015-08-25T17:08:27.173Just a quick note for the uninitiated: (LM) = HKEY_LOCAL_MACHINE\SYSTEM\ and I have to enable/disable my Bluetooth adapter in Windows for my mouse to connect. – Arya S. – 2017-03-07T10:49:32.550
This guide seems outdated. In the Windows registry as well as on Linux, there are 3 keys. The info file on contains the IdentityResolvingKey, the LocalSignatureKey, and the LongTermKey. Each of these keys is 16 bytes long. In the info file, the LongTermKey is accompanied by values called EDiv and Rand, which are also present in the Windows Registry. I assume that I have to copy at least these 5 values. – Sven – 2018-01-27T01:03:07.703