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 -p -u -p -r1.7 hal-system-lcd-get-brightness --- tools/hal-system-lcd-get-brightness 18 Feb 2006 23:11:23 -0000 1.7 +++ tools/hal-system-lcd-get-brightness 24 Apr 2006 20:00:27 -0000 @@ -25,9 +25,18 @@ fi # Check for file existance and that it's readable if [ ! -r $HAL_PROP_LINUX_ACPI_PATH ]; then - echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2 - echo "$1 not readable!" >&2 - exit 1 + if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "sony" ] && [ -x /usr/sbin/spicctrl ]; then + # spicctrl -B + # 70 + # 0..255, but HAL expects 0..7 + value="`/usr/sbin/spicctrl -B`" + let "value = ( ${value} + 1 ) / 32" + exit ${value} + else + echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2 + echo "$1 not readable!" >&2 + exit 1 + fi fi if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "toshiba" ]; then Index: tools/hal-system-lcd-set-brightness =================================================================== RCS file: /cvs/hal/hal/tools/hal-system-lcd-set-brightness,v retrieving revision 1.8 diff -u -p -u -p -r1.8 hal-system-lcd-set-brightness --- tools/hal-system-lcd-set-brightness 10 Mar 2006 19:45:27 -0000 1.8 +++ tools/hal-system-lcd-set-brightness 24 Apr 2006 20:00:27 -0000 @@ -27,20 +27,30 @@ if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METH exit 0 fi -# Check for file existance and that it's writable -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 +if [ ${value} -lt 0 ] || [ ${value} -ge $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 +# Check for file existance and that it's writable +if [ ! -w $HAL_PROP_LINUX_ACPI_PATH ]; then + if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "sony" ] && [ -x /usr/sbin/spicctrl ]; then + # spicctrl -b "{0..255}" + case "$value" in + 0) /usr/sbin/spicctrl -b 0 ;; + *) let "value = ( ( ${value} + 1 ) * 32 ) - 1"; + /usr/sbin/spicctrl -b ${value};; + esac + exit $? + else + echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2 + echo "$1 not writable!" >&2 + exit 1 + fi +fi + 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