Index: tools/hal-system-lcd-get-brightness =================================================================== RCS file: /cvs/hal/hal/tools/hal-system-lcd-get-brightness,v retrieving revision 1.7 diff -u -r1.7 hal-system-lcd-get-brightness --- hal-0.5.7/tools/hal-system-lcd-get-brightness 18 Feb 2006 23:11:23 -0000 1.7 +++ hal-0.5.7/tools/hal-system-lcd-get-brightness 19 Feb 2006 22:44:22 -0000 @@ -8,13 +8,13 @@ # (at your option) any later version. # Check for environment variables -if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "" ]; then +if [ -z "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" ]; then echo "Missing or empty environment variable(s)." >&2 echo "This script should be started by hald." >&2 exit 1 fi -if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "pmu" ]; then +if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "pmu" ]; then value="`hal-system-power-pmu getlcd`" if [ $? -ne 0 ]; then echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2 @@ -24,37 +24,37 @@ fi # Check for file existance and that it's readable -if [ ! -r $HAL_PROP_LINUX_ACPI_PATH ]; then +if [ ! -r "$HAL_PROP_LINUX_ACPI_PATH" ]; then echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2 echo "$1 not readable!" >&2 exit 1 fi -if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "toshiba" ]; then +if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "toshiba" ]; then # cat /proc/acpi/toshiba/lcd # brightness: 5 # brightness_levels: 8 value="`cat $HAL_PROP_LINUX_ACPI_PATH | grep brightness: | awk '{print $2;}'`" -elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "asus" ]; then +elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "asus" ]; then # cat /proc/acpi/asus/brn # 5 value="`cat $HAL_PROP_LINUX_ACPI_PATH`" -elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "panasonic" ]; then +elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "panasonic" ]; then # cat /proc/acpi/pcc/brightness # 5 value="`cat $HAL_PROP_LINUX_ACPI_PATH`" -elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "ibm" ]; then +elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "ibm" ]; then # cat /proc/acpi/ibm/brightness # level: 5 # commands: up, down # commands: level ( is 0-7) value="`cat $HAL_PROP_LINUX_ACPI_PATH | grep level: | awk '{print $2;}'`" -elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "sony" ]; then +elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "sony" ]; then # cat /proc/acpi/sony/brightness # 5 value="`cat $HAL_PROP_LINUX_ACPI_PATH`" let "value = ${value} - 1" -elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "omnibook" ]; then +elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "omnibook" ]; then # cat /proc/omnibook/lcd # LCD brightness: 7 value="`cat $HAL_PROP_LINUX_ACPI_PATH | awk '{print $3;}'`" Index: tools/hal-system-lcd-set-brightness =================================================================== RCS file: /cvs/hal/hal/tools/hal-system-lcd-set-brightness,v retrieving revision 1.7 diff -u -r1.7 hal-system-lcd-set-brightness --- hal-0.5.7/tools/hal-system-lcd-set-brightness 18 Feb 2006 23:11:23 -0000 1.7 +++ hal-0.5.7/tools/hal-system-lcd-set-brightness 19 Feb 2006 22:44:23 -0000 @@ -8,8 +8,8 @@ # (at your option) any later version. # Check for environment variables -if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "" ] || - [ "$HAL_PROP_LAPTOP_PANEL_NUM_LEVELS" == "" ] ; then +if [ -z "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" ] || + [ -z "$HAL_PROP_LAPTOP_PANEL_NUM_LEVELS" ] ; then echo "Missing or empty environment variable(s)." >&2 echo "This script should be started by hald." >&2 exit 1 @@ -18,7 +18,14 @@ # read value for set brightness read value -if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "pmu" ]; then +# Check for values outside range +if [ ${value} -lt 0 ] || [ ${value} -gt $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS ]; then + echo "org.freedesktop.Hal.Device.LaptopPanel.Invalid" >&2 + echo "Brightness has to be between 0 and $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS!" >&2 + exit 1 +fi + +if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "pmu" ]; then hal-system-power-pmu setlcd $value if [ $? -ne 0 ]; then echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2 @@ -28,39 +35,33 @@ fi # Check for file existance and that it's writable -if [ ! -w $HAL_PROP_LINUX_ACPI_PATH ]; then +if [ ! -w "$HAL_PROP_LINUX_ACPI_PATH" ]; then echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2 echo "$1 not writable!" >&2 exit 1 fi -# Check for values outside range -if [ ${value} -lt 0 ] || [ ${value} -gt $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS ]; then - echo "org.freedesktop.Hal.Device.LaptopPanel.Invalid" >&2 - echo "Brightness has to be between 0 and $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS!" >&2 - exit 1 -fi -if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "toshiba" ]; then +if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "toshiba" ]; then # echo "brightness: {0..x}" >/proc/acpi/toshiba/lcd echo "brightness: $value" > $HAL_PROP_LINUX_ACPI_PATH -elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "asus" ]; then +elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "asus" ]; then # echo {0..15} > /proc/acpi/asus/brn # http://www.taupro.com/wiki/ChemBook/LCDdisplayPowerConfiguration echo "$value" > $HAL_PROP_LINUX_ACPI_PATH -elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "panasonic" ]; then +elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "panasonic" ]; then # echo {0..15} > /proc/acpi/pcc/brightness # http://readlist.com/lists/vger.kernel.org/linux-kernel/7/36405.html echo "$value" > $HAL_PROP_LINUX_ACPI_PATH -elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "ibm" ]; then +elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "ibm" ]; then # echo "level {0..7}" > /proc/acpi/ibm/brightness # http://ibm-acpi.sourceforge.net/README echo "level $value" > $HAL_PROP_LINUX_ACPI_PATH -elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "sony" ]; then +elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "sony" ]; then # echo "{1..8}" > /proc/acpi/sony/brightness # http://popies.net/sonypi/2.6-sony_acpi4.patch echo "$value" > $HAL_PROP_LINUX_ACPI_PATH -elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "omnibook" ]; then +elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "omnibook" ]; then # echo "{0..7}" > /proc/omnibook/lcd # http://bugzilla.gnome.org/show_bug.cgi?id=331458 echo "$value" > $HAL_PROP_LINUX_ACPI_PATH Index: tools/hal-system-power-hibernate =================================================================== RCS file: /cvs/hal/hal/tools/hal-system-power-hibernate,v retrieving revision 1.6 diff -u -r1.6 hal-system-power-hibernate --- hal-0.5.7/tools/hal-system-power-hibernate 16 Jan 2006 12:47:40 -0000 1.6 +++ hal-0.5.7/tools/hal-system-power-hibernate 19 Feb 2006 22:44:23 -0000 @@ -43,8 +43,9 @@ # Suspend2 tools installed /usr/sbin/hibernate --force RET=$? - elif [ -w "/sys/power/state" ] ; then - # Use the raw kernel sysfs interface + elif [ -w "/sys/power/state" ] && + [ "$HAL_PROP_POWER_MANAGEMENT_TYPE" != pmu ] ; then + # Use the raw kernel sysfs interface if possible (not on pmu yet) echo "disk" > /sys/power/state RET=$? else Index: tools/hal-system-power-suspend =================================================================== RCS file: /cvs/hal/hal/tools/hal-system-power-suspend,v retrieving revision 1.6 diff -u -r1.6 hal-system-power-suspend --- hal-0.5.7/tools/hal-system-power-suspend 18 Feb 2006 23:00:55 -0000 1.6 +++ hal-0.5.7/tools/hal-system-power-suspend 19 Feb 2006 22:44:23 -0000 @@ -18,15 +18,6 @@ read seconds_to_sleep -#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 - if [ $? -ne 0 ]; then - echo "org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported" >&2 - exit 1 - fi - exit 0 -fi #SuSE and ALTLinux only support powersave if [ -f "/etc/altlinux-release" ] || [ -f "/etc/SuSE-release" ] ; then @@ -62,6 +53,10 @@ elif [ -x "/usr/sbin/pmi" ] ; then /usr/sbin/pmi action suspend force RET=$? + elif [ "$HAL_PROP_POWER_MANAGEMENT_TYPE" = "pmu" ]; then + #PMU systems cannot use /sys/power/state yet, so use a helper to issue an ioctl + hal-system-power-pmu sleep + RET=$? elif [ -w "/sys/power/state" ] ; then # Use the raw kernel sysfs interface echo "mem" > /sys/power/state @@ -72,4 +67,8 @@ fi fi +if [ $RET -ne 0 ]; then + echo "org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported" >&2 + exit 1 +fi exit $RET