Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usblp: continuously poll for status

The usblp in 2.6.18 polled for status regardless if we actually needed it.
At some point I dropped it, to save the batteries if nothing else.
As it turned out, printers exist (e.g. Canon BJC-3000) that need prodding
this way or else they stop. This patch restores the old behaviour.
If you want to save battery, don't leave jobs in the print queue.

I tested this on my printers by printing and examining usbmon traces
to make sure status is being requested and printers continue to print.
Tuomas Jäntti verified the fix on BJC-3000.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Pete Zaitcev and committed by
Greg Kroah-Hartman
dd44be6b 5c16034d

+7 -4
+7 -4
drivers/usb/class/usblp.c
··· 880 880 if (rc <= 0) 881 881 break; 882 882 883 - if (usblp->flags & LP_ABORT) { 884 - if (schedule_timeout(msecs_to_jiffies(5000)) == 0) { 883 + if (schedule_timeout(msecs_to_jiffies(1500)) == 0) { 884 + if (usblp->flags & LP_ABORT) { 885 885 err = usblp_check_status(usblp, err); 886 886 if (err == 1) { /* Paper out */ 887 887 rc = -ENOSPC; 888 888 break; 889 889 } 890 + } else { 891 + /* Prod the printer, Gentoo#251237. */ 892 + mutex_lock(&usblp->mut); 893 + usblp_read_status(usblp, usblp->statusbuf); 894 + mutex_unlock(&usblp->mut); 890 895 } 891 - } else { 892 - schedule(); 893 896 } 894 897 } 895 898 set_current_state(TASK_RUNNING);