On Mon, 26 Mar 2007 20:16:41 +0200
Stefan Seyfried <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> just to make sure that we don't forget about it... :-)
> 
> This is my current minimal userspace suspend patch. It should in theory
> be easy to also patch suspend2 support into it, and it already provides
> a do_suspend_hybrid (untested, i have to admit). It also introduces error
> reporting up the stack, which we also want to have (see also the small
> echo replacement i posted some days ago to further improve this).

Did you look at the S2RAM_OPTS patch I send (Come to think about it,
I don't think I send it to this list ...)

What are all those 'set -x' / 'set +x' pairs for? To beautify the logs?

grts Tim


> Index: pm/functions
> ===================================================================
> RCS file: /cvs/pm-utils/pm-utils/pm/functions,v
> retrieving revision 1.44
> diff -u -r1.44 functions
> --- pm/functions      26 Mar 2007 14:18:07 -0000      1.44
> +++ pm/functions      26 Mar 2007 18:15:44 -0000
> @@ -12,6 +12,8 @@
>  INHIBIT=/var/run/pm-utils.inhibit
>  PM_LOGFILE=${PM_LOGFILE:=/var/log/pm-suspend.log}
>  SUSPEND_MODULES=""
> +HIBERNATE_METHOD=""
> +S2DISK_CONF="/etc/suspend.conf"
>  TEMPORARY_CPUFREQ_GOVERNOR="userspace"
>  
>  set -a
> @@ -120,22 +122,72 @@
>  
>  do_suspend()
>  {
> -     pm-pmu --suspend || echo -n "mem" > /sys/power/state
> +     local RET
> +     if [ -x /usr/sbin/s2ram ]; then
> +             set -x
> +             /usr/sbin/s2ram $S2RAM_OPTS
> +             RET=$?
> +             set +x
> +     else
> +             pm-pmu --suspend || echo -n "mem" > /sys/power/state
> +             RET=$?
> +     fi
> +     return $RET
>  }
>  
>  do_hibernate()
>  {
> -     echo -n "platform" > /sys/power/disk
> -     echo -n "disk" > /sys/power/state
> +     local RET=1
> +     if [ -z "$HIBERNATE_METHOD" ]; then
> +             if [ -x /usr/sbin/s2disk -a -c /dev/snapshot ]; then
> +                     HIBERNATE_METHOD="userspace"
> +             else
> +                     HIBERNATE_METHOD="kernel"
> +             fi
> +     fi
> +     case $HIBERNATE_METHOD in
> +             userspace)
> +                     set -x
> +                     /usr/sbin/s2disk -f $S2DISK_CONF
> +                     RET=$?
> +                     set +x
> +                     ;;
> +             kernel)
> +                     echo -n "platform" > /sys/power/disk
> +                     echo -n "disk" > /sys/power/state
> +                     RET=$?
> +                     ;;
> +     esac
> +     return $RET
>  }
>  
>  do_suspend_hybrid()
>  {
> -     return 1
> +     local RET=1
> +     if [ -z "$HIBERNATE_METHOD" ]; then
> +             if [ -x /usr/sbin/s2both -a -c /dev/snapshot ]; then
> +                     HIBERNATE_METHOD="userspace"
> +             else
> +                     HIBERNATE_METHOD="kernel"
> +             fi
> +     fi
> +     case $HIBERNATE_METHOD in
> +             userspace)
> +                     set -x
> +                     /usr/sbin/s2both -f $S2DISK_CONF
> +                     RET=$?
> +                     set +x
> +                     ;;
> +             *)
> +                     RET=1
> +                     ;;
> +     esac
> +     return $RET
>  }
>  
>  pm_main()
>  {
> +     local RET=1
>       if [ -n "$PM_LOGFILE" ]; then
>               [ -f "$PM_LOGFILE" ] && rm -f "$PM_LOGFILE"
>               exec > "$PM_LOGFILE" 2>&1
> @@ -149,13 +201,14 @@
>       if [ ! -e "$INHIBIT" -a "$(type -t "do_$1")" == "function" ]; then
>               sync ; sync ; sync
>               "do_$1"
> +             RET=$?
>       fi
>  
>       run_hooks "$2" reverse
>  
>       remove_suspend_lock 200
>  
> -     return 0
> +     return $RET
>  }
>  
>  _rmmod() {
> -- 
> Stefan Seyfried
> 
> "Any ideas, John?"
> "Well, surrounding them's out." 
> _______________________________________________
> Pm-utils mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/pm-utils
_______________________________________________
Pm-utils mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pm-utils

Reply via email to