You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
a Ubuntu user complains that the "usb" CUPS backend is crashing from time to time when he is printing and so some jobs do not get printed.
With the help of his core dump I could find out that if the reading of the device ID from the device fails in a certain way, having the IOCTL function not reporting an error but returning invalid data, the USB backend crashes. This happens if the reported length of the ID string (first two bytes) is zero or at least very small. I have created a patch which makes failure reported then instead of trying to convert the read ID string into a C string.
The patch is attached and the original bug reporter tells that the patch fixes the problem.
I have applied this patch and the patch of STR #3965 to the package in Ubuntu Oneiric now and asked the people suffering the following Ubuntu bugs for testing:
For the first three I got answers and they are definitely fixed by the two patches. On the other two I am still waiting for an answer but they are most probably also fixed.
Together with the USB fix on the Linux kernel (STR #3884) it looks like that all known problems of libusb-based USB printing (after deprecation of the "usblp" kernel module) are solved together with these two patches on the libusb-based "usb" CUPS backend. So I highly recommend the inclusion of the two patches in the upstream repository of CUPS, for both CUPS 1.5.x and 1.6.x.
Activity
michaelrsweet commentedon Nov 11, 2011
CUPS.org User: till.kamppeter
I have applied this patch and the patch of STR #3965 to the package in Ubuntu Oneiric now and asked the people suffering the following Ubuntu bugs for testing:
https://bugs.launchpad.net/ubuntu/+source/cups/+bug/887094
usb printer backend crashes
https://bugs.launchpad.net/ubuntu/+source/cups/+bug/872483
laser printer only prints first job correct
https://bugs.launchpad.net/ubuntu/+source/cups/+bug/883169
Brother MFC-8840D usb printer not detected
https://bugs.launchpad.net/ubuntu/+source/cups/+bug/793244
After suspend/hibernate usb printer backend repeatedly crashes
https://bugs.launchpad.net/ubuntu/+source/cups/+bug/564917
Ubuntu 10.04 does not recognize local printer connected via
USB/parallel adapter cable
For the first three I got answers and they are definitely fixed by the two patches. On the other two I am still waiting for an answer but they are most probably also fixed.
Together with the USB fix on the Linux kernel (STR #3884) it looks like that all known problems of libusb-based USB printing (after deprecation of the "usblp" kernel module) are solved together with these two patches on the libusb-based "usb" CUPS backend. So I highly recommend the inclusion of the two patches in the upstream repository of CUPS, for both CUPS 1.5.x and 1.6.x.
michaelrsweet commentedon Jan 27, 2012
CUPS.org User: mike
Fixed in Subversion repository.
michaelrsweet commentedon Jan 27, 2012
"usb-backend-gracefully-fail-on-more-cases-of-bad-device-id.patch":
--- a/backend/usb-libusb.c
+++ b/backend/usb-libusb.c
@@ -430,15 +430,26 @@
*/
length = (((unsigned)buffer[1] & 255) << 8) +
((unsigned)buffer[0] & 255);
if (length > bufsize)
length = bufsize;
length -= 2;
/*
michaelrsweet commentedon Jan 27, 2012
"str3965+3978.patch":
Index: backend/usb-libusb.c
--- backend/usb-libusb.c (revision 10195)
+++ backend/usb-libusb.c (working copy)
@@ -3,7 +3,7 @@
*
*
@@ -423,22 +423,34 @@
*/
((unsigned)buffer[1] & 255);
/*
*/
((unsigned)buffer[0] & 255);
if (length > bufsize)
length = bufsize;
length -= 2;
/*
@@ -631,6 +643,7 @@
int verbose) /* I - Update connecting-to-device state? /
{
int number; / Configuration/interface/altset numbers */
/*
@@ -647,27 +660,37 @@
if ((printer->handle = usb_open(printer->device)) == NULL)
return (-1);
/*
*/
number = printer->device->config[printer->conf].bConfigurationValue;
{
}
/*
@@ -679,41 +702,35 @@
while (usb_claim_interface(printer->handle, number) < 0)
{
if (errno != EBUSY)
goto error;
}
-#if 0 /* STR #3801: Claiming interface 0 causes problems with some printers */
if (printer->device->config[printer->conf].interface[printer->iface].
{
number = printer->device->config[printer->conf].interface[printer->iface].
while (usb_set_altinterface(printer->handle, number) < 0)
{
if (errno != EBUSY)
fprintf(stderr, "DEBUG: Failed to claim interface 0 for %04x:%04x: %s\n",
goto error;
}
-#endif /* 0 */
/*
* Set alternate setting...
- */
- printer->device->descriptor.idProduct, strerror(errno));
}
if (verbose)