Data Error when printing with CUPS 1.3.6

Horky Chen horky.chen at gmail.com
Thu Sep 11 19:19:08 PDT 2008


Dear Michael,
We developed one GDI driver for our printer, and we meet one issue about USB printing with CUPS 1.3.6 in Mac OS 10.5:
 When we printing more than 200 pages to printer, it will be failed. As we analyzed, the printing data has been lost or re-sent, anyway, we found some garbaged data.
 But it can work normally in Mac OS 10.2~Mac OS 10.4.

 So we checked the USB backend with different source codes (1.3.6 and 1.2.12), there are some difference in print_device function, and we are interested at Error recovery action:
  [1.3.6:]
     status = (*g.classdriver)->WritePipe(g.classdriver, (UInt8*)print_ptr, &bytes, 0);

        /*
	* Ignore timeout errors...
	*/

	if (status == kIOUSBTransactionTimeout)
	{
	  status = 0;
	  bytes = 0;
	}
        if (status || bytes < 0)
	{
    .........
     fprintf(stderr, "DEBUG: Wrote %d bytes of print data...\n", (int)bytes);
     g.print_bytes -= bytes;
     print_ptr   += bytes;
     total_bytes += bytes;

  [1.2.12]
    status = (*(printer_data.printerDriver))->WritePipe( printer_data.printerDriver, (UInt8*)bufptr, &wbytes, 0 /* nbytes > wbytes? 0: feof(fp) */ );
    if (wbytes < 0 || noErr != status) {
	  OSStatus err = (*(printer_data.printerDriver))->Abort(printer_data.printerDriver);
	  fprintf(stderr, "ERROR: %ld: Unable to send print file to printer (canceled:%ld)\n", status, err);
	  break;
	}

    	nbytes -= wbytes;
	bufptr += wbytes;

  In 1.4.svn_7696, when IO_TIMEOUT was occurred, USB backend will reset the bytes to ZERO, and resend the whole package again. But in 1.2.12,due to it has no special action for IO_TIMEOUT, so it will check whether some data has been sent to device as normal, and resent the other data.

  By our testing, we found following messages several times:
   [JOB:xxx]Wrote 0 bytes of print data.
  And the printing job will be failed. If you slow down the data transfer rate in device side (adjust the endpoint buffer), we can avoid the message (normally write 8192 bytes) and printing job can finish as normal, but the printing performance is very poor.

  I know this is a special behavior, it is related with GDI data size and USB behavior in device side too. But I am not sure whether some data has been sent out successfully, and whether the USB backend should resend the whole data package again. So I need your help to check it!

I would appreciate your kindly help!

Thanks & Best Regards!
Horky
2008-09-12





More information about the cups-devel mailing list