←back to thread

233 points bahaaador | 2 comments | | HN request time: 0.418s | source

Hi HN! I built Bluetooth USB Peripheral Relay, a tool that lets Bluetooth devices (like keyboards and mice) connect to USB-only hosts using a Raspberry Pi Zero W.

Why? My friend needed a way to use his Bluetooth mouse and keyboard on a PC with Bluetooth disabled due to policy restrictions. This tool acts as a bridge, relaying Bluetooth input over USB. It also lets you use Bluetooth peripherals with older devices that only support USB input.

Tech: Written in Go, optimized for Raspberry Pi Zero W.

I love HN’s community and often lurk here—I’m hoping this project is useful or at least sparks some interesting discussions. Feedback and contributions are welcome!

Show context
reeddavid ◴[] No.42128036[source]
This solves a huge annoyance I've had: swap a Bluetooth keyboard/mouse between multiple laptops, without manually un0paring / re-pairing. I have a personal "hot desk" at home. I want to be able to plug in any laptop to the large monitor, and have the wireless keyboard/mouse on that desk instantly work. And when I leave the desk with my laptop, I don't want that keyboard/mouse connected anymore.

This has been impossible so far, because even USB bluetooth dongles still require each host computer to pair (and un-pair) with the keyboard/mouse.

I am going to try your solution, and I will plug the USB input into the large monitor on my desk. Then any laptop that plugs into that monitor should have access to the wireless keyboard/mouse. Thank you for creating and sharing this!

replies(6): >>42128135 #>>42128230 #>>42128587 #>>42128744 #>>42129328 #>>42130139 #
clort ◴[] No.42128744[source]
many Bluetooth USB dongles have NVRAM, you can write the link key for a device (eg the keyboard or mouse) into the NVRAM and then when connecting, the dongle doesn't ask the Host computer for the key. I have used this to dual boot with a Bluetooth keyboard and mouse in the past.

I think the technique would be: pair in machine A (A has a link key). Then, pair again in machine B with the same dongle. Write that key into NVRAM, and machine A considers the device paired but it never gets asked for the key so just works if you plug the dongle into either machine. I don't know how the monitor thing works, does it act as a USB hub? I guess you can just leave the Bluetooth dongle plugged in there..

replies(1): >>42136498 #
1. redleader55 ◴[] No.42136498[source]
This sounds extremely interesting. Do you have a link for such a USB dongle and how to write the key in the NVRAM?
replies(1): >>42162829 #
2. clort ◴[] No.42162829[source]
I have never a seen a Bluetooth adaptor without the capability. Currently this laptop has an "Intel Dual Band Wireless-AC 8265" device which reports it can store 16 keys in the NVRAM. I have used the btkey(1) program on NetBSD to read and write keys, but it is basically speaking directly directly to the adaptor so should be possible under any OS where that is possible.

https://man.netbsd.org/btkey.1

https://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/btkey/