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

Danny Kukawka dkukawka at kemper.freedesktop.org
Mon Apr 21 02:52:52 PDT 2008


 hald/linux/addons/addon-input.c          |    4 ++--
 tools/linux/hal-dockstation-undock-linux |    3 ++-
 tools/linux/hal-system-wol-linux         |    9 ++++++---
 3 files changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 307343516ef7e1107a182e39d812fc4e845b2b35
Author: Jon Oberheide <jon at oberheide.org>
Date:   Mon Apr 21 11:37:45 2008 +0200

    fix input addon to handle G_IO_NVAL situations
    
    Fixed input addon to handle G_IO_NVAL situations.
    
    https://bugs.launchpad.net/ubuntu/+source/hal/+bug/203679:
    > The file descriptor is closed via remove_device() but not removed
    > from poll's fdset. Therefore poll continues to return with the
    > POLLNVAL code but it is never handled. The POLLNVAL should be
    > handled by adding G_IO_NVAL to the g_io_add_watch_full() event mask
    > and then also included in the error condition at the top of
    > event_io().

diff --git a/hald/linux/addons/addon-input.c b/hald/linux/addons/addon-input.c
index 48fd815..5704f82 100644
--- a/hald/linux/addons/addon-input.c
+++ b/hald/linux/addons/addon-input.c
@@ -210,7 +210,7 @@ event_io (GIOChannel *channel, GIOCondition condition, gpointer data)
 	GError *gerror = NULL;
 	gsize read_bytes;
 
-	if (condition & (G_IO_HUP | G_IO_ERR))
+	if (condition & (G_IO_HUP | G_IO_ERR | G_IO_NVAL))
 		return FALSE;
 
 	/** tbh, we can probably assume every time we read we have a whole
@@ -383,7 +383,7 @@ add_device (LibHalContext *ctx,
 
 	g_hash_table_insert (inputs, g_strdup(udi), channel);
 	g_io_add_watch_full (channel,
-			     G_PRIORITY_DEFAULT, G_IO_IN | G_IO_ERR | G_IO_HUP,
+			     G_PRIORITY_DEFAULT, G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL,
 			     event_io, data, (GDestroyNotify) destroy_data);
 }
 
commit 9e92570541a910ee78f7b8801bad517d4effb534
Author: Holger Macht <holger at homac.de>
Date:   Mon Apr 21 09:29:05 2008 +0200

    output errors to stderr and provide a description
    
    HAL requires scripts to return an exception _and_ a description line in
    the error case. Otherwise the exception is not properly forwarded to the
    caller.

diff --git a/tools/linux/hal-dockstation-undock-linux b/tools/linux/hal-dockstation-undock-linux
index a29f43a..e85e632 100644
--- a/tools/linux/hal-dockstation-undock-linux
+++ b/tools/linux/hal-dockstation-undock-linux
@@ -2,7 +2,8 @@
 
 DOCKED=`cat $HAL_PROP_LINUX_SYSFS_PATH/docked`
 if [ "$DOCKED" = "0" ]; then
- 	echo "org.freedesktop.Hal.Device.DockStation.NotDocked"
+ 	echo "org.freedesktop.Hal.Device.DockStation.NotDocked" >&2
+ 	echo "System not docked" >&2
 	exit 1
 fi
 
diff --git a/tools/linux/hal-system-wol-linux b/tools/linux/hal-system-wol-linux
index 36909c3..35ab994 100755
--- a/tools/linux/hal-system-wol-linux
+++ b/tools/linux/hal-system-wol-linux
@@ -13,7 +13,8 @@ IFACE="$HAL_PROP_NET_INTERFACE"
 wol_get_flags() {
     SUPPORT_FLAGS=`ethtool $IFACE | awk '/Supports Wake-on:/{if ($3 ~ /g/) print $3 }'`
     [ -n "$SUPPORT_FLAGS" ] && return 0
-    echo "org.freedesktop.Hal.Device.WakeOnLAN.NotSupported"
+    echo "org.freedesktop.Hal.Device.WakeOnLAN.NotSupported" >&2
+    echo "Network interface does not support Wake On LAN" >&2
     exit 1
 }
 
@@ -54,7 +55,8 @@ wol_disable() {
 
 which ethtool >/dev/null 2>&1
 if [ "$?" != "0" ]; then
-    echo "org.freedesktop.Hal.Device.WakeOnLan.NoEthtool"
+    echo "org.freedesktop.Hal.Device.WakeOnLan.NoEthtool" >&2
+    echo -e "No ethtool found in \$PATH" >&2
     exit 1
 fi
 
@@ -71,7 +73,8 @@ case "`basename $0`" in
 	elif [ "$enable" = "false" ]; then
 	    wol_disable
 	else
-	    echo "org.freedesktop.Hal.Device.WakeOnLAN.InvalidArgument"
+	    echo "org.freedesktop.Hal.Device.WakeOnLAN.InvalidArgument" >&2
+	    echo "argument must be of boolean type" >&2
 	    exit 1
 	fi
 	;;


More information about the hal-commit mailing list