[PATCH] Add keyboard event addon

David Zeuthen david at fubar.dk
Wed Feb 8 06:29:30 PST 2006


On Sat, 2006-02-04 at 11:58 +0000, Matthew Garrett wrote: 
> Two patches attached:
> 
> 1) Changes the ACPI addon to report the type of button pressed as well 
> as the fact that a button has been pressed
> 
> 2) Adds a keyboard addon. The included fdi file will bind it to anything 
> that has type input.keyboard. It adds the capability "button" to the 
> keyboard devices, and on any keypress checks the key against a table. If 
> the key is found there, a ButtonPressed event is generated with the name 
> of the key in the details field (one exception - KEY_SUSPEND is given 
> the name "hibernate").

Ok, I've committed this patch with a few changes

1) move drop_privileges() to ../probing/shared.h as we want all the
    other addons and probers to eventually use this

2) Fix up a few typos to get it to compile (s/event.name/event_name)
    and other style things

3) Set button.type to "" and button.has_state to FALSE

I tested it with the PS/2 keyboard on my HP Media Center PC m1160n.. it
sorta looks like this 

http://images.anandtech.com/reviews/system/microsoft/mce/keyboard.jpg
http://images.anandtech.com/reviews/system/microsoft/mce/keyboard1.jpg

Using 'lshal --monitor', I got the following events:

        platform_i8042_i8042_Kbd_Port_logicaldev_input condition ButtonPressed = sleep
        platform_i8042_i8042_Kbd_Port_logicaldev_input condition ButtonPressed = www
        platform_i8042_i8042_Kbd_Port_logicaldev_input condition ButtonPressed = search
        platform_i8042_i8042_Kbd_Port_logicaldev_input condition ButtonPressed = mail
        platform_i8042_i8042_Kbd_Port_logicaldev_input condition ButtonPressed = stopcd
        platform_i8042_i8042_Kbd_Port_logicaldev_input condition ButtonPressed = playpause
        platform_i8042_i8042_Kbd_Port_logicaldev_input condition ButtonPressed = previoussong
        platform_i8042_i8042_Kbd_Port_logicaldev_input condition ButtonPressed = nextsong
        
when pressing all the non-standard keys. Notably I didn't get events
from the following buttons

user		- 0xac
<b>hp</b>	- 0x94
<b>?</b>	- 0xa6
photo		- 0x9f
music		- 0x96
video		- 0xb9

shopping	- 0x9e
sports		- 0x92
finance		- 0xa7
chat		- 0x95
eject 1		- 0x98 
eject 2         - (no printk's from atkbd.c)
rec		- 0x86
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)

however gnome-settings-daemon does pick these up and they are
configurable through System->Preferences->Keyboard Shortcuts in GNOME.
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.

> There's a couple of extra features that could be added (export a list of 
> the available keys, for instance - not very helpful on PS/2, but useful 
> on USB), but could these be applied as is for now?

I'll try this in the PM when I am in the office.

Thanks,
David




More information about the hal mailing list