Instead of duplicating the checks in pm-action, simply call pm-is-supported.
Add also initial support for the --suspend-hybrid command (The actual
implementation
of do_suspend_hybrid is still tbd).
Michael
--
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
From 70a4823d958a645cb37f1f226d0cf99bdbb6cb2d Mon Sep 17 00:00:00 2001
From: Michael Biebl <[EMAIL PROTECTED]>
Date: Tue, 29 Jan 2008 00:13:59 +0100
Subject: [PATCH] Don't duplicate the functionality of pm-is-supported in pm-action
Instead of duplicating the checks in pm-action, simply call pm-is-supported.
Add initial support for the --suspend-hybrid command (The actual implementation
of do_suspend_hybrid is tbd).
---
src/pm-action | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/pm-action b/src/pm-action
index bf9d3ec..3a1e6a5 100755
--- a/src/pm-action
+++ b/src/pm-action
@@ -93,18 +93,26 @@ ACTION=${0##*pm-}
case "$ACTION" in
suspend)
- if ! grep -q mem /sys/power/state ; then
+ if ! pm-is-supported --"$ACTION" ; then
echo "Error: kernel cannot suspend to ram." 1>&2
exit 1
fi
- REVERSE=resume ;;
+ REVERSE=resume
+ ;;
hibernate)
- if ! grep -q disk /sys/power/state ; then
+ if ! pm-is-supported --"$ACTION" ; then
echo "Error: kernel cannot suspend to disk." 1>&2
exit 1
fi
REVERSE=thaw
;;
+ suspend-hybrid)
+ if ! pm-is-supported --"$ACTION" ; then
+ echo "Error: hybrid suspend is not supported." 1>&2
+ exit
+ fi
+ REVERSE=resume
+ ;;
*)
exit 1
;;
@@ -112,6 +120,6 @@ esac
export PM_CMDLINE="$@"
-pm_main "$ACTION" "$REVERSE"
+pm_main "$(echo $ACTION | tr - _)" "$REVERSE"
exit $?
--
1.5.3.8
_______________________________________________
Pm-utils mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pm-utils