From: Peter Osterlund <peter.osterlund@mailbox.swipnet.se>
To: Andrea Arcangeli <andrea@suse.de>
Cc: Peter Osterlund <peter.osterlund@mailbox.swipnet.se>,
linux-kernel@vger.kernel.org, linux-parport@torque.net,
tim@cyberelk.demon.co.uk
Subject: Re: Printing to off-line printer in 2.4.0-prerelease
Date: 03 Jan 2001 22:00:59 +0100 [thread overview]
Message-ID: <m2hf3gz6yc.fsf@ppro.localdomain> (raw)
In-Reply-To: <m2k88czda4.fsf@ppro.localdomain> <20010103201344.A3203@athlon.random>
In-Reply-To: Andrea Arcangeli's message of "Wed, 3 Jan 2001 20:13:44 +0100"
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3362 bytes --]
Andrea Arcangeli <andrea@suse.de> writes:
> On Wed, Jan 03, 2001 at 07:44:19PM +0100, Peter Osterlund wrote:
> > Is there a better way to fix this problem?
>
> It looks the simpler fix to me (main loop needs someway to handle errors
> anyways) but ask Tim too.
>
> Another way to fix it is to loop in interruptible mode inside lp_error waiting
> the error to go away.
I didn't give my previous patch enough testing. It still doesn't work
if I queue a print job when my printer (HP LaserJet 4MP) is powered
off. Apparently the printer tells the computer it is OK to send data
to it when it is off.
Anyway, this new patch works for all tests I could think of. I tested
with the printer initially powered off, initially powered on but in
offline mode and initially powered on and in online mode. It also
works if I put the printer in offline mode during sending of a print
job. (tunelp -a and -o also work as expected.)
I also only get one DMA write timeout when putting the printer in
offline mode during sending, instead of repeated timeouts as I got
with the previous patch.
Here is the new patch:
--- linux-2.4.0-prerelease/drivers/char/lp.c.orig Wed Jan 3 18:48:39 2001
+++ linux-2.4.0-prerelease/drivers/char/lp.c Wed Jan 3 21:41:31 2001
@@ -231,6 +231,7 @@
ssize_t retv = 0;
ssize_t written;
size_t copy_size = count;
+ int check_status;
#ifdef LP_STATS
if (jiffies-lp_table[minor].lastcall > LP_TIME(minor))
@@ -259,10 +260,26 @@
parport_set_timeout (lp_table[minor].dev,
lp_table[minor].timeout);
- if ((retv = lp_check_status (minor)) == 0)
+ check_status = 1;
do {
- /* Write the data. */
- written = parport_write (port, kbuf, copy_size);
+ int error = 0;
+ if (check_status) {
+ error = lp_check_status (minor);
+ if (error) {
+ if (LP_F(minor) & LP_ABORT) {
+ if (retv == 0)
+ retv = error;
+ break;
+ }
+ parport_yield_blocking (lp_table[minor].dev);
+ }
+ check_status = 0;
+ }
+ if (error == 0)
+ /* Write the data. */
+ written = parport_write (port, kbuf, copy_size);
+ else
+ written = 0;
if (written >= 0) {
copy_size -= written;
count -= written;
@@ -279,15 +296,7 @@
if (copy_size > 0) {
/* incomplete write -> check error ! */
- int error = lp_check_status (minor);
-
- if (LP_F(minor) & LP_ABORT) {
- if (retv == 0)
- retv = error;
- break;
- }
-
- parport_yield_blocking (lp_table[minor].dev);
+ check_status = 1;
} else if (current->need_resched)
schedule ();
--- linux-2.4.0-prerelease/drivers/parport/ieee1284.c.orig Wed Jan 3 18:50:02 2001
+++ linux-2.4.0-prerelease/drivers/parport/ieee1284.c Wed Jan 3 21:32:28 2001
@@ -524,7 +524,8 @@
PARPORT_STATUS_PAPEROUT,
PARPORT_STATUS_PAPEROUT);
if (r)
- DPRINTK (KERN_INFO "%s: Timeout at event 31\n");
+ DPRINTK (KERN_INFO "%s: Timeout at event 31\n",
+ port->name);
port->ieee1284.phase = IEEE1284_PH_FWD_IDLE;
DPRINTK (KERN_DEBUG "%s: ECP direction: forward\n",
--
Peter Österlund peter.osterlund@mailbox.swipnet.se
Sköndalsvägen 35 http://home1.swipnet.se/~w-15919
S-128 66 Sköndal +46 8 942647
Sweden
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2001-01-03 21:02 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-01-03 18:44 Peter Osterlund
2001-01-03 19:13 ` Andrea Arcangeli
2001-01-03 21:00 ` Peter Osterlund [this message]
2001-01-03 21:35 ` Andrea Arcangeli
2001-01-04 0:08 ` Peter Osterlund
2001-01-04 0:41 ` Andrea Arcangeli
2001-01-04 1:09 ` Peter Osterlund
2001-01-04 1:39 ` Andrea Arcangeli
2001-01-04 11:17 ` Tim Waugh
2001-01-04 9:27 ` Tim Waugh
2001-01-04 13:50 ` Andrea Arcangeli
2001-01-04 11:20 ` Tim Waugh
2001-01-04 13:52 ` Andrea Arcangeli
2001-01-04 14:20 ` Tim Waugh
2001-01-04 14:39 ` Andrea Arcangeli
2001-01-04 14:54 ` Tim Waugh
2001-01-04 19:45 ` Peter Osterlund
2001-01-04 19:07 ` Peter Osterlund
2001-01-04 21:52 ` Tim Waugh
2001-01-05 0:33 ` Peter Osterlund
2001-01-04 15:30 Jesse Pollard
2001-01-04 19:22 ` Gunther Mayer
2001-01-05 1:13 ` Jesse Pollard
2001-01-04 23:20 ` David Ford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2hf3gz6yc.fsf@ppro.localdomain \
--to=peter.osterlund@mailbox.swipnet.se \
--cc=andrea@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parport@torque.net \
--cc=tim@cyberelk.demon.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®