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
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Keys\001bdc0e3454\c4be84437bd0]
"LTK"=hex:57,30,62,7c,8d,e8,3b,a5,5c,d1,82,fa,bb,a0,e5,71
"KeyLength"=dword:00000000
"ERand"=hex(b):80,07,0b,e3,63,85,dd,2b
"EDIV"=dword:0000f548
"IRK"=hex:aa,fd,93,6f,05,c3,e7,08,47,70,43,f3,0a,06,df,1a
"Address"=hex(b):d0,6a,43,84,be,c4,00,00
"AddressType"=dword:00000000
"CSRK"=hex:a2,b3,df,00,25,5c,ff,4d,9c,4c,74,06,e2,cb,07,b7
"OutboundSignCounter"=dword:00000000
"AuthReq"=dword:00000001

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:
[General]
Name=ELECOM Laser Mouse
Appearance=0x03c2
AddressType=public
SupportedTechnologies=LE;
Trusted=true
Blocked=false
Services=00001800-0000-1000-8....
[IdentityResolvingKey]
Key=AAFD936F05C3E708477043F30A06DF1A
[RemoteSignatureKey]
Key=9437CEEC9FD5FEAA30410C1713C6D6CF
Counter=0
Authenticated=false
[LocalSignatureKey]
Key=A2B3DF00255CFF4D9C4C7406E2CB07B7
Counter=0
Authenticated=false
[LongTermKey]
Key=5730627C8DE83BA55CD182FABBA0E571
Authenticated=0
EncSize=16
EDiv=62792
Rand=3160829177541363584
[SlaveLongTermKey]
Key=DA36C669AB37846E1CA15C8A6055912D
Authenticated=0
EncSize=16
EDiv=22299
Rand=4757000163648466617

Then my Bluetooth mouse in dual boot envirinemnt works fine.

Advertisements

About fujiwara

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

8 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

  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

Leave a Reply

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

WordPress.com Logo

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

Google+ photo

You are commenting using your Google+ 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