Converting linux keycodes to X keycodes
Marvin Raaijmakers
marvin.nospam at gmail.com
Fri Jun 2 00:11:36 PDT 2006
Does somebody know how the scancode -> keycode translation is done by
Xorg?
On Thu, 2006-06-01 at 09:12 +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.
> 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.
>
> - Marvin Raaijmakers
>
> On Wed, 2006-05-31 at 23:27 -0700, Park Ji Wong wrote:
>
> > Sorry to interrupt here,
> > But i have a question, the keycode's value differ to each platform(arm, x86)?
> >
> >
> >
> >
> > 2006/5/31, Marvin Raaijmakers <marvin.nospam at gmail.com>:
> > > If the remote control is connected via USB it will not be possible to
> > > set keycodes. At the moment I am trying to modify the input drivers to
> > > make this possible.
> > > If you can set the kernel keycode, then of course you can get the X
> > > keycode by using xev. However you may find it easier to use the
> > > translation table I made:
> > >
> > > /* Kernel keycode -> X keycode table */
> > > const unsigned int keycode_table[256] = {
> > > 0, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
> > > 22, 23,
> > > 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
> > > 38, 39,
> > > 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
> > > 54, 55,
> > > 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
> > > 70, 71,
> > > 72, 73, 74, 75, 76, 77, 76, 79, 80, 81, 82, 83, 84, 85,
> > > 86, 87,
> > > 88, 89, 90, 91, 111, 221, 94, 95, 96, 211, 128, 127, 129, 208,
> > > 131, 126,
> > > 108, 109, 112, 111, 113, 181, 97, 98, 99, 100, 102, 103, 104, 105,
> > > 106, 107,
> > > 239, 160, 174, 176, 222, 157, 123, 110, 139, 134, 209, 210, 133, 115,
> > > 116, 117,
> > > 232, 133, 134, 135, 140, 248, 191, 192, 122, 188, 245, 158, 161, 193,
> > > 223, 227,
> > > 198, 199, 200, 147, 159, 151, 178, 201, 146, 203, 166, 236, 230, 235,
> > > 234, 233,
> > > 163, 204, 253, 153, 162, 144, 164, 177, 152, 190, 208, 129, 130, 231,
> > > 209, 210,
> > > 136, 220, 143, 246, 251, 137, 138, 182, 183, 184, 93, 184, 247, 132,
> > > 170, 219,
> > > 249, 205, 207, 149, 150, 154, 155, 167, 168, 169, 171, 172, 173, 165,
> > > 175, 179,
> > > 180, 0, 185, 186, 187, 118, 119, 120, 121, 229, 194, 195, 196, 197,
> > > 148, 202,
> > > 101, 212, 237, 214, 215, 216, 217, 218, 228, 142, 213, 240, 241, 242,
> > > 243, 244,
> > > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> > > 0, 0
> > > };
> > >
> > > I made this table for my project keyTouch (http://keytouch.sf.net). If
> > > it is possible to the set keycodes for your remote control, then you can
> > > even use this program to bind actions to it. KeyTouch assigns kernel
> > > keycodes to scancodes, translates the kernel keycode to a X keycode and
> > > executes an action when that keycode is pressed under X. By using the
> > > keyTouch editor program you can make a so called keyboard file for your
> > > remote control and import this keyboard file in keyTouch to get working.
> > >
> > > - Marvin Raaijmakers
> > >
> > > On Thu, 2006-06-01 at 08:59 +0300, Aivils Stoss wrote:
> > >
> > > > On Trešdiena, 31. Maijs 2006 20:31, Jeremy Wilkins wrote:
> > > > > Hi All,
> > > > >
> > > > > I've got an ATI remote control, this worked great in older linux 2.6
> > > > > kernels but the OK button has changed and now maps to linux keycode
> > > > > 352 (KEY_OK). I've also managed to find the the scancode using
> > > > > showkeys.
> > > > >
> > > > > How do I find the equivalent X keycode? I've tried xev, but this
> > > > > appears to only work with keycodes up to 255?
> > > >
> > > > Linux kernel does not send keycodes > 255 to X. That is kernel limitation.
> > > > Set another code on OK button.
> > > >
> > > > man setkeycodes
> > > >
> > > > Aivils Stoss
> > > > _______________________________________________
> > > > xorg mailing list
> > > > xorg at lists.freedesktop.org
> > > > http://lists.freedesktop.org/mailman/listinfo/xorg
> > >
> > >
> >
> >
>
> _______________________________________________
> xorg mailing list
> xorg at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xorg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg/attachments/20060602/edf5f313/attachment.html>
More information about the xorg
mailing list