hal: Branch 'hal-0_5_11-branch' - 5 commits

Danny Kukawka dkukawka at kemper.freedesktop.org
Tue Apr 29 09:24:28 PDT 2008


 hald/linux/addons/addon-macbook-backlight.c       |    2 
 policy/Makefile.am                                |   14 ++
 tools/linux/hal-ipw-killswitch-linux.c            |  102 ++++++++++++-------
 tools/linux/hal-luks-remove-linux                 |    9 +
 tools/linux/hal-system-killswitch-get-power-linux |   83 ++++++++++-----
 tools/linux/hal-system-killswitch-set-power-linux |  115 ++++++++++++----------
 tools/linux/hal-system-lcd-get-brightness-linux   |    4 
 tools/linux/hal-system-lcd-set-brightness-linux   |    2 
 8 files changed, 211 insertions(+), 120 deletions(-)

New commits:
commit c909410ce8f9e7ee50702ea91254f8e85e077a6c
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Tue Apr 29 18:03:30 2008 +0200

    fixed make distcheck for validating polkit policy files
    
    Fixed make distcheck for validating polkit policy files.

diff --git a/policy/Makefile.am b/policy/Makefile.am
index 98e447d..28f31d4 100644
--- a/policy/Makefile.am
+++ b/policy/Makefile.am
@@ -15,8 +15,18 @@ dist_polkit_policy_DATA += org.freedesktop.hal.device-access.policy
 endif
 
 check:
-	$(POLKIT_POLICY_FILE_VALIDATE) $(dist_polkit_policy_DATA)
-
+	for f in $(dist_polkit_policy_DATA); do \
+            echo -n "Validate PolicyKit policy in $$f : "; \
+            $(POLKIT_POLICY_FILE_VALIDATE) $(srcdir)/$$f ; \
+	    ret=$$?; \
+            if  [ "$$ret" == "0" ]; \
+	      then \
+                echo ok; \
+            else \
+                echo failed; \ 
+		exit 1; \
+            fi; \
+        done;
 endif
 
 clean-local :
commit a86eac4177479a34c5b186cfbcb92282480167f0
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Fri Apr 25 22:18:24 2008 +0200

    fix macbook-backlight for ix86
    
    Fixed macbook-backlight for ix86 with a patch contributed by user
    'godlygeek' via: https://bugs.launchpad.net/hal/+bug/206921
    
    from comment #27:
    > This patch should fix it. Problem is that we're doing bitwise
    > arithmetic on a signed long that happens to be negative.
    > Wackiness ensues, making the result an invalid offset for mmap().
    > Changing the long to unsigned fixes it.

diff --git a/hald/linux/addons/addon-macbook-backlight.c b/hald/linux/addons/addon-macbook-backlight.c
index 99c3905..47817ab 100644
--- a/hald/linux/addons/addon-macbook-backlight.c
+++ b/hald/linux/addons/addon-macbook-backlight.c
@@ -115,7 +115,7 @@ end:
 static gboolean
 map_register_page (void)
 {
-	long address;
+	unsigned long address;
 	int fd;
 
 	address = determine_video_base_address ();
commit 75a02ba67153abc4e8beae4889a0652a25273877
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Wed Apr 23 22:31:17 2008 +0200

    fixed KillSwitch linux scripts for Dell to return better errormsg
    
    Fixed KillSwitch linux scripts for Dell to return better error
    messages if $DELL_WCTL isn't available/executable.

diff --git a/tools/linux/hal-system-killswitch-get-power-linux b/tools/linux/hal-system-killswitch-get-power-linux
index e90ae7b..70dbb20 100755
--- a/tools/linux/hal-system-killswitch-get-power-linux
+++ b/tools/linux/hal-system-killswitch-get-power-linux
@@ -22,18 +22,24 @@ if [ "$HAL_PROP_KILLSWITCH_TYPE" = "bluetooth" ]; then
 	    exit 1
 	fi
 	exit ${value}
-    elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" -a -x "$DELL_WCTL" ]; then
-	# TODO: write our own binary that links with libsmbios?
-	$DELL_WCTL --st_bt
-	value=$?
-	if [ "$value" = "0" ]; then
-	    exit 1
-	elif [ "$value" = "1" ]; then
-	    exit 0
-	else
+    elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" ]; then
+	if [ -x "$DELL_WCTL" ]; then
+	    # TODO: write our own binary that links with libsmbios?
+	    $DELL_WCTL --st_bt
+	    value=$?
+	    if [ "$value" = "0" ]; then
+	        exit 1
+	    elif [ "$value" = "1" ]; then
+	        exit 0
+	    else
+	        echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
+	        echo "dellWirelessCtl returned $value" >&2
+                exit 1
+	    fi
+        else
 	    echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
-	    echo "dellWirelessCtl returned $value" >&2
-            exit 1
+	    echo "dellWirelessCtl ($DELL_WCTL) not available or executable" >&2
+	    exit 1
 	fi
     elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = thinkpad -a -r "$HAL_PROP_LINUX_SYSFS_PATH" ]; then
 	read value < $HAL_PROP_LINUX_SYSFS_PATH 2> /dev/null
