[Pm-utils] [Patch] TuxOnIce pm/functions patch draft.
Nigel Cunningham
nigel at nigel.suspend2.net
Sun Jan 27 18:59:57 PST 2008
Hi.
Victor Lowther wrote:
> On Jan 27, 2008 8:34 PM, Nigel Cunningham <nigel at nigel.suspend2.net> wrote:
>> Hi again.
>>
>> Here is a draft patch for adding TuxOnIce support to the pm/defaults and
>> pm/functions files. I'm calling it a draft because I want your feedback
>> on whether it's the right sort of approach. I'm not really keen on
>> adding a variable per sysfs entry, and so have only added the most
>> frequently used ones in this iteration.
>
> I would move all the tuxonice specific stuff out of do_hibernate and
> into its own function like so:
Okay, thanks. I'll wait for other comments before doing any more.
> do_tuxonice_hibernate() {
> echo "${TUXONICE_USERUI}" > /sys/power/tuxonice/user_interface/program
> if [ -n "${TUXONICE_USERUI}" ] ; then
> echo "1" > /sys/power/tuxonice/user_interface/enabled
> else
> echo "0" > /sys/power/tuxonice/user_interface/enabled
> fi
>
> echo "1" > /sys/power/tuxonice/userui_interface/enabled
> echo "${TUXONICE_EXTRA_PAGES_ALLOWANCE}" >
> /sys/power/tuxonice/extra_pages_allowance
> echo "${TUXONICE_USERUI_ENABLE_ESCAPE}" >
> /sys/power/tuxonice/user_interface/enable_escape
>
> echo "${TUXONICE_COMPRESSION_ALGORITHM}" >
> /sys/power/tuxonice/compression/algorithm
> if [ -n "${TUXONICE_COMPRESSION_ALGORITHM}" ] ; then
> echo "1" > /sys/power/tuxonice/compression/enabled
> else
> echo "0" > /sys/power/tuxonice/compression/enabled
> fi
>
> # TuxOnIce has a separate entry for rebooting, with rebooting
> # trumping powering down. We therefore explicitly disable
> # rebooting when the user selects a powerdown method.
> case "${HIBERNATE_MODE}" in
> "platform")
> echo "0" > /sys/power/tuxonice/reboot
> echo "4" > /sys/power/tuxonice/powerdown_method
> ;;
> "shutdown")
> echo "0" > /sys/power/tuxonice/reboot
> echo "5" > /sys/power/tuxonice/powerdown_method
> ;;
> "reboot")
> echo "1" > /sys/power/tuxonice/reboot
> ;;
> esac
> echo "anything" > /sys/power/tuxonice/do_hibernate
> }
>
> 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
> }
>
> Helps keep mental pollution down, ya know. :)
Yeah. Simplicity is good.
>> Victor, I'm not ignoring your comment about hybrid support. I'd just
>> already written the lines when your email came, and thought it might
>> never-the-less help to have on record how to do hybrid with TuxOnIce.
>> (This is only an RFC anyway).
>
> Understood. :)
Thanks :)
Nigel
More information about the Pm-utils
mailing list