1# 2# USB Gadget support on a system involves 3# (a) a peripheral controller, and 4# (b) the gadget driver using it. 5# 6# NOTE: Gadget support ** DOES NOT ** depend on host-side CONFIG_USB !! 7# 8# - Host systems (like PCs) need CONFIG_USB (with "A" jacks). 9# - Peripherals (like PDAs) need CONFIG_USB_GADGET (with "B" jacks). 10# - Some systems have both kinds of controllers. 11# 12# With help from a special transceiver and a "Mini-AB" jack, systems with 13# both kinds of controller can also support "USB On-the-Go" (CONFIG_USB_OTG). 14# 15 16menuconfig USB_GADGET_LEGACY 17 bool "Legacy USB Gadget Support" 18 help 19 Legacy USB gadgets are USB gadgets that do not use the USB gadget 20 configfs interface. 21 22if USB_GADGET_LEGACY 23 24config USB_ZERO 25 tristate "Gadget Zero (DEVELOPMENT)" 26 select USB_LIBCOMPOSITE 27 select USB_F_SS_LB 28 help 29 Gadget Zero is a two-configuration device. It either sinks and 30 sources bulk data; or it loops back a configurable number of 31 transfers. It also implements control requests, for "chapter 9" 32 conformance. The driver needs only two bulk-capable endpoints, so 33 it can work on top of most device-side usb controllers. It's 34 useful for testing, and is also a working example showing how 35 USB "gadget drivers" can be written. 36 37 Make this be the first driver you try using on top of any new 38 USB peripheral controller driver. Then you can use host-side 39 test software, like the "usbtest" driver, to put your hardware 40 and its driver through a basic set of functional tests. 41 42 Gadget Zero also works with the host-side "usb-skeleton" driver, 43 and with many kinds of host-side test software. You may need 44 to tweak product and vendor IDs before host software knows about 45 this device, and arrange to select an appropriate configuration. 46 47 Say "y" to link the driver statically, or "m" to build a 48 dynamically linked module called "g_zero". 49 50config USB_ZERO_HNPTEST 51 bool "HNP Test Device" 52 depends on USB_ZERO && USB_OTG 53 help 54 You can configure this device to enumerate using the device 55 identifiers of the USB-OTG test device. That means that when 56 this gadget connects to another OTG device, with this one using 57 the "B-Peripheral" role, that device will use HNP to let this 58 one serve as the USB host instead (in the "B-Host" role). 59 60config USB_AUDIO 61 tristate "Audio Gadget" 62 depends on SND 63 select USB_LIBCOMPOSITE 64 select SND_PCM 65 select USB_F_UAC1 if (GADGET_UAC1 && !GADGET_UAC1_LEGACY) 66 select USB_F_UAC1_LEGACY if (GADGET_UAC1 && GADGET_UAC1_LEGACY) 67 select USB_F_UAC2 if !GADGET_UAC1 68 select USB_U_AUDIO if (USB_F_UAC2 || USB_F_UAC1) 69 help 70 This Gadget Audio driver is compatible with USB Audio Class 71 specification 2.0. It implements 1 AudioControl interface, 72 1 AudioStreaming Interface each for USB-OUT and USB-IN. 73 Number of channels, sample rate and sample size can be 74 specified as module parameters. 75 This driver doesn't expect any real Audio codec to be present 76 on the device - the audio streams are simply sinked to and 77 sourced from a virtual ALSA sound card created. The user-space 78 application may choose to do whatever it wants with the data 79 received from the USB Host and choose to provide whatever it 80 wants as audio data to the USB Host. 81 82 Say "y" to link the driver statically, or "m" to build a 83 dynamically linked module called "g_audio". 84 85config GADGET_UAC1 86 bool "UAC 1.0" 87 depends on USB_AUDIO 88 help 89 If you instead want older USB Audio Class specification 1.0 support 90 with similar driver capabilities. 91 92config GADGET_UAC1_LEGACY 93 bool "UAC 1.0 (Legacy)" 94 depends on GADGET_UAC1 95 help 96 If you instead want legacy UAC Spec-1.0 driver that also has audio 97 paths hardwired to the Audio codec chip on-board and doesn't work 98 without one. 99 100config USB_ETH 101 tristate "Ethernet Gadget (with CDC Ethernet support)" 102 depends on NET 103 select USB_LIBCOMPOSITE 104 select USB_U_ETHER 105 select USB_F_ECM 106 select USB_F_SUBSET 107 select CRC32 108 help 109 This driver implements Ethernet style communication, in one of 110 several ways: 111 112 - The "Communication Device Class" (CDC) Ethernet Control Model. 113 That protocol is often avoided with pure Ethernet adapters, in 114 favor of simpler vendor-specific hardware, but is widely 115 supported by firmware for smart network devices. 116 117 - On hardware can't implement that protocol, a simple CDC subset 118 is used, placing fewer demands on USB. 119 120 - CDC Ethernet Emulation Model (EEM) is a newer standard that has 121 a simpler interface that can be used by more USB hardware. 122 123 RNDIS support is an additional option, more demanding than subset. 124 125 Within the USB device, this gadget driver exposes a network device 126 "usbX", where X depends on what other networking devices you have. 127 Treat it like a two-node Ethernet link: host, and gadget. 128 129 The Linux-USB host-side "usbnet" driver interoperates with this 130 driver, so that deep I/O queues can be supported. On 2.4 kernels, 131 use "CDCEther" instead, if you're using the CDC option. That CDC 132 mode should also interoperate with standard CDC Ethernet class 133 drivers on other host operating systems. 134 135 Say "y" to link the driver statically, or "m" to build a 136 dynamically linked module called "g_ether". 137 138config USB_ETH_RNDIS 139 bool "RNDIS support" 140 depends on USB_ETH 141 select USB_LIBCOMPOSITE 142 select USB_F_RNDIS 143 default y 144 help 145 Microsoft Windows XP bundles the "Remote NDIS" (RNDIS) protocol, 146 and Microsoft provides redistributable binary RNDIS drivers for 147 older versions of Windows. 148 149 If you say "y" here, the Ethernet gadget driver will try to provide 150 a second device configuration, supporting RNDIS to talk to such 151 Microsoft USB hosts. 152 153 To make MS-Windows work with this, use Documentation/usb/linux.inf 154 as the "driver info file". For versions of MS-Windows older than 155 XP, you'll need to download drivers from Microsoft's website; a URL 156 is given in comments found in that info file. 157 158config USB_ETH_EEM 159 bool "Ethernet Emulation Model (EEM) support" 160 depends on USB_ETH 161 select USB_LIBCOMPOSITE 162 select USB_F_EEM 163 default n 164 help 165 CDC EEM is a newer USB standard that is somewhat simpler than CDC ECM 166 and therefore can be supported by more hardware. Technically ECM and 167 EEM are designed for different applications. The ECM model extends 168 the network interface to the target (e.g. a USB cable modem), and the 169 EEM model is for mobile devices to communicate with hosts using 170 ethernet over USB. For Linux gadgets, however, the interface with 171 the host is the same (a usbX device), so the differences are minimal. 172 173 If you say "y" here, the Ethernet gadget driver will use the EEM 174 protocol rather than ECM. If unsure, say "n". 175 176config USB_G_NCM 177 tristate "Network Control Model (NCM) support" 178 depends on NET 179 select USB_LIBCOMPOSITE 180 select USB_U_ETHER 181 select USB_F_NCM 182 select CRC32 183 help 184 This driver implements USB CDC NCM subclass standard. NCM is 185 an advanced protocol for Ethernet encapsulation, allows grouping 186 of several ethernet frames into one USB transfer and different 187 alignment possibilities. 188 189 Say "y" to link the driver statically, or "m" to build a 190 dynamically linked module called "g_ncm". 191 192config USB_GADGETFS 193 tristate "Gadget Filesystem" 194 help 195 This driver provides a filesystem based API that lets user mode 196 programs implement a single-configuration USB device, including 197 endpoint I/O and control requests that don't relate to enumeration. 198 All endpoints, transfer speeds, and transfer types supported by 199 the hardware are available, through read() and write() calls. 200 201 Say "y" to link the driver statically, or "m" to build a 202 dynamically linked module called "gadgetfs". 203 204config USB_FUNCTIONFS 205 tristate "Function Filesystem" 206 select USB_LIBCOMPOSITE 207 select USB_F_FS 208 select USB_FUNCTIONFS_GENERIC if !(USB_FUNCTIONFS_ETH || USB_FUNCTIONFS_RNDIS) 209 help 210 The Function Filesystem (FunctionFS) lets one create USB 211 composite functions in user space in the same way GadgetFS 212 lets one create USB gadgets in user space. This allows creation 213 of composite gadgets such that some of the functions are 214 implemented in kernel space (for instance Ethernet, serial or 215 mass storage) and other are implemented in user space. 216 217 If you say "y" or "m" here you will be able what kind of 218 configurations the gadget will provide. 219 220 Say "y" to link the driver statically, or "m" to build 221 a dynamically linked module called "g_ffs". 222 223config USB_FUNCTIONFS_ETH 224 bool "Include configuration with CDC ECM (Ethernet)" 225 depends on USB_FUNCTIONFS && NET 226 select USB_U_ETHER 227 select USB_F_ECM 228 select USB_F_SUBSET 229 help 230 Include a configuration with CDC ECM function (Ethernet) and the 231 Function Filesystem. 232 233config USB_FUNCTIONFS_RNDIS 234 bool "Include configuration with RNDIS (Ethernet)" 235 depends on USB_FUNCTIONFS && NET 236 select USB_U_ETHER 237 select USB_F_RNDIS 238 help 239 Include a configuration with RNDIS function (Ethernet) and the Filesystem. 240 241config USB_FUNCTIONFS_GENERIC 242 bool "Include 'pure' configuration" 243 depends on USB_FUNCTIONFS 244 help 245 Include a configuration with the Function Filesystem alone with 246 no Ethernet interface. 247 248config USB_MASS_STORAGE 249 tristate "Mass Storage Gadget" 250 depends on BLOCK 251 select USB_LIBCOMPOSITE 252 select USB_F_MASS_STORAGE 253 help 254 The Mass Storage Gadget acts as a USB Mass Storage disk drive. 255 As its storage repository it can use a regular file or a block 256 device (in much the same way as the "loop" device driver), 257 specified as a module parameter or sysfs option. 258 259 This driver is a replacement for now removed File-backed 260 Storage Gadget (g_file_storage). 261 262 Say "y" to link the driver statically, or "m" to build 263 a dynamically linked module called "g_mass_storage". 264 265config USB_GADGET_TARGET 266 tristate "USB Gadget Target Fabric Module" 267 depends on TARGET_CORE 268 select USB_LIBCOMPOSITE 269 select USB_F_TCM 270 help 271 This fabric is an USB gadget. Two USB protocols are supported that is 272 BBB or BOT (Bulk Only Transport) and UAS (USB Attached SCSI). BOT is 273 advertised on alternative interface 0 (primary) and UAS is on 274 alternative interface 1. Both protocols can work on USB2.0 and USB3.0. 275 UAS utilizes the USB 3.0 feature called streams support. 276 277config USB_G_SERIAL 278 tristate "Serial Gadget (with CDC ACM and CDC OBEX support)" 279 depends on TTY 280 select USB_U_SERIAL 281 select USB_F_ACM 282 select USB_F_SERIAL 283 select USB_F_OBEX 284 select USB_LIBCOMPOSITE 285 help 286 The Serial Gadget talks to the Linux-USB generic serial driver. 287 This driver supports a CDC-ACM module option, which can be used 288 to interoperate with MS-Windows hosts or with the Linux-USB 289 "cdc-acm" driver. 290 291 This driver also supports a CDC-OBEX option. You will need a 292 user space OBEX server talking to /dev/ttyGS*, since the kernel 293 itself doesn't implement the OBEX protocol. 294 295 Say "y" to link the driver statically, or "m" to build a 296 dynamically linked module called "g_serial". 297 298 For more information, see Documentation/usb/gadget_serial.txt 299 which includes instructions and a "driver info file" needed to 300 make MS-Windows work with CDC ACM. 301 302config USB_MIDI_GADGET 303 tristate "MIDI Gadget" 304 depends on SND 305 select USB_LIBCOMPOSITE 306 select SND_RAWMIDI 307 select USB_F_MIDI 308 help 309 The MIDI Gadget acts as a USB Audio device, with one MIDI 310 input and one MIDI output. These MIDI jacks appear as 311 a sound "card" in the ALSA sound system. Other MIDI 312 connections can then be made on the gadget system, using 313 ALSA's aconnect utility etc. 314 315 Say "y" to link the driver statically, or "m" to build a 316 dynamically linked module called "g_midi". 317 318config USB_G_PRINTER 319 tristate "Printer Gadget" 320 select USB_LIBCOMPOSITE 321 select USB_F_PRINTER 322 help 323 The Printer Gadget channels data between the USB host and a 324 userspace program driving the print engine. The user space 325 program reads and writes the device file /dev/g_printer to 326 receive or send printer data. It can use ioctl calls to 327 the device file to get or set printer status. 328 329 Say "y" to link the driver statically, or "m" to build a 330 dynamically linked module called "g_printer". 331 332 For more information, see Documentation/usb/gadget_printer.txt 333 which includes sample code for accessing the device file. 334 335if TTY 336 337config USB_CDC_COMPOSITE 338 tristate "CDC Composite Device (Ethernet and ACM)" 339 depends on NET 340 select USB_LIBCOMPOSITE 341 select USB_U_SERIAL 342 select USB_U_ETHER 343 select USB_F_ACM 344 select USB_F_ECM 345 help 346 This driver provides two functions in one configuration: 347 a CDC Ethernet (ECM) link, and a CDC ACM (serial port) link. 348 349 This driver requires four bulk and two interrupt endpoints, 350 plus the ability to handle altsettings. Not all peripheral 351 controllers are that capable. 352 353 Say "y" to link the driver statically, or "m" to build a 354 dynamically linked module. 355 356config USB_G_NOKIA 357 tristate "Nokia composite gadget" 358 depends on PHONET 359 depends on BLOCK 360 select USB_LIBCOMPOSITE 361 select USB_U_SERIAL 362 select USB_U_ETHER 363 select USB_F_ACM 364 select USB_F_OBEX 365 select USB_F_PHONET 366 select USB_F_ECM 367 select USB_F_MASS_STORAGE 368 help 369 The Nokia composite gadget provides support for acm, obex 370 and phonet in only one composite gadget driver. 371 372 It's only really useful for N900 hardware. If you're building 373 a kernel for N900, say Y or M here. If unsure, say N. 374 375config USB_G_ACM_MS 376 tristate "CDC Composite Device (ACM and mass storage)" 377 depends on BLOCK 378 select USB_LIBCOMPOSITE 379 select USB_U_SERIAL 380 select USB_F_ACM 381 select USB_F_MASS_STORAGE 382 help 383 This driver provides two functions in one configuration: 384 a mass storage, and a CDC ACM (serial port) link. 385 386 Say "y" to link the driver statically, or "m" to build a 387 dynamically linked module called "g_acm_ms". 388 389config USB_G_MULTI 390 tristate "Multifunction Composite Gadget" 391 depends on BLOCK && NET 392 select USB_G_MULTI_CDC if !USB_G_MULTI_RNDIS 393 select USB_LIBCOMPOSITE 394 select USB_U_SERIAL 395 select USB_U_ETHER 396 select USB_F_ACM 397 select USB_F_MASS_STORAGE 398 help 399 The Multifunction Composite Gadget provides Ethernet (RNDIS 400 and/or CDC Ethernet), mass storage and ACM serial link 401 interfaces. 402 403 You will be asked to choose which of the two configurations is 404 to be available in the gadget. At least one configuration must 405 be chosen to make the gadget usable. Selecting more than one 406 configuration will prevent Windows from automatically detecting 407 the gadget as a composite gadget, so an INF file will be needed to 408 use the gadget. 409 410 Say "y" to link the driver statically, or "m" to build a 411 dynamically linked module called "g_multi". 412 413config USB_G_MULTI_RNDIS 414 bool "RNDIS + CDC Serial + Storage configuration" 415 depends on USB_G_MULTI 416 select USB_F_RNDIS 417 default y 418 help 419 This option enables a configuration with RNDIS, CDC Serial and 420 Mass Storage functions available in the Multifunction Composite 421 Gadget. This is the configuration dedicated for Windows since RNDIS 422 is Microsoft's protocol. 423 424 If unsure, say "y". 425 426config USB_G_MULTI_CDC 427 bool "CDC Ethernet + CDC Serial + Storage configuration" 428 depends on USB_G_MULTI 429 default n 430 select USB_F_ECM 431 help 432 This option enables a configuration with CDC Ethernet (ECM), CDC 433 Serial and Mass Storage functions available in the Multifunction 434 Composite Gadget. 435 436 If unsure, say "y". 437 438endif # TTY 439 440config USB_G_HID 441 tristate "HID Gadget" 442 select USB_LIBCOMPOSITE 443 select USB_F_HID 444 help 445 The HID gadget driver provides generic emulation of USB 446 Human Interface Devices (HID). 447 448 For more information, see Documentation/usb/gadget_hid.txt which 449 includes sample code for accessing the device files. 450 451 Say "y" to link the driver statically, or "m" to build a 452 dynamically linked module called "g_hid". 453 454# Standalone / single function gadgets 455config USB_G_DBGP 456 tristate "EHCI Debug Device Gadget" 457 depends on TTY 458 select USB_LIBCOMPOSITE 459 help 460 This gadget emulates an EHCI Debug device. This is useful when you want 461 to interact with an EHCI Debug Port. 462 463 Say "y" to link the driver statically, or "m" to build a 464 dynamically linked module called "g_dbgp". 465 466if USB_G_DBGP 467choice 468 prompt "EHCI Debug Device mode" 469 default USB_G_DBGP_SERIAL 470 471config USB_G_DBGP_PRINTK 472 depends on USB_G_DBGP 473 bool "printk" 474 help 475 Directly printk() received data. No interaction. 476 477config USB_G_DBGP_SERIAL 478 depends on USB_G_DBGP 479 select USB_U_SERIAL 480 bool "serial" 481 help 482 Userland can interact using /dev/ttyGSxxx. 483endchoice 484endif 485 486# put drivers that need isochronous transfer support (for audio 487# or video class gadget drivers), or specific hardware, here. 488config USB_G_WEBCAM 489 tristate "USB Webcam Gadget" 490 depends on VIDEO_DEV 491 select USB_LIBCOMPOSITE 492 select VIDEOBUF2_VMALLOC 493 select USB_F_UVC 494 help 495 The Webcam Gadget acts as a composite USB Audio and Video Class 496 device. It provides a userspace API to process UVC control requests 497 and stream video data to the host. 498 499 Say "y" to link the driver statically, or "m" to build a 500 dynamically linked module called "g_webcam". 501 502endif 503