On Saturday 21 November 2009 09:24:21 Will Stephenson wrote:
> The attached patch adds support for laptop docking stations to Solid.  
> Knowing 
> when the machine is docked will allow us to modify powersaving policy while 
> docked, eg don't lock the screen if lid closed while docked, and help fix 
> https://bugs.kde.org/show_bug.cgi?id=185460.
> 
> The missing part is how to instantiate a DockStation device in the hal 
> manager, because in hal, dockstation isn't a capability and we use 
> FindByCapability only.
> 
> Instead it seems to only be defined by the presence of an interface it 
> supports.  I attach an extract from lshal to demonstrate this.  Solid-hal 
> expert(s): is there an obvious way to deal with this?  Holger, how did you 
> handle this in GNOME?

Oh well, it required quite some time to figure this out now.

There should be a 'dock_station' capability as far as I remembered,
however, you were right and it wasn't there :)

The referring HAL patch (attached) got reverted in upstream HAL because
the kernel wasn't ready at that time. And in the meanwhile...I completely
forgot about it :-( So also the GNOME utility relies on a capability
dock_station and thus doesn't work at all at the moment. I'll try to push
the patch again and will add it to the openSUSE distribution until a new
HAL release is made. However, this may last quite some time because HAL
development is frozen because of DeviceKit.

Regards,
 Holger
From 122e41a10aeb3c6b6f1b6590d5c788fb01e0577a Mon Sep 17 00:00:00 2001
From: Holger Macht <[email protected]>
Date: Sun, 12 Oct 2008 20:27:57 +0200
Subject: [PATCH] adapt HAL to changes in the kernel regarding to docking stations

Adapted HAL to recent changes in the kernel regarding to docking
stations.
================================================================================
--- hal-0.5.12/hald/linux/device.c
+++ hal-0.5.12/hald/linux/device.c
@@ -1839,9 +1839,15 @@
 
 	if (strncmp (dev_id, "dock", 4) == 0) {
 		int docked;
+		gchar *type;
 
-		hal_util_get_int_from_file (sysfs_path, "docked", &docked, 0);
-		hal_device_property_set_bool (d, "info.docked", docked);
+		type = hal_util_get_string_from_file (sysfs_path, "type");
+		if (type != NULL && 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;
@@ -1874,8 +1880,8 @@
 	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);
@@ -1887,20 +1893,24 @@
 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 (type != NULL && 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;
_______________________________________________
Kde-hardware-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-hardware-devel

Reply via email to