@@ -50,18 +56,24 @@ if [ "$HAL_PROP_KILLSWITCH_TYPE" = "bluetooth" ]; then
 	exit 1
     fi
 elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wlan" ]; then
-    if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" -a -x "$DELL_WCTL" ]; then
-	# TODO: write our own binary that links with libsmbios?
-	$DELL_WCTL --st_wlan
-	value=$?
-	if [ "$value" = "0" ]; then
-	    exit 1
-	elif [ "$value" = "1" ]; then
-	    exit 0
-	else
+    if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" ]; then
+	if [ -x "$DELL_WCTL" ]; then
+ 	    # TODO: write our own binary that links with libsmbios?
+	    $DELL_WCTL --st_wlan
+	    value=$?
+	    if [ "$value" = "0" ]; then
+	        exit 1
+	    elif [ "$value" = "1" ]; then
+	        exit 0
+	    else
+	        echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
+	        echo "dellWirelessCtl returned $value" >&2
+                exit 1
+	    fi
+	else 
 	    echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
-	    echo "dellWirelessCtl returned $value" >&2
-            exit 1
+	    echo "dellWirelessCtl ($DELL_WCTL) not available or executable" >&2
+	    exit 1
 	fi
     elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "ipw" ]; then
 	hal-ipw-killswitch-linux getrfkill
@@ -81,18 +93,24 @@ elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wlan" ]; then
 	exit 1
     fi
 elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wwan" ]; then
-    if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" -a -x "$DELL_WCTL" ]; then
-	# TODO: write our own binary that links with libsmbios?
-	$DELL_WCTL --st_wwan
-	value=$?
-	if [ "$value" = "0" ]; then
-	    exit 1
-	elif [ "$value" = "1" ]; then
-	    exit 0
-	else
+    if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" ]; then
+	if [ -x "$DELL_WCTL" ]; then
+   	    # TODO: write our own binary that links with libsmbios?
+	    $DELL_WCTL --st_wwan
+	    value=$?
+	    if [ "$value" = "0" ]; then
+	        exit 1
+	    elif [ "$value" = "1" ]; then
+	        exit 0
+	    else
+	        echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
+	        echo "dellWirelessCtl returned $value" >&2
+                exit 1
+	    fi
+	else 
 	    echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
-	    echo "dellWirelessCtl returned $value" >&2
-            exit 1
+	    echo "dellWirelessCtl ($DELL_WCTL) not available or executable" >&2
+	    exit 1
 	fi
     else
 	echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
