Re: [PARPORT] Parallel port programming help


Tim Waugh (twaugh@redhat.com)
Fri, 19 Nov 1999 12:04:01 +0000 (GMT)


On Thu, 18 Nov 1999, Jason Fritz wrote:

> Unfortunately, the patch you gave did not solve my problem. My
> application still freezes when it tries to write a byte to the port.
> Do you have any other suggestions?

Yes. It turns out that the patch I sent you was broken. Here is a fixed
one (fixed by Matthias Grimrath). You also need to play with 'tunelp -C
on' to get any change in behaviour.

Tim.
*/

--- linux-2.2.14pre6/drivers/char/lp.c Wed Nov 17 12:00:06 1999
+++ linux/drivers/char/lp.c Fri Nov 19 10:12:26 1999
@@ -426,10 +426,10 @@
         unsigned char status = r_str(minor);
         /* IEEE 1284 reckons that out-of-paper and off-line don't mean
            anything unless nFault says so. Some printers disagree. */
- if ((status & LP_PERRORP) && !(LP_F(minor) & LP_CAREFUL))
+ if ((status & LP_PERRORP) && !(LP_F(minor) & LP_CAREFUL)) {
                 /* No error. */
                 last = 0;
- else if ((status & LP_POUTPA)) {
+ } else if ((status & LP_POUTPA)) {
                 if (last != LP_POUTPA) {
                         last = LP_POUTPA;
                         printk(KERN_INFO "lp%d out of paper\n", minor);
@@ -439,11 +439,14 @@
                         last = LP_PSELECD;
                         printk(KERN_INFO "lp%d off-line\n", minor);
                 }
- } else {
+ } else if (!(status & LP_PERRORP)) {
                 if (last != LP_PERRORP) {
                         last = LP_PERRORP;
                         printk(KERN_INFO "lp%d on fire\n", minor);
                 }
+ } else {
+ last = 0; /* Come here if LP_CAREFUL is set and no
+ * errors are reported. */
         }
 
         lp_table[minor].last_error = last;

-- 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 2.0b3 on Fri 19 Nov 1999 - 07:09:25 EST