tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Potential problem with reading data from usb devices with ugen(4)



On 09/24/15 21:35, Greg Troxel wrote:
Brian Buhrow <buhrow%nfbcal.org@localhost> writes:

	hello.  I don't necessarily need the read ahead functionality, though
it might be useful when I start doing large transfers to and from the Apple
devices.  However, what I want is the non-blocking functionality which,
according to the manual, requires I use the read ahead code to get.  It
appears, however, that the non-blocking functionality is minimally tested
and may not work as advertised.  Also, it looks like the timeout
functionality may not be quite right either, though I've not investigated
that as thoroughly yet.
So perhaps we should step back and ask why non-blocking doesn't work.
Part of it is that reading from a USB device causes bus transactions, so
even reading is an active step.  The next question is if it makes sense
within USB to have a pending read, or if you can try to read and either
succeed or find nothing.

USB requires that the host controller query and endpoint for data. If the
endpoint isn't ready to provide data then it will respond with NAK.

That is, the USB stack needs an active transfer to an endpoint for any data
to be returned.

The host controller drivers are a little inconsistent in their handling of the
USBD_SHORT_XFER flag, but without it a short transfer will always
result in a callback status of USBD_SHORT_XFER

http://nxr.netbsd.org/xref/src/sys/dev/usb/usbdi.c#883

Nick



Home | Main Index | Thread Index | Old Index