Hi Vojtech,
In looking at USB printer.c and comparing it to drivers/char/lp.c,
they have lots of obvious similarities (on purpose, I'm sure) since
they need to provide the same API and error codes to printing
software.
However, it looks to me like they return printer error status
differently. This is only from eyeballing it since I don't have
a USB printer. Has USB printer error handling been tested (much)?
In char/lp.c:lp_check_status() and usb/printer.c:usblp_check_status(),
they can return -ENOSPC (out of paper), -EIO (off-line or on fire
[general
error]) for errors or 0 for no error.
In char/lp.c:lp_write(), it says:
if (copy_size > 0) {
/* incomplete write -> check error ! */
int error = lp_check_status (minor);
if (LP_F(minor) & LP_ABORT) {
if (retv == 0)
retv = error;
break;
}
and I think that this breaks to "return retv;", which could be -ENOSPC
or
-EIO.
In usb/printer.c:usblp_write(), it says:
if (!usblp->writeurb.status) {
writecount += usblp->writeurb.transfer_buffer_length;
usblp->writeurb.transfer_buffer_length = 0;
} else {
1: if (!(retval = usblp_check_status(usblp))) {
err("usblp%d: error %d writing to printer",
usblp->minor, usblp->writeurb.status);
2: return -EIO;
}
return retval;
}
Again, it looks to me like 1: is negated but shouldn't be. It
currently says (paraphrased): if (usblp_check_status() == 0)
Shouldn't it say: if (usblp_check_status() != 0) ???
And on 2:, to be compatible with char/lp.c, shouldn't/couldn't this
return retval instead of -EIO?
It would help if I had a USB printer, eh? Sorry if this is all wrong.
~Randy
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]