[Utopia] Fix gnome-volume-manager PTP camera detection



Hi!

gnome-volume-manager 1.3.2 broke PTP camera detection due to a logic
flaw in gvm_udi_is_camera(). Even if a device had the "camera"
capability, the subsequent check for libgphoto2 support made the
function return FALSE.

I'm not sure whether this "and" semantics was really intended, but at
least it breaks when using 1.3.2 with hal 0.5.3.

In Ubuntu I applied the following patch which makes it work again:

--- gnome-volume-manager-1.3.2-old/src/manager.c        2005-07-29 17:02:13.000000000 +0200
+++ gnome-volume-manager-1.3.2/src/manager.c    2005-07-29 17:02:13.000000000 +0200
@@ -614,15 +614,13 @@
 static gboolean
 gvm_udi_is_camera (const char *udi, gboolean check_libgphoto2)
 {
-       if (!libhal_device_query_capability (hal_ctx, udi, "camera", NULL))
-               return FALSE;
-
-       if (check_libgphoto2 && !libhal_device_get_property_bool (hal_ctx, udi, "camera.libgphoto2_support", NULL))
-               return FALSE;
-
-       dbg ("Camera detected: %s\n", udi);
+       if (libhal_device_query_capability (hal_ctx, udi, "camera", NULL) ||
+            (check_libgphoto2 && libhal_device_get_property_bool (hal_ctx, udi, "camera.libgphoto2_support", NULL))) {
+                dbg ("Camera detected: %s\n", udi);
+                return TRUE;
+        }

-       return TRUE;
+       return FALSE;
 }

 /*


Grepping the hal 0.5.3 sources for "libgphoto2_support" yields
nothing, so in the long run the second check should just be removed.
For now I left it in to keep compatibility with hal versions that
still used that property.

Thanks,

Martin
-- 
Martin Pitt        http://www.piware.de
Ubuntu Developer   http://www.ubuntu.com
Debian Developer   http://www.debian.org

Attachment: signature.asc
Description: Digital signature



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