hal/tools hal-system-lcd-get-brightness, 1.7, 1.8 hal-system-lcd-set-brightness, 1.8, 1.9

Richard Hughes hughsient at kemper.freedesktop.org
Wed Apr 26 15:27:45 PDT 2006


Update of /cvs/hal/hal/tools
In directory kemper:/tmp/cvs-serv16903/tools

Modified Files:
	hal-system-lcd-get-brightness hal-system-lcd-set-brightness 
Log Message:
2006-04-26  Richard Hughes  <richard at hughsie.com>

	Patch from Bastien Nocera <hadess at hadess.net>:

	* hald/linux2/acpi.c: (laptop_panel_refresh),
	(acpi_synthesize_sonypi_display), (acpi_synthesize_hotplug_events):
	Create an LCD Panel object of type sonypi, necessary for getting the
	methods supported for panasonic notebooks.
	Fixes https://bugs.freedesktop.org/show_bug.cgi?id=6729

	* tools/hal-system-lcd-get-brightness:
	* tools/hal-system-lcd-set-brightness:
	Support the sonypi brightness type.


Index: hal-system-lcd-get-brightness
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-lcd-get-brightness,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- hal-system-lcd-get-brightness	18 Feb 2006 23:11:23 -0000	1.7
+++ hal-system-lcd-get-brightness	26 Apr 2006 22:27:43 -0000	1.8
@@ -58,6 +58,17 @@
 	# cat /proc/omnibook/lcd
 	#  LCD brightness:  7
 	value="`cat $HAL_PROP_LINUX_ACPI_PATH | awk '{print $3;}'`"
+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "sonypi" ]; then
+		# spicctrl -B
+		# 70
+		# 0..255
+		value="`/usr/sbin/spicctrl -B`"
+		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

Index: hal-system-lcd-set-brightness
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-lcd-set-brightness,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- hal-system-lcd-set-brightness	10 Mar 2006 19:45:27 -0000	1.8
+++ hal-system-lcd-set-brightness	26 Apr 2006 22:27:43 -0000	1.9
@@ -27,15 +27,16 @@
 	exit 0
 fi
 
-# Check for file existance and that it's writable
-if [ ! -w $HAL_PROP_LINUX_ACPI_PATH ]; then
+# Check for file existance and that it's writable and that we don't have a sonypi
+# access method
+if [ ! -w $HAL_PROP_LINUX_ACPI_PATH -a "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" != "sonypi" ]; 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
@@ -64,6 +65,9 @@
 	# echo "{0..7}" > /proc/omnibook/lcd
 	# http://bugzilla.gnome.org/show_bug.cgi?id=331458
 	echo "$value" > $HAL_PROP_LINUX_ACPI_PATH
+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "sonypi" ]; then
+	# spicctrl -b "{0..255}"
+	/usr/sbin/spicctrl -b ${value}
 else
 	echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
 	echo "No ACPI method found" >&2




More information about the hal-commit mailing list