diff --git a/tools/linux/hal-system-killswitch-set-power-linux b/tools/linux/hal-system-killswitch-set-power-linux
index 65a5f85..bc2ed38 100755
--- a/tools/linux/hal-system-killswitch-set-power-linux
+++ b/tools/linux/hal-system-killswitch-set-power-linux
@@ -23,23 +23,28 @@ if [ "$HAL_PROP_KILLSWITCH_TYPE" = "bluetooth" ]; then
 	    exit 1
 	fi
 	exit 0
-    elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" -a -x "$DELL_WCTL" ]; then
+    elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" ]; then
+	if [ -x "$DELL_WCTL" ]; then
+	    # As a side effect we disable the physical kill switch
 
-	# As a side effect we disable the physical kill switch
-
-	# TODO: write our own binary that links with libsmbios?
-	if [ "$value" = "true" ]; then
-	    $DELL_WCTL --sw_bt 0 --bt 1
-	    ret=$?
-	else
-	    $DELL_WCTL --sw_bt 0 --bt 0
-	    ret=$?
-	fi
-	if [ "$ret" != "0" ]; then
-	    echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
-	    echo "dellWirelessCtl returned $ret" >&2
-	    exit 1
-	fi
+	    # TODO: write our own binary that links with libsmbios?
+	    if [ "$value" = "true" ]; then
+	        $DELL_WCTL --sw_bt 0 --bt 1
+	        ret=$?
+	    else
+	        $DELL_WCTL --sw_bt 0 --bt 0
+	        ret=$?
+	    fi
+	    if [ "$ret" != "0" ]; then
+	        echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
+	        echo "dellWirelessCtl returned $ret" >&2
+	        exit 1
+	    fi
+        else
+            echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
+            echo "dellWirelessCtl ($DELL_WCTL) not available or executable" >&2
+            exit 1
+        fi
     elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = thinkpad -a -w "$HAL_PROP_LINUX_SYSFS_PATH" ]; then
         if [ "$value" = "true" ]; then 
 	    bit=1; 
@@ -59,23 +64,27 @@ if [ "$HAL_PROP_KILLSWITCH_TYPE" = "bluetooth" ]; then
 	exit 1
     fi
 elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wlan" ]; then
-    if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" -a -x "$DELL_WCTL" ]; then
-
-	# As a side effect we disable the physical kill switch
-
-	# TODO: write our own binary that links with libsmbios?
-	if [ "$value" = "true" ]; then
-	    $DELL_WCTL --sw_wlan 0 --wlan 1
-	    ret=$?
-	else
-	    $DELL_WCTL --sw_wlan 0 --wlan 0
-	    ret=$?
-	fi
-	if [ "$ret" != "0" ]; then
-	    echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
-	    echo "dellWirelessCtl returned $ret" >&2
+    if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" ]; then
+	if [ -x "$DELL_WCTL" ]; then
+	    # As a side effect we disable the physical kill switch
+	    # TODO: write our own binary that links with libsmbios?
+	    if [ "$value" = "true" ]; then
+	        $DELL_WCTL --sw_wlan 0 --wlan 1
+	        ret=$?
+	    else
+	        $DELL_WCTL --sw_wlan 0 --wlan 0
+	        ret=$?
+	    fi
+	    if [ "$ret" != "0" ]; then
+	        echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
+	        echo "dellWirelessCtl returned $ret" >&2
+                exit 1
+	    fi
+        else
+            echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
+            echo "dellWirelessCtl ($DELL_WCTL) not available or executable" >&2
             exit 1
-	fi
+        fi
     elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "ipw" ]; then
 	if [ "$value" = "true" ]; then
 		rf_value=0
@@ -95,23 +104,27 @@ elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wlan" ]; then
 	exit 1
     fi
 elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wwan" ]; then
