Re: [PATCH] usb: gadget: f_fs: add "zombie" mode

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

 



On Tue, 7 Oct 2014, Michal Nazarewicz wrote:

> > On Tue, 7 Oct 2014, Felipe Balbi wrote:
> >> Right, but if we allow this, I can already see folks abusing to
> >> connect to the host early and only when necessary do some trickery to
> >> e.g. start adbd (not saying Android will do this, just using it as an
> >> easy example).
> 
> I don't really see that happening.  For the gadget to start all
> descriptors need to be known.  Functionfs  will know the descriptors
> only once the user space daemon provides them.  Therefore, with the
> current features (or even with addition of Robert's feature) there is no
> way to let the gadget start without having the daemon running.
> 
> On Tue, Oct 07 2014, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> > We can still keep the pullup turned off until all the functions are
> > ready.  That's a part of normal behavior -- unlike what happens when a
> > userspace component crashes or is killed.
> 
> >> Then how do we differentiate a normal close() from a "oh-crap-I-died"
> >> close() ?
> 
> > We can't, so why worry about it?
> 
> We actually might be able to distinguish those cases with another ioctl
> which daemon must issue on the ep0 prior to closing it.  I'm not saying
> that we should implement that though.
> 
> > If a file handle was closed for normal reasons then userspace probably 
> > in the middle of shutting down the gadget anyway.  If not then the 
> > user will get what they deserve.
> >
> > If the file handle was closed for abnormal reasons, we can behave like 
> > crashed firmware.  Which means, in the end, doing the same thing as in 
> > the normal-reason case -- i.e., do nothing.  In particular, don't 
> > disconnect.
> >
> > If you want to allow for the possibility of orderly shutdown (and maybe 
> > even possible restart) of a userspace handler, the function library 
> > should first tell the kernel explicitly to disconnect.  Then function 
> > components can be changed around completely, and when everything is 
> > ready, userspace can tell the kernel to connect again.
> 
> I'm wondering if it would be possible to support user-space daemon
> restarts with O_APPEND flag.  This is probably looking too far to the
> future though.

Actually, we shouldn't need to consider the case where the descriptors
change.  That _always_ requires a disconnect, and the user can cause a
disconnect simply by killing the daemon and starting it again.  No
separate restart capability is needed.

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