On Wed, 2007-02-07 at 11:55 -0500, Peter Jones wrote:
> Already applied this upstream.
Here's my patch... again :-)
Richard.
Index: pm/hooks/20video
===================================================================
RCS file: /cvs/pm-utils/pm-utils/pm/hooks/20video,v
retrieving revision 1.7
diff -u -r1.7 20video
--- pm/hooks/20video 27 Apr 2006 08:05:43 -0000 1.7
+++ pm/hooks/20video 7 Feb 2007 17:10:25 -0000
@@ -1,27 +1,84 @@
#!/bin/bash
+#
+# Copyright (C) 2006 Richard Hughes <[EMAIL PROTECTED]>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
. /etc/pm/functions
+checkproperty() {
+ property=$1
+ hal-get-property --udi /org/freedesktop/Hal/devices/computer --key $property &> /dev/null
+ echo $?
+}
+
+checkvbetool() {
+ if ! [ -x "/usr/sbin/vbetool" ]; then
+ echo "vbetool not found" >&2
+ exit 1
+ fi
+}
+
+s3_bios=`checkproperty "power_management.quirk.s3_bios"`
+s3_mode=`checkproperty "power_management.quirk.s3_mode"`
+dpms_suspend=`checkproperty "power_management.quirk.dpms_suspend"`
+dpms_on=`checkproperty "power_management.quirk.dpms_on"`
+vbestate_restore=`checkproperty "power_management.quirk.vbestate_restore"`
+vbemode_restore=`checkproperty "power_management.quirk.vbemode_restore"`
+vga_mode_3=`checkproperty "power_management.quirk.vga_mode_3"`
+vbe_post=`checkproperty "power_management.quirk.vbe_post"`
+
suspend_video()
{
- # Suspend all video devices using the HAL dbus methods
- devices=`hal-find-by-capability --capability video_adapter_pm`
- for device in $devices
- do
- dbus-send --system --print-reply --dest=org.freedesktop.Hal \
- $device org.freedesktop.Hal.Device.VideoAdapterPM.SuspendVideo
- done
+ # 1=s3_bios, 2=s3_mode, 3=both
+ if [ ${s3_bios} -eq 0 ] && [ ${s3_mode} -eq 0 ]; then
+ echo -n 3 > /proc/sys/kernel/acpi_video_flags
+ elif [ ${s3_bios} -eq 0 ]; then
+ echo -n 1 > /proc/sys/kernel/acpi_video_flags
+ elif [ ${s3_mode} -eq 0 ]; then
+ echo -n 2 > /proc/sys/kernel/acpi_video_flags
+ fi
+
+ # We might need to do one or many of these quirks
+ #if [ ${vga_mode_3} -eq 0 ]; then
+ # # TODO: we need to set mode3
+ #fi
+ if [ ${dpms_suspend} -eq 0 ]; then
+ checkvbetool
+ /usr/sbin/vbetool dpms suspend
+ fi
+ if [ ${vbestate_restore} -eq 0 ]; then
+ checkvbetool
+ /usr/sbin/vbetool vbestate save > /var/run/vbestate
+ fi
+ if [ ${vbemode_restore} -eq 0 ]; then
+ checkvbetool
+ /usr/sbin/vbetool vbemode get > /var/run/vbemode
+ fi
}
resume_video()
{
- # Resume all video devices using the HAL dbus methods
- devices=`hal-find-by-capability --capability video_adapter_pm`
- for device in $devices
- do
- dbus-send --system --print-reply --dest=org.freedesktop.Hal \
- $device org.freedesktop.Hal.Device.VideoAdapterPM.ResumeVideo
- done
+ # We might need to do one or many of these quirks
+ if [ ${vbe_post} -eq 0 ]; then
+ checkvbetool
+ /usr/sbin/vbetool post
+ fi
+ if [ ${vbestate_restore} -eq 0 ]; then
+ checkvbetool
+ /usr/sbin/vbetool vbestate restore < /var/run/vbestate
+ fi
+ if [ ${vbemode_restore} -eq 0 ]; then
+ checkvbetool
+ /usr/sbin/vbetool vbemode set `cat /var/run/vbemode`
+ fi
+ if [ ${dpms_on} -eq 0 ]; then
+ checkvbetool
+ /usr/sbin/vbetool dpms on > /dev/null 2>&1
+ fi
}
case "$1" in
_______________________________________________
Pm-utils mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pm-utils