[Pkg-utopia-commits] r67 - in packages/hal/trunk/debian: . patches

Sjoerd Simons sjoerd@haydn.debian.org
Sat, 06 Nov 2004 12:48:18 -0700


Author: sjoerd
Date: 2004-11-06 12:47:58 -0700 (Sat, 06 Nov 2004)
New Revision: 67

Added:
   packages/hal/trunk/debian/patches/hal-hotplug-map.patch
Modified:
   packages/hal/trunk/debian/changelog
Log:
Added hack to not misdetect UMS camera's as libgphoto2 supported

Modified: packages/hal/trunk/debian/changelog
===================================================================
--- packages/hal/trunk/debian/changelog	2004-11-06 16:16:36 UTC (rev 66)
+++ packages/hal/trunk/debian/changelog	2004-11-06 19:47:58 UTC (rev 67)
@@ -20,8 +20,13 @@
     Added. Fill the Device type and Capabilities field (Patch from Bryan Clark)
   * debian/patches/device-manager-glade.patch
     Added. Improve the appearance of the Device tab in h-d-m 
+  * debian/patches/hal-hotplug-map.patch
+    Added. Check if the usb device isn't actually an usb mass storage device
+    before setting libgphoto2 support properties. Fixes problems with 
+    olympus cameras, because PtP and UMS versions have the same usb id's
+    (Closes: #279395)
 
- -- Sjoerd Simons <sjoerd@debian.org>  Tue, 19 Oct 2004 16:59:21 +0200
+ -- Sjoerd Simons <sjoerd@debian.org>  Sat, 06 Nov 2004 19:59:37 +0100
 
 hal (0.4.0-1) experimental; urgency=low
 

Added: packages/hal/trunk/debian/patches/hal-hotplug-map.patch
===================================================================
--- packages/hal/trunk/debian/patches/hal-hotplug-map.patch	2004-11-06 16:16:36 UTC (rev 66)
+++ packages/hal/trunk/debian/patches/hal-hotplug-map.patch	2004-11-06 19:47:58 UTC (rev 67)
@@ -0,0 +1,73 @@
+Index: tools/linux/hal_hotplug_map.c
+===================================================================
+RCS file: /cvs/hal/hal/tools/linux/hal_hotplug_map.c,v
+retrieving revision 1.3
+diff -u -r1.3 hal_hotplug_map.c
+--- tools/linux/hal_hotplug_map.c	27 Sep 2004 14:52:11 -0000	1.3
++++ tools/linux/hal_hotplug_map.c	6 Nov 2004 18:48:59 -0000
+@@ -3,6 +3,9 @@
+ #include <stdlib.h>
+ #include <string.h>
+ 
++#include <dirent.h>
++#include <sys/types.h>
++
+ #define DBUS_API_SUBJECT_TO_CHANGE
+ #include "libhal/libhal.h"
+ 
+@@ -21,6 +24,45 @@
+ /* @todo FIXME HACK: it's a hack to hardcode this */
+ static const char *usbmapfiles[] = {"/etc/hotplug/usb.usermap", "/etc/hotplug/usb/libsane.usermap", "/etc/hotplug/usb/libgphoto2.usermap",  NULL};
+ 
++#define BUFSIZE 256
++static int 
++check_usb_masstorage() {
++  char *sysfspath = getenv("HAL_PROP_LINUX_SYSFS_PATH");
++  DIR *sysfsdir;
++  struct dirent *direntry;
++  FILE *f;
++  char buf[BUFSIZE];
++  char path[PATH_MAX];
++
++  if (sysfspath == NULL) { 
++    return FALSE;
++  }
++  sysfsdir = opendir(sysfspath);
++  if (sysfsdir == NULL) {
++    return FALSE;
++  }
++  while ((direntry = readdir(sysfsdir)) != NULL)  {
++    if (direntry->d_type == DT_DIR) {
++      snprintf(path, PATH_MAX, "%s/%s/bInterfaceClass", 
++               sysfspath, direntry->d_name);
++      f = fopen(path, "r");
++      if (f == NULL)
++        continue;
++      if (fgets(buf, BUFSIZE, f) == NULL) {
++        fclose(f);
++        continue;
++      }
++      fclose(f);
++      if (atoi(buf) == 8) {
++        /* usb mass storage endpoint */
++        dbg("Found USB Mass Storage endpoint!\n");
++        return TRUE;
++      }
++    }
++  }
++  return FALSE;
++}
++
+ static int
+ handle_usb_found (const char *module)
+ {
+@@ -35,7 +77,8 @@
+ 	if (hal_context == NULL)
+ 		return FALSE;
+ 
+-	if (strcmp (module, "usbcam") == 0 || strcmp(module, "libgphoto2") == 0) {
++	if ((strcmp (module, "usbcam") == 0 || strcmp(module, "libgphoto2") == 0) 
++       && !check_usb_masstorage()) {
+ 		hal_device_add_capability (hal_context, udi, "camera");
+ 		hal_device_set_property_string (hal_context, udi, "info.category", "camera");
+ 		hal_device_set_property_string (hal_context, udi, "camera.access_method", "user");