linux/drivers/staging
Andrzej Pietrasiewicz 450279822f staging: usb: gadget: Add FunctionFS support to Configurable Composite Gadget driver
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@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-16 05:32:20 -07:00
..
android Staging tree fixes for 3.4-rc2 2012-04-12 15:35:12 -07:00
asus_oled USB: asus_oled.c: remove err() usage 2012-04-20 16:53:17 -07:00
bcm Staging: bcm: fix possible memory leak of 'pstAddIndication' in CmHost.c and removes a whitespace 2012-03-02 16:36:55 -08:00
ccg staging: usb: gadget: Add FunctionFS support to Configurable Composite Gadget driver 2012-05-16 05:32:20 -07:00
comedi USB: vmk80xx.c: remove err() usage 2012-04-20 16:53:22 -07:00
cptm1217
crystalhd Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
cxt1e1 Merge branch 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging 2012-01-09 12:18:17 -08:00
echo
et131x Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
frontier USB: tranzport.c: remove err() usage 2012-04-20 16:53:27 -07:00
ft1000 Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
iio staging: iio: hmc5843: Fix crash in probe function. 2012-04-12 14:34:31 -07:00
keucr USB merge for 3.4-rc1 2012-03-20 11:26:30 -07:00
line6 USB: toneport.c: remove err() usage 2012-04-20 16:53:32 -07:00
media USB: remove CONFIG_USB_DEVICEFS 2012-04-29 22:20:03 -04:00
mei watchdog: fix set_timeout operations 2012-03-27 20:08:09 +02:00
nvec staging: nvec: Fix Kconfig dependencies 2012-01-31 10:28:00 -08:00
octeon staging: octeon-ethernet: fix build errors by including interrupt.h 2012-04-24 11:57:37 -07:00
olpc_dcon
omapdrm staging: drm/omap: move where DMM driver is registered 2012-04-10 09:19:29 -07:00
ozwpan staging: ozwpan: Fix bug where kfree is called twice. 2012-04-26 12:40:53 -07:00
panel Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
phison
quickstart Staging: quickstart: Fix compilation warning on 64 bit arch 2012-02-13 20:08:56 -08:00
ramster staging: ramster: unbreak my heart 2012-04-10 09:16:19 -07:00
rtl8187se usermodehelper: use UMH_WAIT_PROC consistently 2012-03-23 16:58:41 -07:00
rtl8192e usermodehelper: use UMH_WAIT_PROC consistently 2012-03-23 16:58:41 -07:00
rtl8192u Merge branch 'kmap_atomic' of git://github.com/congwang/linux 2012-03-21 09:40:26 -07:00
rtl8712 staging: r8712u: Fix Smatch warning 2012-03-07 13:36:45 -08:00
rts5139 staging: Update TODO for rts5139 and rts_pstor 2012-02-24 12:03:14 -08:00
rts_pstor Staging: rts_pstor: off by one in for loop 2012-04-10 09:18:59 -07:00
sbe-2t3e3 Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
sep staging: sep: Fix sign of error 2012-04-10 09:14:39 -07:00
serial
serqt_usb2 USB: serqt_usb2: remove duplicate device ids 2012-05-10 14:13:17 -07:00
slicoss staging: clean up Greg's email address in some TODO files 2012-02-15 14:45:40 -08:00
sm7xx includecheck: delete any duplicate instances of module.h 2012-02-28 19:31:56 -05:00
speakup TTY: speakup, do not use serialP 2012-03-08 11:47:02 -08:00
ste_rmi4 ARM: More device tree support updates 2012-03-28 12:34:33 -07:00
telephony Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
tidspbridge staging: tidspbridge: remove usage of OMAP2_L4_IO_ADDRESS 2012-04-24 11:57:36 -07:00
usbip Revert "usb: move struct usb_device->children to struct usb_hub_port->child" 2012-05-14 09:20:37 -07:00
vme staging/vme: Fix module parameters 2012-04-10 09:14:39 -07:00
vt6655 Staging: vt6655-6: check keysize before memcpy() 2012-04-10 09:17:34 -07:00
vt6656 staging: vt6656: Don't leak memory in drivers/staging/vt6656/ioctl.c::private_ioctl() 2012-04-12 14:34:31 -07:00
winbond
wlags49_h2 Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
wlags49_h25
wlan-ng Staging: wlan-ng: still setting wrong data 2012-02-29 15:55:52 -08:00
xgifb staging/xgifb: fix display on XGI Volari Z11m cards 2012-04-10 09:51:49 -07:00
zcache staging: zcache: fix Kconfig crypto dependency 2012-04-24 11:57:36 -07:00
zram Merge branch 'kmap_atomic' of git://github.com/congwang/linux 2012-03-21 09:40:26 -07:00
zsmalloc staging: zsmalloc: fix memory leak 2012-04-10 09:18:59 -07:00
Kconfig staging: usb: gadget: Add Configurable Composite Gadget driver 2012-05-16 05:31:42 -07:00
Makefile staging: usb: gadget: Add Configurable Composite Gadget driver 2012-05-16 05:31:42 -07:00
staging.c