Jump to content

Dual Boot Bluetooth Pairing Solved


31 posts in this topic

Recommended Posts

This thread was started to address the issue of losing bluetooth connectivity to peripherals when switching between OS X and Windows 7 because each OS has a different link key, therefore forcing you to renegotiate for a new link key to start a secure session. It also can be applied if you have to share one mouse across multiple machines. Further testing necessary, this is a work in progress.

 

I got tired of my wireless mouse not working after I paired with Windows, only to have to re-pair when I booted OS X. It's an aggrevating little annoyance. Now I can pick up my mouse and walk from desktop to laptop and not have to stop and pair because I did this procedure on both. I still need to change the laptop's OS X link key, that gets done with a hex editor.

 

One more thing, the registry keys referred to in this tut, point to where the standard Microsoft bluetooth driver records the link keys. If you see anything in device manager in Bluetooth radio, you should try changing to the generic bluetooth driver. If you have broadcom drivers installed or others, they write their keys to different parts of the registry and I don't support them.

 

Converting OS X link key to Windows registry format tutorial

 

Here's an example of what a portion of a link key might read in OS X : ABCDEF12

Of course it will be longer but I want to keep this as simple as possible at first.

Here's how you convert it to Windows registry format.

You start at the right with 12, and work your way left, grouping up in pairs, so the next is EF, CD, AB.

This is what it should read after you're done: 12 EF CD AB

All we're doing is taking the furthest two right digits off and putting them in the beggining. Reordering

 

Now lets apply this to a hypothetical link key.

 

98542ff9 88e19449 475250e1 3943255b

 

Start with the furthest right group

 

5b 25 43 39

 

then the second from the right

 

e1 50 52 47

 

third from the right

 

49 94 e1 88

 

and the furthest from the right

 

f9 2f 54 98

 

Putting them back together in Windows registry format:

5b 25 43 39 e1 50 52 47 49 94 e1 88 f9 2f 54 98

 

 

 

Understanding how to decode the OS X link key is the difficult part. Converting from little endian to big endian, or vise versa.

 

Accquire your link key, convert, install to Windows registry

 

1.Pair the device in Windows first. So the entry and services are all created in the registry.

 

 

2. Find your device id aka unique identifier. (Open bluetooth devices icon in system tray, right click on device (mouse etc), go to properties, bluetooth.) Make a note of it

 

3. Boot OS X and pair the device.

 

4. Copy/Write down the link key from OS X into a text document or email to yourself so you have access to it when you go back in Windows.

 

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

 

Link key will be 16 bytes long, it looks like 4 groups of 8 characters in hex.

 

such as: 98542ff9 88e19449 475250e1 3943255b

 

To find the one you want, if there are more than one, you would need to find you device unique identifier. Refer to step 2 or you can do it in OS X. Bluetooth preferences, show more info.

 

5. Convert the 16 byte long string to Windows registry format. Refered to as little endian to big endian. (Refer to mini tutorial above)

 

5a. Boot to windows

 

6. Get a free utility from technet psexec (google) copy to desktop.

 

7. Start > type cmd > hit control+ shift+ enter to create a command prompt with Administrator privledges.

 

8.

cd Desktop

psexec -s -i regedit

 

9. Find the key in registry HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\BTHPORT\Parameters\Keys\(Unique ID of your network adapter not your device)

 

10. Your device unique id for your mouse should be visible on the right pane, right click and "Modify binary data".

 

11. We want to erase Value data, and replace our own. Open that scratch pad where you've been taking notes and hopefully have converted the OS X link key to registry format without any typos, you need to enter it in here, one digit at a time, as it doesn't support copy paste from notepad.

 

post-642937-1316891480_thumb.jpg

 

12. Hit OK, close registry, now you have the same link key in OS X and Windows 7. Changes take effect upon pressing OK. No need to reboot to see results.

 

If you try to pair that device to something else now, you'll need to repeat this process because the link key will have changed on the device. I paired my mouse to the laptop then my desktop (Windows first for the sake of this guide, I still need to test my reverse theory to change OS X's link key values, but first I need rest.) Bootcampers automatically have this done. This procedure is just an outline of what it takes, having a streamlined process like Apple would be the goal here.

 

-Camoguy

  • Like 3
Hi camoguy,

