Reverse-Engineering USB Keyboards For Linux Support
For those interested in reverse-engineering USB keyboards (or other input devices), there's a short yet effective guide by Julien Danjou for reverse-engineering a Logitech keyboard in order to provide Linux support.
Julien was using a Logitech K750 keyboard, which is USB-based and wireless, but what makes it different is that the keyboard is solar-powered rather than relying upon disposable batteries. While the Logitech keyboard works under Linux, there's no support for monitoring the battery charge level outside of Windows. This led to writing open-source code in order to read the battery status and light meter from Linux. The actual keyboard works under Linux due to the "Unifying" receiver and more recently the added "hid-logitech-dj" Linux kernel driver.
In his Logitech K750 keyboard and Unifying Receiver Linux support blog post, Julien Danjou goes over the process of writing the support. He used VirtualBox virtualization of Windows since this means of Oracle virtualization supports USB pass-through with hot-plugging support. KVM/QEMU also supports USB pass-through, but Oracle's VM VirtualBox implementation works better for USB. With Windows running within a VirtualBox instance, he used the "usbmon" kernel driver paired with Wireshark to understand the Logitech USB HID protocol by reverse-engineering with snooping the USB packets.
With Windows virtualized and talking to the Logitech keyboard using its respective driver while sniffing out the USB packets from Linux, Julien was able to understand what was happening for the light meter and battery status. From there, he wrote a small libusb-powered application to obtain this information cleanly under Linux. In the end it worked, but there's still room for improvement. See Julien's blog post for details in full.
Latest Linux Hardware Reviews
Latest Linux Articles
Latest Linux News
Latest Forum Discussions