cups-uri-compat.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. diff -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. (void)argc;
  11. (void)argv;
  12. + p = strchr (fixed_uri, ':');
  13. + if (p++ != NULL)
  14. + {
  15. + char *e;
  16. + p += strspn (p, "/");
  17. + e = strchr (p, '/');
  18. + if (e > p)
  19. + {
  20. + size_t mfrlen = e - p;
  21. + e++;
  22. + if (!strncasecmp (e, p, mfrlen))
  23. + {
  24. + char *x = e + mfrlen;
  25. + if (!strncmp (x, "%20", 3))
  26. + /* Take mfr name out of mdl name for compatibility with
  27. + * Fedora 11 before bug #507244 was fixed. */
  28. + strcpy (e, x + 3); puts(fixed_uri);
  29. + }
  30. + }
  31. + }
  32. +
  33. /*
  34. * Open the USB port device...
  35. */
  36. @@ -107,10 +130,10 @@ print_device(const char *uri, /* I - De
  37. _cups_strncasecmp(hostname, "Minolta", 7);
  38. #endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */
  39. - if (use_bc && !strncmp(uri, "usb:/dev/", 9))
  40. + if (use_bc && !strncmp(fixed_uri, "usb:/dev/", 9))
  41. use_bc = 0;
  42. - if ((device_fd = open_device(uri, &use_bc)) == -1)
  43. + if ((device_fd = open_device(fixed_uri, &use_bc)) == -1)
  44. {
  45. if (getenv("CLASS") != NULL)
  46. {