USB Printer Problem!!

Chang u90010 at gmail.com
Thu Apr 26 21:48:28 PDT 2007


Hi, all

I want to write a pure ipp server that listen to 631 port
to share my USB printer.

When I got a job from http, I will parse the request and write
the data to printer's fd .........

If the printer has some problems like paper jam or out of paper
the write function will blocked and I can't get the status of this
printer!!

I trace code to ~drivers/usb/class/usblp.c and found

static ssize_t usblp_write( ... )
{
    while (writecount < count) {
      if (usblp->writeurb->status != 0) {
        if (usblp->quirks & USBLP_QUIRK_BIDIR) {
          if (!usblp->wcomplete)
            err("usblp%d: error %d writing to printer",
                   usblp->minor, usblp->writeurb->status);
          err = usblp->writeurb->status;
        } else {
           err = usblp_check_status(usblp, err);
        }
        mutex_unlock (&usblp->sem);
      /* if the fault was due to disconnect, let khubd's
       * call to usblp_disconnect() grab usblp->sem ...
       */
        schedule ();
        continue;
      }
    }
    return count;
}
//note this!! It will not return error but still wait in while-loop

Who can give me some suggestion to develop this project?

Thanks




More information about the cups mailing list