patch: acpi usermode suspend API change

From: Nate Lawson <nate_at_root.org>
Date: Sun, 17 Jun 2007 10:13:34 -0700
This patch updates the user API for acpi suspend in a number of ways.

* /etc/rc.suspend,rc.resume are always run, no matter the source of the
suspend event
* suspend now requires positive user acknowledgement.  If a user program
wants to cancel the suspend, they can.  If one of the user programs
hangs or doesn't respond within 10 seconds, the system suspends anyway.
* /dev/apm is clonable, allowing multiple listeners for suspend events.
 In the future, xorg-server can use this to be informed about suspend
even if there are other listeners (i.e. apmd).

The API changes are intended to be MFCd and hence are minimal.

* Two new ACPI ioctls:  REQSLPSTATE and ACKSLPSTATE.  Request begins the
process of suspending by notifying all listeners.  acpi is monitored by
devd(8) and /dev/apm listener(s) are also counted.  Users register their
approval or disapproval via Ack.  If anyone disapproves, suspend is vetoed.

* Binary compat is preserved in that old user programs or kernel modules
(yeah, right) that called the API can still do so.  A message is printed
once that this interface is deprecated.

* acpiconf gains the -k flag to ack the suspend request.  This flag is
undocumented on purpose since it's only used by /etc/rc.suspend.  It is
not intended to be a permanent change and will be removed once a better
power API is implemented.

These patches have been successfully tested for about a week through
suspend/resumes and various usermode programs, including patches to
xorg-server.

The eventual goal is to improve subr_power to be a more generic central
power management interface to user and kernel providers.  powerd(8)
might start managing profiles similar to apmd(8).  I don't know yet and
there isn't time to do that.  This patch provides a reasonable interface
for now and eliminates some serious weaknesses, especially in that
pressing a sleep button did not guarantee rc.suspend would run before
sleeping.

Comments welcome, patches are for 6.x and 7.x.

-- 
Nate

Received on Sun Jun 17 2007 - 18:43:32 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:12 UTC