Re: [PARPORT] Patch: 2.3.99pre8-lp.c Report Printer Status

From: Gunther Mayer (gunther.mayer@braunschweig.okersurf.de)
Date: Wed May 17 2000 - 15:13:14 EDT

  • Next message: Barrios G. Carlos I.: "[PARPORT] an easy question..."

    Tim Waugh wrote:

    > On Mon, May 15, 2000 at 08:38:00PM +0100, Philip Blundell wrote:
    >
    > > It looks to me like the old code should have handled the `offline' case.
    >
    > It Works For Me.

    So I retried, it works here only after "tunelp /dev/lp0 -C on".

    There is contradicting information floating around:
    1)
    linux-2.3.99pre8/drivers/char/lp.c:
         * Obsoleted the CAREFUL flag since a printer that doesn' t work with
         * CAREFUL will block a bit after in lp_check_status().
         * Andrea Arcangeli, 15 Oct 1998
    2) man tunelp
           -C [on|off]
                  This option adds extra ("careful") error checking.
                  When this option is on, the printer driver will
                  ensure that the printer is on-line and not report­
                  ing any out of paper or other errors before sending
                  data. This is particularly useful for printers
                  that normally appear to accept data when turned
                  off.
                  NOTE: This option is obsolete because it's the
                  default in 2.1.131 kernel or later.

    For 2.3.99 man tunelp is incorrect, the printer will try to send the data
    without even considering LP_CAREFUL. Only if the printer takes
    a timeout (10 sec) it will look at the status lines and report about it:

    Only with LP_CAREFUL set (i.e. "-C on") it will report most conditions.
    With the default setting (i.e. "-C off"; wrong docu again, sic!) it will report
    errors ONLY if
    LP_ERRORP-Bit is clear (beware of inverse logic here; cleared means
    printer-error
    or "on fire" with the old code). My printer (DJ500) reports the conditions
    (out-of-paper
    and off-line when I tried) without signalling "printer-error" (this was only
    raised for paper jam at my experiments).

    Probably other printer always raise "printer-error", this would explain why
    other people
    don't see this problem. Tim?

    I assume the old code ill until proven wrong.
    Very valid status line combinations are just hidden, the documentation is
    incorrect and the behaviour needs fixing.

    >
    >
    > > I agree that LP_CAREFUL is no longer useful. Once upon a time it actually
    > > affected the semantics of printing, not just error reporting. You should
    > > probably also make the LPCAREFUL ioctl print a warning message.
    >
    > LP_CAREFUL is still needed, I'm afraid. See Andrea's latest megapatch
    > for 2.2.

    But in 2.3.99 LP_NO_ERROR is not even used !?
    (ftp://www.us.kernel.org/pub/linux/kernel/people/andrea/kernels/v2.2/2.2.15aa2/lp-careful-1)

    ...
    -#define LP_NO_ERROR(status) ((status) & LP_PERRORP)
    +#define LP_NO_ERROR(minor, status) ((!(LP_F(minor) & LP_CAREFUL))
             ? ((status) & LP_PERRORP)
            : (((status) & (LP_PERRORP|LP_POUTPA|LP_PSELECD)) ==
    (LP_PERRORP|LP_PSELECD)))

    Note: macro definitions that are just used once are a nuisance.

    BTW. Expect a new patch, the last was too chatty about 'printer-not-ready'.

    Regards, Gunther

    P.S. Can anybody explain how printers could appear to accept data when turned
    off
    (as man tunelp says) ? I consider this impossible since there is a handshake
    when
    transfering data. Any knowledge here ?

    -- To unsubscribe, send mail to: linux-parport-request@torque.net --
    -- with the single word "unsubscribe" in the body of the message. --



    This archive was generated by hypermail 2b29 : Wed May 17 2000 - 15:15:37 EDT