public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: Printing to off-line printer in 2.4.0-prerelease
@ 2001-01-04 15:30 Jesse Pollard
  2001-01-04 19:22 ` Gunther Mayer
  2001-01-04 23:20 ` David Ford
  0 siblings, 2 replies; 24+ messages in thread
From: Jesse Pollard @ 2001-01-04 15:30 UTC (permalink / raw)
  To: twaugh, Andrea Arcangeli; +Cc: Peter Osterlund, linux-kernel

---------  Received message begins Here  ---------
Tim Waugh <twaugh@redhat.com>:
> On Thu, Jan 04, 2001 at 03:39:10PM +0100, Andrea Arcangeli wrote:
> 
> > As noted yesterday falling into parport_write will silenty lose data when the
> > printer is off.
> 
> (Actually it depends; I think FIFO/DMA paths are fine, but yes, the
> software implementation can lose data.)
> 
> > If it's not feasible to make parport_write reliable against
> > power-off printer, then I recommend to loop in interruptible mode
> > before entering the main loop (waiting the printer to power-on) like
> > in latest patch from Peter.
> 
> Have I missed a patch?  How do you know whether or not the printer is
> on yet?
> 
> As I understand it, you can't guarantee anything about any of the
> signals when the printer is off, so all you can do is look for
> 'suspicous' things (like 'no error' and 'paper out').  But some
> printers do this during normal operation, and hence the LP_CAREFUL
> switch.
> 
> Return -EIO when the printer is on and off-line is a bug, sure enough.
> That's what the -EAGAIN patch was for, and Peter's patch fixes this
> too.
> 
> But if you want to avoid losing data when your printer is off you need
> to use LP_CAREFUL, and hope printing still works at all (depends on
> your printer).
> 
> If this goes away:
> 
>         if ((status & LP_PERRORP) && !(LP_F(minor) & LP_CAREFUL))
>                 /* No error. */
>                 last = 0;
> 
> then some people might not be able to print at all.

I don't believe this is a problem that CAN be fixe, either by hardware
or software.

Originally, (wayback machine on) this was handled by a pull-up resistor
in the parallel interface, on the "off-line" signal. ANY time the printer
was powered off, set offline, or cable unplugged, the "off-line" signal
was raised by the pull-up. No data lost.

Now the parallel interface is bidirectional, and can have multiple devices
attached - this "fix" cannot be used. The interface is now more of a 
buss than a single attached interface, and signals from a missing device
(powered off or disconnected) are floating. They may float high or low,
and depending on the environment (and which end of the cable is unplugged)
any thing in between.

Yes, I've lost printouts this way, but there's nothing I can really do
about it other than than tell the users "don't do that - make sure the
printer is turned on before you print".

-------------------------------------------------------------------------
Jesse I Pollard, II
Email: pollard@navo.hpc.mil

Any opinions expressed are solely my own.
-
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/

^ permalink raw reply	[flat|nested] 24+ messages in thread
* Printing to off-line printer in 2.4.0-prerelease
@ 2001-01-03 18:44 Peter Osterlund
  2001-01-03 19:13 ` Andrea Arcangeli
  2001-01-04 11:20 ` Tim Waugh
  0 siblings, 2 replies; 24+ messages in thread
From: Peter Osterlund @ 2001-01-03 18:44 UTC (permalink / raw)
  To: Andrea Arcangeli; +Cc: linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2337 bytes --]

Hello,

When trying to print to an off-line printer with 2.4 kernels, the
"write" system call to /dev/lp0 stalls for 10 seconds and then returns
EIO.  This has the unfortunate effect that the printout will be lost,
because the redhat print filters (in rh7) use "cat" to send data to
the printer device, and cat gives up when EIO is returned.

In 2.2 kernels, the write call waited until the printer went on-line
again.

I think the problem is that the lp_write() function in lp.c calls
lp_check_status() before starting to write to the parport, and if the
printer is not ready, it simply gives up. (The LP_ABORT flag is not
used in that case.)

The following patch makes things work for me again. The kernel keeps
generating the following debug messages until the printer becomes
ready, but that doesn't seem to cause any problems.

  Jan  3 18:54:27 ppro kernel: DMA write timed out
  Jan  3 18:54:37 ppro kernel: parport0: FIFO is stuck
  Jan  3 18:54:37 ppro kernel: parport0: BUSY timeout (1) in compat_write_block_pio
  Jan  3 18:54:37 ppro kernel: lp0 off-line

Is there a better way to fix this problem?

--- 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 18:48:42 2001
@@ -259,7 +259,6 @@
 	parport_set_timeout (lp_table[minor].dev,
 			     lp_table[minor].timeout);
 
-	if ((retv = lp_check_status (minor)) == 0)
 	do {
 		/* Write the data. */
 		written = parport_write (port, kbuf, copy_size);

--- 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 18:50:16 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/

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2001-01-05  1:22 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-04 15:30 Printing to off-line printer in 2.4.0-prerelease Jesse Pollard
2001-01-04 19:22 ` Gunther Mayer
2001-01-05  1:13   ` Jesse Pollard
2001-01-04 23:20 ` David Ford
  -- strict thread matches above, loose matches on Subject: below --
2001-01-03 18:44 Peter Osterlund
2001-01-03 19:13 ` Andrea Arcangeli
2001-01-03 21:00   ` Peter Osterlund
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox