Jump to content
camoguy

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

Share this post


Link to post
Share on other sites
Advertisement
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?

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites
Did you ever tried to port the keys to another mac?

I port the keys around between macs and windows. The keys are pretty much the same for both platforms except, windows it's big endian and mac it's little endian.

Share this post


Link to post
Share on other sites
How to inject the keys - defaults write?

Do you know the syntax?

I haven't got that defaults write working yet, so for now I copy blued to my desktop, change ownership and modify the values with plistedit pro.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

the KEYS child in windows regedit (under vista/7) is not authorized to view

no way to change permissions!

Share this post


Link to post
Share on other sites
the KEYS child in windows regedit (under vista/7) is not authorized to view

no way to change permissions!

Run regedit as "system" with the command:

 

psexec -s -i regedit

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Hi camoguy, I was searching the whole internet for this solution I couldn't find anywhere else!!!

Thank you very much to share this with us!

 

It works!

Share this post


Link to post
Share on other sites

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"?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

there's some way to setup the keyboard/mouse to triple boot ? I'm sucessfully paired it on Win 8 + OS X Mavericks, need to pair it to Ubuntu too.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 :)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×