Comment 9 for bug 108611

Revision history for this message
Valentin Neacsu (valentin.neacsu) wrote :

Okay scrap what I said earlier.

I read msrgi's fix and it does work. I'll post clearer instructions on how to do it.

Open a terminal (Accessories -> Terminal) and type:

sudo gedit /etc/acpi/power.sh

(you can replace gedit with your favourite text editor). It will ask for your password so type it.
Scroll down to line 38 where you'll find:

checkStateChanged;

Change that so it looks like this:

if [ x$1 != xenforce ]; then
        checkStateChanged;
fi

Now save and close gedit. In your terminal window type this:

sudo gedit /etc/acpi/resume.sh

Scroll down to the last line and add this on a new line so that it is the last line in the file:

/etc/acpi/power.sh enforce

Save and close gedit. In your terminal window type this:

sudo gedit /etc/rc.local

Scroll to the end and add this *before* the last line (before the "exit 0" line):

# delay to allow acpi-support and gnome to load, in seconds
# increase if your laptop is not fast enough
sleep 60 && /usr/bin/on_ac_power;
if [ "$?" -eq 1 ]; then
    /etc/acpi/power.sh enforce
fi

Save and close gedit. Reboot.

After these modifications, scripts are called even if you suspend/hibernate on battery and resume on AC and vice-versa, and even if you boot on battery. I don't really understand what msrgi's fix does and how it works, but it works.