CanonIP4200 does not print complete pages #4155

Closed
michaelrsweet opened this Issue Aug 2, 2012 · 21 comments

Comments

Projects
None yet
1 participant
Collaborator

michaelrsweet commented Aug 2, 2012

Version: 1.6.1
CUPS.org User: stosch

Since the release of CUPS 1.5.4 my printer does not print complete pages any more (e.g. testpage finishes at about 3/4). The job however is logged as completed. Reverting to 1.5.3 solves the problem in general.
Seldomly there are jobs which are not finished and the printer just hangs. I then have to turn of the power of the printer. I had this problem with 1.5.3 yesterday but cannot reproduce it.
My guess would be, that it has something to do with the usblp/libusb changes here: http://cups.org/str.php?L4128. Especially the comment to the usb-libusb-c-update-1-5-x-3.patch sounds familiar.

In addition: I am using Archlinux x86_64. In earlier days it was suggested to blacklist usblp - I tested both versions - with and without usblp - and got the same results.
I enabled Debugging in cupsd.conf and received no errors.

Please tell me if you need any further information.

Collaborator

michaelrsweet commented Aug 2, 2012

CUPS.org User: mike

What printer?

Can you provide a debug error_log file? Run:

cupsctl --debug-logging

to enable debug logging, print something, then attach the /var/log/cups/error_log file.

Thanks!

Collaborator

michaelrsweet commented Aug 2, 2012

CUPS.org User: stosch

I attached the error_log. My printer is a Canon PIXMA iP4200 (ID: 04a9:10a2)

Collaborator

michaelrsweet commented Aug 3, 2012

CUPS.org User: Le_Limule

i think i have exactly the same pb with a Canon PIXMA IP1600.
the bug let no error in error_log.

[guigui@ctkarch ~]$ uname -a
Linux ctkarch 3.4.7-1-ARCH #1 SMP PREEMPT Sun Jul 29 20:05:01 UTC 2012 i686 GNU/Linux
[guigui@ctkarch ~]$

[guigui@ctkarch ~]$ lsusb
Bus 003 Device 002: ID 046d:c00c Logitech, Inc. Optical Wheel Mouse
Bus 004 Device 004: ID 04a9:10a0 Canon, Inc. PIXMA iP1600 Printer
Bus 004 Device 003: ID 0553:0202 STMicroelectronics Imaging Division (VLSI Vision) Aiptek PenCam 1
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
[guigui@ctkarch ~]$

[guigui@ctkarch ~]$ tail /var/log/messages.log
Aug 2 19:18:51 localhost dbus[299]: [system] Activating service name='org.freedesktop.UDisks' (using servicehelper)
Aug 2 19:18:51 localhost dbus[299]: [system] Successfully activated service 'org.freedesktop.UDisks'
Aug 2 19:19:05 localhost dbus[299]: [system] Failed to activate service 'org.freedesktop.Avahi': timed out
Aug 2 19:19:16 localhost kernel: [ 75.626703] usb 4-1: reset full-speed USB device number 2 using ohci_hcd
Aug 2 19:21:14 localhost kernel: [ 193.516692] usb 4-1: reset full-speed USB device number 2 using ohci_hcd
Aug 2 19:30:02 localhost kernel: [ 721.876731] usb 4-1: reset full-speed USB device number 2 using ohci_hcd
Aug 2 19:30:41 localhost kernel: [ 760.929964] usb 4-1: reset full-speed USB device number 2 using ohci_hcd
Aug 2 19:42:52 localhost kernel: [ 1491.969893] usb 4-1: reset full-speed USB device number 2 using ohci_hcd
Aug 2 19:59:56 localhost kernel: [ 2516.113416] usb 4-1: USB disconnect, device number 2
Aug 2 20:00:01 localhost kernel: [ 2520.583126] usb 4-1: new full-speed USB device number 4 using ohci_hcd
[guigui@ctkarch ~]$

i downgraded cups to 1.5.3-5. and it seems to works (i will see...). (i let libcups 1.6.1-1)

Collaborator

michaelrsweet commented Aug 4, 2012

CUPS.org User: till.kamppeter

