On Mon, 21 Nov 2005, tong changda wrote:

> hello.
>    I still not very clear with the concept of zero-length.Could anyone explain
> with it? Does it means  if send a 64 byte data(same with endpoint max packet
> size), after send the 64byte, some usb hardware send a extra zero-length
> packet, some usb hardware send nothing? 

This has been explained many times in this list.

Suppose, HC requests N bytes of data from device. Suppose, 
device sends M bytes as a response. The following happens:

1) if M == N; then no zero length packet is sent by device 
regardless of whether N is multiple of MaxPacketSize or not. 
That's because the HCD, which requested N bytes of the data, 
has got all of it.

2) if M < N, M not multiple of MaxPacketSize; then no zero 
length packet is sent because host got less data within the 
last packet than it expected, so it knows that the device is 
not going to send more.

3) if M < N, M is multiple of MaxPacketSize; then the device 
must send a zero length packet to inform host that the 
transfer is over. That's because the last data packet was of 
MaxPacketSize and without the additional zero length packet 
the host has no way to know that the device won't send more.

In summary, zero length packet will be sent ONLY if the host 
doesn't already know from the last packet that the data 
transfer is over. 

Olav


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to