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

Richard Clark <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <1198116026.7284.14.camel@gullinux>
I am using an Epson BA-T500 controller board that identifies itself the
same as the Seiko/Epson Printer M129C that was recently added to the
kernel.

In the past I had used my own driver created off of usb-skeleton.c, and
I did not bother with the bi-directional side.

Now that it's in the usblp.c driver, along with it's quirks, I am
starting to make use of the inbound bulk endpoint for printer status.

My problem is that even if there is no data present, the URB request
completes and usblp->rcomplete is flagged.  This is causing my
poll/select call to always trigger even when there is no data.

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.

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 ?  

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);
        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);
}

Thanks for any info.

--
Richard C


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
[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.