Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

usb backend busy-loops due to runloop logic error #2664

michaelrsweet opened this Issue Jan 9, 2008 · 2 comments


None yet
1 participant

michaelrsweet commented Jan 9, 2008

Version: 1.3.5
CUPS.org User: twaugh.redhat

A logic error in backend/runloop.c causes the usb backend to use very much more power than it needs to.

The situation that triggers this is that backendRunLoop() is entered with use_bc==0 and side_cb!=NULL.

When print_bytes==0 in this situation, I think that this piece of code:

 if (print_bytes || !use_bc)
   FD_SET(device_fd, &output);

is trying to add device_fd to the output set if the select() call will be skipped. This worked up until revision 6170, which added the side_cb parts.

A patch to fix the logic error is attached. Original bug report:


michaelrsweet commented Jan 9, 2008

CUPS.org User: mike

Fixed in Subversion repository.

This actually affected all of the standard CUPS backends that used backendRunLoop() (parallel, serial, socket, usb), not just the USB backend.


michaelrsweet commented Jan 9, 2008


diff -up cups-1.3.5/backend/runloop.c~ cups-1.3.5/backend/runloop.c
--- cups-1.3.5/backend/runloop.c~ 2007-08-22 19:34:34.000000000 +0100
+++ cups-1.3.5/backend/runloop.c 2008-01-09 15:37:44.000000000 +0000
@@ -216,7 +216,7 @@ backendRunLoop(
FD_SET(CUPS_SC_FD, &input);

  • if (print_bytes || !use_bc)
  • if (print_bytes || (!use_bc && !side_cb))
    FD_SET(device_fd, &output);

if (use_bc || side_cb)

@michaelrsweet 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