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).
18 tristate "USB Gadget precomposed configurations"
22 A Linux "Gadget Driver" talks to the USB Peripheral Controller
23 driver through the abstract "gadget" API. Some other operating
24 systems call these "client" drivers, of which "class drivers"
25 are a subset (implementing a USB device class specification).
26 A gadget driver implements one or more USB functions using
27 the peripheral hardware.
29 Gadget drivers are hardware-neutral, or "platform independent",
30 except that they sometimes must understand quirks or limitations
31 of the particular controllers they work with. For example, when
32 a controller doesn't support alternate configurations or provide
33 enough of the right types of endpoints, the gadget driver might
34 not be able work with that controller, or might need to implement
35 a less common variant of a device class protocol.
37 The available choices each represent a single precomposed USB
38 gadget configuration. In the device model, each option contains
39 both the device instantiation as a child for a USB gadget
40 controller, and the relevant drivers for each function declared
44 tristate "Gadget Zero (DEVELOPMENT)"
45 select USB_LIBCOMPOSITE
48 Gadget Zero is a two-configuration device. It either sinks and
49 sources bulk data; or it loops back a configurable number of
50 transfers. It also implements control requests, for "chapter 9"
51 conformance. The driver needs only two bulk-capable endpoints, so
52 it can work on top of most device-side usb controllers. It's
53 useful for testing, and is also a working example showing how
54 USB "gadget drivers" can be written.
56 Make this be the first driver you try using on top of any new
57 USB peripheral controller driver. Then you can use host-side
58 test software, like the "usbtest" driver, to put your hardware
59 and its driver through a basic set of functional tests.
61 Gadget Zero also works with the host-side "usb-skeleton" driver,
62 and with many kinds of host-side test software. You may need
63 to tweak product and vendor IDs before host software knows about
64 this device, and arrange to select an appropriate configuration.
66 Say "y" to link the driver statically, or "m" to build a
67 dynamically linked module called "g_zero".
69 config USB_ZERO_HNPTEST
70 bool "HNP Test Device"
71 depends on USB_ZERO && USB_OTG
73 You can configure this device to enumerate using the device
74 identifiers of the USB-OTG test device. That means that when
75 this gadget connects to another OTG device, with this one using
76 the "B-Peripheral" role, that device will use HNP to let this
77 one serve as the USB host instead (in the "B-Host" role).
80 tristate "Audio Gadget"
82 select USB_LIBCOMPOSITE
84 select USB_F_UAC1 if (GADGET_UAC1 && !GADGET_UAC1_LEGACY)
85 select USB_F_UAC1_LEGACY if (GADGET_UAC1 && GADGET_UAC1_LEGACY)
86 select USB_F_UAC2 if !GADGET_UAC1
87 select USB_U_AUDIO if (USB_F_UAC2 || USB_F_UAC1)
89 This Gadget Audio driver is compatible with USB Audio Class
90 specification 2.0. It implements 1 AudioControl interface,
91 1 AudioStreaming Interface each for USB-OUT and USB-IN.
92 Number of channels, sample rate and sample size can be
93 specified as module parameters.
94 This driver doesn't expect any real Audio codec to be present
95 on the device - the audio streams are simply sinked to and
96 sourced from a virtual ALSA sound card created. The user-space
97 application may choose to do whatever it wants with the data
98 received from the USB Host and choose to provide whatever it
99 wants as audio data to the USB Host.
101 Say "y" to link the driver statically, or "m" to build a
102 dynamically linked module called "g_audio".
108 If you instead want older USB Audio Class specification 1.0 support
109 with similar driver capabilities.
111 config GADGET_UAC1_LEGACY
112 bool "UAC 1.0 (Legacy)"
113 depends on GADGET_UAC1
115 If you instead want legacy UAC Spec-1.0 driver that also has audio
116 paths hardwired to the Audio codec chip on-board and doesn't work
120 tristate "Ethernet Gadget (with CDC Ethernet support)"
122 select USB_LIBCOMPOSITE
128 This driver implements Ethernet style communication, in one of
131 - The "Communication Device Class" (CDC) Ethernet Control Model.
132 That protocol is often avoided with pure Ethernet adapters, in
133 favor of simpler vendor-specific hardware, but is widely
134 supported by firmware for smart network devices.
136 - On hardware can't implement that protocol, a simple CDC subset
137 is used, placing fewer demands on USB.
139 - CDC Ethernet Emulation Model (EEM) is a newer standard that has
140 a simpler interface that can be used by more USB hardware.
142 RNDIS support is an additional option, more demanding than subset.
144 Within the USB device, this gadget driver exposes a network device
145 "usbX", where X depends on what other networking devices you have.
146 Treat it like a two-node Ethernet link: host, and gadget.
148 The Linux-USB host-side "usbnet" driver interoperates with this
149 driver, so that deep I/O queues can be supported. On 2.4 kernels,
150 use "CDCEther" instead, if you're using the CDC option. That CDC
151 mode should also interoperate with standard CDC Ethernet class
152 drivers on other host operating systems.
154 Say "y" to link the driver statically, or "m" to build a
155 dynamically linked module called "g_ether".
160 select USB_LIBCOMPOSITE
164 Microsoft Windows XP bundles the "Remote NDIS" (RNDIS) protocol,
165 and Microsoft provides redistributable binary RNDIS drivers for
166 older versions of Windows.
168 If you say "y" here, the Ethernet gadget driver will try to provide
169 a second device configuration, supporting RNDIS to talk to such
172 To make MS-Windows work with this, use Documentation/usb/linux.inf
173 as the "driver info file". For versions of MS-Windows older than
174 XP, you'll need to download drivers from Microsoft's website; a URL
175 is given in comments found in that info file.
178 bool "Ethernet Emulation Model (EEM) support"
180 select USB_LIBCOMPOSITE
183 CDC EEM is a newer USB standard that is somewhat simpler than CDC ECM
184 and therefore can be supported by more hardware. Technically ECM and
185 EEM are designed for different applications. The ECM model extends
186 the network interface to the target (e.g. a USB cable modem), and the
187 EEM model is for mobile devices to communicate with hosts using
188 ethernet over USB. For Linux gadgets, however, the interface with
189 the host is the same (a usbX device), so the differences are minimal.
191 If you say "y" here, the Ethernet gadget driver will use the EEM
192 protocol rather than ECM. If unsure, say "n".
195 tristate "Network Control Model (NCM) support"
197 select USB_LIBCOMPOSITE
202 This driver implements USB CDC NCM subclass standard. NCM is
203 an advanced protocol for Ethernet encapsulation, allows grouping
204 of several ethernet frames into one USB transfer and different
205 alignment possibilities.
207 Say "y" to link the driver statically, or "m" to build a
208 dynamically linked module called "g_ncm".
211 tristate "Gadget Filesystem"
213 This driver provides a filesystem based API that lets user mode
214 programs implement a single-configuration USB device, including
215 endpoint I/O and control requests that don't relate to enumeration.
216 All endpoints, transfer speeds, and transfer types supported by
217 the hardware are available, through read() and write() calls.
219 Say "y" to link the driver statically, or "m" to build a
220 dynamically linked module called "gadgetfs".
222 config USB_FUNCTIONFS
223 tristate "Function Filesystem"
224 select USB_LIBCOMPOSITE
226 select USB_FUNCTIONFS_GENERIC if !(USB_FUNCTIONFS_ETH || USB_FUNCTIONFS_RNDIS)
228 The Function Filesystem (FunctionFS) lets one create USB
229 composite functions in user space in the same way GadgetFS
230 lets one create USB gadgets in user space. This allows creation
231 of composite gadgets such that some of the functions are
232 implemented in kernel space (for instance Ethernet, serial or
233 mass storage) and other are implemented in user space.
235 If you say "y" or "m" here you will be able what kind of
236 configurations the gadget will provide.
238 Say "y" to link the driver statically, or "m" to build
239 a dynamically linked module called "g_ffs".
241 config USB_FUNCTIONFS_ETH
242 bool "Include configuration with CDC ECM (Ethernet)"
243 depends on USB_FUNCTIONFS && NET
248 Include a configuration with CDC ECM function (Ethernet) and the
251 config USB_FUNCTIONFS_RNDIS
252 bool "Include configuration with RNDIS (Ethernet)"
253 depends on USB_FUNCTIONFS && NET
257 Include a configuration with RNDIS function (Ethernet) and the Filesystem.
259 config USB_FUNCTIONFS_GENERIC
260 bool "Include 'pure' configuration"
261 depends on USB_FUNCTIONFS
263 Include a configuration with the Function Filesystem alone with
264 no Ethernet interface.
266 config USB_MASS_STORAGE
267 tristate "Mass Storage Gadget"
269 select USB_LIBCOMPOSITE
270 select USB_F_MASS_STORAGE
272 The Mass Storage Gadget acts as a USB Mass Storage disk drive.
273 As its storage repository it can use a regular file or a block
274 device (in much the same way as the "loop" device driver),
275 specified as a module parameter or sysfs option.
277 This driver is a replacement for now removed File-backed
278 Storage Gadget (g_file_storage).
280 Say "y" to link the driver statically, or "m" to build
281 a dynamically linked module called "g_mass_storage".
283 config USB_GADGET_TARGET
284 tristate "USB Gadget Target Fabric Module"
285 depends on TARGET_CORE
286 select USB_LIBCOMPOSITE
289 This fabric is an USB gadget. Two USB protocols are supported that is
290 BBB or BOT (Bulk Only Transport) and UAS (USB Attached SCSI). BOT is
291 advertised on alternative interface 0 (primary) and UAS is on
292 alternative interface 1. Both protocols can work on USB2.0 and USB3.0.
293 UAS utilizes the USB 3.0 feature called streams support.
296 tristate "Serial Gadget (with CDC ACM and CDC OBEX support)"
302 select USB_LIBCOMPOSITE
304 The Serial Gadget talks to the Linux-USB generic serial driver.
305 This driver supports a CDC-ACM module option, which can be used
306 to interoperate with MS-Windows hosts or with the Linux-USB
309 This driver also supports a CDC-OBEX option. You will need a
310 user space OBEX server talking to /dev/ttyGS*, since the kernel
311 itself doesn't implement the OBEX protocol.
313 Say "y" to link the driver statically, or "m" to build a
314 dynamically linked module called "g_serial".
316 For more information, see Documentation/usb/gadget_serial.rst
317 which includes instructions and a "driver info file" needed to
318 make MS-Windows work with CDC ACM.
320 config USB_MIDI_GADGET
321 tristate "MIDI Gadget"
323 select USB_LIBCOMPOSITE
327 The MIDI Gadget acts as a USB Audio device, with one MIDI
328 input and one MIDI output. These MIDI jacks appear as
329 a sound "card" in the ALSA sound system. Other MIDI
330 connections can then be made on the gadget system, using
331 ALSA's aconnect utility etc.
333 Say "y" to link the driver statically, or "m" to build a
334 dynamically linked module called "g_midi".
337 tristate "Printer Gadget"
338 select USB_LIBCOMPOSITE
341 The Printer Gadget channels data between the USB host and a
342 userspace program driving the print engine. The user space
343 program reads and writes the device file /dev/g_printer to
344 receive or send printer data. It can use ioctl calls to
345 the device file to get or set printer status.
347 Say "y" to link the driver statically, or "m" to build a
348 dynamically linked module called "g_printer".
350 For more information, see Documentation/usb/gadget_printer.rst
351 which includes sample code for accessing the device file.
355 config USB_CDC_COMPOSITE
356 tristate "CDC Composite Device (Ethernet and ACM)"
358 select USB_LIBCOMPOSITE
364 This driver provides two functions in one configuration:
365 a CDC Ethernet (ECM) link, and a CDC ACM (serial port) link.
367 This driver requires four bulk and two interrupt endpoints,
368 plus the ability to handle altsettings. Not all peripheral
369 controllers are that capable.
371 Say "y" to link the driver statically, or "m" to build a
372 dynamically linked module.
375 tristate "Nokia composite gadget"
378 select USB_LIBCOMPOSITE
385 select USB_F_MASS_STORAGE
387 The Nokia composite gadget provides support for acm, obex
388 and phonet in only one composite gadget driver.
390 It's only really useful for N900 hardware. If you're building
391 a kernel for N900, say Y or M here. If unsure, say N.
394 tristate "CDC Composite Device (ACM and mass storage)"
396 select USB_LIBCOMPOSITE
399 select USB_F_MASS_STORAGE
401 This driver provides two functions in one configuration:
402 a mass storage, and a CDC ACM (serial port) link.
404 Say "y" to link the driver statically, or "m" to build a
405 dynamically linked module called "g_acm_ms".
408 tristate "Multifunction Composite Gadget"
409 depends on BLOCK && NET
410 select USB_G_MULTI_CDC if !USB_G_MULTI_RNDIS
411 select USB_LIBCOMPOSITE
415 select USB_F_MASS_STORAGE
417 The Multifunction Composite Gadget provides Ethernet (RNDIS
418 and/or CDC Ethernet), mass storage and ACM serial link
421 You will be asked to choose which of the two configurations is
422 to be available in the gadget. At least one configuration must
423 be chosen to make the gadget usable. Selecting more than one
424 configuration will prevent Windows from automatically detecting
425 the gadget as a composite gadget, so an INF file will be needed to
428 Say "y" to link the driver statically, or "m" to build a
429 dynamically linked module called "g_multi".
431 config USB_G_MULTI_RNDIS
432 bool "RNDIS + CDC Serial + Storage configuration"
433 depends on USB_G_MULTI
437 This option enables a configuration with RNDIS, CDC Serial and
438 Mass Storage functions available in the Multifunction Composite
439 Gadget. This is the configuration dedicated for Windows since RNDIS
440 is Microsoft's protocol.
444 config USB_G_MULTI_CDC
445 bool "CDC Ethernet + CDC Serial + Storage configuration"
446 depends on USB_G_MULTI
449 This option enables a configuration with CDC Ethernet (ECM), CDC
450 Serial and Mass Storage functions available in the Multifunction
458 tristate "HID Gadget"
459 select USB_LIBCOMPOSITE
462 The HID gadget driver provides generic emulation of USB
463 Human Interface Devices (HID).
465 For more information, see Documentation/usb/gadget_hid.rst which
466 includes sample code for accessing the device files.
468 Say "y" to link the driver statically, or "m" to build a
469 dynamically linked module called "g_hid".
471 # Standalone / single function gadgets
473 tristate "EHCI Debug Device Gadget"
475 select USB_LIBCOMPOSITE
477 This gadget emulates an EHCI Debug device. This is useful when you want
478 to interact with an EHCI Debug Port.
480 Say "y" to link the driver statically, or "m" to build a
481 dynamically linked module called "g_dbgp".
485 prompt "EHCI Debug Device mode"
486 default USB_G_DBGP_SERIAL
488 config USB_G_DBGP_PRINTK
489 depends on USB_G_DBGP
492 Directly printk() received data. No interaction.
494 config USB_G_DBGP_SERIAL
495 depends on USB_G_DBGP
499 Userland can interact using /dev/ttyGSxxx.
503 # put drivers that need isochronous transfer support (for audio
504 # or video class gadget drivers), or specific hardware, here.
506 tristate "USB Webcam Gadget"
507 depends on VIDEO_V4L2
508 select USB_LIBCOMPOSITE
509 select VIDEOBUF2_VMALLOC
512 The Webcam Gadget acts as a composite USB Audio and Video Class
513 device. It provides a userspace API to process UVC control requests
514 and stream video data to the host.
516 Say "y" to link the driver statically, or "m" to build a
517 dynamically linked module called "g_webcam".