Re: Printing to off-line printer in 2.4.0-prerelease

From: Tim Waugh (twaugh@redhat.com)
Date: Thu Jan 04 2001 - 09:20:43 EST


On Thu, Jan 04, 2001 at 02:52:29PM +0100, Andrea Arcangeli wrote:

> I think lp_check_status.

Okay. So what about this patch instead? If the printer is off-line
to start with, fall into parport_write anyway (it will just time out
and return 0). If LP_ABORT is set, we return -EAGAIN.

Tim.
*/

--- lp.c~ Thu Jan 4 11:04:30 2001
+++ lp.c Thu Jan 4 14:16:42 2001
@@ -213,7 +213,7 @@
                         last = LP_PSELECD;
                         printk(KERN_INFO "lp%d off-line\n", minor);
                 }
- error = -EIO;
+ error = -EAGAIN;
         } else if (!(status & LP_PERRORP)) {
                 if (last != LP_PERRORP) {
                         last = LP_PERRORP;
@@ -270,8 +270,11 @@
         parport_set_timeout (lp_table[minor].dev,
                              lp_table[minor].timeout);
 
- if ((retv = lp_check_status (minor)) == 0)
- do {
+ retv = lp_check_status (minor);
+ if (retv == -EAGAIN && (LP_F(minor) & LP_ABORT) == 0)
+ retv = 0;
+
+ if (retv == 0) do {
                 /* Write the data. */
                 written = parport_write (port, kbuf, copy_size);
                 if (written >= 0) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jan 07 2001 - 21:00:18 EST