[Pm-utils] [PATCH 3/5] Moved video-specific option processing to 99video.

Victor Lowther victor.lowther at gmail.com
Sat Mar 1 09:09:33 PST 2008


---
 pm/sleep.d/99video |   20 ++++++++++++++++++++
 src/pm-action.in   |   21 +++------------------
 2 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/pm/sleep.d/99video b/pm/sleep.d/99video
index 1aa6a99..e215e9d 100755
--- a/pm/sleep.d/99video
+++ b/pm/sleep.d/99video
@@ -9,6 +9,26 @@
 
 . "${PM_FUNCTIONS}"
 
+for opt in $PM_CMDLINE; do
+       [ "${opt#--quirk-}" = "$opt" ] && continue # not one we care about.
+	case "${1##--quirk-}" in # just quirks, please
+		dpms-on) 	   QUIRK_DPMS_ON="true" ;;
+		dpms-suspend) 	   QUIRK_DPMS_SUSPEND="true" ;;
+		radeon-off) 	   QUIRK_RADEON_OFF="true" ;;
+		reset-brightness)  QUIRK_RESET_BRIGHTNESS="true" ;;
+		s3-bios) 	   QUIRK_S3_BIOS="true" ;;
+		s3-mode) 	   QUIRK_S3_MODE="true" ;;
+		vbe-post) 	   QUIRK_VBE_POST="true" ;;
+		vbemode-restore)   QUIRK_VBEMODE_RESTORE="true" ;;
+		vbestate-restore)  QUIRK_VBESTATE_RESTORE="true" ;;
+		vga-mode3) 	   QUIRK_VGA_MODE_3="true" ;;
+		none) 		   QUIRK_NONE="true" ;;
+		*) continue ;;
+	esac
+	shift
+done
+
+
 reset_brightness()
 {
 	for bl in /sys/class/backlight/* ; do
diff --git a/src/pm-action.in b/src/pm-action.in
index 457149a..9012802 100644
--- a/src/pm-action.in
+++ b/src/pm-action.in
@@ -29,6 +29,8 @@
 export PM_FUNCTIONS="@PM-UTILS-LIBDIR@/functions"
 . "${PM_FUNCTIONS}"
 
+# save the command line parameters for the hooks.
+export PM_CMDLINE="$*"
 help()
 {
 	echo "${0##*/} [options]"
@@ -49,25 +51,10 @@ if [ -n "$EUID" -a "$EUID" != "0" ]; then
 	exit 1
 fi
 
-# Get the command line options
+# Save the command line options for the hooks
 while [ $# -gt 0 ]
 do
-	[ "${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
 
@@ -81,6 +68,4 @@ case "$ACTION" in
 			exit 1 ;;
 esac
 
-export PM_CMDLINE="$@"
-
 pm_main "${ACTION}" "${REVERSE}"
-- 
1.5.4.3



More information about the Pm-utils mailing list