Comment 11 for bug 89983

Revision history for this message
Turbo Fredriksson (turbo-bayour) wrote :

Oups, sorry. Didn't test it throughly! It suspended even if the power was connected. I only want the suspend when on battery, not on AC. So I modified it like this instead:

----- s n i p -----
#!/bin/sh

grep -q off-line /proc/acpi/ac_adapter/ADP1/state
AC=$?

grep -q closed /proc/acpi/button/lid/*/state
LID=$?

if [ $AC = 0 -a $LID = 0 ]; then
    # Lidstate = closed
    /sbin/s2ram -f -s -p -a 2
fi
----- s n i p -----

I also had to add this snippet to the /etc/acpi/power.sh so that suspend works when the lid is closed (on AC) and the power is disconnected.