hal: Branch 'master'

Danny Kukawka dkukawka at kemper.freedesktop.org
Wed Feb 7 11:54:46 PST 2007


 tools/linux/hal-system-lcd-get-brightness-linux |   12 +++++++++++-
 tools/linux/hal-system-lcd-set-brightness-linux |   13 +++++++++++--
 2 files changed, 22 insertions(+), 3 deletions(-)

New commits:
diff-tree 7186ceb6b2f2cd509c156a045a05c86e7418f135 (from f92db4967e050bbecd5775802fb6ffb7c963958b)
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Wed Feb 7 20:51:28 2007 +0100

    fix get/set brightness for sonypi/spiccrtl
    
    This patch fixes the get/set LCD brightness code for machines which supported
    by the sonypi kernel module and set/get py spicctrl. Added also some checks
    and a new error message if spicctrl is not available/executable and allow
    also spiccrtl in /usr/bin.

diff --git a/tools/linux/hal-system-lcd-get-brightness-linux b/tools/linux/hal-system-lcd-get-brightness-linux
index 673a41e..c5d5615 100755
--- a/tools/linux/hal-system-lcd-get-brightness-linux
+++ b/tools/linux/hal-system-lcd-get-brightness-linux
@@ -61,7 +61,17 @@ elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_ME
 	# spicctrl -B
 	# 70
 	# 0..255
-	value="`/usr/sbin/spicctrl -B`"
+	if [ -x /usr/sbin/spicctrl ]; then
+		SPICCRTL="/usr/sbin/spicctrl"
+        elif [ -x /usr/bin/spicctrl ]; then
+		SPICCRTL="/usr/bin/spicctrl"
+	else
+                echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
+                echo "spicctrl not found or not executable" >&2
+                exit 1;
+        fi
+
+	value="`$SPICCRTL -B`"
 	RETVAL=$?
 	if [ $RETVAL != 0 ]; then
 		echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
diff --git a/tools/linux/hal-system-lcd-set-brightness-linux b/tools/linux/hal-system-lcd-set-brightness-linux
index 0354fde..2eadcc5 100755
--- a/tools/linux/hal-system-lcd-set-brightness-linux
+++ b/tools/linux/hal-system-lcd-set-brightness-linux
@@ -56,13 +56,22 @@ elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_ME
 	# spicctrl -B
 	# 70
 	# 0..255
-	value="`/usr/sbin/spicctrl -B`"
+        if [ -x /usr/sbin/spicctrl ]; then
+                SPICCRTL="/usr/sbin/spicctrl"
+        elif [ -x /usr/bin/spicctrl ]; then
+                SPICCRTL="/usr/bin/spicctrl"
+	else 
+		echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
+		echo "spicctrl not found or not executable" >&2
+		exit 1;
+	fi
+
+	$SPICCRTL -b "$value"
 	RETVAL=$?
 	if [ $RETVAL != 0 ]; then
 		echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
 		exit 1;
 	fi
-	exit ${value}
 else
 	echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
 	echo "No ACPI method found" >&2


More information about the hal-commit mailing list