hal/tools hal-system-lcd-get-brightness, 1.1, 1.2 hal-system-lcd-set-brightness, 1.1, 1.2

Richard Hughes hughsient at freedesktop.org
Mon Sep 26 10:11:12 PDT 2005


Update of /cvs/hal/hal/tools
In directory gabe:/tmp/cvs-serv18278

Modified Files:
	hal-system-lcd-get-brightness hal-system-lcd-set-brightness 
Log Message:
Make GetBrightness and SetBrightness take raw, not percentage, values.

Index: hal-system-lcd-get-brightness
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-lcd-get-brightness,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- hal-system-lcd-get-brightness	3 Sep 2005 15:54:17 -0000	1.1
+++ hal-system-lcd-get-brightness	26 Sep 2005 17:11:10 -0000	1.2
@@ -44,7 +44,4 @@
 	exit 1
 	fi
 
-# Work out the percentage to return
-let "percentage =  ( ( $value + 1 ) *  100 ) / $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS"
-
-exit ${percentage}
+exit ${value}

Index: hal-system-lcd-set-brightness
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-lcd-set-brightness,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- hal-system-lcd-set-brightness	3 Sep 2005 15:54:17 -0000	1.1
+++ hal-system-lcd-set-brightness	26 Sep 2005 17:11:10 -0000	1.2
@@ -7,7 +7,7 @@
 # the Free Software Foundation; either version 2 of the License, or
 # (at your option) any later version.
 
-read percentage
+read value
 
 # Check for file existance and that it's writable
 if [ ! -w $HAL_PROP_LINUX_ACPI_PATH ]; then
@@ -16,8 +16,12 @@
 	exit 1
 fi
 
-# Work out the abs value
-let "value = ( $percentage * $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS ) / 100"
+# 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_ACPI_METHOD" == "toshiba" ]; then
 	# echo "brightness: {0..x}" >/proc/acpi/toshiba/lcd




More information about the hal-commit mailing list