Re: [rfc patch 2/3] usb: gadget: u_serial: introduce gserial_start

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

 



On Tue, Jul 28, 2009 at 06:35:51AM +0200, Balbi Felipe (Nokia-D/Helsinki) wrote:
> Hi,
> 
> On Mon, Jul 27, 2009 at 10:50:53PM +0200, ext David Brownell wrote:
> > >  fail:
> > > diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c
> > > index fc6e709..ab01440 100644
> > > --- a/drivers/usb/gadget/u_serial.c
> > > +++ b/drivers/usb/gadget/u_serial.c
> > > @@ -1201,6 +1201,42 @@ void gserial_cleanup(void)
> > >  }
> > >  
> > >  /**
> > > + * gserial_start - starts gserial
> > > + * @gser: the function to be started
> > > + * @port_num: which port to start
> > > + * Context: any (usually called from ->bind())
> > > + *
> > > + * This should be called in early stage (usualy bind())
> > > + * in order to let the gaget driver connect to the bus
> > > + * and let the gser->connect() be called.
> > 
> > I don't follow.  What's the problem with just
> > having the function call gser_connect() when it's
> > activated?  Why should there be any bind-time hook
> > beyond a single call to gserial_setup()?
> 
> so we load g_serial with f_obex, then obexd opens /dev/ttyGS0 then we
> connect the cable and gser->connect() is not called since port->port_usb
> only becomes a valid pointer after gserial_connect() is called. And
> gserial_connect() is only called when host succesfully sets alternate
> setting 1 (on obex case).
> 
> You see the problem ?

so, just to clarify:

gserial_connect() makes port->port_usb valid and that makes
gser->connect() (in this case obex connect) "reachable", but
gserial_connect() will never get called unless host sets alternate
setting 1 of obex and host will never be able to do that if
usb_function_activate() inside obex_connect() isn't called.

So there's a little chicken-and-egg problem there, no?

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