RE: [PATCH RESEND] FunctionFS: enable multiple functions

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

 



Hello,

On Monday, February 06, 2012 9:46 PM Michał Nazarewicz wrote:

> On Mon, 06 Feb 2012 09:24:38 +0100, Andrzej Pietrasiewicz <andrzej.p@xxxxxxxxxxx> wrote:
> > usb: gadget: FunctionFS: enable multiple USB function instances
> >
> > Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@xxxxxxxxxxx>
> > Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>
> 
> > This patch enables using multiple instances of USB functions in FunctionFS.
> >
> > Example usage (*):
> >
> > On the gadget device:
> >
> > $ insmod g_ffs.ko idVendor=<ID> iSerialNumber=<string> functions=adb,ptp
> > mount -t  functionfs adb /dev/usbgadget/adb -o uid=2000,gid=2000
> > mount -t  functionfs ptp /dev/usbgadget/ptp -o uid=2000,gid=2000
> >
> > ./adbd &
> > ./ptp `pwd`/images 2>ptp.log
> >
> > If no "functions" module parameters is supplied, the driver defaults to old
> > behaviour, i.e. it accepts just one function with any name.
> >
> > When "functions" module parameter is supplied, only functions with listed names
> > are accepted.
> 
> Come to think of it, functionfs could simply accept any number of functions and
> ignore their names all together.  Ie. The “functions” parameter could be dropped
> and functionfs could stop caring about mount device names.
> 
> This, I think, would simplify the code a little.

This will complicate things in userspace a lot. The final configuration of the 
gadget depends on the racy order of starting functionfs daemons in userspace,
what is usually done in the background from some kind of system init scripts.

Also please notice that the Windows drivers expect very specific order of usb 
interfaces in the usb device and will not work if the functions has been registered
in the different order.

Some usb functions might also work incorrectly if they are restarted a few times
just because the other functions get registered (gadget need to reregister to notice
the host that a new function is available). 

I think that the current solution with names makes it both clean and reliable. 
Sometimes too much automation makes things much harder.

Best regards
-- 
Marek Szyprowski
Samsung Poland R&D Center


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