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

Michael Sweet mike at easysw.com
Tue May 11 10:07:45 PDT 2004


Tim Waugh wrote:
> 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;
>  }

Yeah, something like that, although I like to separate the
initialization from the declaration for clarity.

Please post as a STR at:

     http://www.cups.org/str.php

That way we can track the change and make sure something similar
happens for the parallel and serial backends if it doesn't already.

-- 
______________________________________________________________________
Michael Sweet, Easy Software Products           mike at easysw dot com
Printing Software for UNIX                       http://www.easysw.com




More information about the cups mailing list