It's always been a bit cumbersome IMO to discover, pair and connect to a bluetooth HID device, and more so now that one needs to use dbus to do it. So I wrote the attached python script to make it easier. I would like to see it distributed as part of bluez. Please let me know if there is some other process for such contributions. It does discovery and then uses urwid to present a curses menu in the console with the discovered devices. You can simply select one and it will try to pair if necessary (prompting for the pin if necessary) and then connect. So anytime your HID device is no longer connected or you wish to switch the computer to which it's connected (which I do frequently), you can just put it in discoverable mode and run bthid and not worry about whether it was already paired or not. At least that's the idea, although plenty of things can still go wrong (permission trouble, .service files not installed, HCI device not working, cryptic error messages etc.) Maybe some of those can be improved over time. Of course I didn't have to invent any new techniques here, it's just a mashup of an existing script with a curses UI, but still... IMO the regular user needs something like this at least as a fallback to make HID useful, in the absence of a better GUI utility like the KDE one or some such. Since it works over ssh, it's better than a GUI for fixing machines that don't have wired HID devices (e.g. I use a wireless keyboard for my MythTV box, and every time I change the batteries I have to re-connect it). I'm using it with bluez 4.39 at the moment, but have tested some other versions on other machines (e.g. with arch), and I imagine it will work the same as long as the relevant dbus interfaces are the same.
Attachment:
bthid
Description: Binary data
Attachment:
screenshot1.png
Description: PNG image