diff options
Diffstat (limited to 'src')
-rwxr-xr-x | 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 $? |