Jump to content

Dual Boot Bluetooth Pairing Solved


  • Please log in to reply
19 replies to this topic

#1
camoguy

camoguy

    InsanelyMac Protégé

  • Members
  • PipPip
  • 84 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.

Attached File  valuedata.jpg   24.33KB   120 downloads

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

#2
verleihnix

verleihnix

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 164 posts
  • Gender:Male
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

#3
camoguy

camoguy

    InsanelyMac Protégé

  • Members
  • PipPip
  • 84 posts

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?

#4
verleihnix

verleihnix

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 164 posts
  • Gender:Male
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:
[codebox]defaults read /private/var/root/Library/Preferences/blued[/codebox]

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

#5
camoguy

camoguy

    InsanelyMac Protégé

  • Members
  • PipPip
  • 84 posts

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.

#6
verleihnix

verleihnix

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 164 posts
  • Gender:Male
How to inject the keys - defaults write?
Do you know the syntax?

#7
camoguy

camoguy

    InsanelyMac Protégé

  • Members
  • PipPip
  • 84 posts

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.

#8
verleihnix

verleihnix

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 164 posts
  • Gender:Male
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?

#9
ugokind

ugokind

    InsanelyMac Deity

  • Donators
  • 1,712 posts
  • Gender:Male
  • Location:10100
  • Interests:Apicoltura
    Mac
    Linux
    Homebrew
    Australia
    Spremermilcervello
the KEYS child in windows regedit (under vista/7) is not authorized to view
no way to change permissions!

#10
camoguy

camoguy

    InsanelyMac Protégé

  • Members
  • PipPip
  • 84 posts

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


#11
ugokind

ugokind

    InsanelyMac Deity

  • Donators
  • 1,712 posts
  • Gender:Male
  • Location:10100
  • Interests:Apicoltura
    Mac
    Linux
    Homebrew
    Australia
    Spremermilcervello
great
thanks mister

#12
camoguy

camoguy

    InsanelyMac Protégé

  • Members
  • PipPip
  • 84 posts
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.

#13
X-TRiAL

X-TRiAL

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 147 posts
  • Gender:Male
  • Location:UK
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

#14
xiqs00k

xiqs00k

    InsanelyMac Protégé

  • Members
  • Pip
  • 1 posts
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!

#15
Jaroslavus

Jaroslavus

    InsanelyMac Protégé

  • Members
  • Pip
  • 1 posts

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



#16
sebkulu

sebkulu

    InsanelyMac Protégé

  • Members
  • Pip
  • 22 posts
  • Gender:Male
  • Location:France
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

#17
sebkulu

sebkulu

    InsanelyMac Protégé

  • Members
  • Pip
  • 22 posts
  • Gender:Male
  • Location:France
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

#18
pimpao

pimpao

    InsanelyMac Protégé

  • Members
  • Pip
  • 31 posts

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.



#19
mattsnowboard

mattsnowboard

    InsanelyMac Protégé

  • Members
  • Pip
  • 32 posts

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.

 

This looks like what you want. Took like a minute to find it, but hopefully it helps other triple-booters

http://ubuntuforums....d.php?t=1479056



#20
stuck

stuck

    InsanelyMac Protégé

  • Members
  • Pip
  • 38 posts
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.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy