2008/1/28, Victor Lowther <[EMAIL PROTECTED]>:
> On Jan 27, 2008 8:34 PM, Nigel Cunningham <[EMAIL PROTECTED]> 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?
_______________________________________________
Pm-utils mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pm-utils

Reply via email to