hal: Branch 'master'

Danny Kukawka dkukawka at kemper.freedesktop.org
Sun Oct 12 11:29:39 PDT 2008


 hald/linux/device.c |   24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

New commits:
commit 122e41a10aeb3c6b6f1b6590d5c788fb01e0577a
Author: Holger Macht <hmacht at suse.de>
Date:   Sun Oct 12 20:27:57 2008 +0200

    adapt HAL to changes in the kernel regarding to docking stations
    
    Adapted HAL to recent changes in the kernel regarding to docking
    stations.

diff --git a/hald/linux/device.c b/hald/linux/device.c
index 26f6c1b..94b3ab5 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -2017,9 +2017,15 @@ platform_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *pare
 
 	if (strncmp (dev_id, "dock", 4) == 0) {
 		int docked;
-
-		hal_util_get_int_from_file (sysfs_path, "docked", &docked, 0);
-		hal_device_property_set_bool (d, "info.docked", docked);
+		gchar *type;
+
+		type = hal_util_get_string_from_file (sysfs_path, "type");
+		if (strcmp (type, "dock_station") == 0) {
+			hal_device_property_set_string (d, "info.type", type);
+			hal_device_add_capability (d, "dock_station");
+			hal_util_get_int_from_file (sysfs_path, "docked", &docked, 0);
+			hal_device_property_set_bool (d, "info.docked", docked);
+		}
 	}
 
 	return d;
@@ -2052,8 +2058,8 @@ platform_refresh_undock (gpointer data)
 	sysfs_path = hal_device_property_get_string(d, "linux.sysfs_path");
 	hal_util_get_int_from_file (sysfs_path, "flags", &flags, 0);
 
-	/* check for != 0, maybe the user did an immediate dock */
-	if (flags != 0)
+	/* check for != 16, maybe the user did an immediate dock */
+	if (flags != 16)
 		return TRUE;
 
 	hal_util_get_int_from_file (sysfs_path, "docked", &docked, 0);
@@ -2065,20 +2071,24 @@ platform_refresh_undock (gpointer data)
 static gboolean
 platform_refresh (HalDevice *d)
 {
-	const gchar *id, *sysfs_path;
+	const gchar *id, *sysfs_path, *type;
 	gint docked, flags;
 
 	id = hal_device_property_get_string (d, "platform.id");
 	if (strncmp (id, "dock", 4) != 0)
 		return TRUE;
 
+	type = hal_device_property_get_string(d, "info.type");
+	if (strcmp (type, "dock_station") != 0)
+		return TRUE;
+
 	sysfs_path = hal_device_property_get_string(d, "linux.sysfs_path");
 	hal_util_get_int_from_file (sysfs_path, "docked", &docked, 0);
 
 	if (docked == 1) {
 		/* undock still in progress? */
 		hal_util_get_int_from_file (sysfs_path, "flags", &flags, 0);
-		if (flags == 2) {
+		if (flags == 18) {
 			g_timeout_add (DOCK_STATION_UNDOCK_POLL_INTERVAL,
 				       platform_refresh_undock, d);
 			return TRUE;


More information about the hal-commit mailing list