Skip to contentSkip to conversation

Printing to off-line printer in 2.4.0-prerelease

DISCUSSION Jesse Pollard 4 participants 4 messages Jan 4, 2001 – Jan 5, 2001

lore
Share & tools
lore
#0 lore raw

--------- Received message begins Here --------- Tim Waugh <[email protected]>:

Quoted 30 lines · Andrea Arcangeli
Quoted 3 lines

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.)

Quoted 4 lines

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).

Quoted 7 lines

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: [email protected]

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 [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#1 lore raw
Quoted 11 lines · Jesse Pollard

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.

Not true. Electrical characteristics for parallel port implementations/cards differ wildly, nevertheless most implementations have:
- data lines: bidirectional (see datasheets)
- signal lines: see datasheets, never floating !

Floating signal lines are a silicon bug/bad engineering and have nothing to do with bidirectional interfaces !

Nowadays most integrated chips have internal signal line pull-ups internally, e.g. W83877TF says:
-BUSY, ACK, PE, SLCT, ERR:
TTL level input pin. This pin is pulled high internally.
-AFD, STB, INIT, SLIN
Open-drain output pin with 12 mA sink capability. Pulled up internally.
-Data lines:
TTL level bi-directional with 24 mA source-sink capability.

Of course I would expect add-in cards to exist, with not so sophisticated chipsets and makers that have "forgotten" external pull-ups for economical reasons (2 cents :-) We should NOT care for broken hardware !!! I haven't seen any of these yet, even.

On the other hand printer implmentations vary wildly, too.
LJ1100: leave signal lines alone if powered off (0x7f)
i.e. signal printer-not-ready ack-active out-of-paper
DJ500: signal printer-error and off-line when powered off (0x87) !!!
=> Linux would dump data on this printer, if switched off.

I think the current linux lp code tries to handle exotic/weird printers gracefully and leaves mainstream printers and users alone.
-
Gunther
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw
In reply to Jesse Pollard

The only way to _assume_ a printer is online is to attempt a dummy poll for information. Again note that this is a strong assumption as only some new printers return data for a poll, and legacy printers control of the data port are undefined.

The poll btw needs to be done in userspace because printers respond differently with different polls. Thus a 'printer driver' interface needs developed. Oddly enough, WinPrinters won't suffer this problem simply because of their bidirectional design :(

-d

Quoted 63 lines · Jesse Pollard

--------- Received message begins Here --------- Tim Waugh <[email protected]>:

Quoted 30 lines · Andrea Arcangeli
Quoted 3 lines

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.)

Quoted 4 lines

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).

Quoted 7 lines

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: [email protected]

Quoted 5 lines

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 [email protected]
Please read the FAQ at http://www.tux.org/lkml/

begin:vcard
n:Ford;David
x-mozilla-html:TRUE
url:www.blue-labs.org
adr:;;;;;;
version:2.1
email;internet:[email protected]
title:Blue Labs Developer
note;quoted-printable:GPG key: http://www.blue-labs.org/[email protected]=0D=0A
x-mozilla-cpt:;9952
fn:David Ford
end:vcard

#3 lore raw
In reply to Jesse Pollard
Quoted 13 lines · Gunther Mayer
Quoted 11 lines · Jesse Pollard

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.

Quoted 7 lines

Not true. Electrical characteristics for parallel port implementations/cards differ wildly, nevertheless most implementations have:
- data lines: bidirectional (see datasheets)
- signal lines: see datasheets, never floating !

Floating signal lines are a silicon bug/bad engineering and have nothing to do with bidirectional interfaces !

I didn't mean to imply that it was - just that it is much harder to determine if the device is attached or detatched. That depends on the characteristics of the interface and the cable (acting as an antenna).

Quoted 14 lines

Nowadays most integrated chips have internal signal line pull-ups internally, e.g. W83877TF says:

(quoted diff) +0 -3
-BUSY, ACK, PE, SLCT, ERR:
 TTL level input pin. This pin is pulled high internally.
-AFD, STB, INIT, SLIN
 Open-drain output pin with 12 mA sink capability. Pulled up internally.
-Data lines:
 TTL level bi-directional with 24 mA source-sink capability.

Of course I would expect add-in cards to exist, with not so sophisticated chipsets and makers that have "forgotten" external pull-ups for economical reasons (2 cents :-) We should NOT care for broken hardware !!! I haven't seen any of these yet, even.

Quoted 8 lines

On the other hand printer implmentations vary wildly, too.
LJ1100: leave signal lines alone if powered off (0x7f)
i.e. signal printer-not-ready ack-active out-of-paper
DJ500: signal printer-error and off-line when powered off (0x87) !!!
=> Linux would dump data on this printer, if switched off.

I think the current linux lp code tries to handle exotic/weird printers gracefully and leaves mainstream printers and users alone.

It all depends - I've seen printers work perfectly ... and yet others completely fail. The Xerox 5700 printers wouldn't work if the cable were over 9 feet long. They would if a high signal quality data cable were obtained, worked at 15', but no longer than that. Even then, they would not identify (and neither would Zerox) what happens when they were powered off (you loose data).

And yet no problem with a HP laserjet at 40'.

And the signals do vary if it is unplugged at the printer end and not at the host end (major difference - shielded cable works MUCH better).

Signature · 9 lines
-------------------------------------------------------------------------
Jesse I Pollard, II
Email: [email protected]

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 [email protected]
Please read the FAQ at http://www.tux.org/lkml/