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

Tim Waugh (twaugh@redhat.com)
Thu, 4 Jan 2001 14:20:43 +0000


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/