Solution: pairing Bluetooth devices with win10 and Linux dual systems

preface

My computer is equipped with windows (win10) and Linux (Ubuntu 18.04) dual systems. I usually use Logitech’s wireless keyboard, but I find that every time I switch the system, although I have paired before, I can’t connect successfully. You must delete the paired device and re link it every time. Occasionally there will be device delete unsuccessful, very angry. So I want to connect (pair) two systems with one Bluetooth device once and for all.

Device deletion failed

Solution: (reprint, delete)

1. Download the repair tool and complete the installation with the default options. To prevent link failure, attach Baidu network disk link
2. Open shell, input btpair – u from the command line, and press enter to execute
3. Wait, and you will find that the paired bluetooth device has been successfully and completely deleted

 

Solution: (reprint, delete)

Basic steps:

1. First pair Bluetooth mouse under Linux (used to generate configuration file)
2. Switch to pair Bluetooth mouse under windows (used to read pairing information)
3. Modify pairing information under Linux to be consistent with that under windows

Of course, you can also do the opposite. The pairing information under windows is consistent with that under Linux, but it is not recommended.

Reading Bluetooth pairing information in Windows

The Bluetooth pairing information of windows is stored in the registry

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Keys\<本机蓝牙 MAC>\<鼠标蓝牙 MAC>

The MAC address does not have a separator, and the system permission is required to access it. I found two ways to read this part of information. (I used the first way)

use psexec.exe Start with system permissions regedit.exe
psexec.exe </ code> can be downloaded from this page to PSTools.zip ), will PSTools.zip In PsExec.exe Or psexec64.exe (here I copy it directly to Windows/system32), and run CMD with administrator privileges (also in Windows/system32), and then Enter the following command to start regedit.exe :

psexec64.exe -si regedit

Then we can view the corresponding key value in the registry editor, and we can also export it: (my length is like this)

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Keys\58fb842d509f]
"34885dd2457f"=hex:cf,a0,fc,2d,50,b3,f0,4a,93,8b,36,da,81,bb,5b,5e

Modifying Bluetooth pairing information under Linux

The pairing information of Bluetooth devices under Linux is stored in the/var/lib/Bluetooth/& lt; local Bluetooth MAC & gt; directory, such as/var/lib/Bluetooth/60:57: XX: XX: XX: XX. The letters in the MAC address are all uppercase and contain colon separator.

Enter the directory: (of course, it’s more convenient to click directly)

sudo su
cd /var/lib/bluetooth/60:57:XX:XX:XX:XX

You can see the paired bluetooth devices in the system:

root@nanpuyue-pc:/var/lib/bluetooth/60:57:XX:XX:XX:XX# ls -l
All 24
drwx------ 2 root root  4096 3月  13 19:48 4C:57:XX:XX:XX:XX
drwx------ 2 root root 12288 3月  13 22:38 cache
drwxr-xr-x 2 root root  4096 3月  13 21:52 EB:50:XX:XX:XX:XX
-rw------- 1 root root    69 3月   9 13:21 settings

Enter the directory of Bluetooth mouse we want to configure:

cd EB:50:XX:XX:XX:XX

What we need to modify is the info file in this directory. Take mine as an example, the file is as follows (it has been modified here. We only need to change the key into the key in the registry exported under windows. Specifically, delete the comma in win and change the lowercase to uppercase)

[General]
Name=Keyboard K380
Class=0x000540
SupportedTechnologies=BR/EDR;
Trusted=true
Blocked=false
Services=00001000-0000-1000-8000-00805f9b34fb;00001124-0000-1000-8000-00805f9b34fb;00001200-0000-1000-8000-00805f9b34fb;

[LinkKey]
Key=CFA0FC2D50B3F04A938B36DA81BB5B5E
Type=5
PINLength=0

[DeviceID]
Source=2
Vendor=1133
Product=45890
Version=16897

Reset computer

Read More: