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

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

 



On Mon, 23 Mar 2009, Dave Mielke wrote:

> Your statement regarding an even vs an odd number of packets being sent to the 
> device prompted me to try something. It indeed does seem to matter whether the 
> previous use of the device (before usbfs close/reopen) sent an odd vs an even 
> number of bulk writes to the device. Is that really what you meant, though, or 
> did you mean, rather, that a bulk write is really a two-packet oeration (like 
> preparation stuff followed by actual data)? If the latter, I assume the device 
> is counting packets incorrectly or something.

A bulk write can contain an arbitrary number of data packets.  The
actual number depends on the length of the data and the maxpacket size
of the bulk-out endpoint.  Each data packet other than the last one
will have size equal to the maxpacket size.  The size of the last
data packet might be equal to maxpacket or it might be smaller -- it
might even be 0.

I don't know what the maxpacket size is for your device, but let's say 
it is 64 (which is typical for full-speed devices).

	If the length of your		Then the data packets sent
	bulk write is:			will be:

	0				1 packet of len 0
	63				1 packet of len 63
	64				1 packet of len 64
	65				1 packet of len 64 and
						1 packet of len 1
	127				1 packet of len 64 and
						1 packet of len 63
	128				2 packets of len 64
	129				2 packets of len 64 and
						1 packet of len 1

You get the picture.  Using this approach you can count up the total 
number of data packets sent.

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