[Pm-utils] unify 20video and 99video

Stefan Seyfried seife at suse.de
Tue Mar 13 11:25:43 PDT 2007


Hi,

IMO it makes no sense to separate those two hooks.

Index: 20video
===================================================================
RCS file: 20video
diff -N 20video
--- 20video	6 Mar 2007 19:55:31 -0000	1.11
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,71 +0,0 @@
-#!/bin/bash
-#
-# Copyright 2006-2007 Richard Hughes <richard at hughsie.com>
-# Copyright 2007 Peter Jones <pjones at redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
-
-. /usr/lib/pm-utils/functions
-
-vbetool=$(type -p vbetool)
-vbe() {
-	if [ -z "$vbetool" ]; then
-		echo "vbetool not found" 1>&2
-		return 1
-	fi
-	$vbetool "$@"
-}
-
-radeontool=$(type -p radeontool)
-radeon() {
-	if [ -z "$radeontool" ]; then
-		echo "radeontool not found" 1>&2
-		return 1
-	fi
-	$radeontool "$@"
-}
-
-suspend_video()
-{
-	# 0=nothing, 1=s3_bios, 2=s3_mode, 3=both
-	if [ "${DISPLAY_QUIRK_S3_BIOS}" == "true" -a \
-			"${DISPLAY_QUIRK_S3_MODE}" == "true" ]; then
-		sysctl -w kernel.acpi_video_flags=3
-	elif [ "${DISPLAY_QUIRK_S3_BIOS}" == "true" ]; then
-		sysctl -w kernel.acpi_video_flags=1
-	elif [ "${DISPLAY_QUIRK_S3_MODE}" == "true" ]; then
-		sysctl -w kernel.acpi_video_flags=2
-	else
-		sysctl -w kernel.acpi_video_flags=0
-	fi
-
-	# We might need to do one or many of these quirks
-	if [ "${DISPLAY_QUIRK_VBESTATE_RESTORE}" == "true" ]; then
-		vbe vbestate save > /var/run/vbestate
-	fi
-	if [ "${DISPLAY_QUIRK_VBEMODE_RESTORE}" == "true" ]; then
-		vbe vbemode get > /var/run/vbemode
-	fi
-	if [ "${DISPLAY_QUIRK_VGA_MODE_3}" == "true" ]; then
-		vbe vbemode set 3
-	fi
-	if [ "${DISPLAY_QUIRK_DPMS_SUSPEND}" == "true" ]; then
-		vbe dpms suspend
-	fi
-}
-
-
-case "$1" in
-	suspend)
-		suspend_video
-		;;
-	hibernate)
-		if [ "x$HIBERNATE_RESUME_POST_VIDEO" == "xyes" ]; then
-			suspend_video
-		fi
-		;;
-esac
-
-exit $?
Index: 99video
===================================================================
RCS file: /cvs/pm-utils/pm-utils/pm/hooks/99video,v
retrieving revision 1.3
diff -u -p -r1.3 99video
--- 99video	6 Mar 2007 19:55:31 -0000	1.3
+++ 99video	13 Mar 2007 18:24:40 -0000
@@ -27,6 +27,35 @@ radeon() {
 	$radeontool "$@"
 }
 
+suspend_video()
+{
+	# 0=nothing, 1=s3_bios, 2=s3_mode, 3=both
+	if [ "${DISPLAY_QUIRK_S3_BIOS}" == "true" -a \
+			"${DISPLAY_QUIRK_S3_MODE}" == "true" ]; then
+		sysctl -w kernel.acpi_video_flags=3
+	elif [ "${DISPLAY_QUIRK_S3_BIOS}" == "true" ]; then
+		sysctl -w kernel.acpi_video_flags=1
+	elif [ "${DISPLAY_QUIRK_S3_MODE}" == "true" ]; then
+		sysctl -w kernel.acpi_video_flags=2
+	else
+		sysctl -w kernel.acpi_video_flags=0
+	fi
+
+	# We might need to do one or many of these quirks
+	if [ "${DISPLAY_QUIRK_VBESTATE_RESTORE}" == "true" ]; then
+		vbe vbestate save > /var/run/vbestate
+	fi
+	if [ "${DISPLAY_QUIRK_VBEMODE_RESTORE}" == "true" ]; then
+		vbe vbemode get > /var/run/vbemode
+	fi
+	if [ "${DISPLAY_QUIRK_VGA_MODE_3}" == "true" ]; then
+		vbe vbemode set 3
+	fi
+	if [ "${DISPLAY_QUIRK_DPMS_SUSPEND}" == "true" ]; then
+		vbe dpms suspend
+	fi
+}
+
 resume_video()
 {
 	if [ "${DISPLAY_QUIRK_RADEON_OFF}" == "true" ]; then
@@ -51,6 +80,14 @@ resume_video()
 
 
 case "$1" in
+	suspend)
+		suspend_video
+		;;
+	hibernate)
+		if [ "x$HIBERNATE_RESUME_POST_VIDEO" == "xyes" ]; then
+			suspend_video
+		fi
+		;;
 	resume)
 		resume_video
 		;;
-- 
Stefan Seyfried

"Any ideas, John?"
"Well, surrounding them's out." 


More information about the Pm-utils mailing list