Many computer and gaming enthusiasts use special keyboards. One common feature on these keyboards is many custom keys that are meant to be bound to special command specific to games and software.

The software for editing and creating commands that these custom keys trigger is almost always in windows

EX: Tt Esports challenger software Challnger Pro Gaming

When running the software using Wine it is unable to locate the keyboard or other devices, and thus the key bindings cannot be programmed.

Unable to locate keyboard

For most keyboards custom keys are bound be default to ctrl+c and ctrl+v . So using the System Settings to set these keys would overwrite whenever a user tries to use those commands.

What are possible solutions to this issue, is there a way to let Wine detect hardware or is there another method to set custom keys?

Finding a solution would be very helpful to the Linux community as custom keys could be used when developing or using specialized software.

My keyboard is a HID keyboard, using hid-generic.

For the keys not set by default nothing is registered in evtest but for the three preset values they return

Event: time 1488397338.016750, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1488397338.016750, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 0

xev only registers the keys preset to ctrl+c and such as 2 keystrokes, the keys not set by default are not registered

I do have a Windows system, where I could sniff the USB protocol. But how would I do it?


1 Answer 1


This will probably take several steps/iterations, and the Q&A format isn't a good fit. Please update your question with more information if you are stuck, and ping me in a comment to this answer. I'll edit my answer then.

From the description it sounds like the mapping of special keys to key events is done in the keyboard, so programming must happen in the keyboard, and not in a driver.

There are various open source USB sniffer for Windows, e.g. usbpcap or the older usbsnoop, google will probably find more, and tutorials how to use them.

In principle, you'll need to record the communication while programming different special keys with different key sequences with the programming software. Then look at the packets, compare them, and see which bytes change for different special keys or programmed sequences. Guess the protocol, replay it in a self-written program using libusb on Linux.

As your keyboard is HID, and HID is highly standardized, we have a bit of help. Familiarize yourself with the HID documentation (or at least look up those parts you need). Each HID device comes with a descriptor, and the descriptor describes all possible interaction with the device according to the HID standard. If this is how the keyboard is programmed, and if there are not too many "vendor-specific" fields, we may guess the protocol directly.

You can read the descriptor in two ways.

(1) If your kernel has debugfs enabled, as root do

mount -t debugfs none /sys/kernel/debug
cat /sys/kernel/debug/hid/device_id/rdesc

where device_id is the id if your keyboard. This will show the raw descriptor as hex bytes, and how the kernel parses it. If the kernel parse is not enough, try hidrd to convert the raw descriptor.

(2) Issue HIDIOCGRDESCSIZE and HIDIOCGRDESC ioctls on the hidraw device (look in dmesg to find it for your keyboard). The samples/hidraw/hid-example.c in the Linux kernel source explains how to do that, or use a ready-made tool like usbhid-dump.

Ideally you'll see some feature or output description(s) that is/are related to the programming. You may still have to snoop the software tools if too many of the described fields are unclear or marked "vendor-specific".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .