[Pm-utils] [PATCH 4/4] Added tuxonice support to modular sleep branch
Victor Lowther
victor.lowther at gmail.com
Thu Feb 7 20:33:49 PST 2008
---
pm/module.d/Makefile.am | 3 ++-
pm/module.d/tuxonice | 32 ++++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 1 deletions(-)
diff --git a/pm/module.d/Makefile.am b/pm/module.d/Makefile.am
index 8e861f3..636d810 100644
--- a/pm/module.d/Makefile.am
+++ b/pm/module.d/Makefile.am
@@ -1,7 +1,8 @@
moduledir = $(libdir)/pm-utils/module.d
module_SCRIPTS = \
- kernel
+ kernel \
+ tuxonice
EXTRA_DIST=$(module_SCRIPTS)
diff --git a/pm/module.d/tuxonice b/pm/module.d/tuxonice
new file mode 100644
index 0000000..b687d15
--- /dev/null
+++ b/pm/module.d/tuxonice
@@ -0,0 +1,32 @@
+export TUXONICE_LOC
+
+# more locations might be nice
+for loc in "/sys/power/tuxonice" "/sys/power/suspend2"; do
+ [ -d "${loc}" ] && { TUXONICE_LOC="${loc}"; break; }
+done
+
+check_suspend() {
+ grep -q mem /sys/power/state; return $?
+}
+
+do_suspend() {
+ echo "mem" >/sys/power/state
+}
+
+check_hibernate() {
+ [ -f "${TUXONICE_LOC}/do_hibernate" ]; return $?
+}
+
+do_hibernate() {
+ echo 5 > "${TUXONICE_LOC}/powerdown_method"
+ echo anything > "${TUXONICE_LOC}/do_hibernate"
+}
+
+check_suspend_hybrid() {
+ grep -q mem /sys/power/state || return 1
+ [ -f "${TUXONICE_LOC}/do_hibernate" ]; return $?
+}
+do_suspend_hybrid() {
+ echo 3 >"${TUXONICE_LOC}/powerdown_method"
+ echo anything >"${TUXONICE_LOC}/do_hibernate"
+}
--
1.5.3.8
More information about the Pm-utils
mailing list