Re: [PARPORT] Re: carefully does it


Tim Waugh (tim@cyberelk.demon.co.uk)
Sun, 2 May 1999 20:20:47 +0100 (GMT)


On Sat, 1 May 1999, Andrea Arcangeli wrote:

> On Sat, 1 May 1999, Tim Waugh wrote:
>
> >c) Check BUSY and nFault (ERROR)
>
> My point is that you'll get blocked in lp_check_status() anyway the first
> time you'll revert to the slow path when count++ will reach
> LP_CHAR(minor).

Here is a patch against 2.2.7 that should do I what I meant. What do you
think?

Tim.
*/

--- linux/drivers/char/lp.c~ Wed Mar 24 01:42:57 1999
+++ linux/drivers/char/lp.c Sun May 2 20:18:39 1999
@@ -202,9 +202,7 @@
 /* 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_POUTPA|LP_PSELECD|LP_PERRORP)) == \
- (LP_PSELECD|LP_PERRORP))
+#define LP_NO_ERROR(status) ((status) & LP_PERRORP)
 
 #undef LP_DEBUG
 #undef LP_READ_DEBUG
@@ -424,7 +422,10 @@
 {
         unsigned int last = lp_table[minor].last_error;
         unsigned char status = r_str(minor);
- if ((status & LP_POUTPA)) {
+ if (status & LP_PERRORP)
+ /* No error. */
+ last = 0;
+ else if ((status & LP_POUTPA)) {
                 if (last != LP_POUTPA) {
                         last = LP_POUTPA;
                         printk(KERN_INFO "lp%d out of paper\n", minor);
@@ -434,13 +435,12 @@
                         last = LP_PSELECD;
                         printk(KERN_INFO "lp%d off-line\n", minor);
                 }
- } else if (!(status & LP_PERRORP)) {
+ } else {
                 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;
 

-- 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 Sun 02 May 1999 - 15:25:41 EDT