Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 332bb43f authored by Mike Lockwood's avatar Mike Lockwood Committed by Greg Kroah-Hartman
Browse files

staging: usb: gadget: Add Configurable Composite Gadget driver



The Configurable Gadget driver is a composite driver that allows
userspace to change at runtime the list of functions enabled in
its configuration and to configure these functions. It supports
multiple functions: acm, rndis, and mass storage.

It is usually controlled by a daemon that changes the configuration
based on user settings. For example, rndis is enabled when the user
enables sharing the phone data connection.

As an example on how to use it, the following shell commands will
make the gadget disconnect from the host and make it be re-enumerated
as a composite with 1 rndis and 2 acm interfaces, and a different
product id:

echo 0       > /sys/class/ccg_usb/ccg0/enable
echo rndis,acm > /sys/class/ccg_usb/ccg0/functions
echo 2       > /sys/class/ccg_usb/ccg0/f_acm/instances
echo -n 0x2d01 > /sys/module/g_ccg/parameters/idProduct
echo 1       > /sys/class/ccg_usb/ccg0/enable

The driver requires a gadget controller that supports software
control of the D+ pullup and the controller driver must support
disabling the pullup during composite_bind.

Signed-off-by: default avatarMike Lockwood <lockwood@android.com>
Signed-off-by: default avatarBenoit Goby <benoit@android.com>
	[import from android.c, implement review comments, remove adb,mtp,ptp,accessory]
Signed-off-by: default avatarAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3a230038
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -130,4 +130,6 @@ source "drivers/staging/ramster/Kconfig"

source "drivers/staging/ozwpan/Kconfig"

source "drivers/staging/ccg/Kconfig"

endif # STAGING
+1 −0
Original line number Diff line number Diff line
@@ -56,3 +56,4 @@ obj-$(CONFIG_ANDROID) += android/
obj-$(CONFIG_PHONE)		+= telephony/
obj-$(CONFIG_RAMSTER)		+= ramster/
obj-$(CONFIG_USB_WPAN_HCD)	+= ozwpan/
obj-$(CONFIG_USB_G_CCG)		+= ccg/
+20 −0
Original line number Diff line number Diff line
if USB_GADGET

config USB_G_CCG
	tristate "Configurable Composite Gadget (STAGING)"
	depends on STAGING && !USB_ZERO && !USB_ZERO_HNPTEST && !USB_AUDIO && !GADGET_UAC1 && !USB_ETH && !USB_ETH_RNDIS && !USB_ETH_EEM && !USB_G_NCM && !USB_GADGETFS && !USB_FUNCTIONFS && !USB_FUNCTIONFS_ETH && !USB_FUNCTIONFS_RNDIS && !USB_FUNCTIONFS_GENERIC && !USB_FILE_STORAGE && !USB_FILE_STORAGE_TEST && !USB_MASS_STORAGE && !USB_G_SERIAL && !USB_MIDI_GADGET && !USB_G_PRINTER && !USB_CDC_COMPOSITE && !USB_G_NOKIA && !USB_G_ACM_MS && !USB_G_MULTI && !USB_G_MULTI_RNDIS && !USB_G_MULTI_CDC && !USB_G_HID && !USB_G_DBGP && !USB_G_WEBCAM
	help
	  The Configurable Composite Gadget supports multiple USB
	  functions: acm, mass storage, rndis and FunctionFS.
	  Each function can be configured and enabled/disabled
	  dynamically from userspace through a sysfs interface.

	  In order to compile this (either as a module or built-in),
	  "USB Gadget Drivers" and anything under it must not be
	  selected compiled-in in
	  Device Drivers->USB Support->USB Gadget Support.
	  However, you can say "M" there, if you do, the
	  Configurable Composite Gadget can be compiled "M" only
	  or not at all.

endif # USB_GADGET
+4 −0
Original line number Diff line number Diff line
g_ccg-y				:= ccg.o
ccflags-y			+= -Idrivers/usb/gadget

obj-$(CONFIG_USB_G_CCG)		+= g_ccg.o
+6 −0
Original line number Diff line number Diff line
TODO:
	- change configuration interface from sysfs to configfs

Please send patches to Greg Kroah-Hartmann <gregkh@linuxfoundation.org>,
Andrzej Pietrasiewicz <andrzej.p@samsung.com>, and
Cc: Mike Lockwood <lockwood@android.com>
Loading