Re: Gadget driver & virtual hub

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

 



On Fri, 2 Jun 2017, Benjamin Herrenschmidt wrote:

> On Fri, 2017-06-02 at 15:13 +1000, Benjamin Herrenschmidt wrote:
> > On Sat, 2017-05-27 at 21:58 -0400, Alan Stern wrote:
> > > The interfaces required for a UDC driver are explained to some extent 
> > > by the kerneldoc in include/linux/usb/gadget.h.  For anything you still 
> > > don't understand, feel free to ask on this mailing list.
> > 
> > It's missing docs for the udc callbacks :-)

Yeah, the file could use a few additions.

> > One quick question: ->set_halt, when called for clearing a stall (when
> > does that happen btw ? I though only the host would do that), should

See the kerneldoc for usb_ep_set_wedge() in udc/core.c.  The USB Mass 
Storage Bulk-Only Transport spec says that under certain conditions, 
a bulk endpoint must be halted and must remain halted even if the host 
issues a Clear-Feature(Halt) request.  The wedge operation was 
introduced to fulfill this requirement.

The only way to un-wedge an endpoint is for the gadget driver to tell
->set_halt to clear it.

> > it also reset the data toggle like a CLEAR_FEATURE would do 

Yes.

> Also, a SET_FEATURE setting a stall, should that nuke pending
> queued request ?

No, the requests should remain on the queue until the gadget driver
dequeues them or until the halt feature is cleared and they complete
normally (or something else causes them to be dequeued, such as the
endpoint being disabled or the gadget being disconnected from the
host).

> What about things like setting configuration, alt settings etc... all
> these things are supposed to cleanup endpoint data toggles, should
> probably nuke all pending requests etc.... UDC drivers don't seem to
> do it and the "core" doesn't seem to have any kind of tracking of
> these things...

Those things are handled by the gadget driver (or for modern gadgets,
by the composite core), not by the UDC driver.  The gadget driver
disables the endpoints for the old config/altsetting and then enables
the endpoints for the new one.  Disabling an endpoint should clean up
all the state associated with it.

> It looks like if the interface driver wants to do the right thing,
> it needs ->set_halt() to also reset the toggle then ... 

That's right.

Alan Stern

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



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

  Powered by Linux