[Pm-utils] [Patch] TuxOnIce pm/functions patch draft.

Michael Biebl mbiebl at gmail.com
Sun Jan 27 19:21:11 PST 2008


2008/1/28, Victor Lowther <victor.lowther at gmail.com>:
> On Jan 27, 2008 8:34 PM, Nigel Cunningham <nigel at nigel.suspend2.net> wrote:
>
> do_hibernate()
> {
>         if [ -d /sys/power/tuxonice ]; then
>                 do_tuxonice_hibernate
>         else
>                 echo -n "${HIBERNATE_MODE}" > /sys/power/disk
>                 echo -n "disk" > /sys/power/state
>         fi
> }
>

I'd say, we should add additional functions
hibernate_method() and suspend_method() and two config variables
HIBERNATE_METHOD and SUSPEND_METHOD.

The default for the two variables should be "autodetect".
hibernate_method() should return the value of HIBERNATE_METHOD unless
its autodetect.
In that case it should check for tuxonice support (and return
"tuxonice" if found), then uswsusp (return "userspace" if found) and
finally check for kernel (return "kernel" if found);
The same for suspend_method().
The variables HIBERNATE_METHOD, SUSPEND_METHOD could be overwritten by
the user/distributor to enforce a given method.


do_hibernate() would then be:

do_hibernate()
{
case $(hibernate_method)
  tuxonice)
     do_tuxonice_hibernate
  ;;
  userspace)
    do_userspace_hibernate
  ;;
  kernel)
    do_kernel_hibernate
  ;;
esac
}

And the different implementations would follow.

What do you think about that?

Cheers,
Michael


-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?


More information about the Pm-utils mailing list