[Gta04-owner] X keycode of the Power button
Dr. H. Nikolaus Schaller
hns at goldelico.com
Mon Nov 7 15:21:32 CET 2011
Hi Neil,
Am 07.11.2011 um 14:59 schrieb Neil Jerram:
> Hello all...
>
> I'm playing with UIs on my GTA04, and having trouble binding an action to the Power button. The problem seems to be a misunderstanding somewhere about what the right keycode is for the Power button.
>
> When I run xev and press the Power button, xev says that the keycode is 124, and the keysym is XF86PowerOff. But if I bind XF86PowerOff to an action in matchbox-window-manager's config, and run matchbox-window-manager with debugging enabled, its output indicates that it has mapped XF86PowerOff to keycode 222. Therefore matchbox grabs keycode 222, and the result is that nothing happens when I press the button, presumably because the keycode is really 124.
>
> (Also "xmodmap -pk" agrees that the keycode is 124.)
>
> Looking at the source code, matchbox just uses XKeysymToKeycode to do the mapping. So apparently XKeysymToKeycode(XF86PowerOff) == 222.
>
> I'm not sure where to look next for this problem, so can anyone help? What determines what the keycode is? - is it evdev config? Searching has turned up hints that it might be invalid to use XKeysymToKeycode is XKB is in use; but I'm not sure whether XKB is in use on the GTA04 (or what that means).
I think the keycode is defined in the kernel /drivers/input/misc/twl4030-pwrbutton.c):
input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ);
I.e. there is an input event for key KEY_POWER. This is defined in
include/linux/input.h:
#define KEY_POWER 116 /* SC System Power Down */
So we have a third definition...
You could also try
http://packages.debian.org/squeeze/evtest
Which should show the raw events.
>
> I should add that this is all after I've added the following lines to my xorg.conf:
>
> Section "InputDevice"
> Identifier "Power Button"
> Driver "evdev"
> Option "Device" "/dev/input/event2"
> EndSection
>
>
> Section "InputDevice"
> Identifier "AUX Button"
> Driver "evdev"
> Option "Device" "/dev/input/event0"
> EndSection
>
> + adding two InputDevice lines in Section "ServerLayout". Is that an OK thing to do? Is it OK to mix tslib for the touchscreen with evdev for Power and AUX buttons?
This appears to be ok. The touchscreen reports different events, so they don't get mixed.
And it appears to be a good idea that we add it to the default xorg.conf.
> Finally, another problem is that even after the additions above, pressing the AUX button doesn't cause any xev output at all. Do I need to do something else to get it plumbed through to X? Note that I do see stuff if I do "cat /dev/input/event0" and then press AUX, so physically and electronically the button is working.
This appears to indicate that there is one more mapping table between /dev/input/event and xmodmap/xev.
Nikolaus
More information about the Gta04-owner
mailing list