Re: [PARPORT] [PATCH] to drivers/parport/ieee1284_ops.c to fix timing dependent printer hang

From: Tim Waugh (twaugh@redhat.com)
Date: Mon Mar 31 2003 - 07:05:13 EST

  • Next message: Blaise Gassend: "Re: [PARPORT] Paraller port in ECP mode (fwd)"

    On Fri, Mar 21, 2003 at 06:32:16AM +1100, Tim Josling wrote:

    > Hopefully I have at last foudn the right place to post this...

    Yes, you have. Sorry for being slow at replying.

    > Anyway, if 32 repeats of this occur e.g. for a complex document where
    > the printer is slow, 'wait' ends up as a negative number from repeated
    > doublings due to the way twos complement arithmetic works in C. In this
    > case the routine never returns, or at least waits for a very long time
    > i.e. hours. So no more data gets sent to the printer.

    Oops. How embarrassing.

    > Definitely my patch does fix a real problem on my system.

    Great. But I think it's slightly wrong; what ought to happen is that
    after parport_wait_event times out, no_irq is set.

    Please try this patch, which does this, and also applies the cutoff to
    the wait calculation (which I think is a good idea anyway).

    Tim.
    */

    --- linux/drivers/parport/ieee1284_ops.c.hang 2003-03-31 12:57:39.000000000 +0100
    +++ linux/drivers/parport/ieee1284_ops.c 2003-03-31 12:59:49.000000000 +0100
    @@ -101,14 +101,17 @@
                             }
                             else
                                     /* We must have the device claimed here */
    - parport_wait_event (port, wait);
    + if (parport_wait_event (port, wait))
    + no_irq = 1;
     
                             /* Is there a signal pending? */
                             if (signal_pending (current))
                                     break;
     
    - /* Wait longer next time. */
    + /* Wait longer next time, up to 10 seconds. */
                             wait *= 2;
    + if (wait < 0)
    + wait = 10 * HZ;
                     } while (time_before (jiffies, expire));
     
                     if (signal_pending (current))

    -- 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 : Mon Mar 31 2003 - 07:10:17 EST