components/cups/patches/08-usb-hack.patch
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Wed, 29 Aug 2012 11:05:56 -0700
changeset 957 255465c5756f
parent 220 3ff562b51ff5
permissions -rw-r--r--
Close of build 04.

--- backend/usb-unix.c.orig	Tue Sep 22 11:47:36 2009
+++ backend/usb-unix.c	Sat Nov 28 06:16:25 2009
@@ -30,7 +30,11 @@
 
 #include <sys/select.h>
 
+#ifdef __sun
+#include <sys/ecppio.h>
+#endif
 
+
 /*
  * Local functions...
  */
@@ -470,6 +474,8 @@
     {
       for (i = 0, busy = 0; i < 8; i ++)
       {
+        char *s;
+
 	sprintf(device, "/dev/usb/printer%d", i);
 
 	if ((fd = open(device, O_WRONLY | O_EXCL)) >= 0)
@@ -489,6 +495,16 @@
 	  device_uri[0] = '\0';
         }
 
+        /*
+         * The serial# is often missing from the 1284 devid and retrieval from
+         * the bus is a bit more complicated, so append it to the device_uri
+         * before the check if it was only in the supplied uri.
+         */
+        if (((s = strstr(uri, "?serial=")) != NULL) &&
+            (strstr(device_uri, "?serial=") == NULL)) {
+                strncat(device_uri, s, sizeof (device_uri));
+        }
+
         if (!strcmp(uri, device_uri))
 	{
 	 /*