On Tue, 22 Dec 2015, John Youn wrote:

> >> The following fixes it:
> >>
> >> -       if (ret == 0 && request->zero && (request->length % ep->maxpacket 
> >> == 0))
> >> +       if (ret == 0 && request->zero && (request->length % ep->maxpacket 
> >> == 0) &&
> >> +           (request->length != 0))
> > 
> > Can you send this as a proper patch ?
> 
> Sure I can do that. I thought you might want fix it in place since
> it's in your testing/next.
> 
> > And also patch g_mass_storage to
> > _not_ set Zero flag in this case ?
> > 
> 
> The mass storage driver has always done that and I think it is ok. It
> sets this flag for the mass storage data IN phase and the data might
> be various lengths including zero-length.
> 
> It should be up to the controller to insert the ZLP as needed to
> terminate the transfer. And if the length is already short or zero,
> then there is no need to do so.
> 
> What do you think?

I agree with John.  In every case where we might want to insert a ZLP,
the class or gadget driver merely sets the flag for the transfer.  
It's up to the controller driver to check whether the conditions for
inserting the ZLP apply, and this includes checking whether the
transfer already has length 0.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to