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

Closed
michaelrsweet opened this Issue Jan 9, 2008 · 2 comments

Comments

Projects
None yet
1 participant
Collaborator

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:
https://bugzilla.redhat.com/show_bug.cgi?id=426653

Collaborator

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.

Collaborator

michaelrsweet commented Jan 9, 2008

"cups-runloop.patch":

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);

 FD_ZERO(&output);
  • 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