Converting linux keycodes to X keycodes

Zephaniah E. Hull warp at aehallh.com
Thu Jun 1 00:58:04 PDT 2006


On Thu, Jun 01, 2006 at 09:12:16AM +0200, Marvin Raaijmakers wrote:
> I made this table for the x86. The following translations are done:
> 
> |------------------kernel---------------------|-----------X server------------|
>  scancode -> kernel keycode -> scancode related to kernel keycode -> X keycode
>            |                 |
>            V                 V
>   +-----------------+ +-------------+
>   | table can be    | | Fixed table |
>   | modified using  | +-------------+
>   | setkeycodes     |
>   +-----------------+
> 
> 
> So my table translates a kernel keycode to an X keycode. I do not know
> how the X server does the scancode to X keycode translation, but if this
> is done by using a fixed table (or 1:1), then the translation from
> kernel keycode to X keycode can be done by using a fixed table.
> As you can see the translation from kernel keycode to scancode related
> to kernel keycode is quite useless, but must be done because xorg only
> excepts scancodes.

> So it would be great if there was an input driver for
> X that wants to receive kernel keycodes (from the evdev driver) and uses
> them as the X keycodes (so: kernel keycode = X keycode). This is
> actually the intent of the kernel keycode story in kernel 2.6.

You just described xf86-input-evdev actually, it works fairly well.

> Note that a kernel keycode is something like a X keysym for a scancode.
> So no matter what platform (arm, x86, etc) or keyboard connection (USB,
> PS/2, etc) you are using, the kernel keycode for key 'a' will always be
> KEY_A.

However there are some complications, specificly that the kernel keycode
mapping is not always 100% accurate.

This, quite firmly, sucks, but using xkb this becomes a matter of
configuration.

-- 
	  1024D/E65A7801 Zephaniah E. Hull <warp at aehallh.com>
	   92ED 94E4 B1E6 3624 226D  5727 4453 008B E65A 7801
	    CCs of replies from mailing lists are requested.

I've always taken the position that if you can't find anything bad  to
say about a language or an operating system then you don't  understand
it. I also agree with you about the advocacy. AHS. ASS.
  -- Shmuel (Seymour J.) Metz in the Scary Devil Monastery.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg/attachments/20060601/5bfbaeba/attachment.pgp>


More information about the xorg mailing list