Re: patch: acpi usermode suspend API change

From: Lars Engels <lars.engels_at_0x20.net>
Date: Thu, 21 Jun 2007 17:50:44 +0200
On Sun, Jun 17, 2007 at 10:13:34AM -0700, Nate Lawson wrote:
> 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

Nate, 

thanks for your patch. 
But after applying it on a recent -Current I get a lot of kernel messages
like these:
Jun 21 17:48:27 maggie kernel: apm34 opened clone 0xc457fd00
Jun 21 17:48:27 maggie kernel: apm34 closed clone 0xc457fd00
Jun 21 17:48:32 maggie kernel: apm35 opened clone 0xc457ee40
Jun 21 17:48:32 maggie kernel: apm35 closed clone 0xc457ee40
Jun 21 17:48:37 maggie kernel: apm36 opened clone 0xc457ec40
Jun 21 17:48:37 maggie kernel: apm36 closed clone 0xc457ec40
Jun 21 17:48:42 maggie kernel: apm37 opened clone 0xc457fc40
Jun 21 17:48:42 maggie kernel: apm37 closed clone 0xc457fc40
Jun 21 17:48:47 maggie kernel: apm38 opened clone 0xc433b6c0
Jun 21 17:48:47 maggie kernel: apm38 closed clone 0xc433b6c0
Jun 21 17:48:52 maggie kernel: apm39 opened clone 0xc433b240

Additionally, pressing the power button only generates this:
Jun 21 17:50:03 maggie kernel: acpi: request to enter state S5 failed

I need to run 'shutdown -p ' to power the system down.


Lars

Received on Thu Jun 21 2007 - 13:50:49 UTC

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