summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2008-03-01 09:02:41 -0600
committerVictor Lowther <victor.lowther@gmail.com>2008-03-01 09:02:41 -0600
commitfda3bb71c9e4d4fbfc730d1277085e241475ceb1 (patch)
treea987ac73b4ec986541a84110f9a20ab46b580ff4
parent5d7e32ef87f97cb09890b7690f9f62c3395ab673 (diff)
Shortened quirk environment varialbe names.
Also made option handling code in pm-action easier to read.
-rwxr-xr-xpm/sleep.d/99video28
-rw-r--r--src/pm-action.in47
2 files changed, 31 insertions, 44 deletions
diff --git a/pm/sleep.d/99video b/pm/sleep.d/99video
index 67f11e5..8c680ca 100755
--- a/pm/sleep.d/99video
+++ b/pm/sleep.d/99video
@@ -51,51 +51,51 @@ resume_fbcon()
quirk()
{
- [ "$1" = "true" ] && [ -z $DISPLAY_QUIRK_NONE ]
+ [ "$1" = "true" ] && [ -z $QUIRK_NONE ]
}
suspend_video()
{
# 0=nothing, 1=s3_bios, 2=s3_mode, 3=both
local acpi_flag=0
- [ "${DISPLAY_QUIRK_S3_BIOS}" = "true" ] && acpi_flag=$(($acpi_flag + 1))
- [ "${DISPLAY_QUIRK_S3_MODE}" = "true" ] && acpi_flag=$(($acpi_flag + 2))
+ [ "${QUIRK_S3_BIOS}" = "true" ] && acpi_flag=$(($acpi_flag + 1))
+ [ "${QUIRK_S3_MODE}" = "true" ] && acpi_flag=$(($acpi_flag + 2))
sysctl -w kernel.acpi_video_flags=$acpi_flag
# We might need to do one or many of these quirks
- quirk "${DISPLAY_QUIRK_VBESTATE_RESTORE}" && \
+ quirk "${QUIRK_VBESTATE_RESTORE}" && \
vbe vbestate save |savestate vbestate
- quirk "${DISPLAY_QUIRK_VBEMODE_RESTORE}" && \
+ quirk "${QUIRK_VBEMODE_RESTORE}" && \
vbe vbemode get |savestate vbemode
- quirk "${DISPLAY_QUIRK_RADEON_OFF}" && {
+ quirk "${QUIRK_RADEON_OFF}" && {
radeon dac off
radeon light off
}
- quirk "${DISPLAY_QUIRK_VGA_MODE_3}" && \
+ quirk "${QUIRK_VGA_MODE_3}" && \
vbe vbemode set 3
- quirk "${DISPLAY_QUIRK_DPMS_SUSPEND}" && \
+ quirk "${QUIRK_DPMS_SUSPEND}" && \
vbe dpms suspend
save_fbcon
}
resume_video()
{
# We might need to do one or many of these quirks
- quirk "${DISPLAY_QUIRK_VBE_POST}" && {
+ quirk "${QUIRK_VBE_POST}" && {
vbe post
sleep 0.1
}
- quirk "${DISPLAY_QUIRK_VBESTATE_RESTORE}" && \
+ quirk "${QUIRK_VBESTATE_RESTORE}" && \
restorestate vbestate |vbe vbestate restore
- quirk "${DISPLAY_QUIRK_VBEMODE_RESTORE}" && \
+ quirk "${QUIRK_VBEMODE_RESTORE}" && \
vbe vbemode set "$(restorestate vbemode)"
# based on data from s2ram
resume_fbcon
- quirk "${DISPLAY_QUIRK_RADEON_OFF}" && {
+ quirk "${QUIRK_RADEON_OFF}" && {
radeon dac on
radeon light on
}
- quirk "${DISPLAY_QUIRK_DPMS_ON}" && \
+ quirk "${QUIRK_DPMS_ON}" && \
vbe dpms on
- quirk "${DISPLAY_QUIRK_RESET_BRIGHTNESS}" && \
+ quirk "${QUIRK_RESET_BRIGHTNESS}" && \
reset_brightness
}
diff --git a/src/pm-action.in b/src/pm-action.in
index ed537ca..3fe476b 100644
--- a/src/pm-action.in
+++ b/src/pm-action.in
@@ -26,7 +26,7 @@
# The rule here? Simplicity.
-help_options()
+help()
{
echo "${0##*/} [options]"
echo
@@ -45,7 +45,7 @@ help_options()
echo " --quirk-vbestate-restore"
echo " --quirk-vga-mode3"
echo " --quirk-none"
- echo
+ exit 0
}
if [ -n "$EUID" -a "$EUID" != "0" ]; then
@@ -56,34 +56,21 @@ fi
# Get the command line options
while [ $# -gt 0 ]
do
- case "$1" in
- --quirk-dpms-on)
- export DISPLAY_QUIRK_DPMS_ON="true" ;;
- --quirk-dpms-suspend)
- export DISPLAY_QUIRK_DPMS_SUSPEND="true" ;;
- --quirk-radeon-off)
- export DISPLAY_QUIRK_RADEON_OFF="true" ;;
- --quirk-reset-brightness)
- export DISPLAY_QUIRK_RESET_BRIGHTNESS="true" ;;
- --quirk-s3-bios)
- export DISPLAY_QUIRK_S3_BIOS="true" ;;
- --quirk-s3-mode)
- export DISPLAY_QUIRK_S3_MODE="true" ;;
- --quirk-vbe-post)
- export DISPLAY_QUIRK_VBE_POST="true" ;;
- --quirk-vbemode-restore)
- export DISPLAY_QUIRK_VBEMODE_RESTORE="true" ;;
- --quirk-vbestate-restore)
- export DISPLAY_QUIRK_VBESTATE_RESTORE="true" ;;
- --quirk-vga-mode3)
- export DISPLAY_QUIRK_VGA_MODE_3="true" ;;
- --quirk-none)
- export DISPLAY_QUIRK_NONE="true" ;;
- --help)
- help_options
- exit 0 ;;
- *)
- break ;; # terminate while loop
+ [ "${1##--}" = "$1" ] && break #if this matches, it is not an option!
+ [ "$1" = "--help" ] && help
+ case "${1##--quirk-}" in # just quirks, please
+ dpms-on) export QUIRK_DPMS_ON="true" ;;
+ dpms-suspend) export QUIRK_DPMS_SUSPEND="true" ;;
+ radeon-off) export QUIRK_RADEON_OFF="true" ;;
+ reset-brightness) export QUIRK_RESET_BRIGHTNESS="true" ;;
+ s3-bios) export QUIRK_S3_BIOS="true" ;;
+ s3-mode) export QUIRK_S3_MODE="true" ;;
+ vbe-post) export QUIRK_VBE_POST="true" ;;
+ vbemode-restore) export QUIRK_VBEMODE_RESTORE="true" ;;
+ vbestate-restore) export QUIRK_VBESTATE_RESTORE="true" ;;
+ vga-mode3) export QUIRK_VGA_MODE_3="true" ;;
+ none) export QUIRK_NONE="true" ;;
+ *) continue ;;
esac
shift
done