While on the subject of the usb printer driver, I cannot get mine to work.
Is there some manner of setup beyond creating a character file with major
180, minor 0?

If I echo a text file to the /dev/usblp I create, there is a kernel message
that looks like acknowledgement of a control endpoint 0 call. But nothing
ever prints out. Same if I use my print filters to send full files.

-David Waite

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
Randy Dunlap
Sent: Monday, March 20, 2000 6:00 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [linux-usb] USB printer driver question


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.

I7n 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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to