That sounds very interesting.

I am looking for a solution for years.

 

Do you know how to read the keys in SnowLeopard?

 

Regards

verleihnix

 

I think I did it on my SL, but it's the same if I remember.

sudo -s

defaults read /private/var/root/Library/Preferences/blued.plist

 

I don't have any SL around, are the keys encrypted or something?

I tried it, but it didn't work.

The file exits as you can see.

 

bash-3.2# defaults read /private/var/root/Library/Preferences/blued.plist

2011-09-29 08:16:07.659 defaults[696:903]

Domain /private/var/root/Library/Preferences/blued.plist does not exist

bash-3.2#

bash-3.2#

bash-3.2#

bash-3.2# ls -la /private/var/root/Library/Preferences/blued.plist

-rw------- 1 root wheel 392 29 Sep 08:10 /private/var/root/Library/Preferences/blued.plist

 

Edit:

In Snow it works with:

defaults read /private/var/root/Library/Preferences/blued

 

Did you ever tried to port the keys to another mac?

Yeh, it s working fine now.

I am able to boot either and having bluetooth connected without pairing.

:censored2: ;):D

Thanks a lot for pointing that out.

 

Did you tried to transfair the keys to a Windows which has never seen the mouse and keyboard before?

There is also another technique to this. First have the mouse/keyboard paired in OS X. Then switch to Windows and open bluetooth dialog. Add device, then press the power button on the keyboard. Sometimes it won't pair at first, so what I do is hold the power key on the keyboard for a few then let go, then gently press it once. Once windows sees the device and it's in the list, you right click it, properies, then the HID services will have an empty tick box, click that, hit ok, then press cancel on the dialog and windows will install the drivers and should be working in HID mode, less secure but easier.

  • 1 year later...

Hi, I know this is old but I have wanted to know how to do this. I have done all the techniques but I have one issue.

When I boot into Windows I have to open Device Settings > Bluetooth Devices > Right click mouse/keyboard > Click 'Connect'. After that it seems to work, but is there a way to eliminate this process so that they join automatically like it does in OS X.

 

Regards

  • 4 months later...
  • 5 months later...

Hello!

I have Mac OS X 10.5.8 (BT adapter Dynamode BT-USB-M2 and Targus AKB32UK) and Windows 7 Ultimate X64. Keyboard work in Mac OSX and Windows but when I reboot and change OS, keyboard not work.

Unfortunately when I paste "sudo defaults read /private/var/root/Library/Preferences/blued.plist" terminal show "Domain /private/var/root/Library/Preferences/blued.plist does not exist"

Where I found hypothetical link key ex. "12345ab6 78c91234 567891d2 3456789e"?

  • 1 month later...

Hi folks!

 

So, I successfully did the tutorial to pair Magic Mouse both in Windows and OS X without having to pair them again and again each time I switch OS, but... by pairing also the wireless Keyboard into Windows, it seems I just lost HID Proxy Mode at boot...

 

To be clear, before pairing Apple Wireless Keyboard in Windows, I could strike a key at boot, and by doing so, trigger a HID Proxy connection between Keyboard and BTReceiver.

Now, if I do the same thing, I can see the keyboard pairing with the BTReceiver (long flash green light) at boot, but when it comes to entering BIOS or selecting an OS, Keyboard just won't respond to any key.

 

So, anyone aware of this problem that might have a solution?

 

Also, another thing worth being noted, if I pair Apple Wireless Keyboard in OS X only, I get a valid link key.

