• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff -up cups-1.5b1/backend/usb-unix.c.uri-compat cups-1.5b1/backend/usb-unix.c
2--- cups-1.5b1/backend/usb-unix.c.uri-compat	2011-05-24 15:59:05.000000000 +0200
3+++ cups-1.5b1/backend/usb-unix.c	2011-05-24 16:02:03.000000000 +0200
4@@ -63,11 +63,34 @@ print_device(const char *uri,		/* I - De
5   int		device_fd;		/* USB device */
6   ssize_t	tbytes;			/* Total number of bytes written */
7   struct termios opts;			/* Parallel port options */
8+  char		*fixed_uri = strdup (uri);
9+  char		*p;
10
11
12   (void)argc;
13   (void)argv;
14
15+  p = strchr (fixed_uri, ':');
16+  if (p++ != NULL)
17+  {
18+    char *e;
19+    p += strspn (p, "/");
20+    e = strchr (p, '/');
21+    if (e > p)
22+    {
23+      size_t mfrlen = e - p;
24+      e++;
25+      if (!strncasecmp (e, p, mfrlen))
26+      {
27+	char *x = e + mfrlen;
28+	if (!strncmp (x, "%20", 3))
29+	  /* Take mfr name out of mdl name for compatibility with
30+	   * Fedora 11 before bug #507244 was fixed. */
31+	  strcpy (e, x + 3); puts(fixed_uri);
32+      }
33+    }
34+  }
35+
36  /*
37   * Open the USB port device...
38   */
39@@ -107,10 +130,10 @@ print_device(const char *uri,		/* I - De
40              _cups_strncasecmp(hostname, "Minolta", 7);
41 #endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */
42
43-    if (use_bc && !strncmp(uri, "usb:/dev/", 9))
44+    if (use_bc && !strncmp(fixed_uri, "usb:/dev/", 9))
45       use_bc = 0;
46
47-    if ((device_fd = open_device(uri, &use_bc)) == -1)
48+    if ((device_fd = open_device(fixed_uri, &use_bc)) == -1)
49     {
50       if (getenv("CLASS") != NULL)
51       {
52