[Pm-utils] [PATCH 5/6] Always fall back to kernel methods for suspend and hibernate.
Victor Lowther
victor.lowther at gmail.com
Wed Sep 17 20:22:59 PDT 2008
That way we have some resilience in the case of misconfiguration,
and future sleep methods do not have to reimplement the kernel methods.
---
pm/module.d/kernel | 28 ++++------------------------
pm/pm-functions.in | 24 ++++++++++++++++++++++++
2 files changed, 28 insertions(+), 24 deletions(-)
diff --git a/pm/module.d/kernel b/pm/module.d/kernel
dissimilarity index 98%
index ee71278..157fc8a 100755
--- a/pm/module.d/kernel
+++ b/pm/module.d/kernel
@@ -1,24 +1,4 @@
-#!/bin/sh
-
-if [ -z "$SUSPEND_MODULE" ]; then
- if grep -q mem /sys/power/state; then
- SUSPEND_MODULE="kernel"
- do_suspend() { echo -n "mem" >/sys/power/state; }
- elif [ -c /dev/pmu ] && pm-pmu --check; then
- SUSPEND_MODULE="kernel"
- do_suspend() { pm-pmu --suspend; }
- fi
-fi
-
-if [ -z "$HIBERNATE_MODULE" ] && \
- [ -f /sys/power/disk ] && \
- grep -q disk /sys/power/state; then
- HIBERNATE_MODULE="kernel"
- do_hibernate()
- {
- [ -n "${HIBERNATE_MODE}" ] && \
- grep -qw "${HIBERNATE_MODE}" /sys/power/disk && \
- echo -n "${HIBERNATE_MODE}" > /sys/power/disk
- echo -n "disk" > /sys/power/state
- }
-fi
+#!/bin/sh
+
+# this file is a stub -- pm-functions will always fall back to kernel methods
+# if nothing else is available.
\ No newline at end of file
diff --git a/pm/pm-functions.in b/pm/pm-functions.in
index 54c5fca..3690cc9 100644
--- a/pm/pm-functions.in
+++ b/pm/pm-functions.in
@@ -248,3 +248,27 @@ SLEEP_FUNCTIONS="${PM_UTILS_LIBDIR}/module.d/${SLEEP_MODULE}"
. "${SLEEP_FUNCTIONS}"
+# always fall back to kernel methods if nothing else was declared
+
+if [ -z "$SUSPEND_MODULE" ]; then
+ if grep -q mem /sys/power/state; then
+ SUSPEND_MODULE="kernel"
+ do_suspend() { echo -n "mem" >/sys/power/state; }
+ elif [ -c /dev/pmu ] && pm-pmu --check; then
+ SUSPEND_MODULE="kernel"
+ do_suspend() { pm-pmu --suspend; }
+ fi
+fi
+
+if [ -z "$HIBERNATE_MODULE" ] && \
+ [ -f /sys/power/disk ] && \
+ grep -q disk /sys/power/state; then
+ HIBERNATE_MODULE="kernel"
+ do_hibernate()
+ {
+ [ -n "${HIBERNATE_MODE}" ] && \
+ grep -qw "${HIBERNATE_MODE}" /sys/power/disk && \
+ echo -n "${HIBERNATE_MODE}" > /sys/power/disk
+ echo -n "disk" > /sys/power/state
+ }
+fi
--
1.5.6.5
More information about the Pm-utils
mailing list