If I get back to windows, then keyboard pairs itself (because it's been already done, I could also delete the keyboard from BT devices in Windows)

And when I get back to OS X, after my keyboard pairs, my link key becomes 00000000 00000000 00000000 00000000

So, to answer to myself

 

Now I'm damn sure it's a select mode issue only

 

I deleted the keyboard in OS X, then re-added it.

I need to explain a little further why I did this.

Basically, when you pair your Keyboard in Windows, and install the device with HID Driver, and you get back to OS X, I noticed my link keys in /private/var/root/Library/Preferences/blued.plist had become 00000000 00000000 00000000 000000000

I think it does mean that you're paired in HID only mode allowing less secure connection between BT device and BT Dongle.

So, when you delete the keyboard in OS X then re-add it, the connection is then done in HCI mode (because OS X have the right DRIVERS for the Keyboard), and set up in a secure way (you do that by typing a passcode on the keyboard)

 

Then, again, to ensure BT Dongle memory erasing, I unplugged it (while in OS X), then re-plugged it, checked my devices were pairing all right with it, and finally rebooted.

 

And guess what? I have my HID Proxy mode back

 

I think Windows has set BT Dongle in HCI Mode only because of the lack of drivers for the keyboard (or at least its inability to pair in a secure way in HCI), so as long as your BT Dongle is powered, you can't get your HID Proxy Mode back...

That being said, this is not enough, you MUST have paired your keyboard at least once in HCI mode with a valid link key, which I think is stored by the BT Dongle (that could be why HID Proxy Mode works only AFTER you have paired your keyboard at least ONCE)

So that is why I also deleted the keyboard in OS X, and then re-added it, to establish a secure connection and make the BT Dongle store the damn Link Key

 

Now, what I need to ensure, is that it won't happen again!

So, what I can try, is first uncheck "HID Driver" for keyboard bluetooth device in Windows and try to pair it in HCI mode.

If so, I then will have the opportunity to enter the OS X converted link key into Windows Register.

 

If not, I have no clue what to try next ^^

 

PS: I hope I'm clear enough in my explanations

  • 3 months later...
  • 2 months later...
  • 2 weeks later...

Sorry to dig up this old thread. I recently finished setting a dual boot w8 and mavericks ultrabook, purchased a generic logitech BT mouse. Followed the above procedure, paired the mouse in W8, went to Mavericks, paired it. retrieved the link key from blued.plist. Went back in to W8, opened up regedit using psexec, added the value back in (double/triple checked to make sure the values were correct). Exited regedit (CMD screen shows regedit exited with error code 0). Went back to double checked the key value, it did save.

But the mouse won't work, shows offline in devices.

  • 2 years later...

For all who find this thread and are a bit lazy ;)

 

I've created a little python script, which creates a registry file, which can be imported using the regedit tool.

No need to manually do the byte-swapping.

https://github.com/digitalbirdo/BT-LinkkeySync

 

Works great with macOS Sierra 10.12.1 and Win 8.1 Prof and an Asus BT-400 Stick for old bluetooth devices.

 

But i can't get my Logitech MX Master to work which uses Bluetooth 4.0 LE/Smart.

I'll try to pair it on windows and import the keys on the OSX side. Maybe that will work. I'll keep you updated.

  • Like 2

For all who find this thread and are a bit lazy ;)

 

I've created a little python script, which creates a registry file, which can be imported using the regedit tool.

No need to manually do the byte-swapping.

 

https://github.com/digitalbirdo/BT-LinkkeySync

 

Works great with macOS Sierra 10.12.1 and Win 8.1 Prof and an Asus BT-400 Stick for old bluetooth devices.

 

But i can't get my Logitech MX Master to work which uses Bluetooth 4.0 LE/Smart.

I'll try to pair it on windows and import the keys on the OSX side. Maybe that will work. I'll keep you updated.

thank, but :

i try one time between osx  10.11 and win 8.1, and it work fine. i decide to try from osx 10.12 to same win8.1 and didn't work...?

i try again from osx 10.11 and not working.

what i'm doing wrong?

This thread was started to address the issue of losing bluetooth connectivity to peripherals when switching between OS X and Windows 7 because each OS has a different link key, therefore forcing you to renegotiate for a new link key to start a secure session. It also can be applied if you have to share one mouse across multiple machines. Further testing necessary, this is a work in progress.

 

I got tired of my wireless mouse not working after I paired with Windows, only to have to re-pair when I booted OS X. It's an aggrevating little annoyance. Now I can pick up my mouse and walk from desktop to laptop and not have to stop and pair because I did this procedure on both. I still need to change the laptop's OS X link key, that gets done with a hex editor.

 

One more thing, the registry keys referred to in this tut, point to where the standard Microsoft bluetooth driver records the link keys. If you see anything in device manager in Bluetooth radio, you should try changing to the generic bluetooth driver. If you have broadcom drivers installed or others, they write their keys to different parts of the registry and I don't support them.

 

Converting OS X link key to Windows registry format tutorial

 

Here's an example of what a portion of a link key might read in OS X : ABCDEF12

