[Pm-utils] Userspace suspend support for pm-utils
Stefan Seyfried
seife at suse.de
Tue Jun 5 13:55:55 PDT 2007
Hi,
and again, the monthly reminder that we still do not support anything
uswsusp with upstream pm-utils.
Is there anything blocking the merge of something like that?
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 --config $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 --config $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
QA / R&D Team Mobile Devices | "Any ideas, John?"
SUSE LINUX Products GmbH, Nürnberg | "Well, surrounding them's out."
This footer brought to you by insane German lawmakers:
SUSE Linux Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
More information about the Pm-utils
mailing list