# Description: Apply a few suspend quirks by default which are # generally necessary on older hardware, but only if we do not have # any quirks definition all in hal-info's FDIs. Disable video quirks # when running a known-good video driver which does not need quirks # and breaks with them. # Ubuntu: https://launchpad.net/bugs/198808 # Upstream: http://lists.freedesktop.org/archives/hal/2008-March/011223.html diff -Nur -x '*.orig' -x '*~' ubuntu/tools/linux/hal-system-power-hibernate-linux ubuntu.new/tools/linux/hal-system-power-hibernate-linux --- ubuntu/tools/linux/hal-system-power-hibernate-linux 2008-03-27 17:34:15.000000000 +0100 +++ ubuntu.new/tools/linux/hal-system-power-hibernate-linux 2008-03-27 17:37:04.000000000 +0100 @@ -6,6 +6,40 @@ exit 1 } +# on some video drivers we must ignore video quirks, since they break +# on them; this particularly affects Intel >= 915G and the proprietary +# nvidia and fglrx drivers. +if [ -d /sys/module/i915 ]; then + # the i915 kmod also drives the i830/i845/i855/i865 chips nowadays, but + # they still need quirks on at least Linux 2.6.24. + PRODID=`hal-get-property --udi $HAL_PROP_INFO_UDI --key system.hardware.primary_video.product` + if [ "$PRODID" != 13696 ] && [ "$PRODID" != 13698 ] && \ + [ "$PRODID" != 13687 ] && [ "$PRODID" != 9570 ] && \ + [ "$PRODID" != 9586 ]; then + NEW_INTEL=1 + fi +fi + +if [ "$NEW_INTEL" ] || [ -d /sys/module/nvidia ] || [ -d /sys/module/fglrx ]; +then + HAL_PROP_POWER_MANAGEMENT_QUIRK_DPMS_ON=false + HAL_PROP_POWER_MANAGEMENT_QUIRK_VBESTATE_RESTORE=false + HAL_PROP_POWER_MANAGEMENT_QUIRK_VBEMODE_RESTORE=false + HAL_PROP_POWER_MANAGEMENT_QUIRK_VGA_MODE_3=false + HAL_PROP_POWER_MANAGEMENT_QUIRK_VBE_POST=false + HAL_PROP_POWER_MANAGEMENT_QUIRK_RESET_BRIGHTNESS=false +# if we do not have any explicit quirks in the hal FDIs, enable a few by +# default which work around kernel problems and are necessary with most older +# video drivers +elif ! env | grep -q HAL_PROP_POWER_MANAGEMENT_QUIRK; then + HAL_PROP_POWER_MANAGEMENT_QUIRK_DPMS_ON=true + HAL_PROP_POWER_MANAGEMENT_QUIRK_VBESTATE_RESTORE=true + HAL_PROP_POWER_MANAGEMENT_QUIRK_VBEMODE_RESTORE=true + HAL_PROP_POWER_MANAGEMENT_QUIRK_VGA_MODE_3=true + HAL_PROP_POWER_MANAGEMENT_QUIRK_VBE_POST=true + HAL_PROP_POWER_MANAGEMENT_QUIRK_RESET_BRIGHTNESS=true +fi + # 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. diff -Nur -x '*.orig' -x '*~' ubuntu/tools/linux/hal-system-power-suspend-hybrid-linux ubuntu.new/tools/linux/hal-system-power-suspend-hybrid-linux --- ubuntu/tools/linux/hal-system-power-suspend-hybrid-linux 2008-03-27 17:34:15.000000000 +0100 +++ ubuntu.new/tools/linux/hal-system-power-suspend-hybrid-linux 2008-03-27 17:35:44.000000000 +0100 @@ -14,6 +14,39 @@ read seconds_to_sleep +# on some video drivers we must ignore video quirks, since they break +# on them; this particularly affects Intel >= 915G and the proprietary +# nvidia and fglrx drivers. +if [ -d /sys/module/i915 ]; then + # the i915 kmod also drives the i830 and i855 chips nowadays, but they + # still need quirks on at least Linux 2.6.24. + PRODID=`hal-get-property --udi $HAL_PROP_INFO_UDI --key system.hardware.primary_video.product` + if [ "$PRODID" != 13696 ] && [ "$PRODID" != 13698 ] && \ + [ "$PRODID" != 13687 ]; then + NEW_INTEL=1 + fi +fi + +if [ "$NEW_INTEL" ] || [ -d /sys/module/nvidia ] || [ -d /sys/module/fglrx ]; +then + HAL_PROP_POWER_MANAGEMENT_QUIRK_DPMS_ON=false + HAL_PROP_POWER_MANAGEMENT_QUIRK_VBESTATE_RESTORE=false + HAL_PROP_POWER_MANAGEMENT_QUIRK_VBEMODE_RESTORE=false + HAL_PROP_POWER_MANAGEMENT_QUIRK_VGA_MODE_3=false + HAL_PROP_POWER_MANAGEMENT_QUIRK_VBE_POST=false + HAL_PROP_POWER_MANAGEMENT_QUIRK_RESET_BRIGHTNESS=false +# if we do not have any explicit quirks in the hal FDIs, enable a few by +# default which work around kernel problems and are necessary with most older +# video drivers +elif ! env | grep -q HAL_PROP_POWER_MANAGEMENT_QUIRK; then + HAL_PROP_POWER_MANAGEMENT_QUIRK_DPMS_ON=true + HAL_PROP_POWER_MANAGEMENT_QUIRK_VBESTATE_RESTORE=true + HAL_PROP_POWER_MANAGEMENT_QUIRK_VBEMODE_RESTORE=true + HAL_PROP_POWER_MANAGEMENT_QUIRK_VGA_MODE_3=true + HAL_PROP_POWER_MANAGEMENT_QUIRK_VBE_POST=true + HAL_PROP_POWER_MANAGEMENT_QUIRK_RESET_BRIGHTNESS=true +fi + # 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. diff -Nur -x '*.orig' -x '*~' ubuntu/tools/linux/hal-system-power-suspend-linux ubuntu.new/tools/linux/hal-system-power-suspend-linux --- ubuntu/tools/linux/hal-system-power-suspend-linux 2008-03-27 17:34:15.000000000 +0100 +++ ubuntu.new/tools/linux/hal-system-power-suspend-linux 2008-03-27 17:35:44.000000000 +0100 @@ -14,6 +14,39 @@ read seconds_to_sleep +# on some video drivers we must ignore video quirks, since they break +# on them; this particularly affects Intel >= 915G and the proprietary +# nvidia and fglrx drivers. +if [ -d /sys/module/i915 ]; then + # the i915 kmod also drives the i830 and i855 chips nowadays, but they + # still need quirks on at least Linux 2.6.24. + PRODID=`hal-get-property --udi $HAL_PROP_INFO_UDI --key system.hardware.primary_video.product` + if [ "$PRODID" != 13696 ] && [ "$PRODID" != 13698 ] && \ + [ "$PRODID" != 13687 ]; then + NEW_INTEL=1 + fi +fi + +if [ "$NEW_INTEL" ] || [ -d /sys/module/nvidia ] || [ -d /sys/module/fglrx ]; +then + HAL_PROP_POWER_MANAGEMENT_QUIRK_DPMS_ON=false + HAL_PROP_POWER_MANAGEMENT_QUIRK_VBESTATE_RESTORE=false + HAL_PROP_POWER_MANAGEMENT_QUIRK_VBEMODE_RESTORE=false + HAL_PROP_POWER_MANAGEMENT_QUIRK_VGA_MODE_3=false + HAL_PROP_POWER_MANAGEMENT_QUIRK_VBE_POST=false + HAL_PROP_POWER_MANAGEMENT_QUIRK_RESET_BRIGHTNESS=false +# if we do not have any explicit quirks in the hal FDIs, enable a few by +# default which work around kernel problems and are necessary with most older +# video drivers +elif ! env | grep -q HAL_PROP_POWER_MANAGEMENT_QUIRK; then + HAL_PROP_POWER_MANAGEMENT_QUIRK_DPMS_ON=true + HAL_PROP_POWER_MANAGEMENT_QUIRK_VBESTATE_RESTORE=true + HAL_PROP_POWER_MANAGEMENT_QUIRK_VBEMODE_RESTORE=true + HAL_PROP_POWER_MANAGEMENT_QUIRK_VGA_MODE_3=true + HAL_PROP_POWER_MANAGEMENT_QUIRK_VBE_POST=true + HAL_PROP_POWER_MANAGEMENT_QUIRK_RESET_BRIGHTNESS=true +fi + # 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.