-    if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" -a -x "$DELL_WCTL" ]; then
-
-	# As a side effect we disable the physical kill switch
-
-	# TODO: write our own binary that links with libsmbios?
-	if [ "$value" = "true" ]; then
-	    $DELL_WCTL --sw_wwan 0 --wwan 1
-	    ret=$?
-	else
-	    $DELL_WCTL --sw_wwan 0 --wwan 0
-	    ret=$?
-	fi
-	if [ "$ret" != "0" ]; then
-	    echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
-	    echo "dellWirelessCtl returned $ret" >&2
+    if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" ]; then 
+	if [ -x "$DELL_WCTL" ]; then
+	    # As a side effect we disable the physical kill switch
+	    # TODO: write our own binary that links with libsmbios?
+	    if [ "$value" = "true" ]; then
+	        $DELL_WCTL --sw_wwan 0 --wwan 1
+	        ret=$?
+	    else
+	        $DELL_WCTL --sw_wwan 0 --wwan 0
+	        ret=$?
+	    fi
+	    if [ "$ret" != "0" ]; then
+	        echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
+	        echo "dellWirelessCtl returned $ret" >&2
+                exit 1
+	    fi
+        else
+            echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
+            echo "dellWirelessCtl ($DELL_WCTL) not available or executable" >&2
             exit 1
-	fi
+        fi
     else
 	echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
 	echo "Access type not supported" >&2
commit 453c8ad6a6ff22df4c35c97198370d3e1dbc06f6
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Wed Apr 23 22:29:23 2008 +0200

    cleaned up hal-ipw-killswitch-linux
    
    Cleaned up hal-ipw-killswitch-linux. Use fgets/strtol as in util.c of HAL
    instead of fgetc, added better error handling, use syslog to log error
    messages also if HAL is in daemon mode.

diff --git a/tools/linux/hal-ipw-killswitch-linux.c b/tools/linux/hal-ipw-killswitch-linux.c
index 1f1a648..3b14933 100644
--- a/tools/linux/hal-ipw-killswitch-linux.c
+++ b/tools/linux/hal-ipw-killswitch-linux.c
@@ -21,8 +21,10 @@
  *
  **************************************************************************/
 
+#include <errno.h>
 #include <stdio.h>
 #include <string.h>
+#include <syslog.h>
 #include <glib.h>
 #include <stdlib.h>
 
