summaryrefslogtreecommitdiff
path: root/pm/module.d
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2008-02-07 14:23:31 -0600
committerVictor Lowther <victor.lowther@gmail.com>2008-02-07 14:23:31 -0600
commit537449f1acb100d5a49aa314cc40afaa7ef1ccae (patch)
tree97bca62d43c5b483de3a778da3a32971ce59c66c /pm/module.d
parent64c5393ce7d5ad02f773d11aa3d2cf307393fc08 (diff)
Added tuxonice support to modular sleep branch
Diffstat (limited to 'pm/module.d')
-rw-r--r--pm/module.d/Makefile.am3
-rw-r--r--pm/module.d/tuxonice32
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"
+}