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

Tim Waugh (twaugh@redhat.com)
Thu, 4 Jan 2001 21:52:10 +0000


On Thu, Jan 04, 2001 at 08:07:19PM +0100, Peter Osterlund wrote:

> If you do this, you should probably also return -EAGAIN if the printer
> is out of paper, otherwise I would still lose data when the printer
> goes out of paper. Currently it returns -ENOSPC in this situation. I
> suppose the different return codes were meant as a way for user space
> to be able to know why printing failed, so that it could take
> appropriate actions, but maybe this is not used by any programs.

They were intended for that, yes, but it's probably better to stick
with the 2.2 return codes. Here's a patch to do that. Look okay?

Tim.
*/

2001-01-04 Tim Waugh <twaugh@redhat.com>

* drivers/char/lp.c: Follow 2.2 behaviour more closely.

--- linux-2.4.0-prerelease/drivers/char/lp.c.offline Thu Jan 4 21:13:02 2001
+++ linux-2.4.0-prerelease/drivers/char/lp.c Thu Jan 4 21:42:19 2001
@@ -207,7 +207,7 @@
last = LP_POUTPA;
printk(KERN_INFO "lp%d out of paper\n", minor);
}
- error = -ENOSPC;
+ error = -EIO;
} else if (!(status & LP_PSELECD)) {
if (last != LP_PSELECD) {
last = LP_PSELECD;
@@ -230,7 +230,10 @@
if (last != 0)
lp_error(minor);

- return error;
+ if (LP_F (minor) & LP_ABORT)
+ return error;
+
+ return 0;
}

static ssize_t lp_write(struct file * file, const char * buf,
@@ -292,7 +295,7 @@
/* incomplete write -> check error ! */
int error = lp_check_status (minor);

- if (LP_F(minor) & LP_ABORT) {
+ if (error) {
if (retv == 0)
retv = error;
break;
-
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/