Re: A few questions about gadgetfs

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

 



On Tue, 4 Sep 2018, Andrey Konovalov wrote:

> Hi Alan,
> 
> Another question. According to the USB spec:
> 
> """
> The Data stage of a control transfer from an endpoint to the host is
> complete when the endpoint does one of the following:
> * Has transferred exactly the amount of data specified during the Setup stage
> * Transfers a packet with a payload size less than wMaxPacketSize or
> transfers a zero-length packet
> """
> 
> AFAIU, this means that a device only needs to send a zero-length
> packet when the last data packet happened to be equal to
> wMaxPacketSize to indicate that the data stage is over.

And if the total reply size is less than wLength in the Setup stage.

>  Gadgetfs seems
> to be doing something different, it sets the req->zero flag (for the
> response passed to usb_ep_queue) when value < w_length, where value is
> the length of the response being submitted and w_length is the value
> of the wLength field of the control request. Is there something I
> misunderstand?

No, you got it.  But you're missing an important fact: The USB 
controller drivers will ignore the ->zero flag in cases where the 
message length isn't an exact multiple of wMaxPacketSize.  This is what 
makes gadgetfs's behavior correct.

Alan Stern




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux