This script involves accessing and modifying system files on the Windows / Linux systems and may risk damaging your computer. Proceed with the below steps at your own risk.
I recommend backing up all config files before attempting the below steps.
The scripts in this project are intended to be executed on your Linux OS using Python3.
- Boot into Linux and pair bluetooth device(s).
- Reboot into Windows and pair bluetooth device(s).
- Download PSExec and run the following command from a Command Prompt running in Administator mode:
psexec.exe -s -i regedit /e C:\BTKeys.reg HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\BTHPORT\Parameters\Keys
- Copy the
C:\BTKeys.reg
file to a USB key (or leave onC:
drive if it's accessible from the Linux OS). - Turn off bluetooth device(s) and boot back into Linux.
- Copy the
BTKeys.reg
file to your Linux filesystem. - Run
clean_reg_file.py /path/to/BTKeys.reg keys.reg
to clean the file (converts encoding to UTF8 and strips quotation marks). - Run
bluetooth_fix.py --reg_path keys.reg
. - From a terminal with
sudo
, navigate to/var/lib/bluetooth/<ADAPTOR_MAC_ADDRESS>/
and usels
to get the mac addresses similar to the bluetooth device you are trying to pair, and re-name the directory to the new mac displayed in the output from step 8. - Open
/var/lib/bluetooth/<ADAPTOR_MAC>/<DEVICE_MAC>/info
and modify the values as per output from step 8. - Restart bluetooth with
sudo systemctl restart bluetooth
.