Skip to content

BLE support (Windows to Linux only)#17

Open
DragRedSim wants to merge 3 commits intoKeyofBlueS:mainfrom
DragRedSim:main
Open

BLE support (Windows to Linux only)#17
DragRedSim wants to merge 3 commits intoKeyofBlueS:mainfrom
DragRedSim:main

Conversation

@DragRedSim
Copy link

Hi there,
I found this tool and wanted to use it to synchronise my dual-booting Legion Go (a device similar to a Steam Deck). Most of my devices turned out to be BLE, and so I implemented support for BLE synchronisation.
Note that it is currently set up to only work one way, from Windows to Linux, as this was my target use case, and I didn't want to potentially break Windows by writing back to it from Linux.
I've built it so that it will attempt to detect which device matches up (by name), but you will have to pair in both Linux and then Windows, and then run the script in Linux.
I've tested my changes, and it's in a "works-for-me" status, but I can't guarantee all situations.

DragRedSim and others added 3 commits June 21, 2025 02:49
- Note that currently, this only supports importing keys from Windows to Linux.
- The script will attempt to find matching devices (by name) and highlight them.
- When syncing a BLE device, the bt_device_name variable gets clobbered while parsing the Windows devices for names. This fix uses the cached Linux device name.
@KeyofBlueS
Copy link
Owner

Hey! Thanks so much for the PR! Really appreciate you taking the time to add BLE support, super cool stuff.

That said, I don't currently have any BLE devices on hand, so I'm not able to test the changes properly. That's actually why BLE support has been kind of on pause up to now.

I'll leave the PR open for the time being, but I'll need to hold off on merging until I get a chance to test it properly. Thanks again for contributing, really appreciate it!

@moiri-gamboni
Copy link

Hi! I have BLE devices (Logitech LIFT mouse, ProtoArc XK01 TP keyboard) alongside classic BT (Sony WF-1000XM5) on Ubuntu 25.10 + Windows 10 dual-boot, and I'd be happy to help test.

For context: before finding this PR, I hit a bug on mainline where classic BT devices weren't detected when BLE subkeys existed under the same adapter (the awk regex on the classic device discovery broke because bt_controller_windows became multi-line). I independently applied the same two fixes this PR includes: | uniq on the controller pipeline and $ anchor on the awk pattern. With those changes, the classic devices that were previously invisible (reported as "not found in windows") appeared correctly in the listing, and I successfully synced one of them.

Before I test the full PR, I had Claude Code review the source and it flagged 6 places where a spurious = is prefixed to $() inside [[ ]] comparisons. Bash treats ="$(cmd)" as literal string concatenation (=8 instead of 8), so these comparisons always fail:

Infinite loops (in bt_keys_sync_from_linux):

  • L577: until [[ ="$( echo "${key_es_linux_reg}" | wc -m )" = '8' ]]; do — loop condition never true, hangs the script
  • L585: until [[ ="$( echo "${key_ediv_linux_reg}" | wc -m )" = '8' ]]; do — same

Broken sudo refresh (in check_sudo):

  • L764, L779, L792 — timestamp validation and credential refresh are silently skipped

Once those are fixed, happy to test the full BLE sync with my devices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants