Re: [PATCH v5] usb: gadget: f_fs: add "no_disconnect" mode
From: Felipe Balbi
Date: Tue Dec 23 2014 - 18:51:52 EST
On Tue, Dec 23, 2014 at 12:47:55PM -0800, David Cohen wrote:
> On Tue, Dec 23, 2014 at 12:48:58PM -0600, Felipe Balbi wrote:
> > On Thu, Dec 18, 2014 at 09:55:10AM +0100, Robert Baldyga wrote:
> > > Since we can compose gadgets from many functions, there is the problem
> > > related to gadget breakage while FunctionFS daemon being closed. FFS
> > > function is userspace code so there is no way to know when it will close
> > > files (it doesn't matter what is the reason of this situation, it can
> > > be daemon logic, program breakage, process kill or any other). So when
> > > we have another function in gadget which, for example, sends some amount
> > > of data, does some software update or implements some real-time functionality,
> > > we may want to keep the gadget connected despite FFS function is no longer
> > > functional.
> > >
> > > We can't just remove one of functions from gadget since it has been
> > > enumerated, so the only way to keep entire gadget working is to make
> > > broken FFS function deactivated but still visible to host. For this
> > > purpose this patch introduces "no_disconnect" mode. It can be enabled
> > > by setting mount option "no_disconnect=1", and results with defering
> > > function disconnect to the moment of reopen ep0 file or filesystem
> > > unmount. After closing all endpoint files, FunctionFS is set to state
> > > FFS_DEACTIVATED.
> > >
> > > When ffs->state == FFS_DEACTIVATED:
> > > - function is still bound and visible to host,
> > > - setup requests are automatically stalled,
> > > - transfers on other endpoints are refused,
> > > - epfiles, except ep0, are deleted from the filesystem,
> > > - opening ep0 causes the function to be closed, and then FunctionFS
> > > is ready for descriptors and string write,
> > > - altsetting change causes the function to be closed - we want to keep
> > > function alive until another functions are potentialy used, altsetting
> > > change means that another configuration is being selected or USB cable
> > > was unplugged, which indicates that we don't need to stay longer in
> > > FFS_DEACTIVATED state
> > > - unmounting of the FunctionFS instance causes the function to be closed.
> > >
> > > Signed-off-by: Robert Baldyga <r.baldyga@xxxxxxxxxxx>
> >
> > David, can you test it with your setup ?
>
> Works fine on my side.
> Tested-by: David Cohen <david.a.cohen@xxxxxxxxxxxxxxx>
just to make sure, did you try with and without the new parameter ? I
remember someone complaining about regressions when the new parameter
was used.
cheers
--
balbi
Attachment:
signature.asc
Description: Digital signature