Re: gadget: should usb_ep_enable() clear EP STALL?

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

 



Hi,

On Wed, Oct 30, 2013 at 03:17:46PM +0100, Johannes Stezenbach wrote:
> Hi,
> 
> I'm testing dwc3 with g_zero and noticed that errors
> seem to stick even after SET_CONFIGURATION/SET_INTERFACE.
> 
> In f_sourcesink.c, check_read_data() calls usb_ep_set_halt()
> if the data does not match the expected values, and
> sourcesink_set_alt() indirectly calls usb_ep_disable()
> and usb_ep_enable().
> 
> Now, include/linux/usb/gadget.h comments for usb_ep_enable()
> are not 100% clear wrt STALL, except "making it usable"
> sounds like it should clear it.  However, usb_ep_set_halt()
> comments states:
> 
>  * Note that while an endpoint CLEAR_FEATURE will be invisible to the
>  * gadget driver, a SET_INTERFACE will not be.  To reset endpoints for the
>  * current altsetting, see usb_ep_clear_halt().  When switching altsettings,
>  * it's simplest to use usb_ep_enable() or usb_ep_disable() for the endpoints.
> 
> That suggests to me that sourcesink_set_alt() is correct to
> simply call usb_ep_enable(), i.e. no explicit usb_ep_clear_halt()
> is needed?  If so it would mean dwc3 ep_enable() is buggy.

we clear those flags on usb_ep_disable(). You can't enable an endpoint
which is already enabled. And you can see that when you're going to
switch alt settings, f_sourcesink calls disable_source_sink() which will
call disable_endpoints() which will disable each and every endpoint,
thus clearing the such flags.

Do you have any patches on f_sourcesink which might have caused this
bug ?

-- 
balbi

Attachment: signature.asc
Description: Digital signature


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

  Powered by Linux