The problem is a port reset which is done by the new USB backend of CUPS 1.5.4 and 1.6.x to clean up after the job. I will add a quirk handler for this reset so that it will not be done for all printers.

Collaborator

michaelrsweet commented Aug 4, 2012

CUPS.org User: till.kamppeter

See also https://bugs.launchpad.net/ubuntu/+source/cups/+bug/1032456

Collaborator

michaelrsweet commented Aug 6, 2012

CUPS.org User: till.kamppeter

Patch to fix this bug is attached. The reset after the job will now only be done for Samsung printers and for Prolific Technology USB->Parallel adapters as they need the reset to work correctly.

Collaborator

michaelrsweet commented Aug 6, 2012

CUPS.org User: stosch

Thank you. The patch solves the problem of not completing the pages. Though I still have some problems which are pretty random and obviously depending on the software I use:
As I described earlier the printer sometimes hangs after some lines of printing and the only help is to unplug it. I tried it both with and without usblp kernel module loaded. The dmesg output which seems to correlate with this is:
usblp0: USB Bidirectional printer dev 9 if 0 alt 0 proto 2 vid 0x04A9 pid 0x10A2
usblp0: removed
usblp: can't set desired altsetting 0 on interface 0
The problem occures within Openoffice and Canon CD-Labelprint but I haven't experienced it with Adobe Reader. I also had this problem with CUPS 1.5.3.
Is this somehow related or should I open a new bug report?

Collaborator

michaelrsweet commented Aug 6, 2012

CUPS.org User: till.kamppeter

On https://bugs.launchpad.net/ubuntu/+source/cups/+bug/1032456 two users have already confirmed that the patch fixes this bug. I have also done a regression test with the Prolific Technology USB->Parallel adapter (needs the after-job reset and has therefore a quirk rule) and it still works.

Collaborator

michaelrsweet commented Aug 6, 2012

CUPS.org User: stosch

Ok, I think(/hope) I found the problem. As you (till.kamppeter) posted somewhere else (https://bugs.launchpad.net/ubuntu/+source/cups/+bug/1001028/comments/33) to a slightly different problem I tried to execute:
lpadmin -p -o usb-unidir-default=true
Since then I have printed about 20 jobs without hangs and everything works perfectly.
Thank you again for your great help.

Collaborator

michaelrsweet commented Aug 7, 2012

CUPS.org User: till.kamppeter

We have issued the patch now as a Stable Release Update for Ubuntu 12.04 LTS and more people have confirmed that it fixes their problems.

Collaborator

michaelrsweet commented Aug 10, 2012

CUPS.org User: till.kamppeter

Attached is an update for my patch. It adds two quirk rules to force uni-directional communication with the Canon Pixma iP4200 and iP4300. This should solve the problem of stosch in this bug report and also https://bugs.launchpad.net/bugs/1032385.

Collaborator

michaelrsweet commented Aug 16, 2012

CUPS.org User: stosch

Thanks for the update. It works perfectly here, too.

Collaborator

michaelrsweet commented Aug 20, 2012

CUPS.org User: till.kamppeter

Unfortunately, the previous patches caused a regression. The quirk rule for all Samsung printers to still get the clean-up reset did not work making all Samsungs not working with the USB backend.

I have fixed this now and so from now on all-of-a-manufacturer quirk rules (product ID set to 0x0000) work.

Collaborator

michaelrsweet commented Aug 28, 2012

CUPS.org User: mike

Fixed in Subversion repository.

Collaborator

michaelrsweet commented Sep 14, 2012

CUPS.org User: gentoo_root

I have the same problem with Canon Pixma MP550 (04a9:173d). Please add quirk for this printer too.

Collaborator

michaelrsweet commented Sep 17, 2012

CUPS.org User: till.kamppeter

Thank you for the hint. I am preparing some additional quirk rules currently and I will add your printer.

Collaborator

michaelrsweet commented Sep 22, 2012

CUPS.org User: fitzcarraldo

I am not sure whether or not I am supposed to file a new bug report, as I believe the problem I am experiencing is the same as reported here, but this report has been closed with resolution, but the patches attached do not refer to the model of printer I have that is suffering from the problem of incomplete pages being printed. The printer is a Canon PIXMA MP560 (04a9:173e), so would you kindly add this printer to your patch. Thank you.

Collaborator

michaelrsweet commented Sep 24, 2012

CUPS.org User: till.kamppeter

fitzcarraldo, I have submitted the fix for your problem together with fixes for other printers as STR #4191.

Collaborator

michaelrsweet commented Sep 24, 2012

"usb-backend-reset-after-job-only-for-specific-devices.patch":

--- backend/usb-libusb.c.orig 2012-07-16 19:10:55.000000000 +0200
+++ backend/usb-libusb.c 2012-08-06 11:01:58.034150159 +0200
@@ -70,7 +70,7 @@
read_endp, /* Read endpoint /
protocol, /
Protocol: 1 = Uni-di, 2 = Bi-di. /
usblp_attached, /
"usblp" kernel module attached? */

  •       opened_for_job; /\* Set to 1 by print_device() */
    
  •       reset_after_job; /\* Set to 1 by print_device() _/
    
    unsigned int quirks; /_ Quirks flags /
    struct libusb_device_handle *handle; /
    Open handle to device /
    } usb_printer_t;
    @@ -122,6 +122,8 @@
    #define USBLP_QUIRK_USB_INIT 0x2 /
    needs vendor USB init string /
    #define USBLP_QUIRK_BAD_CLASS 0x4 /
    descriptor uses vendor-specific
    Class or SubClass /
    +#define USBLP_QUIRK_RESET 0x4000 /
    After printing do a reset
  •                  for clean-up _/
    
    #define USBLP_QUIRK_NO_REATTACH 0x8000 /_ After printing we cannot re-attach
    the usblp kernel module */

