Wednesday, April 19, 2017

Notes on Using the same Bluetooth LE Mouse (Microsoft 3600) with Windows and Linux without Re-paring

This note intends to collect the key steps of my implantation. It is mainly instructed and inspired by this post as well as its comments:

The idea generally is to have the mouse working with windows, and then copied its credentials to linux.

My OSs are windows 10 64bit and Ubuntu 16.04 64bit with 4.10 kernel;
Mouse is Microsoft 3600

  1. have bluez and blueman installed in linux (so it works with BLE mouse)
  2. pair the mouse with linux and then windows. (so it is working in windows)
  3. extract credentials from registry. (use "psexec -s -i regedit", find and export as txt:  "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\BTHPORT\Parameters\Keys\<MAC of BT adapter>\<MAC of BT mouse>")
  4. Fill the credentials to Linux ("/var/lib/bluetooth/<MAC of BT adapter>/<MAC of BT mouse>/info")
  5. Restart BT service ("/etc/init.d/bluetooth restart")

Below are detailed mapping and manipulation for step 4 above:
  1.  Make sure the MAC of BT mouse is correct in Linux. If they are different, rename the directory in linux to match the MAC found in Windows.  (Examine it character by character. This file for mine was always off by one bit by default in linux)
  2.  "LTK" -> "Key" under [LongTermKey]. Remove anything other than hex character (e.g. whitespace and dash), and convert to upper case. 
  3.  "ERand" -> "Rand" under [LongTermKey]. Do BYTE-WISE reverse and then convert hex to dec. (e.g., "12 AB" -> "AB 12" -> "43794")
  4.  "EDIV" -> "EDiv" under [LongTermKey]. Convert hex to dec. 
  5.  "IRK" -> "Key" under [IdentityResolvingKey].  Remove anything other than hex character
  6.  "CSRK" -> "Key" under [LocalSignatureKey]. Remove anything other than hex character
  7.  Leave "EncSize" and "Authenticated" unchanged

Tuesday, April 18, 2017

Notes on Pairing a Bluetooth LE Mouse with Linux

Pair in ubuntu setting failed;
With bluez and blueman installed (and bt service restarted), it pairs and works out of box

Ubuntu 16.04 LTS with kernel 4.10 amd64
Microsoft Mouse 3600
Intel 8260 WLAN/BT module
Lenovo P50 laptop