/[linux-patches]/genpatches-2.6/trunk/2.6.30/2700_usblp-poll-for-status.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.30/2700_usblp-poll-for-status.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1572 - (show annotations) (download) (as text)
Fri Jun 5 16:26:11 2009 UTC (11 years, 6 months ago) by mpagano
File MIME type: text/x-diff
File size: 1808 byte(s)
Creating 2.6.30 branch from 2.6.29
1 From: Pete Zaitcev <zaitcev@redhat.com>
2 Date: Wed, 7 Jan 2009 00:20:42 +0000 (-0700)
3 Subject: usblp: continuously poll for status
4 X-Git-Tag: v2.6.30-rc1~670^2~93
5 X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=dd44be6b17ac52238aa6c7f46b906d9fb76e7052
6
7 usblp: continuously poll for status
8
9 The usblp in 2.6.18 polled for status regardless if we actually needed it.
10 At some point I dropped it, to save the batteries if nothing else.
11 As it turned out, printers exist (e.g. Canon BJC-3000) that need prodding
12 this way or else they stop. This patch restores the old behaviour.
13 If you want to save battery, don't leave jobs in the print queue.
14
15 I tested this on my printers by printing and examining usbmon traces
16 to make sure status is being requested and printers continue to print.
17 Tuomas Jäntti verified the fix on BJC-3000.
18
19 Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
21 ---
22
23 diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
24 index 3f3ee13..d2747a4 100644
25 --- a/drivers/usb/class/usblp.c
26 +++ b/drivers/usb/class/usblp.c
27 @@ -880,16 +880,19 @@ static int usblp_wwait(struct usblp *usblp, int nonblock)
28 if (rc <= 0)
29 break;
30
31 - if (usblp->flags & LP_ABORT) {
32 - if (schedule_timeout(msecs_to_jiffies(5000)) == 0) {
33 + if (schedule_timeout(msecs_to_jiffies(1500)) == 0) {
34 + if (usblp->flags & LP_ABORT) {
35 err = usblp_check_status(usblp, err);
36 if (err == 1) { /* Paper out */
37 rc = -ENOSPC;
38 break;
39 }
40 + } else {
41 + /* Prod the printer, Gentoo#251237. */
42 + mutex_lock(&usblp->mut);
43 + usblp_read_status(usblp, usblp->statusbuf);
44 + mutex_unlock(&usblp->mut);
45 }
46 - } else {
47 - schedule();
48 }
49 }
50 set_current_state(TASK_RUNNING);
51

  ViewVC Help
Powered by ViewVC 1.1.20