]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - backend/usb-unix.c
More svn:properties changes.
[thirdparty/cups.git] / backend / usb-unix.c
index b5aeb454873d1a536cf96e3a7391ed8aad8145c0..3ca30c965d6e5e3040248587f12af65ffcea1de7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: usb-unix.c 5099 2006-02-13 02:46:10Z mike $"
+ * "$Id$"
  *
  *   USB port backend for the Common UNIX Printing System (CUPS).
  *
@@ -56,8 +56,11 @@ print_device(const char *uri,                /* I - Device URI */
              const char *resource,     /* I - Resource/modelname */
             const char *options,       /* I - Device options/serial number */
             int        fp,             /* I - File descriptor to print */
-            int        copies)         /* I - Copies to print */
+            int        copies,         /* I - Copies to print */
+            int        argc,           /* I - Number of command-line arguments (6 or 7) */
+            char       *argv[])        /* I - Command-line arguments */
 {
+  int          usebc;                  /* Use backchannel path? */
   int          fd;                     /* USB device */
   int          rbytes;                 /* Number of bytes read */
   int          wbytes;                 /* Number of bytes written */
@@ -77,11 +80,23 @@ print_device(const char *uri,               /* I - Device URI */
   unsigned int status;                 /* Port status (off-line, out-of-paper, etc.) */
 #endif /* __linux */
 
+  (void)argc;
+  (void)argv;
+
+ /*
+  * Disable backchannel data when printing to Canon USB printers - apparently
+  * Canon printers will return the IEEE-1284 device ID over and over and over
+  * when they get a read request...
+  */
+
+  usebc = strcasecmp(hostname, "Canon") != 0;
 
  /*
   * Open the USB port device...
   */
 
+  fputs("STATE: +connecting-to-device\n", stderr);
+
   do
   {
     if ((fd = open_device(uri)) == -1)
@@ -127,6 +142,8 @@ print_device(const char *uri,               /* I - Device URI */
   }
   while (fd < 0);
 
+  fputs("STATE: -connecting-to-device\n", stderr);
+
  /*
   * Set any options provided...
   */
@@ -230,7 +247,9 @@ print_device(const char *uri,               /* I - Device URI */
         do
        {
           FD_ZERO(&input);
-         FD_SET(fd, &input);
+         if (usebc)
+           FD_SET(fd, &input);
+
          FD_ZERO(&output);
          FD_SET(fd, &output);
         }
@@ -370,7 +389,6 @@ list_devices(void)
        device_id[1024],        /* Device ID string */
        device_uri[1024],       /* Device URI string */
        make_model[1024];       /* Make and model */
-  struct ecpp_device_id did;   /* Device ID buffer */
 
 
  /*
@@ -394,7 +412,7 @@ list_devices(void)
   }
 #elif defined(__hpux)
 #elif defined(__osf)
-#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
   int   i;                      /* Looping var */
   char  device[255];            /* Device filename */
 
@@ -541,7 +559,6 @@ open_device(const char *uri)                /* I - Device URI */
                device_id[1024],        /* Device ID string */
                make_model[1024],       /* Make and model */
                device_uri[1024];       /* Device URI string */
-    struct ecpp_device_id did;         /* Device ID buffer */
 
 
    /*
@@ -616,5 +633,5 @@ open_device(const char *uri)                /* I - Device URI */
 
 
 /*
- * End of "$Id: usb-unix.c 5099 2006-02-13 02:46:10Z mike $".
+ * End of "$Id$".
  */