@@ -147,9 +149,11 @@
{ 0x04b8, 0x0202, USBLP_QUIRK_BAD_CLASS }, /* Seiko Epson Receipt
Printer M129C */
{ 0x067b, 0x2305, USBLP_QUIRK_BIDIR |

  •         USBLP_QUIRK_NO_REATTACH },
    
  •         USBLP_QUIRK_NO_REATTACH |
    
  •                 USBLP_QUIRK_RESET },
    
    /* Prolific Technology, Inc. PL2305 Parallel Port
    (USB -> Parallel adapter) */
  • { 0x04e8, 0x0000, USBLP_QUIRK_RESET }, /* All Samsung devices */
    { 0, 0 }
    };

@@ -256,7 +260,12 @@
}

g.print_fd = print_fd;

  • g.printer->opened_for_job = 1;
  • /*
  • * Some devices need a reset after finishing a job, these devices are
  • * marked with the USBLP_QUIRK_RESET quirk.
  • */
  • g.printer->reset_after_job = (g.printer->quirks & USBLP_QUIRK_RESET ? 1 : 0);

/*

  • If we are printing data from a print driver on stdin, ignore SIGTERM
    @@ -772,7 +781,7 @@
    • Reset the device to clean up after the job
      */
  • if (printer->opened_for_job == 1)
  • if (printer->reset_after_job == 1)
    {
    if ((errcode = libusb_reset_device(printer->handle)) < 0)
    fprintf(stderr,
    @@ -1288,7 +1297,7 @@
    }

printer->usblp_attached = 0;

  • printer->opened_for_job = 0;
  • printer->reset_after_job = 0;

if (verbose)
fputs("STATE: +connecting-to-device\n", stderr);
@@ -1586,7 +1595,7 @@
for (i = 0; quirk_printers[i].vendorId; i++)
{
if (vendor == quirk_printers[i].vendorId &&

  • product == quirk_printers[i].productId)
  • (product == 0x0000 || product == quirk_printers[i].productId))
    return quirk_printers[i].quirks;
    }
    return 0;
Collaborator

michaelrsweet commented Sep 24, 2012

"usb-backend-reset-after-job-only-for-specific-devices-2.patch":