@@ -44,25 +46,26 @@ int main(int argc,char** argv) {
 	char *path;
 	int ret = -1;
 
-	if(argc == 1) return -1;	
+	if (argc == 1) 
+		return -1;	
 
 	dbus_error_init (&error);
 	
-	if((udi = getenv ("HAL_PROP_INFO_UDI")) == NULL) return -1;
+	if ((udi = getenv ("HAL_PROP_INFO_UDI")) == NULL) return -1;
 
 	if ((hal_ctx = libhal_ctx_new ()) == NULL) {
-		fprintf (stderr, "error: libhal_ctx_new\n");
+		syslog (LOG_INFO, "error: libhal_ctx_new\n");
 		return -1;
 	}
 
 	if (!libhal_ctx_set_dbus_connection (hal_ctx, dbus_bus_get (DBUS_BUS_SYSTEM, &error))) {
-		fprintf (stderr, "error: libhal_ctx_set_dbus_connection: %s: %s\n", error.name, error.message);
+		syslog (LOG_INFO, "error: libhal_ctx_set_dbus_connection: %s: %s\n", error.name, error.message);
 		LIBHAL_FREE_DBUS_ERROR (&error);
 		return -1;
 	}
 
 	if (!libhal_ctx_init (hal_ctx, &error)) {
-		fprintf (stderr, "error: libhal_ctx_init: %s: %s\n", error.name, error.message);
+		syslog (LOG_INFO, "error: libhal_ctx_init: %s: %s\n", error.name, error.message);
 		LIBHAL_FREE_DBUS_ERROR (&error);
 		return -1;
 	}
@@ -70,60 +73,83 @@ int main(int argc,char** argv) {
 
 	parent = libhal_device_get_property_string (hal_ctx, udi, "info.parent", &error);
 	udis = libhal_manager_find_device_string_match (hal_ctx, "info.parent", parent, &num_udis, &error);
-	libhal_free_string (parent);
 	
-	if(argc==2 && strcmp("getrfkill",argv[1])==0) {
+	if( argc==2 && strcmp("getrfkill",argv[1])==0) {
 
 		for (i = 0; i < num_udis; i++) {
+			char buf[64];
+
+			if (strcmp (udis[i], udi) == 0) 
+				continue;
 
-			if(strcmp (udis[i], udi) == 0) continue;
 			iface = libhal_device_get_property_string (hal_ctx, udis[i], "net.interface", &error);
-			path = g_strdup_printf ("/sys/class/net/%s/device/rf_kill", iface);
-			if((fd=fopen (path, "r")) == NULL) return -1;
-			kill_status = fgetc (fd);
-			fclose (fd);
-			g_free (path);
-
-			switch(kill_status) {
-				case '0':
-					ret = 0;
-				break;
-				case '1':
-				case '2':
-				case '3':
-					ret = 1;
-				break;
+			if (iface != NULL) {
+				path = g_strdup_printf ("/sys/class/net/%s/device/rf_kill", iface);
+
+				if ((fd = fopen (path, "r")) == NULL) {
+					return -1;
+				}
+				if (fgets (buf, sizeof (buf), fd) == NULL) {
+					return -1;
+				}
+
+				errno = 0;
+				kill_status = strtol (buf, NULL, 10);
+				if (errno == 0) {
+					/* syslog (LOG_INFO, "'%s' returned %d", path, kill_status); */
+					
+					switch(kill_status) {
+						case 0:
+							ret = 0;
+							break;
+						case 1:
+						case 2:
+						case 3:
+							ret = 1;
+							break;
+						default:
+							break;
+					}
+				}
+
+				fclose (fd);
+				g_free (path);
+				libhal_free_string (iface);
 			}
-
-			libhal_free_string (iface);
 		}
-	
-		libhal_free_string_array (udis);
 	}
 
-	if(argc == 3 && strcmp ("setrfkill", argv[1]) == 0 && (atoi (argv[2]) == 0 || atoi(argv[2]) == 1)) {
+	if (argc == 3 && strcmp ("setrfkill", argv[1]) == 0 && (atoi (argv[2]) == 0 || atoi(argv[2]) == 1)) {
 
 		for (i = 0; i < num_udis; i++) {
+			if (strcmp (udis[i], udi) == 0) 
+				continue;
 
-			if(strcmp (udis[i], udi)==0) continue;
 			iface = libhal_device_get_property_string (hal_ctx, udis[i], "net.interface", &error);
-			path = g_strdup_printf ("/sys/class/net/%s/device/rf_kill", iface);
-			if((fd=fopen (path, "w")) == NULL) return -1;
-			fputc (argv[2][0], fd);
-			fclose (fd);
-			g_free (path);
-			libhal_free_string (iface);
+			if (iface != NULL) {
+				path = g_strdup_printf ("/sys/class/net/%s/device/rf_kill", iface);
+				
+				if ((fd = fopen (path, "w")) == NULL) {
+					return -1;
+				}
+
+				fputc (argv[2][0], fd);
+				fclose (fd);
+
+				g_free (path);
+				libhal_free_string (iface);
+			}
 		}
 	
-		libhal_free_string_array (udis);	
-
 		ret = 0;
 	}
 	
+	libhal_free_string (parent);
+	libhal_free_string_array (udis);
 	libhal_ctx_free (hal_ctx);
 
 	if (dbus_error_is_set (&error)) {
-		fprintf (stderr, "error: %s: %s\n", error.name, error.message);
+		syslog (LOG_INFO, "error: %s: %s\n", error.name, error.message);
 		dbus_error_free (&error);
 		return -1;
 	}
commit c8d62bac881eb11a7060ad5d76a36a156a8f46e1
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Mon Apr 21 12:11:40 2008 +0200

    fixed error handling in linux scripts
    
    Fixed the error handling in the linux scripts. Always return
    an error and a error description, call 'exit 1' after the error.

diff --git a/tools/linux/hal-luks-remove-linux b/tools/linux/hal-luks-remove-linux
index 1393dfc..fc398e6 100755
--- a/tools/linux/hal-luks-remove-linux
+++ b/tools/linux/hal-luks-remove-linux
@@ -8,6 +8,12 @@
 
 CRYPTSETUP=/sbin/cryptsetup
 
+if [ ! -f $CRYPTSETUP ]; then
+    echo org.freedesktop.Hal.Device.Volume.Crypto.CryptSetupMissing >&2
+    echo Error remove $HAL_PROP_BLOCK_DEVICE - $CRYPTSETUP not found >&2
+    exit 1
+fi
+
 echo LUKS cryptotext device $HAL_PROP_INFO_UDI is going away
 
 # make sure that the cleartext volume is unmounted
@@ -26,16 +32,19 @@ fi
 echo Tearing down LUKS cryptotext volume
 
 if [ ! -f $CRYPTSETUP ]; then
+	echo org.freedesktop.Hal.Device.Volume.Crypto.RemoveError >&2
 	echo Error removing $HAL_PROP_BLOCK_DEVICE - $CRYPTSETUP not found >&2
 	exit 1
 fi
 
 if [ -z $HAL_PROP_VOLUME_UUID ]; then
+	echo org.freedesktop.Hal.Device.Volume.Crypto.RemoveError >&2
 	echo Error determining UUID of $HAL_PROP_BLOCK_DEVICE >&2
 	exit 1
 fi
 
 if ! $CRYPTSETUP luksClose luks_crypto_$HAL_PROP_VOLUME_UUID 2> /dev/null; then
+	echo org.freedesktop.Hal.Device.Volume.Crypto.RemoveError >&2
 	echo Error removing luks_crypto_$HAL_PROP_VOLUME_UUID >&2
 	exit 1
 fi
diff --git a/tools/linux/hal-system-killswitch-get-power-linux b/tools/linux/hal-system-killswitch-get-power-linux
index 8ed817e..e90ae7b 100755
--- a/tools/linux/hal-system-killswitch-get-power-linux
+++ b/tools/linux/hal-system-killswitch-get-power-linux
@@ -33,6 +33,7 @@ if [ "$HAL_PROP_KILLSWITCH_TYPE" = "bluetooth" ]; then
 	else
 	    echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
 	    echo "dellWirelessCtl returned $value" >&2
+            exit 1
 	fi
     elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = thinkpad -a -r "$HAL_PROP_LINUX_SYSFS_PATH" ]; then
 	read value < $HAL_PROP_LINUX_SYSFS_PATH 2> /dev/null
@@ -41,6 +42,7 @@ if [ "$HAL_PROP_KILLSWITCH_TYPE" = "bluetooth" ]; then
 	else
             echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
             echo "cannot read $HAL_PROP_LINUX_SYSFS_PATH" >&2
+            exit 1
         fi
     else
 	echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
@@ -59,6 +61,7 @@ elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wlan" ]; then
 	else
 	    echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
 	    echo "dellWirelessCtl returned $value" >&2
+            exit 1
 	fi
     elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "ipw" ]; then
 	hal-ipw-killswitch-linux getrfkill
@@ -70,6 +73,7 @@ elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wlan" ]; then
 	else
 	    echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
 	    echo "hal-ipw-killswitch-linux returned $value" >&2
+	    exit 1
 	fi
     else
 	echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
@@ -88,6 +92,7 @@ elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wwan" ]; then
 	else
 	    echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
 	    echo "dellWirelessCtl returned $value" >&2
+            exit 1
 	fi
     else
 	echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
diff --git a/tools/linux/hal-system-killswitch-set-power-linux b/tools/linux/hal-system-killswitch-set-power-linux
index 2f805d8..65a5f85 100755
--- a/tools/linux/hal-system-killswitch-set-power-linux
+++ b/tools/linux/hal-system-killswitch-set-power-linux
@@ -16,8 +16,10 @@ fi
 if [ "$HAL_PROP_KILLSWITCH_TYPE" = "bluetooth" ]; then
     if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "sonypic" ]; then
 	hal-system-sonypic setbluetooth $value
-	if [ $? -ne 0 ]; then
+	ret=$?
+	if [ "$ret" != "0" ]; then
 	    echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
+	    echo "hal-system-sonypic returned $ret" >&2
 	    exit 1
 	fi
 	exit 0
@@ -36,6 +38,7 @@ if [ "$HAL_PROP_KILLSWITCH_TYPE" = "bluetooth" ]; then
 	if [ "$ret" != "0" ]; then
 	    echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
 	    echo "dellWirelessCtl returned $ret" >&2
+	    exit 1
 	fi
     elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = thinkpad -a -w "$HAL_PROP_LINUX_SYSFS_PATH" ]; then
         if [ "$value" = "true" ]; then 
@@ -71,6 +74,7 @@ elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wlan" ]; then
 	if [ "$ret" != "0" ]; then
 	    echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
 	    echo "dellWirelessCtl returned $ret" >&2
+            exit 1
 	fi
     elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "ipw" ]; then
 	if [ "$value" = "true" ]; then
