On Linux kernel / X keycodes

Peter Hutterer mailinglists at who-t.net
Sat Dec 29 21:27:31 PST 2007


Dmitry Dzhus wrote:
> 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?

no. the server ignores codes outside of the 0-255 range.

> > 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.

the problem is that there's only 8 bits in the protocol. so if you have 
keycodes > 256  you need two+ keymaps. if such a key occurs, you have to 
send a mapping notify to the app first to let it switch to the new 
keymap. that's how I understand it anyway.

it's a bit of a chicken and egg problem. when we get the data (SIGIO 
handling), we can't switch the keymap. on the other hand, when we can 
switch the keymap (event processing), the data is already lost 
(normalised to 256).

Cheers,
   Peter



More information about the xorg mailing list