usblp: continuously poll for status

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, March 26, 2009 - 12:28 pm

Gitweb:     http://git.kernel.org/linus/dd44be6b17ac52238aa6c7f46b906d9fb76e7052
Commit:     dd44be6b17ac52238aa6c7f46b906d9fb76e7052
Parent:     5c16034d73da2c1b663aa25dedadbc533b3d811c
Author:     Pete Zaitcev <zaitcev@redhat.com>
AuthorDate: Tue Jan 6 17:20:42 2009 -0700
Committer:  Greg Kroah-Hartman <gregkh@suse.de>
CommitDate: Tue Mar 24 16:20:26 2009 -0700

    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>
---
 drivers/usb/class/usblp.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index 3f3ee13..d2747a4 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -880,16 +880,19 @@ static int usblp_wwait(struct usblp *usblp, int nonblock)
 		if (rc <= 0)
 			break;
 
-		if (usblp->flags & LP_ABORT) {
-			if (schedule_timeout(msecs_to_jiffies(5000)) == 0) {
+		if (schedule_timeout(msecs_to_jiffies(1500)) == 0) {
+			if (usblp->flags & LP_ABORT) {
 				err = usblp_check_status(usblp, err);
 				if (err == 1) {	/* Paper out */
 					rc = -ENOSPC;
 					break;
 				}
+			} else {
+				/* Prod the printer, Gentoo#251237. */
+				mutex_lock(&usblp->mut);
+				usblp_read_status(usblp, usblp->statusbuf);
+				mutex_unlock(&usblp->mut);
 			}
-		} else {
-			schedule();
 		}
 	}
 	set_current_state(TASK_RUNNING);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
usblp: continuously poll for status, Linux Kernel Mailing ..., (Thu Mar 26, 12:28 pm)