@@ -83,6 +87,7 @@ elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wlan" ]; then
 	if [ "$ret" != "0" ]; then 
 		echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
 		echo "hal-ipw-killswitch-linux returned $value" >&2
+                exit 1
 	fi
     else
 	echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
@@ -105,6 +110,7 @@ elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wwan" ]; then
 	if [ "$ret" != "0" ]; then
 	    echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
 	    echo "dellWirelessCtl returned $ret" >&2
+            exit 1
 	fi
     else
 	echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
diff --git a/tools/linux/hal-system-lcd-get-brightness-linux b/tools/linux/hal-system-lcd-get-brightness-linux
index 5128c4b..5810785 100755
--- a/tools/linux/hal-system-lcd-get-brightness-linux
+++ b/tools/linux/hal-system-lcd-get-brightness-linux
@@ -17,6 +17,7 @@ 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
+		echo "hal-system-power-pmu getlcd returned != 0" >&2
 		exit 1
 	fi
 	exit ${value}
@@ -24,6 +25,7 @@ elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "sonypi" ]; then
 	value="`hal-system-sonypic getlcd`"
 	if [ $? -ne 0 ]; then
 		echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
+		echo "hal-system-sonypic getlcd returned != 0" >&2
 		exit 1
 	fi
 	exit ${value}
@@ -32,7 +34,7 @@ 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
+	echo "$HAL_PROP_LINUX_ACPI_PATH not readable!" >&2
 	exit 1
 fi
 
diff --git a/tools/linux/hal-system-lcd-set-brightness-linux b/tools/linux/hal-system-lcd-set-brightness-linux
index a456744..4b4c2f1 100755
--- a/tools/linux/hal-system-lcd-set-brightness-linux
+++ b/tools/linux/hal-system-lcd-set-brightness-linux
@@ -17,6 +17,7 @@ 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
+		echo "hal-system-power-pmu setlcd returned != 0" >&2
 		exit 1
 	fi
 	exit 0
@@ -24,6 +25,7 @@ elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "sonypi" ]; then
 	hal-system-sonypic setlcd $value
 	if [ $? -ne 0 ]; then
 		echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
+		echo "hal-system-sonypic setlcd returned != 0" >&2
 		exit 1
 	fi
 	exit 0


More information about the hal-commit mailing list