--- cups/backend/usb-libusb.c 2012-07-24 18:37:15.312013467 +0200
+++ usb-libusb.c 2012-08-10 18:31:34.227441856 +0200
@@ -70,7 +70,7 @@
read_endp, /* Read endpoint /
protocol, /
Protocol: 1 = Uni-di, 2 = Bi-di. /
usblp_attached, /
"usblp" kernel module attached? */

  •       opened_for_job; /\* Set to 1 by print_device() */
    
  •       reset_after_job; /\* Set to 1 by print_device() _/
    
    unsigned int quirks; /_ Quirks flags /
    struct libusb_device_handle *handle; /
    Open handle to device /
    } usb_printer_t;
    @@ -122,6 +122,8 @@
    #define USBLP_QUIRK_USB_INIT 0x2 /
    needs vendor USB init string /
    #define USBLP_QUIRK_BAD_CLASS 0x4 /
    descriptor uses vendor-specific
    Class or SubClass /
    +#define USBLP_QUIRK_RESET 0x4000 /
    After printing do a reset
  •                  for clean-up _/
    
    #define USBLP_QUIRK_NO_REATTACH 0x8000 /_ After printing we cannot re-attach
    the usblp kernel module */

@@ -141,15 +143,21 @@
{ 0x0409, 0xf1be, USBLP_QUIRK_BIDIR }, /* NEC Picty800 (HP OEM) /
{ 0x0482, 0x0010, USBLP_QUIRK_BIDIR }, /
Kyocera Mita FS 820,
by zut kernel@zut.de */

  • { 0x04a9, 0x10a2, USBLP_QUIRK_BIDIR }, /* Canon, Inc. PIXMA iP4200
  •           Printer, http://www.cups.org/str.php?L4155 */
    
  • { 0x04a9, 0x10b6, USBLP_QUIRK_BIDIR }, /* Canon, Inc. PIXMA iP4300
  •           Printer, https://bugs.launchpad.net/bugs/1032385 _/
    
    { 0x04f9, 0x000d, USBLP_QUIRK_BIDIR |
    USBLP_QUIRK_NO_REATTACH }, /_ Brother Industries, Ltd
    HL-1440 Laser Printer /
    { 0x04b8, 0x0202, USBLP_QUIRK_BAD_CLASS }, /
    Seiko Epson Receipt
    Printer M129C */
    { 0x067b, 0x2305, USBLP_QUIRK_BIDIR |
  •         USBLP_QUIRK_NO_REATTACH },
    
  •         USBLP_QUIRK_NO_REATTACH |
    
  •                 USBLP_QUIRK_RESET },
    
    /* Prolific Technology, Inc. PL2305 Parallel Port
    (USB -> Parallel adapter) */
  • { 0x04e8, 0x0000, USBLP_QUIRK_RESET }, /* All Samsung devices */
    { 0, 0 }
    };

@@ -256,7 +264,12 @@
}

g.print_fd = print_fd;

  • g.printer->opened_for_job = 1;
  • /*
  • * Some devices need a reset after finishing a job, these devices are
  • * marked with the USBLP_QUIRK_RESET quirk.
  • */
  • g.printer->reset_after_job = (g.printer->quirks & USBLP_QUIRK_RESET ? 1 : 0);

/*

  • If we are printing data from a print driver on stdin, ignore SIGTERM
    @@ -772,7 +785,7 @@
    • Reset the device to clean up after the job
      */
  • if (printer->opened_for_job == 1)
  • if (printer->reset_after_job == 1)
    {
    if ((errcode = libusb_reset_device(printer->handle)) < 0)
    fprintf(stderr,
    @@ -1288,7 +1301,7 @@
    }

printer->usblp_attached = 0;

  • printer->opened_for_job = 0;
  • printer->reset_after_job = 0;

if (verbose)
fputs("STATE: +connecting-to-device\n", stderr);
@@ -1586,7 +1599,7 @@
for (i = 0; quirk_printers[i].vendorId; i++)
{
if (vendor == quirk_printers[i].vendorId &&

  • product == quirk_printers[i].productId)
  • (product == 0x0000 || product == quirk_printers[i].productId))
    return quirk_printers[i].quirks;
    }
    return 0;
Collaborator

michaelrsweet commented Sep 24, 2012

"usb-backend-reset-after-job-only-for-specific-devices-3.patch":

