1 # SPDX-License-Identifier: GPL-2.0
3 # USB Gadget support on a system involves
4 # (a) a peripheral controller, and
5 # (b) the gadget driver using it.
7 # NOTE: Gadget support ** DOES NOT ** depend on host-side CONFIG_USB !!
9 # - Host systems (like PCs) need CONFIG_USB (with "A" jacks).
10 # - Peripherals (like PDAs) need CONFIG_USB_GADGET (with "B" jacks).
11 # - Some systems have both kinds of controllers.
13 # With help from a special transceiver and a "Mini-AB" jack, systems with
14 # both kinds of controller can also support "USB On-the-Go" (CONFIG_USB_OTG).
16 # A Linux "Gadget Driver" talks to the USB Peripheral Controller
17 # driver through the abstract "gadget" API. Some other operating
18 # systems call these "client" drivers, of which "class drivers"
19 # are a subset (implementing a USB device class specification).
20 # A gadget driver implements one or more USB functions using
21 # the peripheral hardware.
23 # Gadget drivers are hardware-neutral, or "platform independent",
24 # except that they sometimes must understand quirks or limitations
25 # of the particular controllers they work with. For example, when
26 # a controller doesn't support alternate configurations or provide
27 # enough of the right types of endpoints, the gadget driver might
28 # not be able work with that controller, or might need to implement
29 # a less common variant of a device class protocol.
31 # The available choices each represent a single precomposed USB
32 # gadget configuration. In the device model, each option contains
33 # both the device instantiation as a child for a USB gadget
34 # controller, and the relevant drivers for each function declared
37 menu "USB Gadget precomposed configurations"
40 tristate "Gadget Zero (DEVELOPMENT)"
41 select USB_LIBCOMPOSITE
44 Gadget Zero is a two-configuration device. It either sinks and
45 sources bulk data; or it loops back a configurable number of
46 transfers. It also implements control requests, for "chapter 9"
47 conformance. The driver needs only two bulk-capable endpoints, so
48 it can work on top of most device-side usb controllers. It's
49 useful for testing, and is also a working example showing how
50 USB "gadget drivers" can be written.
52 Make this be the first driver you try using on top of any new
53 USB peripheral controller driver. Then you can use host-side
54 test software, like the "usbtest" driver, to put your hardware
55 and its driver through a basic set of functional tests.
57 Gadget Zero also works with the host-side "usb-skeleton" driver,
58 and with many kinds of host-side test software. You may need
59 to tweak product and vendor IDs before host software knows about
60 this device, and arrange to select an appropriate configuration.
62 Say "y" to link the driver statically, or "m" to build a
63 dynamically linked module called "g_zero".
65 config USB_ZERO_HNPTEST
66 bool "HNP Test Device"
67 depends on USB_ZERO && USB_OTG
69 You can configure this device to enumerate using the device
70 identifiers of the USB-OTG test device. That means that when
71 this gadget connects to another OTG device, with this one using
72 the "B-Peripheral" role, that device will use HNP to let this
73 one serve as the USB host instead (in the "B-Host" role).
76 tristate "Audio Gadget"
78 select USB_LIBCOMPOSITE
80 select USB_F_UAC1 if (GADGET_UAC1 && !GADGET_UAC1_LEGACY)
81 select USB_F_UAC1_LEGACY if (GADGET_UAC1 && GADGET_UAC1_LEGACY)
82 select USB_F_UAC2 if !GADGET_UAC1
83 select USB_U_AUDIO if (USB_F_UAC2 || USB_F_UAC1)
85 This Gadget Audio driver is compatible with USB Audio Class
86 specification 2.0. It implements 1 AudioControl interface,
87 1 AudioStreaming Interface each for USB-OUT and USB-IN.
88 Number of channels, sample rate and sample size can be
89 specified as module parameters.
90 This driver doesn't expect any real Audio codec to be present
91 on the device - the audio streams are simply sinked to and
92 sourced from a virtual ALSA sound card created. The user-space
93 application may choose to do whatever it wants with the data
94 received from the USB Host and choose to provide whatever it
95 wants as audio data to the USB Host.
97 Say "y" to link the driver statically, or "m" to build a
98 dynamically linked module called "g_audio".
104 If you instead want older USB Audio Class specification 1.0 support
105 with similar driver capabilities.
107 config GADGET_UAC1_LEGACY
108 bool "UAC 1.0 (Legacy)"
109 depends on GADGET_UAC1
111 If you instead want legacy UAC Spec-1.0 driver that also has audio
112 paths hardwired to the Audio codec chip on-board and doesn't work
116 tristate "Ethernet Gadget (with CDC Ethernet support)"
118 select USB_LIBCOMPOSITE
124 This driver implements Ethernet style communication, in one of
127 - The "Communication Device Class" (CDC) Ethernet Control Model.
128 That protocol is often avoided with pure Ethernet adapters, in
129 favor of simpler vendor-specific hardware, but is widely
130 supported by firmware for smart network devices.
132 - On hardware can't implement that protocol, a simple CDC subset
133 is used, placing fewer demands on USB.
135 - CDC Ethernet Emulation Model (EEM) is a newer standard that has
136 a simpler interface that can be used by more USB hardware.
138 RNDIS support is an additional option, more demanding than subset.
140 Within the USB device, this gadget driver exposes a network device
141 "usbX", where X depends on what other networking devices you have.
142 Treat it like a two-node Ethernet link: host, and gadget.
144 The Linux-USB host-side "usbnet" driver interoperates with this
145 driver, so that deep I/O queues can be supported. On 2.4 kernels,
146 use "CDCEther" instead, if you're using the CDC option. That CDC
147 mode should also interoperate with standard CDC Ethernet class
148 drivers on other host operating systems.
150 Say "y" to link the driver statically, or "m" to build a
151 dynamically linked module called "g_ether".
156 select USB_LIBCOMPOSITE
160 Microsoft Windows XP bundles the "Remote NDIS" (RNDIS) protocol,
161 and Microsoft provides redistributable binary RNDIS drivers for
162 older versions of Windows.
164 If you say "y" here, the Ethernet gadget driver will try to provide
165 a second device configuration, supporting RNDIS to talk to such
168 To make MS-Windows work with this, use Documentation/usb/linux.inf
169 as the "driver info file". For versions of MS-Windows older than
170 XP, you'll need to download drivers from Microsoft's website; a URL
171 is given in comments found in that info file.
174 bool "Ethernet Emulation Model (EEM) support"
176 select USB_LIBCOMPOSITE
179 CDC EEM is a newer USB standard that is somewhat simpler than CDC ECM
180 and therefore can be supported by more hardware. Technically ECM and
181 EEM are designed for different applications. The ECM model extends
182 the network interface to the target (e.g. a USB cable modem), and the
183 EEM model is for mobile devices to communicate with hosts using
184 ethernet over USB. For Linux gadgets, however, the interface with
185 the host is the same (a usbX device), so the differences are minimal.
187 If you say "y" here, the Ethernet gadget driver will use the EEM
188 protocol rather than ECM. If unsure, say "n".
191 tristate "Network Control Model (NCM) support"
193 select USB_LIBCOMPOSITE
198 This driver implements USB CDC NCM subclass standard. NCM is
199 an advanced protocol for Ethernet encapsulation, allows grouping
200 of several ethernet frames into one USB transfer and different
201 alignment possibilities.
203 Say "y" to link the driver statically, or "m" to build a
204 dynamically linked module called "g_ncm".
207 tristate "Gadget Filesystem"
209 This driver provides a filesystem based API that lets user mode
210 programs implement a single-configuration USB device, including
211 endpoint I/O and control requests that don't relate to enumeration.
212 All endpoints, transfer speeds, and transfer types supported by
213 the hardware are available, through read() and write() calls.
215 Say "y" to link the driver statically, or "m" to build a
216 dynamically linked module called "gadgetfs".
218 config USB_FUNCTIONFS
219 tristate "Function Filesystem"
220 select USB_LIBCOMPOSITE
222 select USB_FUNCTIONFS_GENERIC if !(USB_FUNCTIONFS_ETH || USB_FUNCTIONFS_RNDIS)
224 The Function Filesystem (FunctionFS) lets one create USB
225 composite functions in user space in the same way GadgetFS
226 lets one create USB gadgets in user space. This allows creation
227 of composite gadgets such that some of the functions are
228 implemented in kernel space (for instance Ethernet, serial or
229 mass storage) and other are implemented in user space.
231 If you say "y" or "m" here you will be able what kind of
232 configurations the gadget will provide.
234 Say "y" to link the driver statically, or "m" to build
235 a dynamically linked module called "g_ffs".
237 config USB_FUNCTIONFS_ETH
238 bool "Include configuration with CDC ECM (Ethernet)"
239 depends on USB_FUNCTIONFS && NET
244 Include a configuration with CDC ECM function (Ethernet) and the
247 config USB_FUNCTIONFS_RNDIS
248 bool "Include configuration with RNDIS (Ethernet)"
249 depends on USB_FUNCTIONFS && NET
253 Include a configuration with RNDIS function (Ethernet) and the Filesystem.
255 config USB_FUNCTIONFS_GENERIC
256 bool "Include 'pure' configuration"
257 depends on USB_FUNCTIONFS
259 Include a configuration with the Function Filesystem alone with
260 no Ethernet interface.
262 config USB_MASS_STORAGE
263 tristate "Mass Storage Gadget"
265 select USB_LIBCOMPOSITE
266 select USB_F_MASS_STORAGE
268 The Mass Storage Gadget acts as a USB Mass Storage disk drive.
269 As its storage repository it can use a regular file or a block
270 device (in much the same way as the "loop" device driver),
271 specified as a module parameter or sysfs option.
273 This driver is a replacement for now removed File-backed
274 Storage Gadget (g_file_storage).
276 Say "y" to link the driver statically, or "m" to build
277 a dynamically linked module called "g_mass_storage".
279 config USB_GADGET_TARGET
280 tristate "USB Gadget Target Fabric Module"
281 depends on TARGET_CORE
282 select USB_LIBCOMPOSITE
285 This fabric is an USB gadget. Two USB protocols are supported that is
286 BBB or BOT (Bulk Only Transport) and UAS (USB Attached SCSI). BOT is
287 advertised on alternative interface 0 (primary) and UAS is on
288 alternative interface 1. Both protocols can work on USB2.0 and USB3.0.
289 UAS utilizes the USB 3.0 feature called streams support.
292 tristate "Serial Gadget (with CDC ACM and CDC OBEX support)"
298 select USB_LIBCOMPOSITE
300 The Serial Gadget talks to the Linux-USB generic serial driver.
301 This driver supports a CDC-ACM module option, which can be used
302 to interoperate with MS-Windows hosts or with the Linux-USB
305 This driver also supports a CDC-OBEX option. You will need a
306 user space OBEX server talking to /dev/ttyGS*, since the kernel
307 itself doesn't implement the OBEX protocol.
309 Say "y" to link the driver statically, or "m" to build a
310 dynamically linked module called "g_serial".
312 For more information, see Documentation/usb/gadget_serial.rst
313 which includes instructions and a "driver info file" needed to
314 make MS-Windows work with CDC ACM.
316 config USB_MIDI_GADGET
317 tristate "MIDI Gadget"
319 select USB_LIBCOMPOSITE
323 The MIDI Gadget acts as a USB Audio device, with one MIDI
324 input and one MIDI output. These MIDI jacks appear as
325 a sound "card" in the ALSA sound system. Other MIDI
326 connections can then be made on the gadget system, using
327 ALSA's aconnect utility etc.
329 Say "y" to link the driver statically, or "m" to build a
330 dynamically linked module called "g_midi".
333 tristate "Printer Gadget"
334 select USB_LIBCOMPOSITE
337 The Printer Gadget channels data between the USB host and a
338 userspace program driving the print engine. The user space
339 program reads and writes the device file /dev/g_printer to
340 receive or send printer data. It can use ioctl calls to
341 the device file to get or set printer status.
343 Say "y" to link the driver statically, or "m" to build a
344 dynamically linked module called "g_printer".
346 For more information, see Documentation/usb/gadget_printer.rst
347 which includes sample code for accessing the device file.
351 config USB_CDC_COMPOSITE
352 tristate "CDC Composite Device (Ethernet and ACM)"
354 select USB_LIBCOMPOSITE
360 This driver provides two functions in one configuration:
361 a CDC Ethernet (ECM) link, and a CDC ACM (serial port) link.
363 This driver requires four bulk and two interrupt endpoints,
364 plus the ability to handle altsettings. Not all peripheral
365 controllers are that capable.
367 Say "y" to link the driver statically, or "m" to build a
368 dynamically linked module.
371 tristate "Nokia composite gadget"
374 select USB_LIBCOMPOSITE
381 select USB_F_MASS_STORAGE
383 The Nokia composite gadget provides support for acm, obex
384 and phonet in only one composite gadget driver.
386 It's only really useful for N900 hardware. If you're building
387 a kernel for N900, say Y or M here. If unsure, say N.
390 tristate "CDC Composite Device (ACM and mass storage)"
392 select USB_LIBCOMPOSITE
395 select USB_F_MASS_STORAGE
397 This driver provides two functions in one configuration:
398 a mass storage, and a CDC ACM (serial port) link.
400 Say "y" to link the driver statically, or "m" to build a
401 dynamically linked module called "g_acm_ms".
404 tristate "Multifunction Composite Gadget"
405 depends on BLOCK && NET
406 select USB_G_MULTI_CDC if !USB_G_MULTI_RNDIS
407 select USB_LIBCOMPOSITE
411 select USB_F_MASS_STORAGE
413 The Multifunction Composite Gadget provides Ethernet (RNDIS
414 and/or CDC Ethernet), mass storage and ACM serial link
417 You will be asked to choose which of the two configurations is
418 to be available in the gadget. At least one configuration must
419 be chosen to make the gadget usable. Selecting more than one
420 configuration will prevent Windows from automatically detecting
421 the gadget as a composite gadget, so an INF file will be needed to
424 Say "y" to link the driver statically, or "m" to build a
425 dynamically linked module called "g_multi".
427 config USB_G_MULTI_RNDIS
428 bool "RNDIS + CDC Serial + Storage configuration"
429 depends on USB_G_MULTI
433 This option enables a configuration with RNDIS, CDC Serial and
434 Mass Storage functions available in the Multifunction Composite
435 Gadget. This is the configuration dedicated for Windows since RNDIS
436 is Microsoft's protocol.
440 config USB_G_MULTI_CDC
441 bool "CDC Ethernet + CDC Serial + Storage configuration"
442 depends on USB_G_MULTI
445 This option enables a configuration with CDC Ethernet (ECM), CDC
446 Serial and Mass Storage functions available in the Multifunction
454 tristate "HID Gadget"
455 select USB_LIBCOMPOSITE
458 The HID gadget driver provides generic emulation of USB
459 Human Interface Devices (HID).
461 For more information, see Documentation/usb/gadget_hid.rst which
462 includes sample code for accessing the device files.
464 Say "y" to link the driver statically, or "m" to build a
465 dynamically linked module called "g_hid".
467 # Standalone / single function gadgets
469 tristate "EHCI Debug Device Gadget"
471 select USB_LIBCOMPOSITE
473 This gadget emulates an EHCI Debug device. This is useful when you want
474 to interact with an EHCI Debug Port.
476 Say "y" to link the driver statically, or "m" to build a
477 dynamically linked module called "g_dbgp".
481 prompt "EHCI Debug Device mode"
482 default USB_G_DBGP_SERIAL
484 config USB_G_DBGP_PRINTK
485 depends on USB_G_DBGP
488 Directly printk() received data. No interaction.
490 config USB_G_DBGP_SERIAL
491 depends on USB_G_DBGP
495 Userland can interact using /dev/ttyGSxxx.
499 # put drivers that need isochronous transfer support (for audio
500 # or video class gadget drivers), or specific hardware, here.
502 tristate "USB Webcam Gadget"
503 depends on VIDEO_V4L2
504 select USB_LIBCOMPOSITE
505 select VIDEOBUF2_VMALLOC
508 The Webcam Gadget acts as a composite USB Audio and Video Class
509 device. It provides a userspace API to process UVC control requests
510 and stream video data to the host.
512 Say "y" to link the driver statically, or "m" to build a
513 dynamically linked module called "g_webcam".
515 config USB_RAW_GADGET
516 tristate "USB Raw Gadget"
518 USB Raw Gadget is a kernel module that provides a userspace interface
519 for the USB Gadget subsystem. Essentially it allows to emulate USB
520 devices from userspace. See Documentation/usb/raw-gadget.rst for
523 Say "y" to link the driver statically, or "m" to build a
524 dynamically linked module called "raw_gadget".