Fedora – Dual Boot Bluetooth LE (low energy) device pairing

bluetoothdual-bootfedorawindows

I'm trying to pair two bluetooth devices, a mouse and a keyboard on fedora 26. I also have Windows 10 installed. What I did was: pair them on linux then on Windows, but when I tried to insert the key that I get from windows, I didn't find the entry [LinkKey] that was mentioned on the guide I followed

This is what I have on the info file for one of the devices:

[General]
Name=Designer Mouse
Appearance=0x03c2
AddressType=static
SupportedTechnologies=LE;
Trusted=true
Blocked=false
Services=00001800-0000-1000-8000-00805f9b34fb;00001801-0000-1000-8000-00805f9b34fb;0000180a-0000-1000-8000-00805f9b34fb;0000180f-0000-1000-8000-00805f9b34fb;00001812-0000-1000-8000-00805f9b34fb;

[IdentityResolvingKey]
Key=D8F3A0A146FEB991BF2ECD9756C8BDFA

[LocalSignatureKey]
Key=23AB7AF05C5AC930F9322CF44114856B
Counter=0
Authenticated=false

[LongTermKey]
Key=D2681BEA8B2C177B1AB8786F22C89DBB
Authenticated=0
EncSize=16
EDiv=48309
Rand=10283782112900107958

[DeviceID]
Source=2
Vendor=1118
Product=2053
Version=272

[ConnectionParameters]
MinInterval=6
MaxInterval=6
Latency=60
Timeout=300

According to the guide, it should be [LinkKey] entry, but there is none.

I already have the key from windows and also tried the method mentioned on this question

Best Answer

The problem is that your device is a Bluetooth LE (Low Energy) device and they are handled differently. I've found the following two solutions that helped me set up my Microsoft 3600 mouse for dual boot.

Check here for a tutorial on how to do it manually with Bluetooth LE devices: http://console.systems/2014/09/how-to-pair-low-energy-le-bluetooth.html

The key steps are:

  • First pair in Linux
  • Reboot
  • Pair in Windows
  • Get the key values from HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\BTHPORT\Parameters\Keys\{computer-bluetooth-mac}\{device-bluetooth-id}
    • It may be ControlSet001 or ControlSet002 which one cane be found in SYSTEM\Select but it's usually ControlSet001
  • This can be done e.g. using chntpw (from linux)
    cd {PATH_TO_WINDOWS_PARTITION}/Windows/System32/config/
    chntpw -e SYSTEM
  • Go to /var/lib/bluetooth/{computer-bluetooth-mac}
  • Check for a directory that closely resembles the device bluetooth id (they are usually a bit off because they may change whenever you pair again)
  • Rename that directory to match the device id
  • Edit the info file in the renamed directory
  • Copy the value of:
    • IRK into Key in IdentityResolvingKey
    • CSRK into Key in LocalSignatureKey
    • LTK into Key in LongTermKey
    • ERand into Rand: Take the hex value ab cd ef, byte reverse it (ef cd ab) and convert it into decimal (e.g. using the Programming mode of the calculator application)
    • EDIV into EDiv: Just take the hex value and convert it normally or use the decimal value directly if it is displayed (chntpw displays it)
  • Reboot

Alternatively
Use this python script by Mygod that does these steps for you: https://gist.github.com/Mygod/f390aabf53cf1406fc71166a47236ebf

I've used the script and just copied the Key entries for the groups LongTermKey, LocalSignatureKey and IdentityResolvingKey, and the EDiv and Rand entries in the LongTermKey group.

Notes for the linked manual route
It didn't really work for me which is why I didn't use it but these are common fixes if it didn't work that worked for other people:

  • The tutorial doesn't mention it but if you have an IRK entry, copy the value to the IdentityResolvingKey Key.
  • Don't copy the KeyLength to EncSize. Just leave it at what it is (in my case 16)
  • Don't forget to move the directory if the device names aren't exactly equal.
    • In my case the 5th group was counting up with every pairing.

Some additional help for the script:

  • It's run in linux.
  • The Windows partition has to be mounted.
  • The command should look like this:
    ./export-ble-infos.py -s {PATH_TO_WINDOWS_PARTITION}/Windows/System32/config/SYSTEM
    • You can also copy the SYSTEM file somewhere else and pass the path with -s {PATH}
  • It crashes if there are other bluetooth devices that windows knows which aren't LE or at least not in this format.
Related Question