On Linux kernel / X keycodes

Dmitry Dzhus mail at sphinx.net.ru
Sat Dec 29 08:31:29 PST 2007


Daniel Stone <daniel at fooishbar.org> writes:

>> Did I miss something or X really doesn't get keycodes higher than 255
>> from the kernel? Is this intentional limitation? How can it be fixed?
>
> X can get extended keycodes with evdev, but you then need to do a
> remapping, as the protocol can't support more than 255 keycodes, period.

Some of the extra keys on my keyboard get really high *kernel* keycodes,
like 418 or 432.

Does `evdev(4x)` pass such high keycodes to X?

I've noted the following code in `evdev_key.c`:

    int keycode = ev->code + MIN_KEYCODE;

(And `MIN_KEYCODE` is 8 by definition.)

As far I've understood, later keypress from event kernel interface gets
processed further by

    xf86PostKeyboardEvent(pInfo->dev, keycode, ev->value);

Where keycodes>255 seem to get lost. How can I use a device producing
high kernel keycodes in X with `evdev(4x)`? `setkeycodes(1)` doesn't
allow me to rebind kernel keycode; I've found that a possible solution
(actually a kludge) is to change builtin kernel keycodes in
`include/linux/input.h` for problem keys to some lower value not
colliding with existing keycodes — then X server sees my keypresses
wonderfully, but that's a dirty hack and I want to find out how X server
and `evdev(4x)` really deal with kernel keycodes.
-- 
Happy Hacking.

http://sphinx.net.ru


More information about the xorg mailing list