[PATCH, RFC] Add support for keyboard hotkeys

Richard Hughes hughsient at gmail.com
Tue Jan 31 01:50:37 PST 2006


On Tue, 2006-01-31 at 01:52 +0000, Matthew Garrett wrote:
> I've attached two patches. The first adds some code to the acpi addon to
> place the type of the button pressed in the details field of the
> generated event. This isn't strictly necessary for acpi (since the
> button type can be worked out afterwards), but makes sense in the
> context of the second patch.

Looks good. This is what I did for my demo Toshiba hal applet.

(side note, did the kernel guys allow your acpi patch to toshiba_acpi?)

> This adds an addon for keyboard devices. It simply attaches to the
> keyboard's event device (these allow multiple readers) and monitors
> keypresses. When an "interesting" key (currently defined as one which
> would correspond to power management events) is pressed, it generates a
> ButtonPressed condition and puts the appropriate type in the details
> field.

Sweet, but I see the comment:

/* FIXME - find the keyboard device */

does this mean the ButtonPressed condition comes from the keyboard or
some other object?

> KEY_SLEEP corresponds to the sleep key that appears on Microsoft (and
> some laptop) keyboards. KEY_SUSPEND doesn't actually appear to exist on
> any PS/2 keyboards (judging by atkbd.c), so it's a handy thing to hijack
> for hibernation. KEY_POWER is fairly self-explanatory.

I have hibernate and suspend keys on my USB keyboard.

> Any comments on this approach? Right now it doesn't provide any
> information about these capabilities, on the assumption that all
> keyboards may potentially have these keys (we certainly can't tell for
> PS/2, I'm not sure about USB)

Surely we need to launch the addon for each keyboard from an fdi file?
Also adding capability "button" so that applications such as g-p-m can
monitor this UDI as a "button device"

Small nitpick:

+++ hal/hald/linux2/addons/addon-keyboard.c	2006-01-30 23:45:46 +0000
@@ -0,0 +1,156 @@
+/***************************************************************************
+ * CVSID: $Id: addon-key.c,v 1.13 2005/11/09 21:13:30 dkukawka Exp $
+ *
+ * addon-acpi.c : Listen to key events and modify hal device objects
+ *

Should probably have addon-keyboard.c throughout the file...

Richard.



More information about the hal mailing list