Author Topic: Multi-data packet clarification needed.  (Read 4907 times)

rallysjd

  • Member
  • ***
  • Posts: 21
    • PiXCL Automation Technologies Inc
Multi-data packet clarification needed.
« on: January 25, 2014, 05:06:18 pm »
In USB Complete, p.304, it's stated "...the HID is sending a report whose data is a multiple of the EP's max packet size, the HID indicates the end of the report  by sending a zero length packet (ZLP) for all but the HID's longest report".

I understand that all but the last packets will be the max packet size, and the last packet may or may not be of max packet size i.e. a short packet. My understanding is that when the last packet is not max packet size, the host will know that the transfer is over.  The text above seems to suggest that a ZLP is required once the last short packet is transferred, unless the last packet IS max packet size.  If this is right, then the host has read the descriptor and knows that the complete transfer is 'n' packets of max packet size.

Have I got this right?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Multi-data packet clarification needed.
« Reply #1 on: January 25, 2014, 07:43:47 pm »
If the HID supports only report ID zero, there is never a need for a ZLP.

Otherwise, if a report IS an exact multiple of maxpacketsize AND the report IS NOT the longest defined report, the report should terminate with a ZLP.

In other words, the receiver of the report knows a complete report has been received if (1) a short packet, which may be a ZLP, has been received or (2) the amount of data received equals the size of the longest defined report.