cups/cups-uri-compat.patch
Tim Waugh d08cd1d6a2 - Applied patch to prevent bad job control files crashing cupsd on start-up
(STR #3253, bug #509741).
- Correctly handle CUPS-Get-PPDs requests for models with '+' in their
    names (STR #3254, bug #509586).
- Accept incorrect device URIs in the (non-libusb) usb backend for
    compatibility with Fedora 11 before bug #507244 was fixed.
- Applied patch to fix incorrect device URIs (STR #3259, bug #507244).
- Applied patch to fix job-hold-until for remote queues (STR #3258, bug
    #497376).
2009-07-15 13:27:21 +00:00

52 lines
1.5 KiB
Diff

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