Subject: Re: Hotkey support via powerd
To: Steven M. Bellovin <smb@cs.columbia.edu>
From: Jared D. McNeill <jmcneill@invisible.ca>
List: tech-kern
Date: 12/22/2007 11:07:06
On Sat, 22 Dec 2007, Steven M. Bellovin wrote:
> First -- and at this level -- where does the list of hotkeys come
> from?  Is that part of some standard or is it vendor- and
> model-specific?  For example, I'm pretty certain that on my T42, the
> volume control and "Acess IBM" buttons are ACPI events -- at least, I
> see things on the screen in Windows when I press them, but xev doesn't
> think I've pressed anything.  If they are vendor-specific, the
> PSWITCH_HK_* defines are probably inappropriate; we'd need a way to
> load the appropriate definitions.

They are handled by the new thinkpad(4) driver, which uses IBM/Lenovo's 
HKEY interface. The hotkey driver is responsible for mapping its hotkey 
events to the generic PSWITCH_HK_* events. We can use pmf_platform to use 
the information from DMI tables to handle any quirks in the keymappings 
between models.

Volume events don't need to be passed to userland -- pmf can handle them 
just fine in the kernel. The "Access IBM" button is the same as my 
"ThinkVantage" button, which is delivered to powerd as a 
PSWITCH_HK_VENDOR_BUTTON.

> Second -- we're going to have to figure out some way for powerd to
> invoke user-specific scripts, running with the user's permissions.
> Realistically, on most NetBSD laptops that's not a big concern, since
> the user probably has root, but architecturally it would be nice.  The
> more powerd can do, the more important this is.

powerd runs scripts as root. We do, however, need to find out who is 
running X -- right now my scripts are pretty stupid and assume the 
owner of /dev/console is the X user.

Cheers,
Jared