Re: usblp : Seiko/Epson Printer M129C - poll/select always POLLIN

Richard Clark <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
> > Question - 1
> > Is this action normal for class based usb printers ? ie, the URB request
> > will complete and return even if there is no data.
> 
> What does the usb printer spec say about this?
> 

I have looked through the USB Device Class Def for Printing Devices, and
through the USB 1.1 spec but I can't find anything that answers it.  

>From reading the Linux Device Drivers manual, things like
usb_bulk_message having a timeout parm makes me think that in general,
if there is not data, the bulk endpoint will not return without data.

This printer already deviates from the device class spec in other
regards.

> > Question - 2
> > I have solved my problem by changing the usblp_buld_read callback to
> > check for data before flaging usblp->rcomplete, and if not, resubmitting
> > the URB.  Is there any problem with doing as I have below ?  
> > 
> Can you send this in diff format so we can see exactly what was changed?

Yes, sorry, my bad.

--- drivers/usb/class/usblp.c.orig   2007-07-08 16:32:17.000000000 -0700
+++ drivers/usb/class/usblp.c     2007-12-19 17:30:41.000000000 -0800
@@ -277,27 +277,32 @@
 
 static void usblp_bulk_read(struct urb *urb)
 {
        struct usblp *usblp = urb->context;
 
        if (unlikely(!usblp || !usblp->dev || !usblp->used))
                return;
 
        if (unlikely(!usblp->present))
                goto unplug;
        if (unlikely(urb->status))
                warn("usblp%d: nonzero read/write bulk status received:
%d",
                        usblp->minor, urb->status);
-       usblp->rcomplete = 1;
+       if (urb->actual_length)
+           usblp->rcomplete = 1;
+       else {
+           if (usb_submit_urb(usblp->readurb, GFP_ATOMIC) < 0)
+                err("usblp%d: Error resubmitting read urb",
usblp->minor);
+       }
 unplug:
        wake_up_interruptible(&usblp->wait);
 }



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.