Re: [RFC/PATCH 1/2] usb: gadget: let gadgets control pullup on their own

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

 



On Wed, Feb 06, 2013 at 10:45:13AM -0500, Alan Stern wrote:
> On Wed, 6 Feb 2013, Felipe Balbi wrote:
> 
> > This is useful on gadgets that depend on userland
> > daemons to function properly. We can delay connection
> > to the host until userland is ready.
> 
> > --- a/drivers/usb/gadget/udc-core.c
> > +++ b/drivers/usb/gadget/udc-core.c
> > @@ -235,7 +235,18 @@ static void usb_gadget_remove_driver(struct usb_udc *udc)
> >  
> >  	kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE);
> >  
> > -	usb_gadget_disconnect(udc->gadget);
> > +	/*
> > +	 * NOTICE: if gadget driver wants to control
> > +	 * pullup, it needs to make sure that when
> > +	 * user tries to rmmod the gadget driver, it
> > +	 * will disconnect the pullups before returning
> > +	 * from its ->unbind() method.
> > +	 *
> > +	 * We are truly trusting the gadget driver here.
> > +	 */
> > +	if (!udc->driver->controls_pullups)
> > +		usb_gadget_disconnect(udc->gadget);
> 
> Even though you trust the gadget driver about when to enable the 
> pullup, doesn't it make sense to disable the pullup whenever the gadget 
> driver is removed, regardless?

Maybe, but we don't know what sort of trickery userland has. Also, I
wanted to use this as a way to catch 'non-compliant' gadget drivers
which say they will control pullup but don't.

Maybe a warning if pullup is still connected ?!?

-- 
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