This is caused by the way Bluetooth devices authenticate to each other.
When the initial (manual) authentication occurs, both devices store a 'link key' which they use to automatically authenticate for future connections.
Note: Scroll down to "The easy way" at the bottom of this answer if you don't care about what's going on and how to do it manually.
What's happening
- You pair the headphones to computer A.
- This requires manual authentication.
- A new link key is generated.
- Both devices store this link key.
- You flip your USB switch so that your Bluetooth dongle is now connected to computer B.
- You pair the headphones to computer B.
- This requires manual authentication.
- A new link key is generated.
- Since computer B is using the same Bluetooth adapter that computer A used they both have the same address, so the headphones assume it's the same computer, and that it has lost its original link key (e.g. by you telling it to "Forget" the headphones) and when it stores this link key, it replaces computer A's link key.
- You flip your USB switch again so that the Bluetooth dongle is once again connected to computer A.
- Computer A and the headphones try to communicate, but can't because they have different link keys, and thus can't authenticate that they're the same device that they were originally given permission to connected to.
What you want is for the headphones to think they're both the same computer, therefore you need both computers to store the same link key.
The solution
Assuming you're using Windows' built in Bluetooth stack, the link key is is stored at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Keys
under a key named after the Bluetooth address.
Note: This registry key isn't accessible unless you either alter its permissions, or launch the registry editor as the SYSTEM account.
I recommend the latter option:
- Download PsExec from SysInternals.
- Launch Command Prompt.
- Execute
X:\Path\to\psexec.exe -s -i regedit.exe
.
If you were using Windows on both computers, you could simply pair to both computers, then copy the link key from the last one to the first one. Seeing as one of your computers is a mac, you're going to need to do a little more work, 'cause they store the link keys differently.
- First you should pair the Windows PC.
- Move the Bluetooth dongle to the Mac.
- Get the latest link key from the Mac:
- This should be stored in
/private/var/root/Library/Preferences/blued.plist
- Execute
sudo defaults read /private/var/root/Library/Preferences/com.apple.bluetoothd.plist
to find all stored link keys.
- Find which link key is for your headphones.
- Convert this link key from Mac's format to Windows' format:
- Effectively you split it up into 2 character chunks, then reverse those chunks.
- As unrealistic as this link key is, if the Mac stored it as
1234567890ABCDEFGH
, the Windows PC would need it to be GHEFCDAB9078563412
- Copy this newly converted link key into the Windows PC's registry over top of the old one.
The easy way
I also came across "BT-LinkkeySync", a open source (MIT licensed) project by Tobias Finke which can get all the keys from a Mac and output them as a .reg
file for easy importing on Windows.
Here's a link to it on GitHub: https://github.com/digitalbirdo/BT-LinkkeySync