Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've got an magic mouse and an apple bluetooth keyboard.

I usually run ubuntu on my computer, but sometimes I need to use windows 7 from an external disk.

Whenever I boot into the other system I have to pair my devices again.

Is there a way to make this work? I've already tried setting the hostname to be the same, but this didn't work.

share|improve this question

3 Answers 3

Here I share what I learned about this, after struggled with it for quite a few days. I have a dual boot system with Windows 10 and up-to-date Debian testing, and would like to share the same bluetooth mouse. Mine is a Razer Orochi mouse. I am giving all the credits for the following people and their work:

1) http://forum.notebookreview.com/threads/dual-booting-and-bluetooth.739236/
2) http://forums.solydxk.com/viewtopic.php?f=7&t=5251#p53746
3) http://www.insanelymac.com/forum/topic/268837-dual-boot-bluetooth-pairing-solved/

*EDIT: I discovered that a more consistent way is to pair it with Linux first, then go to Windows to change the pair key. Therefore I am revising the answers here so it is a complete tutorial you can follow.

-- Linux First Method (so far so good!)

Before you start, I assume you have paired the mouse in both Windows and Linux at least once, so the corresponding registries are set. Boot to Linux and make sure the mouse works. I use Debian testing with KDE (Plasma 5), so it is pretty easy to pair using the standard build-in Bluetooth packages. I am not too sure about Ubuntu, but I suppose the underlying processes are similar. Make sure the mouse is usable.

Change to root user (sudo won't do here) (just use command su or sux), navigate into the following location:

/var/lib/bluetooth/AA:AA:AA:AA:AA:AA/BB:BB:BB:BB:BB:BB

Where AAs are the adapter of your laptop, BBs are the mouse. There is one file in there called info. Edit this file with vi, nano or your favorite editor. Inside "info" you should see the following entry called LinkKey. The Key is a 32 character hex string. Copy and save this string in a text file somewhere in which both Linux and Windows can access, for example an external flash drive.

[LinkKey]
Key=XXXXXXXXXXXXXXXXXXXXXXXXXXXX
Type=4
PINLength=0

Now Boot into Windows. Without using the bluetooth mouse (turn it off or set aside), under an adminstrator terminal, run this: psexec -s -i regedit.exe. You will have to download psexec first.

Navigate to the following key:

(LM)\ControlSet001\Services\BTHPORT\Parameters\Keys\(ID_Adapter)

In there, you should be able to see another ID that matches with your mouse. Right-click on the key and choose "Modify Binary Data".

Now it is time to find that file you saved and enter the 32 characters in 16 groups in the "normal order". Don't reverse the order, which is a mac thing.

After this, close the registry and turn on the mouse! Wolla!

--- Windows First Method (not consistent, only for the record here)

First you need to pair the mouse with Windows 10, and obtain the linkkey. To achieve this, you can either use the chntpw method in Linux (see link 1), or the psexec method in Windows. In windows, under an adminstrator terminal, run this: psexec -s -i regedit.exe. You will have to download psexec first.

Obtain and export the key from the following place. Save it to a text file you can access later in linux.

(LM)\ControlSet001\Services\BTHPORT\Parameters\Keys

Then boot to Linux; in this case, you probably have attempted pairing the mouse at least once before. I am assuming you did.

Change to a root user, go into the following location:

/var/lib/bluetooth/AA:AA:AA:AA:AA:AA/BB:BB:BB:BB:BB:BB

Where AAs are the adapter of your laptop, BBs are the mouse. There is one file in there called info. Edit this file with vi, nano or your favorite editor.

[LinkKey]
Key=A7XXXXXXXXXXXXXXXXXXXXXXXXXXXX89
Type=4
PINLength=0

The goal is to sandwitch your key (all spaces and commas removed) between A7 and 89. A7 and 89 are critical for making this work. Why the sandwitch? Honestly I have no idea, but without it it won't work for me. The key is no longer 8 bytes, but 16 bytes! So you will have 32 characters to sandwitch. The final key will have a total length of 36 characters.

Reboot your linux with finger-crossed. Finally, yah!

share|improve this answer
    
I report back that after enjoying the initial success for 2 days. I lost the connection. I tried this procedure again and it won't work again, namely, I don't think we correctly understood the mechanism and why the A7 and 89 in the LinkKey, because the default length of keys are all 32 characters. –  GoJian Aug 25 at 17:04
    
I reversed the process by first pairing it in Linux, then going back to Windows to change the LinkKey by modifying the registry, following this link. I think I solved it this time, for now. –  GoJian Aug 25 at 17:08

Probably you've already found an answer. But for the sake of completeness here is the link where it is explained http://ubuntuforums.org/showpost.php?p=9363229&postcount=5 . The pin code used for pairing is used to generate a another key. This key is different even each time for the same pin. That is why same pin does not work. You have to copy the key from WIndows to Ubuntu machine.

share|improve this answer

Every time you load an operating system, that OS needs to load the hardware drivers. Even if you are loading from hibernation, it still loads/refreshes the drivers again. Try it... uninstall a driver in Device Manager, and immediately hibernate. When you restore from hibernation, the driver is there in Device Manager again as if you had restarted.

You need to pair the bluetooth devices after the drivers have been loaded.

The only way to keep the bluetooth devices connected, is to keep the bluetooth receivers active. The only way to keep them active, is to not unload them from the system. The only way to not unload them from the system, is not to shut down the operating system that is accessing them.

Now, if you were running one of the operating systems in a virtual machine, that's a whole different ball game. But since you are not, and since you actually reboot between changes, then no. There is no way with your current usage choices to make the bluetooth devices avoid having to be re-paired each time.

share|improve this answer
    
I'm not sure we're talking about the same thing. If I reboot the system I don't have to re-pair the devices, they connect automatically. If I, however, switch the operation system, they aren't able to connect automatically. –  Georg Schölly May 9 '12 at 14:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.