[PATCH] Add keyboard event addon

David Zeuthen david at fubar.dk
Thu Feb 9 09:03:27 PST 2006


On Wed, 2006-02-08 at 14:40 +0000, Matthew Garrett wrote:
> On Wed, Feb 08, 2006 at 09:29:30AM -0500, David Zeuthen wrote:
> 
> > when pressing all the non-standard keys. Notably I didn't get events
> > from the following buttons
> 
> These are the X keycodes, presumably? Would it be possible to get the 
> kernel keycodes (easiest way to grab them is to use evtest - 
> http://floam.sh.nu/files/misc/evtest.c has a copy) and see if they 
> appear in /usr/include/linux/input.h ? It's possible that it generates 
> keycodes outside the range that we currently have defined (the 
> keycode->X mapping is strange and scary and hard to predict)

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

 user            - 0xac -> KEY_HOMEPAGE
 <b>hp</b>       - 0x94 -> KEY_PROG1
 <b>?</b>        - 0xa6 -> KEY_STOPCD
 photo           - 0x9f -> KEY_FORWARD
 music           - 0x96 -> KEY_WWW
 video           - 0xb9 -> KEY_F15

 shopping        - 0x9e -> KEY_BACK
 sports          - 0x92 -> KEY_DELETEFILE
 finance         - 0xa7 -> KEY_RECORD
 chat            - 0x95 -> KEY_PROG2
 eject 1         - 0x98 -> KEY_REWIND
 eject 2         - (no printk's from atkbd.c)
 rec             - 0x86 -> KEY_OPEN
 volume+         - (no printk's from atkbd.c)
 volume-         - (no printk's from atkbd.c)
 (vol+ and vol- is on a wheel)
 mute            - (no printk's from atkbd.c)

Hmmm... did I read the wrong number from atkbd.c in /var/log/messages?
This looks completely bogus... Any clues?

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.

Btw, I fixed a grave bug in run-hald.sh (we weren't using absolute
paths) so that may explain what Richard have been seeing. Richard,
please try with CVS HEAD again...

> > Are these keys standardized? Also, it doesn't seem to me we can get any
> > useful vendor or product id out of this just yet, so if they're not
> > standardized.. maybe atkbd.c needs the magic though it would be nice to
> > do this from user space.
> 
> PS/2 has no mechanism for providing vendor and product IDs, and the 
> codes produced by the keyboard can vary. There's no terribly good 
> solution for this right now. 

Right. However if I'm Dell or HP I should be able to just install a fdi
file that sets up the mapping for a system where said vendor knows what
kind of keyboard will be attached; perhaps this fdi file will even try
to match smbios.* properties on computer. Not perfect (user may attached
another PS/2 keyboard)... but it should solve the "make multimedia
keyboards work out of the box" problem (as long as the user don't attach
another keyboard). *shrugs*

Btw, I've changed the code a tiny bit so the fdi file now merges the
button.type -> '', button.has_state -> FALSE and info.capabilities ->
{'button'} properties. Because without this we can't rely on merging
said properties above.

    David




More information about the hal mailing list