Skip to content

Instantly share code, notes, and snippets.

@tVienonen
Created February 23, 2020 17:24
Show Gist options
  • Save tVienonen/fad5cb68e6449f6c4804e276094516e3 to your computer and use it in GitHub Desktop.
Save tVienonen/fad5cb68e6449f6c4804e276094516e3 to your computer and use it in GitHub Desktop.
Guide for pairing and connecting Bluetooth LE devices when using Linux and Windows dual boot

Bluetooth LE Dual Boot Connecting guide

  1. Pair and connect on Linux

  2. Pair and connect on Windows

  3. Shut down Bluetooth device

  4. Boot to Linux

  5. Mount Windows partition

  6. Go to <windows-mount>/Windows/System32/config

  7. Run command chntpw -e SYSTEM

    • Install chntpw if it is not available
  8. Go to the keys ControlSet001\Services\BTHPORT\Parameters1\Keys\<computer-bluetooth-mac>\<device-bluetooth-mac>

    • Rename the device's bluetooth mac in Linux /var/lib/bluetooth directory to the one found in the Windows registry. (Usually just one byte changes in the Mac when pairing is done)
  9. Replace values in Linux device's directory info file:

    • 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)
  10. Restart bluetooth service

    • systemctl restart bluetooth
  11. Power on bluetooth device

Connection should work now seamlessly in Linux and Windows

@obook
Copy link

obook commented Apr 18, 2024

Thank tVienonen for this tutorial.

For BLE Logitech M240 mice, I just changed two things in Linux BT info file :

[IdentityResolvingKey]
Key=IRK Key

[PeripheralLongTermKey]
Key=LTK Key

Then power on the mice and restart bluetooth.

Notes : Keys are without spaces, CSRK was missing in register.

Regards.

(Windows 10 / Kubuntu 22.04 LTS)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment