Re: [PARPORT] lp behavior change 2.1.91-94


Tim Waugh (tim@cyberelk.demon.co.uk)
Sat, 11 Apr 1998 13:19:02 +0100 (BST)


On Fri, 10 Apr 1998, Marc F Pucci wrote:

> Since installing 2.1.94, and with my printer off (an HP laserjet 3P)
> I get "notch kernel: lp0 out of paper" messages every 10 seconds.
> Didn't happen on 2.1.91; This tends to mask out other kernel messages.

This patch should fix that.

Tim.
*/

--- linux/drivers/char/lp.c~ Sat Apr 11 13:06:51 1998
+++ linux/drivers/char/lp.c Sat Apr 11 13:18:01 1998
@@ -239,23 +239,32 @@
 }
 
 static int lp_check_status(int minor) {
+ static unsigned char last = 0;
         unsigned char status = r_str(minor);
         if ((status & LP_POUTPA)) {
- printk(KERN_INFO "lp%d out of paper\n", minor);
- if (LP_F(minor) & LP_ABORT)
- return 1;
- lp_error(minor);
+ if (last != LP_POUTPA) {
+ last = LP_POUTPA;
+ printk(KERN_INFO "lp%d out of paper\n", minor);
+ }
         } else if (!(status & LP_PSELECD)) {
- printk(KERN_INFO "lp%d off-line\n", minor);
- if (LP_F(minor) & LP_ABORT)
- return 1;
- lp_error(minor);
+ if (last != LP_PSELECD) {
+ last = LP_PSELECD;
+ printk(KERN_INFO "lp%d off-line\n", minor);
+ }
         } else if (!(status & LP_PERRORP)) {
- printk(KERN_ERR "lp%d printer error\n", minor);
+ if (last != LP_PERRORP) {
+ last = LP_PERRORP;
+ printk(KERN_ERR "lp%d on fire!\n", minor);
+ }
+ }
+ else last = 0;
+
+ if (last != 0) {
                 if (LP_F(minor) & LP_ABORT)
                         return 1;
                 lp_error(minor);
         }
+
         return 0;
 }
 

-- 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 Wed 30 Dec 1998 - 10:17:36 EST