Detecting the used keyboard driver

Marvin Raaijmakers marvin.nospam at
Wed Apr 29 00:26:20 PDT 2009

The XClient is not doing the wrong thing. I am not talking about an X
keycode to X key symbol binding. The first program changes the kernel
keycode (so not the X keycode), that is bound by the keyboard driver
inside the kernel, to the scancode of a key. The when a key is
pressed, the kernel driver receives the scancode from the physical
keyboard. It then translates this scancode to the kernel keycode,
which it then sends to the X server. The (driver inside) X server
receives this kernel keycode that it then converts to an X keycode.
For the evdev X input driver for example:
X_keycode = 8 + kernel_keycode
My program does not bind an X key symbol to the X keycode, since that
is not needed for grabbing a key (XGrabKey() takes the key's keycode
as an argument).

- Marvin

On Wed, Apr 29, 2009 at 12:14 AM, Peter Hutterer
<peter.hutterer at> wrote:
> On Tue, Apr 28, 2009 at 11:10:57AM +0200, Marvin Raaijmakers wrote:
>> Well I developed keyTouch, a program that allows the user to bind
>> actions to extra function keys (like the Play/Pause, WWW or Zoom keys
>> for example) on a keyboard. KeyTouch is a collection of programs. One
>> program binds a key's scancode to a Linux keycode. So it changes the
>> mapping inside the Linux kernel. Another program is an X client and
>> grabs all key events of the extra function keys. So this program needs
>> to know the X keycodes of the keys and thus it will have to translate
>> the kernel keycode to the X keycode. These translations are different
>> when the evdev input driver is used by the X server instead of the kbd
>> driver.
> This sounds like the X client is doing the wrong thing. It should get the
> mapping from the server and then bind to the correct keysym.
> The only thing a keycode tells you is that it is the e.g. 5th key in the
> second row. And even that you have to guess.
>> What do you mean by "query the keyboards for all properties"? Using
>> XListInputDevices? Then there need to be different values for
>> min_keycode, max_keycode or num_keys (or am I wrong?). These are
>> however the same for evdev and kbd.
> XListDeviceProperties()
> Cheers,
>  Peter

More information about the xorg mailing list