Cannot sync an Xbox Controller
I used this script using this tutorial for my Steam Deck
This worked just fine for both of my Bluetooth headphones, however I am unable to sync my Xbox Series controller, as it shows the error "KeyError: 'Long Term Key'"
I already tried the step 7, however as far as I can tell, the keys on both systems are the same, so I am unable to do that step.
Devices on Linux
Device F4:6A:D7:D1:7C:2D Xbox Wireless Controller Device 44:5E:CD:37:50:B7 Razer Barracuda X (BT) Device 6C:D3:EE:2D:F3:ED Redmi Buds 3 Pro
Regkey on Windows
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\BTHPORT\Parameters\Keys]
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\BTHPORT\Parameters\Keys\505a657976c6] "CentralIRK"=hex:51,7d,43,80,1d,25,2d,2a,7b,a4,87,a5,f3,f5,56,48 "6cd3ee2df3ed"=hex:e2,cc,c5,6a,7d,cb,03,c1,e5,0c,0b,f1,a3,5e,77,a9 "445ecd3750b7"=hex:d5,d6,d9,b4,d3,c0,74,12,a1,bd,76,90,f4,be,69,ad
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\BTHPORT\Parameters\Keys\505a657976c6\f46ad7d17c2d] "LTK"=hex:77,8d,dc,f4,6f,a5,cd,27,02,0d,2b,66,9e,d8,d8,68 "KeyLength"=dword:00000010 "ERand"=hex(b):00,00,00,00,00,00,00,00 "EDIV"=dword:00000000 "IRK"=hex:76,37,ed,cc,eb,ea,da,43,f4,6a,d7,d1,7c,2d,37,76 "Address"=hex(b):2d,7c,d1,d7,6a,f4,00,00 "AddressType"=dword:00000000 "CEntralIRKStatus"=dword:00000001 "AuthReq"=dword:0000002d
Maybe I'm missing something? Help would be appreciated, thanks
same issue with a cheapo bLE keyboard.
$ sudo python3 ./synckeys.py ./keydump.reg
Bluetooth Adapter - 28:16:A8:50:BA:90
28:16:A8:50:BA:90 (# not paired #)
F4:4E:FD:5B:37:DD (# not paired #)
B0:F1:A3:74:02:9F (# not paired #)
10:12:C3:99:00:0D (Bluetooth Keyboard / Bluetooth Keyboard)
Traceback (most recent call last):
File "/home/vikingsail/Downloads/./synckeys.py", line 240, in <module>
main()
~~~~^^
File "/home/vikingsail/Downloads/./synckeys.py", line 236, in main
process_devices(config)
~~~~~~~~~~~~~~~^^^^^^^^
File "/home/vikingsail/Downloads/./synckeys.py", line 224, in process_devices
process_advanced_pairing(config[device], adapter_mac, device_mac)
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vikingsail/Downloads/./synckeys.py", line 163, in process_advanced_pairing
current_ltk = paired_config['LongTermKey']['Key']
~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/configparser.py", line 998, in __getitem__
raise KeyError(key)
KeyError: 'LongTermKey'
I also encountered the same issue but found a fix:
I manually edited the copied /var/lib/bluetooth/{adapter}/{device}/info file which contains both a PeripheralLongTermKey and a SlaveLongTermKey entry. I renamed the PeriferalLongTermKey to LongTermKey and deleted everything under SlaveLongTermKey. After that the script ran without errors and the bluetooth device was able to connect (after systemctl restart bluetooth).
Initial content of /info file:
...
[PeripheralLongTermKey]
Key=...
Authenticated=2
EncSize=16
EDiv=0
Rand=0
[SlaveLongTermKey]
Key=...
Authenticated=2
EncSize=16
EDiv=0
Rand=0
[ConnectionParameters]
...
Updated content:
...
[LongTermKey]
Key=...
Authenticated=2
EncSize=16
EDiv=0
Rand=0
[ConnectionParameters]
...
@Shadow-Devil That worked like a charm, thank you!!
Now I can finally dualboot as God intended