hal/tools/linux hal-system-video-resume-linux, 1.1, 1.2 hal-system-video-suspend-linux, 1.1, 1.2

Danny Kukawka dkukawka at kemper.freedesktop.org
Tue Jul 11 01:27:14 PDT 2006


Update of /cvs/hal/hal/tools/linux
In directory kemper:/tmp/cvs-serv3981/tools/linux

Modified Files:
	hal-system-video-resume-linux hal-system-video-suspend-linux 
Log Message:
2006-07-11  Danny Kukawka  <danny.kukawka at web.de>

        Added checks if vbetool is available and executable in /usr/sbin/,
        added check if /var/run/{vbemode,vbestate} is available, if needed.

        * tools/linux/hal-system-video-resume-linux:
        * tools/linux/hal-system-video-suspend-linux:



Index: hal-system-video-resume-linux
===================================================================
RCS file: /cvs/hal/hal/tools/linux/hal-system-video-resume-linux,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- hal-system-video-resume-linux	9 Jun 2006 10:10:05 -0000	1.1
+++ hal-system-video-resume-linux	11 Jul 2006 08:27:12 -0000	1.2
@@ -14,17 +14,41 @@
     exit 1
 fi
 
+checkvbetool() {
+    if ! [ -x "/usr/sbin/vbetool" ]; then
+        echo org.freedesktop.Hal.Device.Video.NotSupported >&2
+        echo vbetool not found or not executable >&2
+        exit 1
+    fi
+}
+
 # We might need to do one or many of these quirks
 if [ "$HAL_PROP_VIDEO_ADAPTER_PM_VBE_POST" == "true" ]; then
+	checkvbetool
 	/usr/sbin/vbetool post
 fi
 if [ "$HAL_PROP_VIDEO_ADAPTER_PM_VBESTATE_RESTORE" == "true" ]; then
-	/usr/sbin/vbetool vbestate restore < /var/run/vbestate
+	checkvbetool
+	if [ -f /var/run/vbestate ]; then
+		/usr/sbin/vbetool vbestate restore < /var/run/vbestate
+	else
+		echo org.freedesktop.Hal.Device.Video.UnableToRetore>&2
+	        echo /var/run/vbestate is missing, can not restore >&2
+        	exit 1
+	fi
 fi
 if [ "$HAL_PROP_VIDEO_ADAPTER_PM_VBEMODE_RESTORE" == "true" ]; then
-	/usr/sbin/vbetool vbemode set `cat /var/run/vbemode`
+	checkvbetool
+	if [ -f /var/run/vbemode ]; then
+		/usr/sbin/vbetool vbemode set `cat /var/run/vbemode`
+	else
+		echo org.freedesktop.Hal.Device.Video.UnableToRetore>&2
+	        echo /var/run/vbemode is missing, can not restore >&2
+        	exit 1
+	fi
 fi
 if [ "$HAL_PROP_VIDEO_ADAPTER_PM_DPMS_ON" == "true" ]; then
+	checkvbetool
 	/usr/sbin/vbetool dpms on > /dev/null 2>&1
 fi
 

Index: hal-system-video-suspend-linux
===================================================================
RCS file: /cvs/hal/hal/tools/linux/hal-system-video-suspend-linux,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- hal-system-video-suspend-linux	9 Jun 2006 10:10:05 -0000	1.1
+++ hal-system-video-suspend-linux	11 Jul 2006 08:27:12 -0000	1.2
@@ -14,6 +14,15 @@
     exit 1
 fi
 
+checkvbetool() {
+    if ! [ -x "/usr/sbin/vbetool" ]; then
+        echo org.freedesktop.Hal.Device.Video.NotSupported >&2
+        echo vbetool not found or not executable >&2
+        exit 1
+    fi
+}
+
+
 # 1=s3_bios, 2=s3_mode, 3=both
 if [ "$HAL_PROP_VIDEO_ADAPTER_PM_S3_BIOS" == "true" ] && [ "$HAL_PROP_VIDEO_ADAPTER_PM_S3_MODE" == "true" ]; then
 	echo -n 3 > /proc/sys/kernel/acpi_video_flags
@@ -28,12 +37,15 @@
 #	# TODO: we need to set mode3
 #fi
 if [ "$HAL_PROP_VIDEO_ADAPTER_PM_DPMS_SUSPEND" == "true" ]; then
+	checkvbetool
 	/usr/sbin/vbetool dpms suspend
 fi
 if [ "$HAL_PROP_VIDEO_ADAPTER_PM_VBESTATE_RESTORE" == "true" ]; then
+	checkvbetool
 	/usr/sbin/vbetool vbestate save > /var/run/vbestate
 fi
 if [ "$HAL_PROP_VIDEO_ADAPTER_PM_VBEMODE_RESTORE" == "true" ]; then
+	checkvbetool
 	/usr/sbin/vbetool vbemode get > /var/run/vbemode
 fi
 




More information about the hal-commit mailing list