18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci# 38c2ecf20Sopenharmony_ci# USB Gadget support on a system involves 48c2ecf20Sopenharmony_ci# (a) a peripheral controller, and 58c2ecf20Sopenharmony_ci# (b) the gadget driver using it. 68c2ecf20Sopenharmony_ci# 78c2ecf20Sopenharmony_ci# NOTE: Gadget support ** DOES NOT ** depend on host-side CONFIG_USB !! 88c2ecf20Sopenharmony_ci# 98c2ecf20Sopenharmony_ci# - Host systems (like PCs) need CONFIG_USB (with "A" jacks). 108c2ecf20Sopenharmony_ci# - Peripherals (like PDAs) need CONFIG_USB_GADGET (with "B" jacks). 118c2ecf20Sopenharmony_ci# - Some systems have both kinds of controllers. 128c2ecf20Sopenharmony_ci# 138c2ecf20Sopenharmony_ci# With help from a special transceiver and a "Mini-AB" jack, systems with 148c2ecf20Sopenharmony_ci# both kinds of controller can also support "USB On-the-Go" (CONFIG_USB_OTG). 158c2ecf20Sopenharmony_ci# 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_cimenuconfig USB_GADGET 188c2ecf20Sopenharmony_ci tristate "USB Gadget Support" 198c2ecf20Sopenharmony_ci select USB_COMMON 208c2ecf20Sopenharmony_ci select NLS 218c2ecf20Sopenharmony_ci help 228c2ecf20Sopenharmony_ci USB is a host/device protocol, organized with one host (such as a 238c2ecf20Sopenharmony_ci PC) controlling up to 127 peripheral devices. 248c2ecf20Sopenharmony_ci The USB hardware is asymmetric, which makes it easier to set up: 258c2ecf20Sopenharmony_ci you can't connect a "to-the-host" connector to a peripheral. 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci Linux can run in the host, or in the peripheral. In both cases 288c2ecf20Sopenharmony_ci you need a low level bus controller driver, and some software 298c2ecf20Sopenharmony_ci talking to it. Peripheral controllers are often discrete silicon, 308c2ecf20Sopenharmony_ci or are integrated with the CPU in a microcontroller. The more 318c2ecf20Sopenharmony_ci familiar host side controllers have names like "EHCI", "OHCI", 328c2ecf20Sopenharmony_ci or "UHCI", and are usually integrated into southbridges on PC 338c2ecf20Sopenharmony_ci motherboards. 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci Enable this configuration option if you want to run Linux inside 368c2ecf20Sopenharmony_ci a USB peripheral device. Configure one hardware driver for your 378c2ecf20Sopenharmony_ci peripheral/device side bus controller, and a "gadget driver" for 388c2ecf20Sopenharmony_ci your peripheral protocol. (If you use modular gadget drivers, 398c2ecf20Sopenharmony_ci you may configure more than one.) 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci If in doubt, say "N" and don't enable these drivers; most people 428c2ecf20Sopenharmony_ci don't have this kind of hardware (except maybe inside Linux PDAs). 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci For more information, see <http://www.linux-usb.org/gadget> and 458c2ecf20Sopenharmony_ci the kernel documentation for this API. 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ciif USB_GADGET 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ciconfig USB_GADGET_DEBUG 508c2ecf20Sopenharmony_ci bool "Debugging messages (DEVELOPMENT)" 518c2ecf20Sopenharmony_ci depends on DEBUG_KERNEL 528c2ecf20Sopenharmony_ci help 538c2ecf20Sopenharmony_ci Many controller and gadget drivers will print some debugging 548c2ecf20Sopenharmony_ci messages if you use this option to ask for those messages. 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci Avoid enabling these messages, even if you're actively 578c2ecf20Sopenharmony_ci debugging such a driver. Many drivers will emit so many 588c2ecf20Sopenharmony_ci messages that the driver timings are affected, which will 598c2ecf20Sopenharmony_ci either create new failure modes or remove the one you're 608c2ecf20Sopenharmony_ci trying to track down. Never enable these messages for a 618c2ecf20Sopenharmony_ci production build. 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ciconfig USB_GADGET_VERBOSE 648c2ecf20Sopenharmony_ci bool "Verbose debugging Messages (DEVELOPMENT)" 658c2ecf20Sopenharmony_ci depends on USB_GADGET_DEBUG 668c2ecf20Sopenharmony_ci help 678c2ecf20Sopenharmony_ci Many controller and gadget drivers will print verbose debugging 688c2ecf20Sopenharmony_ci messages if you use this option to ask for those messages. 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci Avoid enabling these messages, even if you're actively 718c2ecf20Sopenharmony_ci debugging such a driver. Many drivers will emit so many 728c2ecf20Sopenharmony_ci messages that the driver timings are affected, which will 738c2ecf20Sopenharmony_ci either create new failure modes or remove the one you're 748c2ecf20Sopenharmony_ci trying to track down. Never enable these messages for a 758c2ecf20Sopenharmony_ci production build. 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ciconfig USB_GADGET_DEBUG_FILES 788c2ecf20Sopenharmony_ci bool "Debugging information files (DEVELOPMENT)" 798c2ecf20Sopenharmony_ci depends on PROC_FS 808c2ecf20Sopenharmony_ci help 818c2ecf20Sopenharmony_ci Some of the drivers in the "gadget" framework can expose 828c2ecf20Sopenharmony_ci debugging information in files such as /proc/driver/udc 838c2ecf20Sopenharmony_ci (for a peripheral controller). The information in these 848c2ecf20Sopenharmony_ci files may help when you're troubleshooting or bringing up a 858c2ecf20Sopenharmony_ci driver on a new board. Enable these files by choosing "Y" 868c2ecf20Sopenharmony_ci here. If in doubt, or to conserve kernel memory, say "N". 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ciconfig USB_GADGET_DEBUG_FS 898c2ecf20Sopenharmony_ci bool "Debugging information files in debugfs (DEVELOPMENT)" 908c2ecf20Sopenharmony_ci depends on DEBUG_FS 918c2ecf20Sopenharmony_ci help 928c2ecf20Sopenharmony_ci Some of the drivers in the "gadget" framework can expose 938c2ecf20Sopenharmony_ci debugging information in files under /sys/kernel/debug/. 948c2ecf20Sopenharmony_ci The information in these files may help when you're 958c2ecf20Sopenharmony_ci troubleshooting or bringing up a driver on a new board. 968c2ecf20Sopenharmony_ci Enable these files by choosing "Y" here. If in doubt, or 978c2ecf20Sopenharmony_ci to conserve kernel memory, say "N". 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ciconfig USB_GADGET_VBUS_DRAW 1008c2ecf20Sopenharmony_ci int "Maximum VBUS Power usage (2-500 mA)" 1018c2ecf20Sopenharmony_ci range 2 500 1028c2ecf20Sopenharmony_ci default 2 1038c2ecf20Sopenharmony_ci help 1048c2ecf20Sopenharmony_ci Some devices need to draw power from USB when they are 1058c2ecf20Sopenharmony_ci configured, perhaps to operate circuitry or to recharge 1068c2ecf20Sopenharmony_ci batteries. This is in addition to any local power supply, 1078c2ecf20Sopenharmony_ci such as an AC adapter or batteries. 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci Enter the maximum power your device draws through USB, in 1108c2ecf20Sopenharmony_ci milliAmperes. The permitted range of values is 2 - 500 mA; 1118c2ecf20Sopenharmony_ci 0 mA would be legal, but can make some hosts misbehave. 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci This value will be used except for system-specific gadget 1148c2ecf20Sopenharmony_ci drivers that have more specific information. 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ciconfig USB_GADGET_STORAGE_NUM_BUFFERS 1178c2ecf20Sopenharmony_ci int "Number of storage pipeline buffers" 1188c2ecf20Sopenharmony_ci range 2 256 1198c2ecf20Sopenharmony_ci default 2 1208c2ecf20Sopenharmony_ci help 1218c2ecf20Sopenharmony_ci Usually 2 buffers are enough to establish a good buffering 1228c2ecf20Sopenharmony_ci pipeline. The number may be increased in order to compensate 1238c2ecf20Sopenharmony_ci for a bursty VFS behaviour. For instance there may be CPU wake up 1248c2ecf20Sopenharmony_ci latencies that makes the VFS to appear bursty in a system with 1258c2ecf20Sopenharmony_ci an CPU on-demand governor. Especially if DMA is doing IO to 1268c2ecf20Sopenharmony_ci offload the CPU. In this case the CPU will go into power 1278c2ecf20Sopenharmony_ci save often and spin up occasionally to move data within VFS. 1288c2ecf20Sopenharmony_ci If selecting USB_GADGET_DEBUG_FILES this value may be set by 1298c2ecf20Sopenharmony_ci a module parameter as well. 1308c2ecf20Sopenharmony_ci If unsure, say 2. 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ciconfig U_SERIAL_CONSOLE 1338c2ecf20Sopenharmony_ci bool "Serial gadget console support" 1348c2ecf20Sopenharmony_ci depends on USB_U_SERIAL 1358c2ecf20Sopenharmony_ci help 1368c2ecf20Sopenharmony_ci It supports the serial gadget can be used as a console. 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_cisource "drivers/usb/gadget/udc/Kconfig" 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ci# 1418c2ecf20Sopenharmony_ci# USB Gadget Drivers 1428c2ecf20Sopenharmony_ci# 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci# composite based drivers 1458c2ecf20Sopenharmony_ciconfig USB_LIBCOMPOSITE 1468c2ecf20Sopenharmony_ci tristate 1478c2ecf20Sopenharmony_ci select CONFIGFS_FS 1488c2ecf20Sopenharmony_ci depends on USB_GADGET 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ciconfig USB_F_ACM 1518c2ecf20Sopenharmony_ci tristate 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_ciconfig USB_F_SS_LB 1548c2ecf20Sopenharmony_ci tristate 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ciconfig USB_U_SERIAL 1578c2ecf20Sopenharmony_ci tristate 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ciconfig USB_U_ETHER 1608c2ecf20Sopenharmony_ci tristate 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ciconfig USB_U_AUDIO 1638c2ecf20Sopenharmony_ci tristate 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_ciconfig USB_F_SERIAL 1668c2ecf20Sopenharmony_ci tristate 1678c2ecf20Sopenharmony_ci 1688c2ecf20Sopenharmony_ciconfig USB_F_OBEX 1698c2ecf20Sopenharmony_ci tristate 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ciconfig USB_F_NCM 1728c2ecf20Sopenharmony_ci tristate 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_ciconfig USB_F_ECM 1758c2ecf20Sopenharmony_ci tristate 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_ciconfig USB_F_PHONET 1788c2ecf20Sopenharmony_ci tristate 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_ciconfig USB_F_EEM 1818c2ecf20Sopenharmony_ci tristate 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ciconfig USB_F_SUBSET 1848c2ecf20Sopenharmony_ci tristate 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ciconfig USB_F_RNDIS 1878c2ecf20Sopenharmony_ci tristate 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ciconfig USB_F_MASS_STORAGE 1908c2ecf20Sopenharmony_ci tristate 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_ciconfig USB_F_FS 1938c2ecf20Sopenharmony_ci tristate 1948c2ecf20Sopenharmony_ci 1958c2ecf20Sopenharmony_ciconfig USB_F_UAC1 1968c2ecf20Sopenharmony_ci tristate 1978c2ecf20Sopenharmony_ci 1988c2ecf20Sopenharmony_ciconfig USB_F_UAC1_LEGACY 1998c2ecf20Sopenharmony_ci tristate 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ciconfig USB_F_UAC2 2028c2ecf20Sopenharmony_ci tristate 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ciconfig USB_F_UVC 2058c2ecf20Sopenharmony_ci tristate 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_ciconfig USB_F_MIDI 2088c2ecf20Sopenharmony_ci tristate 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ciconfig USB_F_HID 2118c2ecf20Sopenharmony_ci tristate 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_ciconfig USB_F_PRINTER 2148c2ecf20Sopenharmony_ci tristate 2158c2ecf20Sopenharmony_ci 2168c2ecf20Sopenharmony_ciconfig USB_F_TCM 2178c2ecf20Sopenharmony_ci tristate 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci# this first set of drivers all depend on bulk-capable hardware. 2208c2ecf20Sopenharmony_ci 2218c2ecf20Sopenharmony_ciconfig USB_CONFIGFS 2228c2ecf20Sopenharmony_ci tristate "USB Gadget functions configurable through configfs" 2238c2ecf20Sopenharmony_ci select USB_LIBCOMPOSITE 2248c2ecf20Sopenharmony_ci help 2258c2ecf20Sopenharmony_ci A Linux USB "gadget" can be set up through configfs. 2268c2ecf20Sopenharmony_ci If this is the case, the USB functions (which from the host's 2278c2ecf20Sopenharmony_ci perspective are seen as interfaces) and configurations are 2288c2ecf20Sopenharmony_ci specified simply by creating appropriate directories in configfs. 2298c2ecf20Sopenharmony_ci Associating functions with configurations is done by creating 2308c2ecf20Sopenharmony_ci appropriate symbolic links. 2318c2ecf20Sopenharmony_ci For more information see Documentation/usb/gadget_configfs.rst. 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_ciconfig USB_CONFIGFS_SERIAL 2348c2ecf20Sopenharmony_ci bool "Generic serial bulk in/out" 2358c2ecf20Sopenharmony_ci depends on USB_CONFIGFS 2368c2ecf20Sopenharmony_ci depends on TTY 2378c2ecf20Sopenharmony_ci select USB_U_SERIAL 2388c2ecf20Sopenharmony_ci select USB_F_SERIAL 2398c2ecf20Sopenharmony_ci help 2408c2ecf20Sopenharmony_ci The function talks to the Linux-USB generic serial driver. 2418c2ecf20Sopenharmony_ci 2428c2ecf20Sopenharmony_ciconfig USB_CONFIGFS_ACM 2438c2ecf20Sopenharmony_ci bool "Abstract Control Model (CDC ACM)" 2448c2ecf20Sopenharmony_ci depends on USB_CONFIGFS 2458c2ecf20Sopenharmony_ci depends on TTY 2468c2ecf20Sopenharmony_ci select USB_U_SERIAL 2478c2ecf20Sopenharmony_ci select USB_F_ACM 2488c2ecf20Sopenharmony_ci help 2498c2ecf20Sopenharmony_ci ACM serial link. This function can be used to interoperate with 2508c2ecf20Sopenharmony_ci MS-Windows hosts or with the Linux-USB "cdc-acm" driver. 2518c2ecf20Sopenharmony_ci 2528c2ecf20Sopenharmony_ciconfig USB_CONFIGFS_OBEX 2538c2ecf20Sopenharmony_ci bool "Object Exchange Model (CDC OBEX)" 2548c2ecf20Sopenharmony_ci depends on USB_CONFIGFS 2558c2ecf20Sopenharmony_ci depends on TTY 2568c2ecf20Sopenharmony_ci select USB_U_SERIAL 2578c2ecf20Sopenharmony_ci select USB_F_OBEX 2588c2ecf20Sopenharmony_ci help 2598c2ecf20Sopenharmony_ci You will need a user space OBEX server talking to /dev/ttyGS*, 2608c2ecf20Sopenharmony_ci since the kernel itself doesn't implement the OBEX protocol. 2618c2ecf20Sopenharmony_ci 2628c2ecf20Sopenharmony_ciconfig USB_CONFIGFS_NCM 2638c2ecf20Sopenharmony_ci bool "Network Control Model (CDC NCM)" 2648c2ecf20Sopenharmony_ci depends on USB_CONFIGFS 2658c2ecf20Sopenharmony_ci depends on NET 2668c2ecf20Sopenharmony_ci select USB_U_ETHER 2678c2ecf20Sopenharmony_ci select USB_F_NCM 2688c2ecf20Sopenharmony_ci select CRC32 2698c2ecf20Sopenharmony_ci help 2708c2ecf20Sopenharmony_ci NCM is an advanced protocol for Ethernet encapsulation, allows 2718c2ecf20Sopenharmony_ci grouping of several ethernet frames into one USB transfer and 2728c2ecf20Sopenharmony_ci different alignment possibilities. 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_ciconfig USB_CONFIGFS_ECM 2758c2ecf20Sopenharmony_ci bool "Ethernet Control Model (CDC ECM)" 2768c2ecf20Sopenharmony_ci depends on USB_CONFIGFS 2778c2ecf20Sopenharmony_ci depends on NET 2788c2ecf20Sopenharmony_ci select USB_U_ETHER 2798c2ecf20Sopenharmony_ci select USB_F_ECM 2808c2ecf20Sopenharmony_ci help 2818c2ecf20Sopenharmony_ci The "Communication Device Class" (CDC) Ethernet Control Model. 2828c2ecf20Sopenharmony_ci That protocol is often avoided with pure Ethernet adapters, in 2838c2ecf20Sopenharmony_ci favor of simpler vendor-specific hardware, but is widely 2848c2ecf20Sopenharmony_ci supported by firmware for smart network devices. 2858c2ecf20Sopenharmony_ci 2868c2ecf20Sopenharmony_ciconfig USB_CONFIGFS_ECM_SUBSET 2878c2ecf20Sopenharmony_ci bool "Ethernet Control Model (CDC ECM) subset" 2888c2ecf20Sopenharmony_ci depends on USB_CONFIGFS 2898c2ecf20Sopenharmony_ci depends on NET 2908c2ecf20Sopenharmony_ci select USB_U_ETHER 2918c2ecf20Sopenharmony_ci select USB_F_SUBSET 2928c2ecf20Sopenharmony_ci help 2938c2ecf20Sopenharmony_ci On hardware that can't implement the full protocol, 2948c2ecf20Sopenharmony_ci a simple CDC subset is used, placing fewer demands on USB. 2958c2ecf20Sopenharmony_ci 2968c2ecf20Sopenharmony_ciconfig USB_CONFIGFS_RNDIS 2978c2ecf20Sopenharmony_ci bool "RNDIS" 2988c2ecf20Sopenharmony_ci depends on USB_CONFIGFS 2998c2ecf20Sopenharmony_ci depends on NET 3008c2ecf20Sopenharmony_ci select USB_U_ETHER 3018c2ecf20Sopenharmony_ci select USB_F_RNDIS 3028c2ecf20Sopenharmony_ci help 3038c2ecf20Sopenharmony_ci Microsoft Windows XP bundles the "Remote NDIS" (RNDIS) protocol, 3048c2ecf20Sopenharmony_ci and Microsoft provides redistributable binary RNDIS drivers for 3058c2ecf20Sopenharmony_ci older versions of Windows. 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_ci To make MS-Windows work with this, use Documentation/usb/linux.inf 3088c2ecf20Sopenharmony_ci as the "driver info file". For versions of MS-Windows older than 3098c2ecf20Sopenharmony_ci XP, you'll need to download drivers from Microsoft's website; a URL 3108c2ecf20Sopenharmony_ci is given in comments found in that info file. 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ciconfig USB_CONFIGFS_EEM 3138c2ecf20Sopenharmony_ci bool "Ethernet Emulation Model (EEM)" 3148c2ecf20Sopenharmony_ci depends on USB_CONFIGFS 3158c2ecf20Sopenharmony_ci depends on NET 3168c2ecf20Sopenharmony_ci select USB_U_ETHER 3178c2ecf20Sopenharmony_ci select USB_F_EEM 3188c2ecf20Sopenharmony_ci select CRC32 3198c2ecf20Sopenharmony_ci help 3208c2ecf20Sopenharmony_ci CDC EEM is a newer USB standard that is somewhat simpler than CDC ECM 3218c2ecf20Sopenharmony_ci and therefore can be supported by more hardware. Technically ECM and 3228c2ecf20Sopenharmony_ci EEM are designed for different applications. The ECM model extends 3238c2ecf20Sopenharmony_ci the network interface to the target (e.g. a USB cable modem), and the 3248c2ecf20Sopenharmony_ci EEM model is for mobile devices to communicate with hosts using 3258c2ecf20Sopenharmony_ci ethernet over USB. For Linux gadgets, however, the interface with 3268c2ecf20Sopenharmony_ci the host is the same (a usbX device), so the differences are minimal. 3278c2ecf20Sopenharmony_ci 3288c2ecf20Sopenharmony_ciconfig USB_CONFIGFS_PHONET 3298c2ecf20Sopenharmony_ci bool "Phonet protocol" 3308c2ecf20Sopenharmony_ci depends on USB_CONFIGFS 3318c2ecf20Sopenharmony_ci depends on NET 3328c2ecf20Sopenharmony_ci depends on PHONET 3338c2ecf20Sopenharmony_ci select USB_U_ETHER 3348c2ecf20Sopenharmony_ci select USB_F_PHONET 3358c2ecf20Sopenharmony_ci help 3368c2ecf20Sopenharmony_ci The Phonet protocol implementation for USB device. 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_ciconfig USB_CONFIGFS_MASS_STORAGE 3398c2ecf20Sopenharmony_ci bool "Mass storage" 3408c2ecf20Sopenharmony_ci depends on USB_CONFIGFS 3418c2ecf20Sopenharmony_ci depends on BLOCK 3428c2ecf20Sopenharmony_ci select USB_F_MASS_STORAGE 3438c2ecf20Sopenharmony_ci help 3448c2ecf20Sopenharmony_ci The Mass Storage Gadget acts as a USB Mass Storage disk drive. 3458c2ecf20Sopenharmony_ci As its storage repository it can use a regular file or a block 3468c2ecf20Sopenharmony_ci device (in much the same way as the "loop" device driver), 3478c2ecf20Sopenharmony_ci specified as a module parameter or sysfs option. 3488c2ecf20Sopenharmony_ci 3498c2ecf20Sopenharmony_ciconfig USB_CONFIGFS_F_LB_SS 3508c2ecf20Sopenharmony_ci bool "Loopback and sourcesink function (for testing)" 3518c2ecf20Sopenharmony_ci depends on USB_CONFIGFS 3528c2ecf20Sopenharmony_ci select USB_F_SS_LB 3538c2ecf20Sopenharmony_ci help 3548c2ecf20Sopenharmony_ci Loopback function loops back a configurable number of transfers. 3558c2ecf20Sopenharmony_ci Sourcesink function either sinks and sources bulk data. 3568c2ecf20Sopenharmony_ci It also implements control requests, for "chapter 9" conformance. 3578c2ecf20Sopenharmony_ci Make this be the first driver you try using on top of any new 3588c2ecf20Sopenharmony_ci USB peripheral controller driver. Then you can use host-side 3598c2ecf20Sopenharmony_ci test software, like the "usbtest" driver, to put your hardware 3608c2ecf20Sopenharmony_ci and its driver through a basic set of functional tests. 3618c2ecf20Sopenharmony_ci 3628c2ecf20Sopenharmony_ciconfig USB_CONFIGFS_F_FS 3638c2ecf20Sopenharmony_ci bool "Function filesystem (FunctionFS)" 3648c2ecf20Sopenharmony_ci depends on USB_CONFIGFS 3658c2ecf20Sopenharmony_ci select USB_F_FS 3668c2ecf20Sopenharmony_ci help 3678c2ecf20Sopenharmony_ci The Function Filesystem (FunctionFS) lets one create USB 3688c2ecf20Sopenharmony_ci composite functions in user space in the same way GadgetFS 3698c2ecf20Sopenharmony_ci lets one create USB gadgets in user space. This allows creation 3708c2ecf20Sopenharmony_ci of composite gadgets such that some of the functions are 3718c2ecf20Sopenharmony_ci implemented in kernel space (for instance Ethernet, serial or 3728c2ecf20Sopenharmony_ci mass storage) and other are implemented in user space. 3738c2ecf20Sopenharmony_ci 3748c2ecf20Sopenharmony_ciconfig USB_CONFIGFS_F_UAC1 3758c2ecf20Sopenharmony_ci bool "Audio Class 1.0" 3768c2ecf20Sopenharmony_ci depends on USB_CONFIGFS 3778c2ecf20Sopenharmony_ci depends on SND 3788c2ecf20Sopenharmony_ci select USB_LIBCOMPOSITE 3798c2ecf20Sopenharmony_ci select SND_PCM 3808c2ecf20Sopenharmony_ci select USB_U_AUDIO 3818c2ecf20Sopenharmony_ci select USB_F_UAC1 3828c2ecf20Sopenharmony_ci help 3838c2ecf20Sopenharmony_ci This Audio function implements 1 AudioControl interface, 3848c2ecf20Sopenharmony_ci 1 AudioStreaming Interface each for USB-OUT and USB-IN. 3858c2ecf20Sopenharmony_ci This driver doesn't expect any real Audio codec to be present 3868c2ecf20Sopenharmony_ci on the device - the audio streams are simply sinked to and 3878c2ecf20Sopenharmony_ci sourced from a virtual ALSA sound card created. The user-space 3888c2ecf20Sopenharmony_ci application may choose to do whatever it wants with the data 3898c2ecf20Sopenharmony_ci received from the USB Host and choose to provide whatever it 3908c2ecf20Sopenharmony_ci wants as audio data to the USB Host. 3918c2ecf20Sopenharmony_ci 3928c2ecf20Sopenharmony_ciconfig USB_CONFIGFS_F_UAC1_LEGACY 3938c2ecf20Sopenharmony_ci bool "Audio Class 1.0 (legacy implementation)" 3948c2ecf20Sopenharmony_ci depends on USB_CONFIGFS 3958c2ecf20Sopenharmony_ci depends on SND 3968c2ecf20Sopenharmony_ci select USB_LIBCOMPOSITE 3978c2ecf20Sopenharmony_ci select SND_PCM 3988c2ecf20Sopenharmony_ci select USB_F_UAC1_LEGACY 3998c2ecf20Sopenharmony_ci help 4008c2ecf20Sopenharmony_ci This Audio function implements 1 AudioControl interface, 4018c2ecf20Sopenharmony_ci 1 AudioStreaming Interface each for USB-OUT and USB-IN. 4028c2ecf20Sopenharmony_ci This is a legacy driver and requires a real Audio codec 4038c2ecf20Sopenharmony_ci to be present on the device. 4048c2ecf20Sopenharmony_ci 4058c2ecf20Sopenharmony_ciconfig USB_CONFIGFS_F_UAC2 4068c2ecf20Sopenharmony_ci bool "Audio Class 2.0" 4078c2ecf20Sopenharmony_ci depends on USB_CONFIGFS 4088c2ecf20Sopenharmony_ci depends on SND 4098c2ecf20Sopenharmony_ci select USB_LIBCOMPOSITE 4108c2ecf20Sopenharmony_ci select SND_PCM 4118c2ecf20Sopenharmony_ci select USB_U_AUDIO 4128c2ecf20Sopenharmony_ci select USB_F_UAC2 4138c2ecf20Sopenharmony_ci help 4148c2ecf20Sopenharmony_ci This Audio function is compatible with USB Audio Class 4158c2ecf20Sopenharmony_ci specification 2.0. It implements 1 AudioControl interface, 4168c2ecf20Sopenharmony_ci 1 AudioStreaming Interface each for USB-OUT and USB-IN. 4178c2ecf20Sopenharmony_ci This driver doesn't expect any real Audio codec to be present 4188c2ecf20Sopenharmony_ci on the device - the audio streams are simply sinked to and 4198c2ecf20Sopenharmony_ci sourced from a virtual ALSA sound card created. The user-space 4208c2ecf20Sopenharmony_ci application may choose to do whatever it wants with the data 4218c2ecf20Sopenharmony_ci received from the USB Host and choose to provide whatever it 4228c2ecf20Sopenharmony_ci wants as audio data to the USB Host. 4238c2ecf20Sopenharmony_ci 4248c2ecf20Sopenharmony_ciconfig USB_CONFIGFS_F_MIDI 4258c2ecf20Sopenharmony_ci bool "MIDI function" 4268c2ecf20Sopenharmony_ci depends on USB_CONFIGFS 4278c2ecf20Sopenharmony_ci depends on SND 4288c2ecf20Sopenharmony_ci select USB_LIBCOMPOSITE 4298c2ecf20Sopenharmony_ci select SND_RAWMIDI 4308c2ecf20Sopenharmony_ci select USB_F_MIDI 4318c2ecf20Sopenharmony_ci help 4328c2ecf20Sopenharmony_ci The MIDI Function acts as a USB Audio device, with one MIDI 4338c2ecf20Sopenharmony_ci input and one MIDI output. These MIDI jacks appear as 4348c2ecf20Sopenharmony_ci a sound "card" in the ALSA sound system. Other MIDI 4358c2ecf20Sopenharmony_ci connections can then be made on the gadget system, using 4368c2ecf20Sopenharmony_ci ALSA's aconnect utility etc. 4378c2ecf20Sopenharmony_ci 4388c2ecf20Sopenharmony_ciconfig USB_CONFIGFS_F_HID 4398c2ecf20Sopenharmony_ci bool "HID function" 4408c2ecf20Sopenharmony_ci depends on USB_CONFIGFS 4418c2ecf20Sopenharmony_ci select USB_F_HID 4428c2ecf20Sopenharmony_ci help 4438c2ecf20Sopenharmony_ci The HID function driver provides generic emulation of USB 4448c2ecf20Sopenharmony_ci Human Interface Devices (HID). 4458c2ecf20Sopenharmony_ci 4468c2ecf20Sopenharmony_ci For more information, see Documentation/usb/gadget_hid.rst. 4478c2ecf20Sopenharmony_ci 4488c2ecf20Sopenharmony_ciconfig USB_CONFIGFS_F_UVC 4498c2ecf20Sopenharmony_ci bool "USB Webcam function" 4508c2ecf20Sopenharmony_ci depends on USB_CONFIGFS 4518c2ecf20Sopenharmony_ci depends on VIDEO_V4L2 4528c2ecf20Sopenharmony_ci depends on VIDEO_DEV 4538c2ecf20Sopenharmony_ci select VIDEOBUF2_VMALLOC 4548c2ecf20Sopenharmony_ci select USB_F_UVC 4558c2ecf20Sopenharmony_ci help 4568c2ecf20Sopenharmony_ci The Webcam function acts as a composite USB Audio and Video Class 4578c2ecf20Sopenharmony_ci device. It provides a userspace API to process UVC control requests 4588c2ecf20Sopenharmony_ci and stream video data to the host. 4598c2ecf20Sopenharmony_ci 4608c2ecf20Sopenharmony_ciconfig USB_CONFIGFS_F_PRINTER 4618c2ecf20Sopenharmony_ci bool "Printer function" 4628c2ecf20Sopenharmony_ci select USB_F_PRINTER 4638c2ecf20Sopenharmony_ci depends on USB_CONFIGFS 4648c2ecf20Sopenharmony_ci help 4658c2ecf20Sopenharmony_ci The Printer function channels data between the USB host and a 4668c2ecf20Sopenharmony_ci userspace program driving the print engine. The user space 4678c2ecf20Sopenharmony_ci program reads and writes the device file /dev/g_printer<X> to 4688c2ecf20Sopenharmony_ci receive or send printer data. It can use ioctl calls to 4698c2ecf20Sopenharmony_ci the device file to get or set printer status. 4708c2ecf20Sopenharmony_ci 4718c2ecf20Sopenharmony_ci For more information, see Documentation/usb/gadget_printer.rst 4728c2ecf20Sopenharmony_ci which includes sample code for accessing the device file. 4738c2ecf20Sopenharmony_ci 4748c2ecf20Sopenharmony_ciconfig USB_CONFIGFS_F_TCM 4758c2ecf20Sopenharmony_ci bool "USB Gadget Target Fabric" 4768c2ecf20Sopenharmony_ci depends on TARGET_CORE 4778c2ecf20Sopenharmony_ci depends on USB_CONFIGFS 4788c2ecf20Sopenharmony_ci select USB_LIBCOMPOSITE 4798c2ecf20Sopenharmony_ci select USB_F_TCM 4808c2ecf20Sopenharmony_ci help 4818c2ecf20Sopenharmony_ci This fabric is a USB gadget component. Two USB protocols are 4828c2ecf20Sopenharmony_ci supported that is BBB or BOT (Bulk Only Transport) and UAS 4838c2ecf20Sopenharmony_ci (USB Attached SCSI). BOT is advertised on alternative 4848c2ecf20Sopenharmony_ci interface 0 (primary) and UAS is on alternative interface 1. 4858c2ecf20Sopenharmony_ci Both protocols can work on USB2.0 and USB3.0. 4868c2ecf20Sopenharmony_ci UAS utilizes the USB 3.0 feature called streams support. 4878c2ecf20Sopenharmony_ci 4888c2ecf20Sopenharmony_cisource "drivers/usb/gadget/legacy/Kconfig" 4898c2ecf20Sopenharmony_ci 4908c2ecf20Sopenharmony_ciendif # USB_GADGET 491