supporting tuxonice in pm-utils

Matt Price matt.price at utoronto.ca
Fri Jan 18 19:30:15 UTC 2008


hi,

i've been browsing through the pm-utils code since fixing some suspend
issues on my laptop (running ubuntu hardy) and it looks to me like it'd
be pretty straightforward to get pm-utils to support tuxonice in
debian-based distros.  i think not much would be required beyond a
couple of small changes in pm-action and functions; first we slightly
improve the test for suspend-hybrid capability (in pm-action):

case "$ARG" in
       suspend)
               grep -q mem /sys/power/state || exit 1
               ;;
       hibernate)
               grep -q disk /sys/power/state || exit 1
               ;;
       suspend-hybrid)
              grep -q mem /sys/power/state || exit 1
              grep -q disk /sys/power/state || exit 1
              [ -d /sys/power/tuxonice ] || [ -x /usr/sbin/s2both ] ||
exit 1

and in functions, change do_suspend_hybrid():
do_suspend_hybrid()
{
       if [ -x /usr/sbin/s2both ]; then
               /usr/sbin/s2both -f $S2DISK_CONF $S2RAM_OPTS
       elif [ -d /sys/power/tuxonice ]; then
               echo 3 > /sys/power/tuxonice/powerdown_method
               echo -n "platform > /sys/power/disk
               echo -n "disk" > /sys/power/state
      else
               exit 1;
       fi
}

one could make other refinements, in particular allowing users to set a
preference when multiple suspend options are present; but i think these
would be sufficient in principle.  let me know what you think & if you
would be interested in patches.  thanks much,

matt

-- 
Matt Price
matt.price at utoronto.ca
	




More information about the Ubuntu-devel-discuss mailing list