]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - backend/usb-unix.c
Import CUPS 1.4svn-r7356.
[thirdparty/cups.git] / backend / usb-unix.c
index a02b3713d1b9d9259ba5c7344b0f3a47672220b8..64215815ec43a58e00cd5890771d9fe406c78844 100644 (file)
@@ -37,7 +37,8 @@
  */
 
 static int     open_device(const char *uri, int *use_bc);
-static void    side_cb(int print_fd, int device_fd, int use_bc);
+static void    side_cb(int print_fd, int device_fd, int snmp_fd,
+                       http_addr_t *addr, int use_bc);
 
 
 /*
@@ -90,8 +91,8 @@ print_device(const char *uri,         /* I - Device URI */
 
     use_bc = strcasecmp(hostname, "Brother") &&
              strcasecmp(hostname, "Canon") &&
-             strcasecmp(hostname, "Konica Minolta") &&
-             strcasecmp(hostname, "Minolta");
+             strncasecmp(hostname, "Konica", 6) &&
+             strncasecmp(hostname, "Minolta", 7);
 #endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */
 
     if ((device_fd = open_device(uri, &use_bc)) == -1)
@@ -173,7 +174,7 @@ print_device(const char *uri,               /* I - Device URI */
       lseek(print_fd, 0, SEEK_SET);
     }
 
-    tbytes = backendRunLoop(print_fd, device_fd, use_bc, side_cb);
+    tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, side_cb);
 
     if (print_fd != 0 && tbytes >= 0)
       _cupsLangPrintf(stderr,
@@ -345,7 +346,7 @@ open_device(const char *uri,                /* I - Device URI */
     * Find the correct USB device...
     */
 
-    do
+    for (;;)
     {
       for (busy = 0, i = 0; i < 16; i ++)
       {
@@ -420,15 +421,6 @@ open_device(const char *uri,               /* I - Device URI */
        sleep(5);
       }
     }
-    while (busy);
-
-   /*
-    * Couldn't find the printer, return "no such device or address"...
-    */
-
-    errno = ENODEV;
-
-    return (-1);
   }
 #elif defined(__sun) && defined(ECPPIOC_GETDEVID)
   {
@@ -525,7 +517,7 @@ open_device(const char *uri,                /* I - Device URI */
   }
 #else
   {
-    if (use_bc)
+    if (*use_bc)
       fd = open(uri + 4, O_RDWR | O_EXCL);
     else
       fd = -1;
@@ -552,9 +544,11 @@ open_device(const char *uri,               /* I - Device URI */
  */
 
 static void
-side_cb(int print_fd,                  /* I - Print file */
-        int device_fd,                 /* I - Device file */
-       int use_bc)                     /* I - Using back-channel? */
+side_cb(int         print_fd,          /* I - Print file */
+        int         device_fd,         /* I - Device file */
+        int         snmp_fd,           /* I - SNMP socket (unused) */
+       http_addr_t *addr,              /* I - Device address (unused) */
+       int         use_bc)             /* I - Using back-channel? */
 {
   cups_sc_command_t    command;        /* Request command */
   cups_sc_status_t     status;         /* Request/response status */
@@ -562,6 +556,9 @@ side_cb(int print_fd,                       /* I - Print file */
   int                  datalen;        /* Request/response data size */
 
 
+  (void)snmp_fd;
+  (void)addr;
+
   datalen = sizeof(data);
 
   if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))