TL;DR: If you have a Logitech K290 and want your F-keys to work regularly on Linux, you can now.
A few weeks ago I got myself a Logitech K290 keyboard for my home office. I really like how silent it is and the attack on the keys feels very nice, too. Also it is quite resistant to crumbs, which were somehow always squeezing through the gaps of my former Cherry XStream.
But despite this, the keyboard has a major flaw: by default, the function keys work as a kind of “multimedia” keys
instead of good ol’
F12. On Windows that can easily be remedied by installing the Logitech Setpoint
software. But on Linux, where I do most of my hacking, it is a major PITA to always need to use the
At first, I thought I’d just have to roll with it or begin The Chase For A Comfortable Keyboard anew but after accidentally shutting down my machine yesterday - when all I wanted to was to press F12, forgetting the modifier -, I was overcome by a sudden Nerd Rage: this device obviously needed some serious hacking.
Equipped with cursory knowledge about the USB protocol and my usual can-do-attitude, I fired up the browser, looking for a way to snoop on the USB traffic. After two unsuccessful tries, I came across USBPcap, which can be used in conjunction with Wireshark to do USB protocol analysis.
After a few tries it became quickly apparent that toggling the checkbox in the Windows software would send one specific control packet to the device, so I decided to write a small tool to do exactly this on Linux.
At first it did not work, because I used the simplified
libusb_open_device_with_vid_pid function from libusb which
has no proper error reporting. So I added proper device enumeration and found that the error was
And behold: running it via
sudo made everything work on the first try!
So this concludes a wonderfully entertaining friday night. :D