On Monday 21 November 2005 6:00 am, Olav Kongas wrote:

> 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.

That "regardless" is incorrect.  It's appropriate for the data
stage of control transfers, but for e.g. bulk or interrupt
transfers the peripheral's protocol may say otherwise.


> 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. 

Same thing ... this is specific to the protocol.  Sometimes
protocols specify that ALL transfers are terminated by a
short packet.  When that's the case, and M is an integral
multiple of the packet size, that means a zero length packet
must be sent.

That rule applies both to peripherals sending data IN to the
host, and also to hosts sending data OUT to peripherals.

The URB_ZERO_PACKET bit in urb->transfer_flags tells the HCD
whether to apply this for OUT transfers.  For IN transfers,
the issue is entirely in the driver's hands ... usually it's
handled by issuing a request for more than M bytes, so the
HCD will issue the read for the zero length packet.

- Dave



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&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