[cups.general] USB backend and hot-plugging printers

Tim Waugh twaugh at redhat.com
Tue May 11 06:55:51 PDT 2004


On Tue, May 11, 2004 at 09:21:11AM -0400, Michael Sweet wrote:

> Tim Waugh wrote:
> >Re: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=122829
> >
> >When a print job is being sent to a printer over the USB backend and
> >the USB cable is pulled out, the USB backend exits and the job is
> >removed from the queue.
> >
> >But since it hasn't printed, shouldn't the USB backend retry the job
> >until it succeeds?
> 
> In this case, since the connection has been made initially but fails
> to complete, it should return a non-zero exit status to stop the
> queue.

Like this?:

--- cups-1.1.20/backend/usb.c.usb	2004-05-11 14:53:30.000000000 +0100
+++ cups-1.1.20/backend/usb.c	2004-05-11 14:55:18.000000000 +0100
@@ -94,7 +94,7 @@
   int		fp;		/* Print file */
   int		copies;		/* Number of copies to print */
   int		fd;		/* Parallel device */
-  int		wbytes;		/* Number of bytes written */
+  int		wbytes = 0;	/* Number of bytes written */
   size_t	nbytes,		/* Number of bytes read */
 		tbytes;		/* Total number of bytes written */
   char		buffer[8192],	/* Output buffer */
@@ -315,7 +315,7 @@
 
   fputs("INFO: Ready to print.\n", stderr);
 
-  return (0);
+  return wbytes < 0;
 }
 
 
Tim.
*/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://lists.cups.org/pipermail/cups/attachments/20040511/8e7937f4/attachment.bin>


More information about the cups mailing list