Re: [PARPORT] Possible Bug in lp-module (Kernel 2.2.8) (fwd)


Tim Waugh (tim@cyberelk.demon.co.uk)
Mon, 17 May 1999 20:40:41 +0100 (GMT)


Michael,

Here is a patch to optionally restore the 2.2.7 behaviour. You need to
use lptune to enable it.

Could you please verify that this fixes the problem for you?

Thanks,
Tim.
*/

diff -durN linux-2.2.9/drivers/char/lp.c linux/drivers/char/lp.c
--- linux-2.2.9/drivers/char/lp.c Wed May 12 09:14:29 1999
+++ linux/drivers/char/lp.c Mon May 17 19:40:37 1999
@@ -202,7 +202,12 @@
 /* Test if the printer is not acking the strobe */
 #define LP_NO_ACKING(status) ((status) & LP_PACK)
 /* Test if the printer has error conditions */
-#define LP_NO_ERROR(status) ((status) & LP_PERRORP)
+#define LP_NO_ERROR(minor,status) \
+ (!(LP_F(minor) & LP_CAREFUL) ? (status) & LP_PERRORP : \
+ ((status) & (LP_POUTPA | \
+ LP_PSELECD | \
+ LP_PERRORP)) == \
+ (LP_PSELECD|LP_PERRORP))
 
 #undef LP_DEBUG
 #undef LP_READ_DEBUG
@@ -288,7 +293,7 @@
                 lp_yield(minor);
 
                 status = r_str(minor);
- if (LP_NO_ERROR(status))
+ if (LP_NO_ERROR(minor,status))
                 {
                         if (LP_READY(status))
                                 break;
@@ -422,7 +427,7 @@
 {
         unsigned int last = lp_table[minor].last_error;
         unsigned char status = r_str(minor);
- if (status & LP_PERRORP)
+ if (!(LP_F(minor) & LP_CAREFUL) && (status & LP_PERRORP))
                 /* No error. */
                 last = 0;
         else if ((status & LP_POUTPA)) {
@@ -435,12 +440,12 @@
                         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;
 
         lp_table[minor].last_error = last;
 
@@ -784,14 +789,12 @@
                         else
                                 LP_F(minor) &= ~LP_ABORTOPEN;
                         break;
-#ifdef OBSOLETED
                 case LPCAREFUL:
                         if (arg)
                                 LP_F(minor) |= LP_CAREFUL;
                         else
                                 LP_F(minor) &= ~LP_CAREFUL;
                         break;
-#endif
                 case LPTRUSTIRQ:
                         if (arg)
                                 LP_F(minor) |= LP_TRUST_IRQ;
diff -durN linux-2.2.9/include/linux/lp.h linux/include/linux/lp.h
--- linux-2.2.9/include/linux/lp.h Fri Nov 27 18:23:11 1998
+++ linux/include/linux/lp.h Mon May 17 19:37:44 1999
@@ -25,7 +25,7 @@
 #define LP_NOPA 0x0010
 #define LP_ERR 0x0020
 #define LP_ABORT 0x0040
-#define LP_CAREFUL 0x0080 /* obsoleted -arca */
+#define LP_CAREFUL 0x0080
 #define LP_ABORTOPEN 0x0100
 #define LP_TRUST_IRQ 0x0200
 
@@ -66,7 +66,6 @@
                             or 0 for polling (no IRQ) */
 #define LPGETIRQ 0x0606 /* get the current IRQ number */
 #define LPWAIT 0x0608 /* corresponds to LP_INIT_WAIT */
-/* NOTE: LPCAREFUL is obsoleted and it' s always the default right now -arca */
 #define LPCAREFUL 0x0609 /* call with TRUE arg to require out-of-paper, off-
                             line, and error indicators good on all writes,
                             FALSE to ignore them. Default is ignore. */

-- 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 Mon 17 May 1999 - 15:56:53 EDT