On 10/04/2011 07:54 PM, Peter Stuge wrote:
Holger Hans Peter Freyther wrote:
I 'reverted'
fe88b83e80df8be0351ff38ee6a77b855b0cd0a9 that added
sending a ZPL for every thing length % 8 == 0 and the device
started to work on OSX. I assume we will need to look at the USB
spec. :)
I think that commit is mostly correct, it just overlooks the
condition of total data length == requested length, in which case I
think no zlp should be sent. Also, hard coding 8 as packet size is
not awesome, the value used by the host for this is bMaxPacketSize0
in the device descriptor. (See 9.6.1) At least a define would be
good, full-speed devices can choose value here.
So 8.5.3.2 demands that if data.length is an exact multiple of wMaxPacketSize
we need to send the ZPL.
And 9.4.3
The wLength field specifies the number of bytes to return. If the descriptor
is longer than the wLength field, only the initial bytes of the descriptor
are returned. If the descriptor is shorter than the wLength field, the device
indicates the end of the control transfer by sending a short packet when
further data is requested. A short packet is defined as a packet shorter than
the maximum payload size or a zero length data packet (refer to Chapter 5).
How to put this together? I will try to tomorrow.
So as Peter points out we should not send a ZPL if we sent wLength byte but it
also happens to be a multiple of wMaxPacketSize?