hal: Branch 'master'

Danny Kukawka dkukawka at kemper.freedesktop.org
Tue Mar 4 10:56:36 PST 2008


 tools/linux/hal-system-killswitch-get-power-linux |    2 +-
 tools/linux/hal-system-killswitch-set-power-linux |    9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

New commits:
commit f735bd9b89c9e0f6d57ebe4a0b6d6c25557005ff
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Tue Mar 4 19:55:48 2008 +0100

    fix/cleanup ThinkPad bluetooth switch script code
    
    Fixed/cleanedup ThinkPad bluetooth switch script code. Don't use
    cat to read from sysfs, use instead read which need no fork.

diff --git a/tools/linux/hal-system-killswitch-get-power-linux b/tools/linux/hal-system-killswitch-get-power-linux
index efd0eab..9f2e412 100755
--- a/tools/linux/hal-system-killswitch-get-power-linux
+++ b/tools/linux/hal-system-killswitch-get-power-linux
@@ -35,7 +35,7 @@ if [ "$HAL_PROP_KILLSWITCH_TYPE" = "bluetooth" ]; then
 	    echo "dellWirelessCtl returned $value" >&2
 	fi
     elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = thinkpad -a -r "$HAL_PROP_LINUX_SYSFS_PATH" ]; then
-        value="`cat "$HAL_PROP_LINUX_SYSFS_PATH"`"
+	read value < $HAL_PROP_LINUX_SYSFS_PATH 2> /dev/null
 	if [ $? -eq 0 ]; then
 	    exit $value
 	else
diff --git a/tools/linux/hal-system-killswitch-set-power-linux b/tools/linux/hal-system-killswitch-set-power-linux
index f68e00a..a1e7b1a 100755
--- a/tools/linux/hal-system-killswitch-set-power-linux
+++ b/tools/linux/hal-system-killswitch-set-power-linux
@@ -38,9 +38,14 @@ if [ "$HAL_PROP_KILLSWITCH_TYPE" = "bluetooth" ]; then
 	    echo "dellWirelessCtl returned $ret" >&2
 	fi
     elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = thinkpad -a -w "$HAL_PROP_LINUX_SYSFS_PATH" ]; then
-        if [ "$value" = true ]; then bit=1; else bit=0; fi
+        if [ "$value" = "true" ]; then 
+	    bit=1; 
+	else 
+            bit=0; 
+        fi
         echo $bit >$HAL_PROP_LINUX_SYSFS_PATH
-        if [ $? -ne 0 ]; then
+	ret=$?
+        if [ "$ret" != "0" ]; then
             echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
 	    echo "cannot write $bit into $HAL_PROP_LINUX_SYSFS_PATH" >&2
 	    exit 1


More information about the hal-commit mailing list