[PATCH] Add keyboard event addon

Matthew Garrett mjg59 at srcf.ucam.org
Thu Feb 9 09:20:10 PST 2006


On Thu, Feb 09, 2006 at 12:03:27PM -0500, David Zeuthen wrote:

> Those were actually the kernel keycodes? I've got them from.. the
> atkbd.c file is using printk to complain about the mapping so it
> appeared in /var/log/messages - so consulting input.h gives

Ok, it gets complicated here. The PS/2 hardware produces scancodes. The 
kernel has an in-built mapping that maps those to keycodes. When you get 
something along the lines of 

"Unknown key e0 0f pressed, use setkeycodes to set it"

then the first number is the scancode and what you set it to will be the 
keycode. The kernel's table is correct for Microsoft keyboards, and most 
third party multimedia ones. Stuff coming from atkbd.c is likely to be 
the translated scancode rather than the keycode - if you use evtest, 
you'll see what the kernel ends up mapping it to.

> Another thing... I've now tested this on my USB keyboard with "Sleep",
> "Wakeup" and "Power" buttons. After adding KEY_POWER -> "power" in
> addon-keyboard.c all three buttons make hald emit the right
> DeviceCondition.

Cool.

-- 
Matthew Garrett | mjg59 at srcf.ucam.org


More information about the hal mailing list