summaryrefslogtreecommitdiff
path: root/src/pm-action
diff options
context:
space:
mode:
authorMichael Biebl <mbiebl@gmail.com>2008-01-29 18:27:31 +0000
committerRichard Hughes <richard@hughsie.com>2008-01-29 18:27:31 +0000
commit0de89bf5f75ac3ba46f464f51e46c416ad0781ef (patch)
treed3f6adfa8b10dd468b9287629cd7a97ecfac8528 /src/pm-action
parenta89c9649210479110f4af37f27b905434920f607 (diff)
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).
Diffstat (limited to 'src/pm-action')
-rwxr-xr-xsrc/pm-action16
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 $?