Re: First bulk write often doesn't seem to reach device.

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

 



On Wed, 25 Mar 2009, Dave Mielke wrote:

> [quoted lines by Alan Stern on 2009/03/25 at 10:35 -0400]
> 
> >> Does doing a read into a zero-length buffer make any 
> >> sense?
> >
> >No.  It's more likely either to time out or cause an overflow error
> >when the device tries to send you more than 0 bytes of data.  It's a
> >little safer to do a read into a buffer whose length is the endpoint's 
> >maxpacket size; then you can't get an overflow.  But you still can time 
> >out if the device doesn't have any data to send.
> 
> What should happen if a read into a packet-sized buffer is done and the toggle 
> is wrong? Should it yield zero bytes and no erorr, a specific type of error, 
> or what? And, of coruse, will the toggle state then be correct?

What should happen is this:

	The host will ask the device for data.

	If no data is available, the read will eventually time out and
	the toggle will still be wrong.  Otherwise the device will send 
	a data packet with the wrong toggle value.

	The host will accept the packet and ignore it.  All the data
	in the packet will be lost.  But now the toggle will be 
	correct.

	The host will continue asking the device for data, since the
	data received earlier was ignored.

	Either the device will send more data or the read will time 
	out.  If the device does send data, that will be the result
	of the read.

If the read times out, your program has no way of knowing whether or 
not the toggle has been corrected.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux