On Wed, 2007-02-07 at 15:18 -0500, David Zeuthen wrote:
> I think that was the plan. I don't feel good about making pm-utils
> depend hal; we really need hal to pass the options down e.g.
>
> pm-suspend --quirk-foo --quirk-bar
>
> That's just a lot cleaner.
What about something like the attached?
Richard
diff --git a/tools/linux/hal-system-power-hibernate-linux b/tools/linux/hal-system-power-hibernate-linux
index 632acb6..3e462e6 100755
--- a/tools/linux/hal-system-power-hibernate-linux
+++ b/tools/linux/hal-system-power-hibernate-linux
@@ -10,6 +10,19 @@ unsupported() {
exit 1
}
+# Make a suitable command line argument so that the tools can do the correct
+# quirks for video resume.
+# Passing the quirks to the tool allows the tool to not depend on HAL for data.
+QUIRKS=""
+[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_S3_BIOS" == "true" ] && QUIRKS="$QUIRKS --quirk-s3-bios"
+[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_S3_MODE" == "true" ] && QUIRKS="$QUIRKS --quirk-s3-mode"
+[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_DPMS_SUSPEND" == "true" ] && QUIRKS="$QUIRKS --quirk-dpms-suspend"
+[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_DPMS_ON" == "true" ] && QUIRKS="$QUIRKS --quirk-dpms-on"
+[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_VBESTATE_RESTORE" == "true" ] && QUIRKS="$QUIRKS --quirk-vbestate"
+[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_VBEMODE_RESTORE" == "true" ] && QUIRKS="$QUIRKS --quirk-vbemode"
+[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_VGA_MODE_3" == "true" ] && QUIRKS="$QUIRKS --quirk-vga-mode3"
+[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_VBE_POST" == "true" ] && QUIRKS="$QUIRKS --quirk-vbepost"
+
#ALTLinux only supports powersave
if [ -f /etc/altlinux-release ] ; then
if [ -x /usr/bin/powersave ] ; then
@@ -32,7 +45,7 @@ elif [ -f /etc/mandriva-release ] ; then
elif [ -f /etc/redhat-release ] || [ -f /etc/fedora-release ] \
|| [ -f "/etc/SuSE-release" ] ; then
if [ -x /usr/sbin/pm-hibernate ] ; then
- /usr/sbin/pm-hibernate
+ /usr/sbin/pm-hibernate $QUIRKS
RET=$?
else
unsupported
@@ -47,7 +60,7 @@ else
/usr/sbin/pmi action hibernate force
RET=$?
elif [ -x "/usr/sbin/pm-hibernate" ] ; then
- /usr/sbin/pm-hibernate
+ /usr/sbin/pm-hibernate $QUIRKS
RET=$?
elif [ -x "/usr/sbin/hibernate" ] ; then
# Suspend2 tools installed
diff --git a/tools/linux/hal-system-power-suspend-linux b/tools/linux/hal-system-power-suspend-linux
index 180d4a1..d16ea7d 100755
--- a/tools/linux/hal-system-power-suspend-linux
+++ b/tools/linux/hal-system-power-suspend-linux
@@ -18,6 +18,19 @@ unsupported() {
read seconds_to_sleep
+# Make a suitable command line argument so that the tools can do the correct
+# quirks for video resume.
+# Passing the quirks to the tool allows the tool to not depend on HAL for data.
+QUIRKS=""
+[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_S3_BIOS" == "true" ] && QUIRKS="$QUIRKS --quirk-s3-bios"
+[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_S3_MODE" == "true" ] && QUIRKS="$QUIRKS --quirk-s3-mode"
+[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_DPMS_SUSPEND" == "true" ] && QUIRKS="$QUIRKS --quirk-dpms-suspend"
+[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_DPMS_ON" == "true" ] && QUIRKS="$QUIRKS --quirk-dpms-on"
+[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_VBESTATE_RESTORE" == "true" ] && QUIRKS="$QUIRKS --quirk-vbestate"
+[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_VBEMODE_RESTORE" == "true" ] && QUIRKS="$QUIRKS --quirk-vbemode"
+[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_VGA_MODE_3" == "true" ] && QUIRKS="$QUIRKS --quirk-vga-mode3"
+[ "$HAL_PROP_POWER_MANAGEMENT_QUIRK_VBE_POST" == "true" ] && QUIRKS="$QUIRKS --quirk-vbepost"
+
#PMU systems cannot use /sys/power/state yet, so use a helper to issue an ioctl
if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "pmu" ]; then
hal-system-power-pmu sleep
@@ -63,7 +76,7 @@ elif [ -f "/etc/redhat-release" ] || [ -f "/etc/fedora-release" ] \
# TODO: fixup pm-suspend to define erroc code (see alarm above) and throw
# the appropriate exception
if [ -x "/usr/sbin/pm-suspend" ] ; then
- /usr/sbin/pm-suspend
+ /usr/sbin/pm-suspend $QUIRKS
RET=$?
else
# TODO: add support
@@ -88,7 +101,7 @@ else
/usr/sbin/pmi action suspend force
RET=$?
elif [ -x "/usr/sbin/pm-suspend" ] ; then
- /usr/sbin/pm-suspend
+ /usr/sbin/pm-suspend $QUIRKS
RET=$?
elif [ -w "/sys/power/state" ] ; then
# Use the raw kernel sysfs interface
_______________________________________________
Pm-utils mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pm-utils