Re: [PATCHv2 10/10] staging: usb: gadget: Add FunctionFS support to Configurable Composite Gadget driver

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

 



On Fri, May 11, 2012 at 02:29:25PM +0200, Andrzej Pietrasiewicz wrote:
> Add FunctionFS support.
> It allows certain USB functions to be provided from userspace, e.g. MTP,
> PTP, adb.
> 
> The functions provided by the gadget itself are enumerated in
> /sys/class/ccg0/functions. The functions which can be supplied
> from userspace must be enumerated in /sys/class/ccg0/f_fs/user_functions.
> No other userspace functions can be used than specified in the above mentioned
> file, but just specifying them there is not enough to activate them.
> The userspace functions in order to be activated need also be enumerated
> in /sys/class/ccg0/functions.
> 
> An example sequence of operations can be as follows:
> 
> $ echo 0 > /sys/class/ccg_usb/ccg0/enable
> 
> $ echo -n 0x2d01 > /sys/module/g_ccg/parameters/idProduct
> $ echo -n MyDevice > /sys/module/g_ccg/parameters/iSerialNumber
> $ echo -n 0x1d6b > /sys/module/g_ccg/parameters/idVendor
> $ echo -n Manufacturer > /sys/module/g_ccg/parameters/iManufacturer
> $ echo -n Product > /sys/module/g_ccg/parameters/iProduct
> $ echo -n bcdDevice > /sys/module/g_ccg/parameters/bcdDevice
> 
> $ echo adb,mtp,ptp > /sys/class/ccg_usb/ccg0/f_fs/user_functions
> $ echo mass_storage,ptp > /sys/class/ccg_usb/ccg0/functions
> $ echo /file.img > /sys/class/ccg_usb/ccg0/f_mass_storage/lun/file
> 
> $ mkdir -p /dev/usbgadget/ptp
> $ mount -t functionfs ptp /dev/usbgadget/ptp
> $ ./ptp &
> 
> $ echo 1 > /sys/class/ccg_usb/ccg0/enable
> 
> The above example declares that adb, mtp and ptp functions can be supplied
> from userspace through FunctionFS. But of them all only ptp is actually
> activated, together with mass_storage, the latter being implemented in
> the gadget itself (in kernel, not in userspace). The list of functions
> can be modified at runtime while the gadget is not enabled, that is,
> after
> 
> $ echo 0 > /sys/class/ccg_usb/ccg0/enable
> 
> The FunctionFS function is implicitly handled by the gadget, that is,
> if a userspace function name is provided in
> /sys/class/ccg_usb/ccg0/functions, then the FunctionFS function
> is activated.
> 
> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@xxxxxxxxxxx>
> Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>
> Acked-by: Michal Nazarewicz <mina86@xxxxxxxxxx>
> ---
>  Documentation/ABI/testing/sysfs-class-ccg_usb |   32 +++-

Again, put this file in drivers/staging/ccg/ as well, staging drivers
should be self-contained, the reason you are putting it in here, is the
userspace api is changing.  You just documented something that we have
to support forever, which isn't true.


> +What:		/sys/class/ccg_usb/ccgX/f_fs
> +Date:		March 2012
> +KernelVersion:	3.3
> +Contact:	linux-usb@xxxxxxxxxxxxxxx
> +Description:
> +		The /sys/class/ccg_usb/ccgX/f_fs subdirectory
> +		corresponds to the gadget's FunctionFS driver.
> +
> +What:		/sys/class/ccg_usb/ccgX/f_fs/user_functions
> +Date:		March 2012
> +KernelVersion:	3.3

Again, 3.3?

And March 2012?

Please fix.

greg k-h
--
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