Edumara

Q: Dual pairing in OS X and Windows

If I understand the bluetooth pairing process correctly, the MAC addresses of a bluetooth receiving device (the bluetooth adapter itself) and a bluetooth emitting device (in this case, the Magic Trackpad) are paired shared a randomly selected 16-bit link key. I might be wrong, but my hunch is the link key is stored (possibly encrypted) in the Trackpad itself and, additionally, somewhere in a file in OS X (com.apple.bluetooth.plist???). After pairing the Trackpad with OS X and booting into Windows (using Boot Camp), the link key (stored in the clear in the Windows registry under System\ControlSet???\services\BTHPORT\Parameters\keys, followed by the bluetooth adapter MAC address, then the Trackpad MAC address and then, as its value, the link key itself) will be different from the one stored in the Trackpad. For them to be the same, pairing is required, thereby destroying OS X pairing, et cetera.

 

So, put in a nutshell, for dual pairing to be effective we need one of two things:

  1. Apple could provide either OS X or Windows tools capable of reading the relevant link key from one system and writing it into the relevant plist or the Windows registry.
  2. Someone could let us know where exactly the blue tooth link keys are stored in Snow Leopard, so that the relevant OS X link key can be copied to the relevant entry in the Windows registry.

Advice will be most welcome.

Magic Trackpad, Mac OS X (10.6.7)

Posted on Jun 11, 2011 3:28 PM

Close

Q: Dual pairing in OS X and Windows

  • All replies
  • Helpful answers

  • by Edumara,

    Edumara Edumara Jun 12, 2011 2:44 AM in response to Edumara
    Level 1 (0 points)
    Jun 12, 2011 2:44 AM in response to Edumara

    In case the above is not altogether clear, in Linux the link keys can be found in

    /var/lib/bluetooth/MAC_ADDRESS/linkkeys. What's the equivalent path in Snow Leopard to the relevant information?

  • by Edumara,

    Edumara Edumara Jun 16, 2011 11:32 PM in response to Edumara
    Level 1 (0 points)
    Jun 16, 2011 11:32 PM in response to Edumara

    If an Apple engineer has read this, it appears they aren't willing to share their knowledge. Be that as it may, this is what I've discovered so far:

     

    The Snow Leopard link keys can be found in /private/var/root/Library/Preferences/blued.plist. This file can be opened with a Pist editor. In my case, it contains a couple of entries (couplings) for my only Bluetooth device, i.e., the Magic Trackpad, whose MAC address is paired with a couple of entries, which I supposed are MAC "identities" of my Bluetooth USB receiver. The Plist editor shows one 16-bit hex key for each pairing.

     

    Now, in theory, these keys should be copied to the relevant Windows registry entries in Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\BTHPORT\Parameter s\Keys\

    (these entries MUST be accessed running psexec -s -i regedit.exe).

     

    There are two main entries under ...\Parameters\Keys, each coinciding with what I presume are the two (?) MAC addresses of the Bluetooth dongle. Under each of these entries there's a REG_BINARY key whose name is the MAC address of the Magic Trackpad and whose value (the Bluetooth link key both devices share to communicate) SHOULD be made the same as in blued.plist.

     

    Unfortunately, the operation doesn't work. Now my Windows registry contains the same link keys as my blued.plist, but the Magic Trackpad doesn't do anything in Windows (and I don't want to pair it again, or I would be forced to do the reverse operation in blued.plist.

     

    I must be missing something. Are the link keys in blued.plist to be interpreted as big-endian, so that bits should be swapped in the Windows registry? Any advice will be most welcome.

  • by Edumara,

    Edumara Edumara Jun 17, 2011 1:37 PM in response to Edumara
    Level 1 (0 points)
    Jun 17, 2011 1:37 PM in response to Edumara

    As a continuation of the above, analysis of the relevant MAC addresses has revealed that the "extra" link key both in blued.plist and the Windows registry is, as far as I can see, an unexplained false pairing between the Magic Trackpad and another person's iMac just a short distance from my Mac Pro. Apparently, both Macs were paired at the time the pairing of the Trackpad occurred.

  • by pacnow,

    pacnow pacnow Sep 24, 2011 10:59 AM in response to Edumara
    Level 1 (0 points)
    Sep 24, 2011 10:59 AM in response to Edumara

    I found the answer.

     

    We have to enter the link key from right to left, two digits pairs at a time. I setup boot camp, and inspecting the link keys, I saw they were backwards, but in two digit pairs. So if OSX says 12345678 you will enter 78 56 34 12 on Windows. I believe it's little endian, but I am very sleep so might have to double check.

     

    1. Pair mouse with windows, then go back in and pair in OS X.

     

    2. Get the link key from OS X and email it to yourself or put it somewhere you can reach from Windows.

    [code]sudo defaults read /private/var/root/Library/Preferences/blued.plist[/code]

     

    3. Boot Windows, open cmd as admin, [code]psexec -s -i regedit[/code]

     

    4. Navigate to HKLM\System\CurrentControlSet\services\BTHPORT\Parameters\Keys\ (BT ID of Mouse/Keyboard) and begin modify binary data

     

    Here's an example link key, instead of just pluggin that in, what you want to do is break it apart starting from the right, working two digits at a time in pairs.

     

    98542ff9 88e19449 475250e1 3943255b ( What is shown in OS X)

    5B254339 E1505247 4994E188 F92F5498 (What you enter in Windows)

     

    -Camoguy

  • by Edumara,

    Edumara Edumara Sep 25, 2011 3:40 AM in response to pacnow
    Level 1 (0 points)
    Sep 25, 2011 3:40 AM in response to pacnow

    That was perfect. Thank you very much. Who would have thought the key was backwards in Windows?!

  • by Soorms,

    Soorms Soorms Dec 11, 2014 9:48 PM in response to pacnow
    Level 1 (0 points)
    Dec 11, 2014 9:48 PM in response to pacnow

    I took pacnow's great steps and turned them into an AppleScript to help automate the process a bit. After you pair the device first in Windows then in OS X, run the script, and it will popup a dialog with the OS X and Windows bluetooth pairing [Key,Value] pairs which are [Bluetooth device mac address, Bluetooth device pairing value]. The script will automatically format the Windows pairing value to the correct little endian.

     

    I've uploaded my AppleScript to this git repository. Feel free to clone it and run the script. Enjoy!

    https://github.com/Soorma07/OS-X-Bluetooth-Pairing-Value-To-Windows-Value.git

     

    Note, the script does require admin rights to run and prompts for your current user's password. I have no interest in your passwords. I'm strictly using this password in the script. The code is all open source, feel free to dig in and confirm.

  • by feitianw,

    feitianw feitianw Apr 16, 2016 2:58 AM in response to pacnow
    Level 1 (4 points)
    Peripherals
    Apr 16, 2016 2:58 AM in response to pacnow

    mac.jpg

     

    OS X El Capitan 11.4 win10

    ????