Patch: detection of Palm with latest HAL no longer working


we switched in Mandriva to hal 0.5.11 (rc2 at the moment, final is
pretty imminent) and info.bus is no longer advertised as part of usb
devices (key has been deprecated).

The attached patch changes this check with a check on pda.platform.

Those keys have been recently added in hal-info to detect all known
Palms (supported by pilot-link) so device permissions can now be handled
by hal / ConsoleKit / PolicyKit.

I think a good patch or hal_device_added logic (including usage of
devices.xml) could be removed since most of the information needed for
device detection is now directly available from HAL, including the right
device to use (when using visor module).

Opinions ?
Frederic Crozat <fcrozat mandriva com>
diff -p -up gnome-pilot-2.0.16/gpilotd/gpilotd.c.hal gnome-pilot-2.0.16/gpilotd/gpilotd.c
--- gnome-pilot-2.0.16/gpilotd/gpilotd.c.hal	2008-03-21 18:46:09.000000000 +0100
+++ gnome-pilot-2.0.16/gpilotd/gpilotd.c	2008-03-21 18:56:02.000000000 +0100
@@ -1079,7 +1079,7 @@ static void
 hal_device_added (LibHalContext *ctx, const char *udi)
 	gboolean visor_net = FALSE;
-	char *bus, *match_str;
+	char *platform, *match_str;
 	int vendor_id, product_id, i;
 	GPilotDevice *device;
 	DBusError error;
@@ -1090,14 +1090,14 @@ hal_device_added (LibHalContext *ctx, co
 	load_devices_xml ();
-	/* HAL match rule: we look for info.bus == 'usb_device'
+	/* HAL match rule: we look for pda.platform == 'palm'
 	 * and then try to match the usb_device.product_id and usb_device.vendor_id
 	 * against the list in devices.xml.
-	if (!(bus = libhal_device_get_property_string (hal_ctx, udi, "info.bus", NULL)))
+	if (!(platform = libhal_device_get_property_string (hal_ctx, udi, "pda.platform", NULL)))
-	if (strcmp (bus, "usb_device") != 0) {
-		libhal_free_string (bus);
+	if (strcmp (platform, "palm") != 0) {
+		libhal_free_string (platform);

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]