Linux support for the Trust GXT 18 keyboard

I tried using a Trust GXT 18 keyboard in June 2012 with Linux 3.5. Interestingly the keyboard worked with Windows, but not Linux.

The keyboard identifies over USB as a Holtek device, and uses a Holtek HT82B40R microcontroller.

Human Interface Devices (HID) such as keyboards and mice, state their input/output capabilities (such as specific keyboard buttons, LEDs, mouse wheels and so on) to the host system via the HID protocol. The chunk of data describing the keyboard is called the HID descriptor. A typical keyboard's HID descriptor states the range of "input" scan codes emitted by the keyboard (thus describing which specific buttons it has), and the "output" codes used to toggle the num/caps/scroll lock keys.

In the case of this keyboard, the HID descriptor effectively states the keyboard has ~32k buttons. Linux assumes this is silly and rejects the keyboard.

To solve the problem, I wrote a kernel patch, which adds a special driver for the keyboard. The driver provides a correct HID descriptor for the device, and additionally corrects another problem with the LEDs not working correctly. When using the patch, the hid_holtek_kbd kernel module should automatically load when plugging in the keyboard:

tfh@tiramisu ~ $ lsmod | grep hid_
hid_holtek_kbd         12657  0
hid_generic            12445  0
hid                    81915  3 hid_holtek_kbd,hid_generic,usbhid

The patch is now merged into the mainline kernel, and is enabled in 3.6-rc1+.