Bluetooth mouse in dual boot of Windows 10 and Linux

I prefer the Bluetooth mouse to the wireless USB mouse because I feel USB mouses caused chattering when I used them for more than one year. I don’t see the problem with Bluetooth mouse.

However I had one critical problem to authenticate Bluetooth 4.0 mouse in the dual boot.

After I made a pairing between Bluetooth mouse and MS-Windows 10, rebooted the system, and launched Fedora 27, and made a pairing between the mouse and Fedora, the mouse worked fine.

But after rebooted the system again and launched Windows 10, the Bluetooth mouse didn’t work and I had to make a pairing by reboot.

It seems the Bluetooth authentication saves a unique key in the host and I got how to fix the problem.

0. Make a pairing in Fedora 27

1. Make a pairing in Windows 10

2. Get PsTools to read some secret regedit keys

3. Right click on MS-DOS prompt and launch it with an Administrator privilege

3. PsExec64.exe -s -i regedit

4. Save the “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Keys\${DEVICE}\${ADDRESS}

My data is:
Windows Registry Editor Version 5.00

5. Reboot the system and Launch Fedora 27

6. Modify /var/lib/bluetooth/${DEVICE}/${ADDRESS}/info with root

  • If $DEVICE or $ADDRESS is different, you have to move the directory. My path is /var/lib/bluetooth/00:1B:DC:0E:34:54/C4:BE:84:43:7B:D0/info and no problem.
  • Copy LTK in Windows to Key in LongTermKey in Linux with capital characters and no comma
  • Reverse ERand in Windows and convert the hexadecimal without comma to the decimal and paste it to Rand in LongTermKey in Linux. In my case, ERand is 80070be36385dd2b and the reverse is 2bdd8563e30b0780 and the decimal Rand is 3160829177541363584
  • Convert the hexadecimal of EDIV in Windows to the decimal and paste it to EDiv in LongTermKey in Linux. It’s no reverse. In my case, EDIV is f548 and the decimal EDiv is 62792
  • Copy IRK in Windows to Key in IdentifyResolvingKey in Linux with capital characters and no comma
  • Copy CSRK in Windows to Key in LocalSignatureKey in Linux with capital characters and no comma

7. Run systemctl restart bluetooth with root

My modified /var/lib/bluetooth/00:1B:DC:0E:34:54/C4:BE:84:43:7B:D0/info file is:
Name=ELECOM Laser Mouse

Then my Bluetooth mouse in dual boot envirinemnt works fine.


About fujiwara

I'm an open-sourced desktop i18n developer.
This entry was posted in RedHat and tagged , . Bookmark the permalink.

23 Responses to Bluetooth mouse in dual boot of Windows 10 and Linux

  1. pablo says:

    I have a Logitech MX master, which I bought for two reasons, one of them being bluetooth. But I see myself forced to use the USB adapter because if I use it through bluetooh my Wifi connection starts lagging more and more until it just does not reach the host (packet loss 100%).

    I see that behaviour in an Asus UX31A and a Dell Latitude E7470, both with Fedora 26 and now 27. Do you know why could that be or where to report it?

  2. I’m using Ubuntu 17.10 and this procedure doesn’t work for me.

    • fujiwara says:

      Probably I can check if you send me Windows 10 registory file and Linux info files.
      Also probably I think you need to reboot the system after you modify the info file.

  3. Ary Kleinerman says:

    I am using Archlinux and you don’t have to reverse ERand from Windows. You just only have to convert from HEX to decimal. Thx

    • James says:

      Ubuntu 18.04 here.
      Erand does not have to be reversed but only converted to decimal.

      • Anyoneelse says:

        Does this procedure worked for you?
        Using ubunto 18 and tried the exact procedure above and also with erand not reversed but nothing worked for me.

      • fujiwara says:

        Yes, I use this in Fedora.

      • Michał says:

        Ubuntu 18.04 – Mx Anywhere 2 mouse works well, but:
        – ERand have to be reversed.
        – /var/lib/bluetooth/… path have to be slightly modified to be in accordance with Windows registry value: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Keys\…

  4. Mat Lilly says:

    echo $(( 16#$(echo “1C EE 99 08 74 B9 F5 77 7E CA C4 CC 08 37 08 C5” | sed ‘s/ //g’|rev) ))
    … but I am seeing some people say don’t reverse it

  5. Lee Seng says:

    i noticed that my bluetooth mac was E2:20:C9:ED:5B:F5 in ubuntu, after pairing with windows 10, it becomes E2:20:C9:ED:5B:F6. Need to rename folder name, E2:20:C9:ED:5B:F5 to E2:20:C9:ED:5B:F6 in ubuntu 18.04, so that the pairing works. my mouse is logitech M590

  6. 4tmelDriver says:

    Manjaro / Arch linux here.

    Some people noticed, that it is not necessary to reverse ERand.
    At first I reversed it, but this didn’t seem to work.
    Then I tried without reversing: then it worked.

  7. Sampson Fung says:

    I have Microsoft Mouse 3600.
    Latest Windows 10 updateded as of 2020Jan05 and Fedora 31.
    I followed exactly your guide and my Mouse3600 works in both Windows and Fedora without re-pairing now.

    Thank you very much!
    ps. The critical part is the ERand and Ediv editings. Which is not mentioned in other “solutions” in the Internet.

  8. Boris says:

    Thanks for your guide!
    But it’s not working for me.
    Keyboard: “Microsoft Surface keyboard”
    OS: Windows 10 and Ubuntu 19.10
    I followed exactly your guide and tried reversing and without reversing ERand.

  9. omdaddi says:

    Brilliant, thank you. Followed it exactly in Debian Buster and it worked immediately.

  10. David C. says:

    Thanks!!!!!!!! I tried in Ubuntu Mate 18.04 and it runs perfectly. Now I will fight with the Headphones.

  11. Pingback: Bluetooth mouse in dual boot of Windows 10 and Linux #2 | DesktopI18N's Blog

  12. The MXAnywhere mouse allows one to click the “switch” button at the bottom and switch to a different “OS”.

  13. Bernhard S. says:

    Hi, with both the newest Win10 and Ubuntu20.10 your recept works. Thank you!

  14. Gordon Wells says:

    This procedure works for me for my Logitech G604 mouse in Manjaro, with and without reversing Erand. But profile switching in G HUB stops working upon rebooting back to Windows. The default button assignments remain, but G HUB doesn’t see the mouse and let me edit profiles unless I pair again.

  15. 刘润 says:

    thanks it works in ubuntu 20.04 & windows 11 with bluetooth 5.0

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s