Trying to understand how suspend works in 10.10.
I use an alias suspend='sudo /etc/acpi/sleep.sh && sudo alsactl init 0
The alsactl
bit is to re-init my sound card which sometimes does not come out of suspend correctly.
And then:
/etc/acpi/sleep.sh
-> /usr/sbin/pm-suspend
-> /usr/lib/pm-utils/bin/pm-action
-> /usr/lib/pm-utils/pm-functions
Irony is /usr/lib/pm-utils/bin/pm-action
claims to be "Simple suspend script".
Still don't know how it works. I think I directly used s2ram
before.
Best Answer
The
gnome-power-manager
tool listens for suspend button events, and spawnspm-suspend
. Extensive detail about howpm-suspend
operates can be found in theman pm-suspend
command output. The quick version:/etc/pm/config.d
is scanned for files that define environment variables./etc/pm/sleep.d
and/usr/lib/pm-utils/sleep.d
are called in order with the "suspend" argument.echo -n "mem" >/sys/power/state
. See/usr/lib/pm-utils/pm-functions
wheredo_suspend
is defined./etc/pm/sleep.d
and/usr/lib/pm-utils/sleep.d
are called in reverse order with the "resume" argument.If you need to add a script to the stack, I would suggest adding it to
/etc/pm/sleep.d
and name it something that does not conflict with other scripts, and make sure it processes the "suspend"/"resume" argument.For debugging, see
/var/log/pm-suspend.log
as well as the man page which has more information on how to do testing.