--- backend/usb-libusb.c 2012-07-24 18:37:15.312013467 +0200
+++ backend/usb-libusb.c 2012-08-20 13:17:53.565679124 +0200
@@ -70,7 +70,7 @@
read_endp, /* Read endpoint /
protocol, /
Protocol: 1 = Uni-di, 2 = Bi-di. /
usblp_attached, /
"usblp" kernel module attached? */

  •       opened_for_job; /\* Set to 1 by print_device() */
    
  •       reset_after_job; /\* Set to 1 by print_device() _/
    
    unsigned int quirks; /_ Quirks flags /
    struct libusb_device_handle *handle; /
    Open handle to device /
    } usb_printer_t;
    @@ -122,6 +122,8 @@
    #define USBLP_QUIRK_USB_INIT 0x2 /
    needs vendor USB init string /
    #define USBLP_QUIRK_BAD_CLASS 0x4 /
    descriptor uses vendor-specific
    Class or SubClass /
    +#define USBLP_QUIRK_RESET 0x4000 /
    After printing do a reset
  •                  for clean-up _/
    
    #define USBLP_QUIRK_NO_REATTACH 0x8000 /_ After printing we cannot re-attach
    the usblp kernel module */

@@ -141,15 +143,21 @@
{ 0x0409, 0xf1be, USBLP_QUIRK_BIDIR }, /* NEC Picty800 (HP OEM) /
{ 0x0482, 0x0010, USBLP_QUIRK_BIDIR }, /
Kyocera Mita FS 820,
by zut kernel@zut.de */

  • { 0x04a9, 0x10a2, USBLP_QUIRK_BIDIR }, /* Canon, Inc. PIXMA iP4200
  •           Printer, http://www.cups.org/str.php?L4155 */
    
  • { 0x04a9, 0x10b6, USBLP_QUIRK_BIDIR }, /* Canon, Inc. PIXMA iP4300
  •           Printer, https://bugs.launchpad.net/bugs/1032385 _/
    
    { 0x04f9, 0x000d, USBLP_QUIRK_BIDIR |
    USBLP_QUIRK_NO_REATTACH }, /_ Brother Industries, Ltd
    HL-1440 Laser Printer /
    { 0x04b8, 0x0202, USBLP_QUIRK_BAD_CLASS }, /
    Seiko Epson Receipt
    Printer M129C */
    { 0x067b, 0x2305, USBLP_QUIRK_BIDIR |
  •         USBLP_QUIRK_NO_REATTACH },
    
  •         USBLP_QUIRK_NO_REATTACH |
    
  •                 USBLP_QUIRK_RESET },
    
    /* Prolific Technology, Inc. PL2305 Parallel Port
    (USB -> Parallel adapter) */
  • { 0x04e8, 0x0000, USBLP_QUIRK_RESET }, /* All Samsung devices */
    { 0, 0 }
    };

@@ -256,7 +264,12 @@
}

g.print_fd = print_fd;

  • g.printer->opened_for_job = 1;
  • /*
  • * Some devices need a reset after finishing a job, these devices are
  • * marked with the USBLP_QUIRK_RESET quirk.
  • */
  • g.printer->reset_after_job = (g.printer->quirks & USBLP_QUIRK_RESET ? 1 : 0);

/*

  • If we are printing data from a print driver on stdin, ignore SIGTERM
    @@ -772,7 +785,7 @@
    • Reset the device to clean up after the job
      */
  • if (printer->opened_for_job == 1)
  • if (printer->reset_after_job == 1)
    {
    if ((errcode = libusb_reset_device(printer->handle)) < 0)
    fprintf(stderr,
    @@ -1288,7 +1301,7 @@
    }

printer->usblp_attached = 0;

  • printer->opened_for_job = 0;
  • printer->reset_after_job = 0;

if (verbose)
fputs("STATE: +connecting-to-device\n", stderr);
@@ -1586,7 +1599,8 @@
for (i = 0; quirk_printers[i].vendorId; i++)
{
if (vendor == quirk_printers[i].vendorId &&

  • product == quirk_printers[i].productId)
  • (quirk_printers[i].productId == 0x0000 ||
  • product == quirk_printers[i].productId))
    return quirk_printers[i].quirks;
    }
    return 0;

michaelrsweet added this to the Stable milestone Mar 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment