Getting the Freedom Universal Keyboard2 to Work Under Linux
I recently bought a Freedom Universal Keyboard2 for use with my Freerunner. When it finally arrived I found out that it doesn’t work by default under Linux although the openmoko wiki stated otherwise. Anyway I started googling around and found a mailing list post on bluez-user which suggested to disable the whole MTU handling. With this information I started looking around in the bluez-utils source and finally came up with a patch for hidd:
--- bluez-utils-3.36/hidd/main.c
+++ bluez-utils-3.36-working/hidd/main.c
@@ -90,12 +90,14 @@
return -1;
}
+#if 0
memset(&opts, 0, sizeof(opts));
opts.imtu = HIDP_DEFAULT_MTU;
opts.omtu = HIDP_DEFAULT_MTU;
opts.flush_to = 0xffff;
setsockopt(sk, SOL_L2CAP, L2CAP_OPTIONS, &opts, sizeof(opts));
+#endif
memset(&addr, 0, sizeof(addr));
addr.l2_family = AF_BLUETOOTH;
@@ -131,12 +133,14 @@
setsockopt(sk, SOL_L2CAP, L2CAP_LM, &lm, sizeof(lm));
+#if 0
memset(&opts, 0, sizeof(opts));
opts.imtu = HIDP_DEFAULT_MTU;
opts.omtu = HIDP_DEFAULT_MTU;
opts.flush_to = 0xffff;
setsockopt(sk, SOL_L2CAP, L2CAP_OPTIONS, &opts, sizeof(opts));
+#endif
if (listen(sk, backlog) < 0) {
close(sk);
With this patch applied and the steps below I got the keyboard to work both on my desktop (Debian Sid) and Freerunner (Om2008.8). First we check whether our bluetooth controller is operating in HID mode and if so we will switch it to HCI mode. Then we search for new bluetooth devices and the keyboard should be found and connected.
lsusb | grep HID && hid2hci
./hidd --search
So far so good, then I learned that hidd is depreciated and a new dbus based input-service should be used instead. I hope they will at least provide a shell script wrapper with some easy to use command line switches. Haven’t yet found the time to actually test this new method, but the keyboard works with hidd which means it should be possible to make it work one way or another.
Marc