Utility to read and convert Bluetooth pairing key configurations between different OS formats.
Copyright © 2018 Yuriy Guts
btconvert.py
requires only vanilla Python 3.6 or above. No third-party packages need to be installed.
- Copy the contents of '/var/lib/bluetooth' folder:
sudo rsync -IPavz /var/lib/bluetooth/* <source_dir>
sudo chown -R `whoami` <source_dir>
- Install SysInternals tools.
- Open Administrator Command Line.
- Export the registry keys responsible for Bluetooth device configuration. Note: use full directory paths!
psexec -s -i reg export HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Devices <source_dir_full_path>\BluetoothDevices.reg
psexec -s -i reg export HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Keys <source_dir_full_path>\BluetoothKeys.reg
- To import the registry keys generated by btexport.py, use:
psexec -s -i reg import <output_dir_full_path>\BluetoothDevices.reg
psexec -s -i reg import <output_dir_full_path>\BluetoothKeys.reg
- Copy the binary .plist file with device info:
sudo cp /Library/Preferences/com.apple.Bluetooth.plist <source_dir>
- Copy the binary .plist file with keys:
sudo cp /private/var/root/Library/Preferences/com.apple.bluetoothd.plist <source_dir>
btconvert.py [-h] --source-format FMT --destination-format FMT source_dir destination_dir
positional arguments:
source_dir Path to the directory containing Bluetooth configuration files
to convert. The format of the files depends on the source OS.
destination_dir Path to the directory where the converted output will
be written. The format of the files depends on the destination OS.
optional arguments:
-h, --help show this help message and exit
--source-format FMT Source operating system (linux, windows, macos)
--destination-format FMT
Destination operating system (linux, windows, macos)
Exporting Bluetooth config files on Linux and converting them to Windows Registry files:
sudo rsync -IPavz /var/lib/bluetooth/* ~/bt-linux
sudo chown -R `whoami` ~/bt-linux
python btconvert.py --source-format linux --destination-format windows ~/bt-linux ~/bt-windows