[ltp] belt & suspenders suspend-to-ram script for acpid

Richard Neill linux-thinkpad@linux-thinkpad.org
Sat, 24 Jun 2006 02:32:13 +0100


>>Ah. Could it be that you have the BIOS configured to suspend on 
>>>>lid-close? The BIOS's internal suspend-logic is independent of ACPI!
>>>
>>>There is no "BIOS's internal suspend-logic" if ACPI is in use. Thats all
>>>about ACPI, not using the BIOS to make things happen.
>>>
>>>APM = everything does the BIOS
>>>ACPI = everthing does the OS
>>
>>Thanks for the correction. Still, at least on my A22p, I normally have 
>>suspend working thus:
>>
>>  lid-close -> ACPI event -> acpi sleep script -> suspend to RAM.
>>    -> open lid -> wake.
>>
>>BUT, if I also have "suspend on lid close" enabled in the BIOS, the 
>>machine either sleeps again immediately after waking (and needs to be 
>>woken twice), or crashes.
>>
>>So the BIOS certainly does something as well as the OS. Maybe the BIOS 
>>does an APM suspend while the OS does an ACPI suspend?
>>
>>The A22 is an odd machine in that it seems to do both apm and acpi; you 
>>can choose, although neither is done well.
> 
> 
> I've seen notebooks which send the LID-close-event twice. So maybe you get
> other after resume. In my ACPI scripts i test before suspend
> the LID state (somewhere in /proc/acpi/.../LID).
> 

No - it definitely doesn't do that.  At any rate, I find the following 
behaviour:


  BIOS SUSPEND       ACPI SCRIPT           RESULT
  ON LID CLOSE       TRIGGERED BY

     n                lid (only)          suspend once on lid-close
     y                lid (only)          suspend;resume;suspend;resume

     n                Fn-F4 (only)        suspend once on FnF4
     y                Fn-F4 (only)        suspend;resume;suspend;resume

     n                lid AND FnF4        suspend once on lid-close
					 or twice on Fn-F4 + lid close
     y                lid AND Fn-F4       suspend thrice on Fn-F4; close.



Conclusions:

1)You don't want the BIOS setting "Suspend on lid-close" enabled.
Even if it were harmless, it's useless, besides which, sometimes you 
might want to close the lid without suspending.

2)/etc/acpi/events should trigger something in response to EITHER
   Lid-close OR  Fn-F4, but not both. Fn-F4 is preferred.

3)Any other clients of acpid (eg klaptop) can mess with this!


In my setup, I completely ignore the lid-event.


Best wishes,

Richard