File hal-20081112-fix-docking-support.diff of Package hal
From 122e41a10aeb3c6b6f1b6590d5c788fb01e0577a Mon Sep 17 00:00:00 2001
From: Holger Macht <hmacht@suse.de>
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;