Of course it will be longer but I want to keep this as simple as possible at first.

Here's how you convert it to Windows registry format.

You start at the right with 12, and work your way left, grouping up in pairs, so the next is EF, CD, AB.

This is what it should read after you're done: 12 EF CD AB

All we're doing is taking the furthest two right digits off and putting them in the beggining. Reordering

 

Now lets apply this to a hypothetical link key.

 

98542ff9 88e19449 475250e1 3943255b

 

Start with the furthest right group

 

5b 25 43 39

 

then the second from the right

 

e1 50 52 47

 

third from the right

 

49 94 e1 88

 

and the furthest from the right

 

f9 2f 54 98

 

Putting them back together in Windows registry format:

5b 25 43 39 e1 50 52 47 49 94 e1 88 f9 2f 54 98

 

Understanding how to decode the OS X link key is the difficult part. Converting from little endian to big endian, or vise versa.

 

Accquire your link key, convert, install to Windows registry

 

1.Pair the device in Windows first. So the entry and services are all created in the registry.

 

 

2. Find your device id aka unique identifier. (Open bluetooth devices icon in system tray, right click on device (mouse etc), go to properties, bluetooth.) Make a note of it

 

3. Boot OS X and pair the device.

 

4. Copy/Write down the link key from OS X into a text document or email to yourself so you have access to it when you go back in Windows.

 

sudo defaults read /private/var/root/Library/Preferences/blued.plist
Link key will be 16 bytes long, it looks like 4 groups of 8 characters in hex.

 

such as: 98542ff9 88e19449 475250e1 3943255b

 

To find the one you want, if there are more than one, you would need to find you device unique identifier. Refer to step 2 or you can do it in OS X. Bluetooth preferences, show more info.

 

5. Convert the 16 byte long string to Windows registry format. Refered to as little endian to big endian. (Refer to mini tutorial above)

 

5a. Boot to windows

 

6. Get a free utility from technet psexec (google) copy to desktop.

 

7. Start > type cmd > hit control+ shift+ enter to create a command prompt with Administrator privledges.

 

8.

cd Desktop
psexec -s -i regedit
9. Find the key in registry HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\BTHPORT\Parameters\Keys\(Unique ID of your network adapter not your device)

 

10. Your device unique id for your mouse should be visible on the right pane, right click and "Modify binary data".

 

11. We want to erase Value data, and replace our own. Open that scratch pad where you've been taking notes and hopefully have converted the OS X link key to registry format without any typos, you need to enter it in here, one digit at a time, as it doesn't support copy paste from notepad.

 

attachicon.gifvaluedata.jpg

 

12. Hit OK, close registry, now you have the same link key in OS X and Windows 7. Changes take effect upon pressing OK. No need to reboot to see results.

 

If you try to pair that device to something else now, you'll need to repeat this process because the link key will have changed on the device. I paired my mouse to the laptop then my desktop (Windows first for the sake of this guide, I still need to test my reverse theory to change OS X's link key values, but first I need rest.) Bootcampers automatically have this done. This procedure is just an outline of what it takes, having a streamlined process like Apple would be the goal here.

 

-Camoguy

 

Thank you so much for this, that was a quite an inconvenience on my system and now it runs perfectly.

  • Like 1

For all who find this thread and are a bit lazy ;)

 

I've created a little python script, which creates a registry file, which can be imported using the regedit tool.

No need to manually do the byte-swapping.

 

https://github.com/digitalbirdo/BT-LinkkeySync

 

Works great with macOS Sierra 10.12.1 and Win 8.1 Prof and an Asus BT-400 Stick for old bluetooth devices.

 

But i can't get my Logitech MX Master to work which uses Bluetooth 4.0 LE/Smart.

I'll try to pair it on windows and import the keys on the OSX side. Maybe that will work. I'll keep you updated.

This thread is proven golden for me, I started learning Python through your script. Thank you for sharing :)

  • Like 1
  • 8 months later...

Thank you very much to DigitalBird and Camoguy. For anyone having trouble, for example: "Error accessing the registry." I had to go to regedit and BTHPORT/Keys and add ownership. I followed this guide to do that. I then was able to merge the btkeys.reg file. Apologies if this is too much of a necro-thread. I just wanted to help.

  • Like 1
×
×
  • Create New...