Blame SOURCES/cups-uri-compat.patch

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