diff options
author | Victor Lowther <victor.lowther@gmail.com> | 2009-11-07 23:51:04 -0600 |
---|---|---|
committer | Victor Lowther <victor.lowther@gmail.com> | 2009-11-07 23:51:04 -0600 |
commit | 51afe0cac4d540116c48949f65e16c141d6b0ade (patch) | |
tree | fb5bb313b3a0181ce3ebac0ca05eb358a7ae05a5 | |
parent | 054668a461347514034b88eef24f902b69d55d5b (diff) | |
parent | 6014e54b7f007109616965ff601ff05ea6fc397a (diff) |
Merge branch 'master' into pm-utils-1.2
-rw-r--r-- | man/pm-action.xml | 6 | ||||
-rw-r--r-- | pm/HOWTO.hooks | 2 | ||||
-rw-r--r-- | pm/functions.in | 15 | ||||
-rw-r--r-- | pm/pm-functions.in | 2 | ||||
-rwxr-xr-x | pm/sleep.d/90clock | 5 | ||||
-rwxr-xr-x | pm/sleep.d/98smart-kernel-video | 28 | ||||
-rwxr-xr-x | pm/sleep.d/99video | 8 |
7 files changed, 29 insertions, 37 deletions
diff --git a/man/pm-action.xml b/man/pm-action.xml index a6e064c..8c1732e 100644 --- a/man/pm-action.xml +++ b/man/pm-action.xml @@ -302,7 +302,7 @@ is specific to this system. The file will be saved in <filename>/etc/hal/fdi/information/99local-pm-utils-quirks.fdi</filename>. This parameter will only save the actual quirks that were - used to sucessfully suspend/resume a system -- if you are + used to successfully suspend/resume a system -- if you are running proprietary video drivers or kernel modesetting video drivers, you will generate a potentially incorrect .fdi file. @@ -325,7 +325,7 @@ of pm-utils. If a global configuration variable is set, the value set to will be appended to the previous value. If any other variable is set, it will be ignored. - The syntax is simply: VAR_NAME = value. + The syntax is simply: VAR_NAME=value. See the CONFIGURATION VARIABLES section for valid variables defined by pm-utils. External packages can define others, see @@ -492,7 +492,7 @@ <listitem> <para> If your system clock drifts across a suspend/resume or - hiberante/thaw cycle, you should set this to true. + hibernate/thaw cycle, you should set this to true. This will cause pm-utils to synchronize the system clock whenever we go through a sleep/wake cycle at the expense of making suspend/resume take longer. diff --git a/pm/HOWTO.hooks b/pm/HOWTO.hooks index a506759..ad7d4a7 100644 --- a/pm/HOWTO.hooks +++ b/pm/HOWTO.hooks @@ -43,7 +43,7 @@ In normal operation, hooks should only return either 0 or 254 as exit codes. Any other return code is interpreted by the pm-utils machinery as a signal from the hook that it should abort whatever it is doing. When running sleep.d hooks, that means that pm-utils stops running hooks, aborts the suspend/resume -process, calls any hooks that ran sucessfully prior to this one with the +process, calls any hooks that ran successfully prior to this one with the appropriate wakeup options, and exits with a non-zero exit code. When running power.d hooks, any hooks after this one will be skipped. diff --git a/pm/functions.in b/pm/functions.in index bd0705c..0aba5ea 100644 --- a/pm/functions.in +++ b/pm/functions.in @@ -3,8 +3,20 @@ # Common functionality for the hooks. +# If a variable is set to true, yes, 1, or is simply set with no value, +# return 0, otherwise return 1. +is_set() +{ + case ${1-UNSET} in + true|yes|TRUE|YES|on|ON|1'') return 0;; + false|FALSE|no|NO|off|OFF|0|UNSET) return 1;; + *) return 2;; + esac +} + # for great debugging! -[ "${PM_DEBUG}" = "true" ] && set -x +is_set "${PM_DEBUG}" && set -x + # try to take the lock. Fail if we cannot get it. try_lock() @@ -246,3 +258,4 @@ dbus_send () { command dbus-send "$@" 2>/dev/null || return $NA } + diff --git a/pm/pm-functions.in b/pm/pm-functions.in index 8ba975c..67910ea 100644 --- a/pm/pm-functions.in +++ b/pm/pm-functions.in @@ -89,7 +89,7 @@ fi # We do it this way because 'echo -n' is not posix. log() { - [ $LOGGING ] || return 0; + is_set "$LOGGING" || return 0; local fmt='%s\n' [ "$1" = "-n" ] && { fmt='%s'; shift; } printf "$fmt" "$*" diff --git a/pm/sleep.d/90clock b/pm/sleep.d/90clock index 5df6e8e..b8ade29 100755 --- a/pm/sleep.d/90clock +++ b/pm/sleep.d/90clock @@ -1,7 +1,6 @@ #!/bin/sh # Synchronize system time with hardware time. -# TODO: Do modern kernels handle this correctly? If so, we should detect that -# and skip this hook. +# Modern kernels handle this correctly so we skip this hook by default. . "${PM_FUNCTIONS}" @@ -15,7 +14,7 @@ resume_clock() /sbin/hwclock --hctosys >/dev/null 2>&1 0<&1 } -[ "$NEED_CLOCK_SYNC" ] || exit $NA +is_set "$NEED_CLOCK_SYNC" || exit $NA case "$1" in hibernate|suspend) suspend_clock ;; diff --git a/pm/sleep.d/98smart-kernel-video b/pm/sleep.d/98smart-kernel-video index 6ec301b..11b5490 100755 --- a/pm/sleep.d/98smart-kernel-video +++ b/pm/sleep.d/98smart-kernel-video @@ -32,9 +32,9 @@ have_kms() { # if we are running with a KMS-enabled video driver, we should not # attempt to run any quirks - [ -d /sys/class/drm/card0/device/graphics/fb0 ] || return 1 + grep -q -E '(noveau|drm)fb' /proc/fb || return 1 remove_all_video_quirks - add_parameter --quirk-no-chvt + add_parameters --quirk-no-chvt } have_nvidia() @@ -44,6 +44,7 @@ have_nvidia() # suspend/resume in a quirk-free manner. [ -d /sys/module/nvidia ] || return 1 remove_all_video_quirks + add_parameters --quirk-no-chvt } have_fglrx() @@ -53,30 +54,9 @@ have_fglrx() remove_all_video_quirks } -have_smart_intel() -{ - # currently, intel kernel modesetting is not quite smart enough - # we still need acpi s3 kernel modesetting hooks, so don't remove those - # options if they were passed. - [ -d /sys/module/i915 ] || return 1 - local kernel_rev="$(uname -r |awk -F '[_-]' '{print $1}')" - [ "$kernel_rev" \> "2.6.26" -o "$kernel_rev" = "2.6.26" ] || return 1 - remove_parameters --quirk-dpms-on \ - --quirk-dpms-suspend \ - --quirk-vbe-post \ - --quirk-vbe-post \ - --quirk-vga-mode3 \ - --quirk-vbemode-restore \ - --quirk-vbestate-restore \ - --quirk-reset-brightness \ - --quirk-radeon-off \ - --quirk-no-fb \ - --quirk-pci-save -} - smart_kernel_video() { - have_kms || have_nvidia || have_fglrx || have_smart_intel || return $NA + have_kms || have_nvidia || have_fglrx || return $NA } case $1 in diff --git a/pm/sleep.d/99video b/pm/sleep.d/99video index 23e56ef..957cbc2 100755 --- a/pm/sleep.d/99video +++ b/pm/sleep.d/99video @@ -85,7 +85,7 @@ resume_fbcon() maybe_chvt() { - [ "$QUIRK_NO_CHVT" = "true" ] && return + is_set "$QUIRK_NO_CHVT" && return fgconsole |savestate console chvt 63 } @@ -98,7 +98,7 @@ maybe_deallocvt() } # Some tiny helper functions for quirk handling -quirk() { [ "$1" = "true" ] && [ -z $QUIRK_NONE ]; } +quirk() { is_set "$1" && [ -z $QUIRK_NONE ]; } # save/restore vbe state vbe_savestate() { vbe vbestate save |savestate vbestate; } @@ -204,13 +204,13 @@ help() { case "$1" in suspend) maybe_chvt; suspend_video ;; hibernate) maybe_chvt - if [ "$HIBERNATE_RESUME_POST_VIDEO" = "yes" ]; then + if is_set "$HIBERNATE_RESUME_POST_VIDEO"; then suspend_video fi ;; resume) resume_video; maybe_deallocvt;; thaw) - if [ "${HIBERNATE_RESUME_POST_VIDEO}" = "yes" ]; then + if is_set "${HIBERNATE_RESUME_POST_VIDEO}"; then resume_video fi maybe_deallocvt |