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:54:55
On Sat, 22 Dec 2007, Steven M. Bellovin wrote:
> So other laptops would need their own model-specific driver?  Wouldn't
> that still necessitate something other than those #defines?  (Or
> rather, they should be in thinkpad.h, I'd guess.)

Things like "display switch" hotkeys are not unique to Thinkpads.

>> 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.
>
> The question is user feedback.  Many interfaces -- Windows, I think
> Gnome/Ubuntu, my mobile phone, my television, etc., display something
> to show the relative volume level when I change it.  If the events
> aren't passed to userlevel, displaying that is hard.  Of course, I'm
> not saying that powerd is the best way to pass that info to userlevel
> -- see below -- but I think we need some way.

So what I would like to do for those devices, is deliver the events to 
powerd. The script handling volume presses can inject keycodes back to 
wsmux1 if it doesn't want to handle it directly.

>> 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.
>>
> I know it runs things as root now -- that's the problem...  I want some
> mechanism for user control on certain events.  For example, the MUA I
> use (pkgsrc/mail/claws-mail) gets unhappy if its local IP address
> changes while it has connections open, but that happens frequently
> after a suspend/resume.  I'd like to run a command to tell it to go
> offline when I suspend.  Similarly, I sometimes like to run a command to
> lock my screen when I suspend.

What exactly is the problem? This can all be scripted.

> Figuring out who's running X is certainly a necessary step.  The next
> problem, though, is figuring out what scripts that particular user
> wants to run.  I'm looking for the analog of user crontabs.

I feel that you're overcomplicating the issue.

So let me ask you -- do you actually have a technical issue against 
delivering hotkey events via powerd?

Jared