Subject: Re: ACPI suspend support.
To: Kentaro A. Kurahone <kurahone@sigusr1.org>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-kern
Date: 01/25/2005 09:00:13
On Jan 24, 2005, at 10:18 PM, Kentaro A. Kurahone wrote:

> Hmmm.  Yeah, I guess using /dev/apm(ctl), apm(8), and apmd(8) doen't 
> really
> make sense on most platforms.  It looks like powerd is the sysmon 
> equivalent
> to apmd.  Not sure what the best replacement for /dev/apmctl would be
> (/dev/power maybe?).

"Sort of."  powerd(8) is a *start*.  Right now, powerd(8) only handles 
events that occur when you press a button such as the power button.  
And really only for ACPI, right now.

The whole idea is to put all of the policy into userland, in the form 
of scripts.  powerd(8) invokes the script for the event source with 
arguments describing the event (e.g. power_button pressed).  If your 
system has APM instead of ACPI, you don't see buttons, you see requests 
(e.g. standby, sleep, etc.).  Those differences can be handled by 
having a different set of scripts for APM.

Userland could then do various things before sending a message back 
down to the kernel to actually sleep the machine (by sending a generic 
message to sysmon that then dispatches it to the correct back-end to 
actually do the work).

Maybe the policy for closing the lid switch is simply to turn off the 
display and set the CPU speed as slow as possible.  Maybe it is to 
sleep the system.  This policy would be codified in a script that 
powerd(8) would invoke.

Make sense?

         -- Jason R. Thorpe <thorpej@shagadelic.org>