Hi,

attached is the patch, which parses the video quirks in the uswsusp
sleep module and passes this options to s2ram/s2both.

The only open question is, if quirk-dpms*, quirk-reset-brightness and
quirk-vga-mode3 should be shown in sleep_method_help or removed from
get_quirks/sleep_method_help.

s2ram has no command line parameters for those options.

What do you think: Drop those parameters or leave them as is, as no-ops?

I also added the --quirk-save-pci option, even if that is not provided
by hal yet.



I was also wondering, why reset_brighness in 99video isn't using
vbetool's (get,set)brightness method.

Cheers,
Michael

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
From 57a0ae1256d6790f8a73607aad41692aa8d59341 Mon Sep 17 00:00:00 2001
From: Michael Biebl <[EMAIL PROTECTED]>
Date: Sun, 16 Mar 2008 18:33:21 +0100
Subject: [PATCH] Parse the quirks in the uswsusp module and pass it to s2ram (s2both).

---
 pm/module.d/uswsusp |   52 +++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/pm/module.d/uswsusp b/pm/module.d/uswsusp
index c7f8e70..8cfff66 100644
--- a/pm/module.d/uswsusp
+++ b/pm/module.d/uswsusp
@@ -4,6 +4,31 @@ before_hooks()
 	disablehook 99video "disabled by uswsusp"
 }
 
+get_quirks()
+{
+	OPTS=""
+	ACPI_SLEEP=""
+	for opt in $PM_CMDLINE; do
+		case "${opt##--quirk-}" in # just quirks, please
+			dpms-on) 	   # no-op ;;
+			dpms-suspend) 	   # no-op ;;
+			radeon-off) 	   OPTS="$OPTS --radeontool" ;;
+			reset-brightness)  # no-op ;;
+			s3-bios) 	   ACPI_SLEEP=$((ACPI_SLEEP+1)) ;;
+			s3-mode) 	   ACPI_SLEEP=$((ACPI_SLEEP+2)) ;;
+			vbe-post) 	   OPTS="$OPTS --vbe_post" ;;
+			vbemode-restore)   OPTS="$OPTS --vbe_mode" ;;
+			vbestate-restore)  OPTS="$OPTS --vbe_save" ;;
+			vga-mode3) 	   # no-op ;;
+			save-pci)          OPTS="$OPTS --pci_save" ;;
+			none) 		   QUIRK_NONE="true" ;;
+			*) continue ;;
+		esac
+	done
+
+	[ -n "$ACPI_SLEEP" ] && OPTS="$OPTS --acpi_sleep $ACPI_SLEEP"
+}
+
 check_suspend()
 {
 	grep -q mem /sys/power/state
@@ -11,7 +36,8 @@ check_suspend()
 
 do_suspend()
 {
-	echo "mem" >/sys/power/state
+	get_quirks
+	s2ram --force $OPTS
 }
 
 check_hibernate()
@@ -36,7 +62,25 @@ check_suspend_hybrid()
 
 do_suspend_hybrid()
 {
-	# a brief perusal of the source indicates that -f bypasses
-	# quirks application and the whitelist.
-	s2both -f
+	get_quirks
+	s2both --force $OPTS 
+}
+
+sleep_method_help()
+{
+	echo  # first echo makes it look nicer.
+	echo "Video quirk handler options:"
+	echo
+	echo "  --quirk-dpms-on"
+	echo "  --quirk-dpms-suspend"
+	echo "  --quirk-radeon-off"
+	echo "  --quirk-reset-brightness"
+	echo "  --quirk-s3-bios"
+	echo "  --quirk-s3-mode"
+	echo "  --quirk-vbe-post"
+	echo "  --quirk-vbemode-restore"
+	echo "  --quirk-vbestate-restore"
+	echo "  --quirk-vga-mode3"
+	echo "  --quirk-save-pci"
+	echo "  --quirk-none"
 }
-- 
1.5.4.4

_______________________________________________
Pm-utils mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pm-utils

Reply via email to