XI2 = moving target?

Jim Gettys jg at freedesktop.org
Sat Jul 25 16:30:20 PDT 2009


Nicolas,

In the original X11 design and keyboard system, keycodes are arbitrary, 
and need not have anything to do with the codes produced by the hardware 
(which are often quite baroque, and often formed by multiple character 
transmissions from the keyboard to the host).

Just because the hardware sends some byte, doesn't mean it needs to be 
used as its keycode.  It is often convenient to do so, but not 
necessary...  And they may have nothing to do with PS/2 keyboards at 
all; in fact, most workstation keyboards were entirely different.

For example, some keyboards (at the hardware level) have sent a bit 
vector of all the keys that are down as a set of bytes, and that has 
then been translated to a sequence of keycodes that changed.  Others 
transmit a few bytes that talk about X/Y coordinates in the scan matrix, 
and whether the key went up or down.

There may be something in our current implementations that deal with PC 
style keyboards that do magic with keycodes > 255 and translate them, 
but that is different than what gets encoded into a keyboard event as a 
keycode.

Usually, when one is trying to distinguish what the hardware sends from 
the X protocol layer (or if you actually talk about what keyboards 
send), the bytes a keyboard transmits are called "scancodes". It has 
been convenient on many keyboards to just use them as keycodes if the 
keyboard makes it easy, but not necessary.

Ergo my question on whether anyone has ever actually seen in captivity a 
keyboard with more than 248 keys...
                        - Jim


Nicolas Mailhot wrote:
> Le samedi 25 juillet 2009 à 13:31 -0400, Jim Gettys a écrit :
>> That isn't a good reason: keycodes are arbitrary, a simple table lookup 
>> to remap them to 8-255 is an easy solution, much easier than the 
>> alternatives, unless I'm missing something...
> 
> keycodes are not arbitrary, the codes > 255 have a standardised meaning,
> if you remap them they don't behave like they should according to the
> symbol printed on them.
> 
> Also it is very common to have multiple input devices nowadays that all
> have some keycodes > 255 so any remapping solution would need to be able
> to manage parallel hotplug of devices with different requirements (in
> fact what is un-common is devices that only use keycodes < 255, I tried
> to buy one last time I was in the local chinatown to avoid dealing with
> this issue — they don't exist anymore)
> 




More information about the xorg mailing list