[Bug 37554] Re: USB Printing problem

Oliver Zendel zendel at linuxtag.org
Fri May 26 20:45:07 UTC 2006


After upgrading from breezy to dapper I run into similar problems with
my hp 1022 usb printer. I'm not sure whether I had tracked down this bug
completely but finally I created a working patch for cups.

/var/log/cups/error.log says:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
D [26/May/2006:20:56:35 +0200] Get-Jobs ipp://localhost.localdomain:631/printers/HP1022
D [26/May/2006:20:56:35 +0200] cupsdProcessIPPRequest: 5 status_code=0 (successful-ok)
D [26/May/2006:20:56:35 +0200] cupsdCloseClient: 5
D [26/May/2006:20:56:38 +0200] [Job 71] LPGETSTATUS returned a port status of 00...
W [26/May/2006:20:56:38 +0200] [Job 71] Printer fault!
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

this is the code snipped from backend/usb-unix.c that generates these
logging output:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  while (!ioctl(fd, LPGETSTATUS, &status))
  {
    fprintf(stderr, "DEBUG: LPGETSTATUS returned a port status of %02X...\n", status);

    if (status & LP_POUTPA)
    {
      fputs("WARNING: Media tray empty!\n", stderr);
      fputs("STATUS: +media-tray-empty-error\n", stderr);

      paperout = 1;
    }

    if (!(status & LP_PERRORP))
      fputs("WARNING: Printer fault!\n", stderr);
    else if (!(status & LP_PSELECD))
      fputs("WARNING: Printer off-line.\n", stderr);
    else
      break;

    sleep(5);
  }
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

first !ioctl(fd, LPGETSTATUS, &status) is ever evaluated to true (even
if status is 0). Maybe this is a side effect from a bug in the kernel.
Second I really don't know why the break statement is never reached, so
i applied following (ugly) patch that enabled printing for me:

--- cupsys-1.2.0/backend/usb-unix.c.orig        2006-05-26 22:08:53.000000000 +0200
+++ cupsys-1.2.0/backend/usb-unix.c     2006-05-26 22:09:43.000000000 +0200
@@ -158,7 +158,7 @@
   * Show the printer status before we send the file...
   */

-  while (!ioctl(fd, LPGETSTATUS, &status))
+  while (!ioctl(fd, LPGETSTATUS, &status) && status != 0)
   {
     fprintf(stderr, "DEBUG: LPGETSTATUS returned a port status of %02X...\n", status);

-- 
USB Printing problem
https://launchpad.net/bugs/37554




More information about the kernel-bugs mailing list