Blame SOURCES/cups-uri-compat.patch

3635cf
diff -up cups-1.5b1/backend/usb-unix.c.uri-compat cups-1.5b1/backend/usb-unix.c
3635cf
--- cups-1.5b1/backend/usb-unix.c.uri-compat	2011-05-24 15:59:05.000000000 +0200
3635cf
+++ cups-1.5b1/backend/usb-unix.c	2011-05-24 16:02:03.000000000 +0200
3635cf
@@ -63,11 +63,34 @@ print_device(const char *uri,		/* I - De
3635cf
   int		device_fd;		/* USB device */
3635cf
   ssize_t	tbytes;			/* Total number of bytes written */
3635cf
   struct termios opts;			/* Parallel port options */
3635cf
+  char		*fixed_uri = strdup (uri);
3635cf
+  char		*p;
3635cf
 
3635cf
 
3635cf
   (void)argc;
3635cf
   (void)argv;
3635cf
 
3635cf
+  p = strchr (fixed_uri, ':');
3635cf
+  if (p++ != NULL)
3635cf
+  {
3635cf
+    char *e;
3635cf
+    p += strspn (p, "/");
3635cf
+    e = strchr (p, '/');
3635cf
+    if (e > p)
3635cf
+    {
3635cf
+      size_t mfrlen = e - p;
3635cf
+      e++;
3635cf
+      if (!strncasecmp (e, p, mfrlen))
3635cf
+      {
3635cf
+	char *x = e + mfrlen;
3635cf
+	if (!strncmp (x, "%20", 3))
3635cf
+	  /* Take mfr name out of mdl name for compatibility with
3635cf
+	   * Fedora 11 before bug #507244 was fixed. */
3635cf
+	  strcpy (e, x + 3); puts(fixed_uri);
3635cf
+      }
3635cf
+    }
3635cf
+  }
3635cf
+
3635cf
  /*
3635cf
   * Open the USB port device...
3635cf
   */
3635cf
@@ -107,10 +130,10 @@ print_device(const char *uri,		/* I - De
3635cf
              _cups_strncasecmp(hostname, "Minolta", 7);
3635cf
 #endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */
3635cf
 
3635cf
-    if (use_bc && !strncmp(uri, "usb:/dev/", 9))
3635cf
+    if (use_bc && !strncmp(fixed_uri, "usb:/dev/", 9))
3635cf
       use_bc = 0;
3635cf
 
3635cf
-    if ((device_fd = open_device(uri, &use_bc)) == -1)
3635cf
+    if ((device_fd = open_device(fixed_uri, &use_bc)) == -1)
3635cf
     {
3635cf
       if (getenv("CLASS") != NULL)
3635cf
       {