Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: gadget: Gadget directory cleanup - group legacy gadgets

The drivers/usb/gadget directory contains many files.
Files which are related can be distributed into separate directories.
This patch moves the legacy gadgets (i.e. those not using configfs)
into a separate directory.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>

authored by

Andrzej Pietrasiewicz and committed by
Felipe Balbi
8443f2d2 8ecef00f

+521 -501
+1 -460
drivers/usb/gadget/Kconfig
··· 722 722 implemented in kernel space (for instance Ethernet, serial or 723 723 mass storage) and other are implemented in user space. 724 724 725 - config USB_ZERO 726 - tristate "Gadget Zero (DEVELOPMENT)" 727 - select USB_LIBCOMPOSITE 728 - select USB_F_SS_LB 729 - help 730 - Gadget Zero is a two-configuration device. It either sinks and 731 - sources bulk data; or it loops back a configurable number of 732 - transfers. It also implements control requests, for "chapter 9" 733 - conformance. The driver needs only two bulk-capable endpoints, so 734 - it can work on top of most device-side usb controllers. It's 735 - useful for testing, and is also a working example showing how 736 - USB "gadget drivers" can be written. 737 - 738 - Make this be the first driver you try using on top of any new 739 - USB peripheral controller driver. Then you can use host-side 740 - test software, like the "usbtest" driver, to put your hardware 741 - and its driver through a basic set of functional tests. 742 - 743 - Gadget Zero also works with the host-side "usb-skeleton" driver, 744 - and with many kinds of host-side test software. You may need 745 - to tweak product and vendor IDs before host software knows about 746 - this device, and arrange to select an appropriate configuration. 747 - 748 - Say "y" to link the driver statically, or "m" to build a 749 - dynamically linked module called "g_zero". 750 - 751 - config USB_ZERO_HNPTEST 752 - boolean "HNP Test Device" 753 - depends on USB_ZERO && USB_OTG 754 - help 755 - You can configure this device to enumerate using the device 756 - identifiers of the USB-OTG test device. That means that when 757 - this gadget connects to another OTG device, with this one using 758 - the "B-Peripheral" role, that device will use HNP to let this 759 - one serve as the USB host instead (in the "B-Host" role). 760 - 761 - config USB_AUDIO 762 - tristate "Audio Gadget" 763 - depends on SND 764 - select USB_LIBCOMPOSITE 765 - select SND_PCM 766 - help 767 - This Gadget Audio driver is compatible with USB Audio Class 768 - specification 2.0. It implements 1 AudioControl interface, 769 - 1 AudioStreaming Interface each for USB-OUT and USB-IN. 770 - Number of channels, sample rate and sample size can be 771 - specified as module parameters. 772 - This driver doesn't expect any real Audio codec to be present 773 - on the device - the audio streams are simply sinked to and 774 - sourced from a virtual ALSA sound card created. The user-space 775 - application may choose to do whatever it wants with the data 776 - received from the USB Host and choose to provide whatever it 777 - wants as audio data to the USB Host. 778 - 779 - Say "y" to link the driver statically, or "m" to build a 780 - dynamically linked module called "g_audio". 781 - 782 - config GADGET_UAC1 783 - bool "UAC 1.0 (Legacy)" 784 - depends on USB_AUDIO 785 - help 786 - If you instead want older UAC Spec-1.0 driver that also has audio 787 - paths hardwired to the Audio codec chip on-board and doesn't work 788 - without one. 789 - 790 - config USB_ETH 791 - tristate "Ethernet Gadget (with CDC Ethernet support)" 792 - depends on NET 793 - select USB_LIBCOMPOSITE 794 - select USB_U_ETHER 795 - select USB_F_ECM 796 - select USB_F_SUBSET 797 - select CRC32 798 - help 799 - This driver implements Ethernet style communication, in one of 800 - several ways: 801 - 802 - - The "Communication Device Class" (CDC) Ethernet Control Model. 803 - That protocol is often avoided with pure Ethernet adapters, in 804 - favor of simpler vendor-specific hardware, but is widely 805 - supported by firmware for smart network devices. 806 - 807 - - On hardware can't implement that protocol, a simple CDC subset 808 - is used, placing fewer demands on USB. 809 - 810 - - CDC Ethernet Emulation Model (EEM) is a newer standard that has 811 - a simpler interface that can be used by more USB hardware. 812 - 813 - RNDIS support is an additional option, more demanding than than 814 - subset. 815 - 816 - Within the USB device, this gadget driver exposes a network device 817 - "usbX", where X depends on what other networking devices you have. 818 - Treat it like a two-node Ethernet link: host, and gadget. 819 - 820 - The Linux-USB host-side "usbnet" driver interoperates with this 821 - driver, so that deep I/O queues can be supported. On 2.4 kernels, 822 - use "CDCEther" instead, if you're using the CDC option. That CDC 823 - mode should also interoperate with standard CDC Ethernet class 824 - drivers on other host operating systems. 825 - 826 - Say "y" to link the driver statically, or "m" to build a 827 - dynamically linked module called "g_ether". 828 - 829 - config USB_ETH_RNDIS 830 - bool "RNDIS support" 831 - depends on USB_ETH 832 - select USB_LIBCOMPOSITE 833 - select USB_F_RNDIS 834 - default y 835 - help 836 - Microsoft Windows XP bundles the "Remote NDIS" (RNDIS) protocol, 837 - and Microsoft provides redistributable binary RNDIS drivers for 838 - older versions of Windows. 839 - 840 - If you say "y" here, the Ethernet gadget driver will try to provide 841 - a second device configuration, supporting RNDIS to talk to such 842 - Microsoft USB hosts. 843 - 844 - To make MS-Windows work with this, use Documentation/usb/linux.inf 845 - as the "driver info file". For versions of MS-Windows older than 846 - XP, you'll need to download drivers from Microsoft's website; a URL 847 - is given in comments found in that info file. 848 - 849 - config USB_ETH_EEM 850 - bool "Ethernet Emulation Model (EEM) support" 851 - depends on USB_ETH 852 - select USB_LIBCOMPOSITE 853 - select USB_F_EEM 854 - default n 855 - help 856 - CDC EEM is a newer USB standard that is somewhat simpler than CDC ECM 857 - and therefore can be supported by more hardware. Technically ECM and 858 - EEM are designed for different applications. The ECM model extends 859 - the network interface to the target (e.g. a USB cable modem), and the 860 - EEM model is for mobile devices to communicate with hosts using 861 - ethernet over USB. For Linux gadgets, however, the interface with 862 - the host is the same (a usbX device), so the differences are minimal. 863 - 864 - If you say "y" here, the Ethernet gadget driver will use the EEM 865 - protocol rather than ECM. If unsure, say "n". 866 - 867 - config USB_G_NCM 868 - tristate "Network Control Model (NCM) support" 869 - depends on NET 870 - select USB_LIBCOMPOSITE 871 - select USB_U_ETHER 872 - select USB_F_NCM 873 - select CRC32 874 - help 875 - This driver implements USB CDC NCM subclass standard. NCM is 876 - an advanced protocol for Ethernet encapsulation, allows grouping 877 - of several ethernet frames into one USB transfer and different 878 - alignment possibilities. 879 - 880 - Say "y" to link the driver statically, or "m" to build a 881 - dynamically linked module called "g_ncm". 882 - 883 - config USB_GADGETFS 884 - tristate "Gadget Filesystem" 885 - help 886 - This driver provides a filesystem based API that lets user mode 887 - programs implement a single-configuration USB device, including 888 - endpoint I/O and control requests that don't relate to enumeration. 889 - All endpoints, transfer speeds, and transfer types supported by 890 - the hardware are available, through read() and write() calls. 891 - 892 - Say "y" to link the driver statically, or "m" to build a 893 - dynamically linked module called "gadgetfs". 894 - 895 - config USB_FUNCTIONFS 896 - tristate "Function Filesystem" 897 - select USB_LIBCOMPOSITE 898 - select USB_F_FS 899 - select USB_FUNCTIONFS_GENERIC if !(USB_FUNCTIONFS_ETH || USB_FUNCTIONFS_RNDIS) 900 - help 901 - The Function Filesystem (FunctionFS) lets one create USB 902 - composite functions in user space in the same way GadgetFS 903 - lets one create USB gadgets in user space. This allows creation 904 - of composite gadgets such that some of the functions are 905 - implemented in kernel space (for instance Ethernet, serial or 906 - mass storage) and other are implemented in user space. 907 - 908 - If you say "y" or "m" here you will be able what kind of 909 - configurations the gadget will provide. 910 - 911 - Say "y" to link the driver statically, or "m" to build 912 - a dynamically linked module called "g_ffs". 913 - 914 - config USB_FUNCTIONFS_ETH 915 - bool "Include configuration with CDC ECM (Ethernet)" 916 - depends on USB_FUNCTIONFS && NET 917 - select USB_U_ETHER 918 - select USB_F_ECM 919 - select USB_F_SUBSET 920 - help 921 - Include a configuration with CDC ECM function (Ethernet) and the 922 - Function Filesystem. 923 - 924 - config USB_FUNCTIONFS_RNDIS 925 - bool "Include configuration with RNDIS (Ethernet)" 926 - depends on USB_FUNCTIONFS && NET 927 - select USB_U_ETHER 928 - select USB_F_RNDIS 929 - help 930 - Include a configuration with RNDIS function (Ethernet) and the Filesystem. 931 - 932 - config USB_FUNCTIONFS_GENERIC 933 - bool "Include 'pure' configuration" 934 - depends on USB_FUNCTIONFS 935 - help 936 - Include a configuration with the Function Filesystem alone with 937 - no Ethernet interface. 938 - 939 - config USB_MASS_STORAGE 940 - tristate "Mass Storage Gadget" 941 - depends on BLOCK 942 - select USB_LIBCOMPOSITE 943 - select USB_F_MASS_STORAGE 944 - help 945 - The Mass Storage Gadget acts as a USB Mass Storage disk drive. 946 - As its storage repository it can use a regular file or a block 947 - device (in much the same way as the "loop" device driver), 948 - specified as a module parameter or sysfs option. 949 - 950 - This driver is a replacement for now removed File-backed 951 - Storage Gadget (g_file_storage). 952 - 953 - Say "y" to link the driver statically, or "m" to build 954 - a dynamically linked module called "g_mass_storage". 955 - 956 - config USB_GADGET_TARGET 957 - tristate "USB Gadget Target Fabric Module" 958 - depends on TARGET_CORE 959 - select USB_LIBCOMPOSITE 960 - help 961 - This fabric is an USB gadget. Two USB protocols are supported that is 962 - BBB or BOT (Bulk Only Transport) and UAS (USB Attached SCSI). BOT is 963 - advertised on alternative interface 0 (primary) and UAS is on 964 - alternative interface 1. Both protocols can work on USB2.0 and USB3.0. 965 - UAS utilizes the USB 3.0 feature called streams support. 966 - 967 - config USB_G_SERIAL 968 - tristate "Serial Gadget (with CDC ACM and CDC OBEX support)" 969 - depends on TTY 970 - select USB_U_SERIAL 971 - select USB_F_ACM 972 - select USB_F_SERIAL 973 - select USB_F_OBEX 974 - select USB_LIBCOMPOSITE 975 - help 976 - The Serial Gadget talks to the Linux-USB generic serial driver. 977 - This driver supports a CDC-ACM module option, which can be used 978 - to interoperate with MS-Windows hosts or with the Linux-USB 979 - "cdc-acm" driver. 980 - 981 - This driver also supports a CDC-OBEX option. You will need a 982 - user space OBEX server talking to /dev/ttyGS*, since the kernel 983 - itself doesn't implement the OBEX protocol. 984 - 985 - Say "y" to link the driver statically, or "m" to build a 986 - dynamically linked module called "g_serial". 987 - 988 - For more information, see Documentation/usb/gadget_serial.txt 989 - which includes instructions and a "driver info file" needed to 990 - make MS-Windows work with CDC ACM. 991 - 992 - config USB_MIDI_GADGET 993 - tristate "MIDI Gadget" 994 - depends on SND 995 - select USB_LIBCOMPOSITE 996 - select SND_RAWMIDI 997 - help 998 - The MIDI Gadget acts as a USB Audio device, with one MIDI 999 - input and one MIDI output. These MIDI jacks appear as 1000 - a sound "card" in the ALSA sound system. Other MIDI 1001 - connections can then be made on the gadget system, using 1002 - ALSA's aconnect utility etc. 1003 - 1004 - Say "y" to link the driver statically, or "m" to build a 1005 - dynamically linked module called "g_midi". 1006 - 1007 - config USB_G_PRINTER 1008 - tristate "Printer Gadget" 1009 - select USB_LIBCOMPOSITE 1010 - help 1011 - The Printer Gadget channels data between the USB host and a 1012 - userspace program driving the print engine. The user space 1013 - program reads and writes the device file /dev/g_printer to 1014 - receive or send printer data. It can use ioctl calls to 1015 - the device file to get or set printer status. 1016 - 1017 - Say "y" to link the driver statically, or "m" to build a 1018 - dynamically linked module called "g_printer". 1019 - 1020 - For more information, see Documentation/usb/gadget_printer.txt 1021 - which includes sample code for accessing the device file. 1022 - 1023 - if TTY 1024 - 1025 - config USB_CDC_COMPOSITE 1026 - tristate "CDC Composite Device (Ethernet and ACM)" 1027 - depends on NET 1028 - select USB_LIBCOMPOSITE 1029 - select USB_U_SERIAL 1030 - select USB_U_ETHER 1031 - select USB_F_ACM 1032 - select USB_F_ECM 1033 - help 1034 - This driver provides two functions in one configuration: 1035 - a CDC Ethernet (ECM) link, and a CDC ACM (serial port) link. 1036 - 1037 - This driver requires four bulk and two interrupt endpoints, 1038 - plus the ability to handle altsettings. Not all peripheral 1039 - controllers are that capable. 1040 - 1041 - Say "y" to link the driver statically, or "m" to build a 1042 - dynamically linked module. 1043 - 1044 - config USB_G_NOKIA 1045 - tristate "Nokia composite gadget" 1046 - depends on PHONET 1047 - select USB_LIBCOMPOSITE 1048 - select USB_U_SERIAL 1049 - select USB_U_ETHER 1050 - select USB_F_ACM 1051 - select USB_F_OBEX 1052 - select USB_F_PHONET 1053 - select USB_F_ECM 1054 - help 1055 - The Nokia composite gadget provides support for acm, obex 1056 - and phonet in only one composite gadget driver. 1057 - 1058 - It's only really useful for N900 hardware. If you're building 1059 - a kernel for N900, say Y or M here. If unsure, say N. 1060 - 1061 - config USB_G_ACM_MS 1062 - tristate "CDC Composite Device (ACM and mass storage)" 1063 - depends on BLOCK 1064 - select USB_LIBCOMPOSITE 1065 - select USB_U_SERIAL 1066 - select USB_F_ACM 1067 - select USB_F_MASS_STORAGE 1068 - help 1069 - This driver provides two functions in one configuration: 1070 - a mass storage, and a CDC ACM (serial port) link. 1071 - 1072 - Say "y" to link the driver statically, or "m" to build a 1073 - dynamically linked module called "g_acm_ms". 1074 - 1075 - config USB_G_MULTI 1076 - tristate "Multifunction Composite Gadget" 1077 - depends on BLOCK && NET 1078 - select USB_G_MULTI_CDC if !USB_G_MULTI_RNDIS 1079 - select USB_LIBCOMPOSITE 1080 - select USB_U_SERIAL 1081 - select USB_U_ETHER 1082 - select USB_F_ACM 1083 - select USB_F_MASS_STORAGE 1084 - help 1085 - The Multifunction Composite Gadget provides Ethernet (RNDIS 1086 - and/or CDC Ethernet), mass storage and ACM serial link 1087 - interfaces. 1088 - 1089 - You will be asked to choose which of the two configurations is 1090 - to be available in the gadget. At least one configuration must 1091 - be chosen to make the gadget usable. Selecting more than one 1092 - configuration will prevent Windows from automatically detecting 1093 - the gadget as a composite gadget, so an INF file will be needed to 1094 - use the gadget. 1095 - 1096 - Say "y" to link the driver statically, or "m" to build a 1097 - dynamically linked module called "g_multi". 1098 - 1099 - config USB_G_MULTI_RNDIS 1100 - bool "RNDIS + CDC Serial + Storage configuration" 1101 - depends on USB_G_MULTI 1102 - select USB_F_RNDIS 1103 - default y 1104 - help 1105 - This option enables a configuration with RNDIS, CDC Serial and 1106 - Mass Storage functions available in the Multifunction Composite 1107 - Gadget. This is the configuration dedicated for Windows since RNDIS 1108 - is Microsoft's protocol. 1109 - 1110 - If unsure, say "y". 1111 - 1112 - config USB_G_MULTI_CDC 1113 - bool "CDC Ethernet + CDC Serial + Storage configuration" 1114 - depends on USB_G_MULTI 1115 - default n 1116 - select USB_F_ECM 1117 - help 1118 - This option enables a configuration with CDC Ethernet (ECM), CDC 1119 - Serial and Mass Storage functions available in the Multifunction 1120 - Composite Gadget. 1121 - 1122 - If unsure, say "y". 1123 - 1124 - endif # TTY 1125 - 1126 - config USB_G_HID 1127 - tristate "HID Gadget" 1128 - select USB_LIBCOMPOSITE 1129 - help 1130 - The HID gadget driver provides generic emulation of USB 1131 - Human Interface Devices (HID). 1132 - 1133 - For more information, see Documentation/usb/gadget_hid.txt which 1134 - includes sample code for accessing the device files. 1135 - 1136 - Say "y" to link the driver statically, or "m" to build a 1137 - dynamically linked module called "g_hid". 1138 - 1139 - # Standalone / single function gadgets 1140 - config USB_G_DBGP 1141 - tristate "EHCI Debug Device Gadget" 1142 - depends on TTY 1143 - select USB_LIBCOMPOSITE 1144 - help 1145 - This gadget emulates an EHCI Debug device. This is useful when you want 1146 - to interact with an EHCI Debug Port. 1147 - 1148 - Say "y" to link the driver statically, or "m" to build a 1149 - dynamically linked module called "g_dbgp". 1150 - 1151 - if USB_G_DBGP 1152 - choice 1153 - prompt "EHCI Debug Device mode" 1154 - default USB_G_DBGP_SERIAL 1155 - 1156 - config USB_G_DBGP_PRINTK 1157 - depends on USB_G_DBGP 1158 - bool "printk" 1159 - help 1160 - Directly printk() received data. No interaction. 1161 - 1162 - config USB_G_DBGP_SERIAL 1163 - depends on USB_G_DBGP 1164 - select USB_U_SERIAL 1165 - bool "serial" 1166 - help 1167 - Userland can interact using /dev/ttyGSxxx. 1168 - endchoice 1169 - endif 1170 - 1171 - # put drivers that need isochronous transfer support (for audio 1172 - # or video class gadget drivers), or specific hardware, here. 1173 - config USB_G_WEBCAM 1174 - tristate "USB Webcam Gadget" 1175 - depends on VIDEO_DEV 1176 - select USB_LIBCOMPOSITE 1177 - select VIDEOBUF2_VMALLOC 1178 - help 1179 - The Webcam Gadget acts as a composite USB Audio and Video Class 1180 - device. It provides a userspace API to process UVC control requests 1181 - and stream video data to the host. 1182 - 1183 - Say "y" to link the driver statically, or "m" to build a 1184 - dynamically linked module called "g_webcam". 725 + source "drivers/usb/gadget/legacy/Kconfig" 1185 726 1186 727 endchoice 1187 728
+3 -41
drivers/usb/gadget/Makefile
··· 1 1 # 2 2 # USB peripheral controller drivers 3 3 # 4 - ccflags-$(CONFIG_USB_GADGET_DEBUG) := -DDEBUG 5 - ccflags-$(CONFIG_USB_GADGET_VERBOSE) += -DVERBOSE_DEBUG 4 + subdir-ccflags-$(CONFIG_USB_GADGET_DEBUG) := -DDEBUG 5 + subdir-ccflags-$(CONFIG_USB_GADGET_VERBOSE) += -DVERBOSE_DEBUG 6 6 7 7 obj-$(CONFIG_USB_GADGET) += udc-core.o 8 8 obj-$(CONFIG_USB_LIBCOMPOSITE) += libcomposite.o ··· 64 64 usb_f_fs-y := f_fs.o 65 65 obj-$(CONFIG_USB_F_FS) += usb_f_fs.o 66 66 67 - # 68 - # USB gadget drivers 69 - # 70 - g_zero-y := zero.o 71 - g_audio-y := audio.o 72 - g_ether-y := ether.o 73 - g_serial-y := serial.o 74 - g_midi-y := gmidi.o 75 - gadgetfs-y := inode.o 76 - g_mass_storage-y := mass_storage.o 77 - g_printer-y := printer.o 78 - g_cdc-y := cdc2.o 79 - g_multi-y := multi.o 80 - g_hid-y := hid.o 81 - g_dbgp-y := dbgp.o 82 - g_nokia-y := nokia.o 83 - g_webcam-y := webcam.o 84 - g_ncm-y := ncm.o 85 - g_acm_ms-y := acm_ms.o 86 - g_tcm_usb_gadget-y := tcm_usb_gadget.o 87 - 88 - obj-$(CONFIG_USB_ZERO) += g_zero.o 89 - obj-$(CONFIG_USB_AUDIO) += g_audio.o 90 - obj-$(CONFIG_USB_ETH) += g_ether.o 91 - obj-$(CONFIG_USB_GADGETFS) += gadgetfs.o 92 - obj-$(CONFIG_USB_FUNCTIONFS) += g_ffs.o 93 - obj-$(CONFIG_USB_MASS_STORAGE) += g_mass_storage.o 94 - obj-$(CONFIG_USB_G_SERIAL) += g_serial.o 95 - obj-$(CONFIG_USB_G_PRINTER) += g_printer.o 96 - obj-$(CONFIG_USB_MIDI_GADGET) += g_midi.o 97 - obj-$(CONFIG_USB_CDC_COMPOSITE) += g_cdc.o 98 - obj-$(CONFIG_USB_G_HID) += g_hid.o 99 - obj-$(CONFIG_USB_G_DBGP) += g_dbgp.o 100 - obj-$(CONFIG_USB_G_MULTI) += g_multi.o 101 - obj-$(CONFIG_USB_G_NOKIA) += g_nokia.o 102 - obj-$(CONFIG_USB_G_WEBCAM) += g_webcam.o 103 - obj-$(CONFIG_USB_G_NCM) += g_ncm.o 104 - obj-$(CONFIG_USB_G_ACM_MS) += g_acm_ms.o 105 - obj-$(CONFIG_USB_GADGET_TARGET) += tcm_usb_gadget.o 67 + obj-$(CONFIG_USB_GADGET) += legacy/
drivers/usb/gadget/acm_ms.c drivers/usb/gadget/legacy/acm_ms.c
drivers/usb/gadget/audio.c drivers/usb/gadget/legacy/audio.c
drivers/usb/gadget/cdc2.c drivers/usb/gadget/legacy/cdc2.c
drivers/usb/gadget/dbgp.c drivers/usb/gadget/legacy/dbgp.c
drivers/usb/gadget/ether.c drivers/usb/gadget/legacy/ether.c
drivers/usb/gadget/g_ffs.c drivers/usb/gadget/legacy/g_ffs.c
drivers/usb/gadget/gmidi.c drivers/usb/gadget/legacy/gmidi.c
drivers/usb/gadget/hid.c drivers/usb/gadget/legacy/hid.c
drivers/usb/gadget/inode.c drivers/usb/gadget/legacy/inode.c
+475
drivers/usb/gadget/legacy/Kconfig
··· 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 + 16 + config USB_ZERO 17 + tristate "Gadget Zero (DEVELOPMENT)" 18 + select USB_LIBCOMPOSITE 19 + select USB_F_SS_LB 20 + help 21 + Gadget Zero is a two-configuration device. It either sinks and 22 + sources bulk data; or it loops back a configurable number of 23 + transfers. It also implements control requests, for "chapter 9" 24 + conformance. The driver needs only two bulk-capable endpoints, so 25 + it can work on top of most device-side usb controllers. It's 26 + useful for testing, and is also a working example showing how 27 + USB "gadget drivers" can be written. 28 + 29 + Make this be the first driver you try using on top of any new 30 + USB peripheral controller driver. Then you can use host-side 31 + test software, like the "usbtest" driver, to put your hardware 32 + and its driver through a basic set of functional tests. 33 + 34 + Gadget Zero also works with the host-side "usb-skeleton" driver, 35 + and with many kinds of host-side test software. You may need 36 + to tweak product and vendor IDs before host software knows about 37 + this device, and arrange to select an appropriate configuration. 38 + 39 + Say "y" to link the driver statically, or "m" to build a 40 + dynamically linked module called "g_zero". 41 + 42 + config USB_ZERO_HNPTEST 43 + boolean "HNP Test Device" 44 + depends on USB_ZERO && USB_OTG 45 + help 46 + You can configure this device to enumerate using the device 47 + identifiers of the USB-OTG test device. That means that when 48 + this gadget connects to another OTG device, with this one using 49 + the "B-Peripheral" role, that device will use HNP to let this 50 + one serve as the USB host instead (in the "B-Host" role). 51 + 52 + config USB_AUDIO 53 + tristate "Audio Gadget" 54 + depends on SND 55 + select USB_LIBCOMPOSITE 56 + select SND_PCM 57 + help 58 + This Gadget Audio driver is compatible with USB Audio Class 59 + specification 2.0. It implements 1 AudioControl interface, 60 + 1 AudioStreaming Interface each for USB-OUT and USB-IN. 61 + Number of channels, sample rate and sample size can be 62 + specified as module parameters. 63 + This driver doesn't expect any real Audio codec to be present 64 + on the device - the audio streams are simply sinked to and 65 + sourced from a virtual ALSA sound card created. The user-space 66 + application may choose to do whatever it wants with the data 67 + received from the USB Host and choose to provide whatever it 68 + wants as audio data to the USB Host. 69 + 70 + Say "y" to link the driver statically, or "m" to build a 71 + dynamically linked module called "g_audio". 72 + 73 + config GADGET_UAC1 74 + bool "UAC 1.0 (Legacy)" 75 + depends on USB_AUDIO 76 + help 77 + If you instead want older UAC Spec-1.0 driver that also has audio 78 + paths hardwired to the Audio codec chip on-board and doesn't work 79 + without one. 80 + 81 + config USB_ETH 82 + tristate "Ethernet Gadget (with CDC Ethernet support)" 83 + depends on NET 84 + select USB_LIBCOMPOSITE 85 + select USB_U_ETHER 86 + select USB_F_ECM 87 + select USB_F_SUBSET 88 + select CRC32 89 + help 90 + This driver implements Ethernet style communication, in one of 91 + several ways: 92 + 93 + - The "Communication Device Class" (CDC) Ethernet Control Model. 94 + That protocol is often avoided with pure Ethernet adapters, in 95 + favor of simpler vendor-specific hardware, but is widely 96 + supported by firmware for smart network devices. 97 + 98 + - On hardware can't implement that protocol, a simple CDC subset 99 + is used, placing fewer demands on USB. 100 + 101 + - CDC Ethernet Emulation Model (EEM) is a newer standard that has 102 + a simpler interface that can be used by more USB hardware. 103 + 104 + RNDIS support is an additional option, more demanding than than 105 + subset. 106 + 107 + Within the USB device, this gadget driver exposes a network device 108 + "usbX", where X depends on what other networking devices you have. 109 + Treat it like a two-node Ethernet link: host, and gadget. 110 + 111 + The Linux-USB host-side "usbnet" driver interoperates with this 112 + driver, so that deep I/O queues can be supported. On 2.4 kernels, 113 + use "CDCEther" instead, if you're using the CDC option. That CDC 114 + mode should also interoperate with standard CDC Ethernet class 115 + drivers on other host operating systems. 116 + 117 + Say "y" to link the driver statically, or "m" to build a 118 + dynamically linked module called "g_ether". 119 + 120 + config USB_ETH_RNDIS 121 + bool "RNDIS support" 122 + depends on USB_ETH 123 + select USB_LIBCOMPOSITE 124 + select USB_F_RNDIS 125 + default y 126 + help 127 + Microsoft Windows XP bundles the "Remote NDIS" (RNDIS) protocol, 128 + and Microsoft provides redistributable binary RNDIS drivers for 129 + older versions of Windows. 130 + 131 + If you say "y" here, the Ethernet gadget driver will try to provide 132 + a second device configuration, supporting RNDIS to talk to such 133 + Microsoft USB hosts. 134 + 135 + To make MS-Windows work with this, use Documentation/usb/linux.inf 136 + as the "driver info file". For versions of MS-Windows older than 137 + XP, you'll need to download drivers from Microsoft's website; a URL 138 + is given in comments found in that info file. 139 + 140 + config USB_ETH_EEM 141 + bool "Ethernet Emulation Model (EEM) support" 142 + depends on USB_ETH 143 + select USB_LIBCOMPOSITE 144 + select USB_F_EEM 145 + default n 146 + help 147 + CDC EEM is a newer USB standard that is somewhat simpler than CDC ECM 148 + and therefore can be supported by more hardware. Technically ECM and 149 + EEM are designed for different applications. The ECM model extends 150 + the network interface to the target (e.g. a USB cable modem), and the 151 + EEM model is for mobile devices to communicate with hosts using 152 + ethernet over USB. For Linux gadgets, however, the interface with 153 + the host is the same (a usbX device), so the differences are minimal. 154 + 155 + If you say "y" here, the Ethernet gadget driver will use the EEM 156 + protocol rather than ECM. If unsure, say "n". 157 + 158 + config USB_G_NCM 159 + tristate "Network Control Model (NCM) support" 160 + depends on NET 161 + select USB_LIBCOMPOSITE 162 + select USB_U_ETHER 163 + select USB_F_NCM 164 + select CRC32 165 + help 166 + This driver implements USB CDC NCM subclass standard. NCM is 167 + an advanced protocol for Ethernet encapsulation, allows grouping 168 + of several ethernet frames into one USB transfer and different 169 + alignment possibilities. 170 + 171 + Say "y" to link the driver statically, or "m" to build a 172 + dynamically linked module called "g_ncm". 173 + 174 + config USB_GADGETFS 175 + tristate "Gadget Filesystem" 176 + help 177 + This driver provides a filesystem based API that lets user mode 178 + programs implement a single-configuration USB device, including 179 + endpoint I/O and control requests that don't relate to enumeration. 180 + All endpoints, transfer speeds, and transfer types supported by 181 + the hardware are available, through read() and write() calls. 182 + 183 + Say "y" to link the driver statically, or "m" to build a 184 + dynamically linked module called "gadgetfs". 185 + 186 + config USB_FUNCTIONFS 187 + tristate "Function Filesystem" 188 + select USB_LIBCOMPOSITE 189 + select USB_F_FS 190 + select USB_FUNCTIONFS_GENERIC if !(USB_FUNCTIONFS_ETH || USB_FUNCTIONFS_RNDIS) 191 + help 192 + The Function Filesystem (FunctionFS) lets one create USB 193 + composite functions in user space in the same way GadgetFS 194 + lets one create USB gadgets in user space. This allows creation 195 + of composite gadgets such that some of the functions are 196 + implemented in kernel space (for instance Ethernet, serial or 197 + mass storage) and other are implemented in user space. 198 + 199 + If you say "y" or "m" here you will be able what kind of 200 + configurations the gadget will provide. 201 + 202 + Say "y" to link the driver statically, or "m" to build 203 + a dynamically linked module called "g_ffs". 204 + 205 + config USB_FUNCTIONFS_ETH 206 + bool "Include configuration with CDC ECM (Ethernet)" 207 + depends on USB_FUNCTIONFS && NET 208 + select USB_U_ETHER 209 + select USB_F_ECM 210 + select USB_F_SUBSET 211 + help 212 + Include a configuration with CDC ECM function (Ethernet) and the 213 + Function Filesystem. 214 + 215 + config USB_FUNCTIONFS_RNDIS 216 + bool "Include configuration with RNDIS (Ethernet)" 217 + depends on USB_FUNCTIONFS && NET 218 + select USB_U_ETHER 219 + select USB_F_RNDIS 220 + help 221 + Include a configuration with RNDIS function (Ethernet) and the Filesystem. 222 + 223 + config USB_FUNCTIONFS_GENERIC 224 + bool "Include 'pure' configuration" 225 + depends on USB_FUNCTIONFS 226 + help 227 + Include a configuration with the Function Filesystem alone with 228 + no Ethernet interface. 229 + 230 + config USB_MASS_STORAGE 231 + tristate "Mass Storage Gadget" 232 + depends on BLOCK 233 + select USB_LIBCOMPOSITE 234 + select USB_F_MASS_STORAGE 235 + help 236 + The Mass Storage Gadget acts as a USB Mass Storage disk drive. 237 + As its storage repository it can use a regular file or a block 238 + device (in much the same way as the "loop" device driver), 239 + specified as a module parameter or sysfs option. 240 + 241 + This driver is a replacement for now removed File-backed 242 + Storage Gadget (g_file_storage). 243 + 244 + Say "y" to link the driver statically, or "m" to build 245 + a dynamically linked module called "g_mass_storage". 246 + 247 + config USB_GADGET_TARGET 248 + tristate "USB Gadget Target Fabric Module" 249 + depends on TARGET_CORE 250 + select USB_LIBCOMPOSITE 251 + help 252 + This fabric is an USB gadget. Two USB protocols are supported that is 253 + BBB or BOT (Bulk Only Transport) and UAS (USB Attached SCSI). BOT is 254 + advertised on alternative interface 0 (primary) and UAS is on 255 + alternative interface 1. Both protocols can work on USB2.0 and USB3.0. 256 + UAS utilizes the USB 3.0 feature called streams support. 257 + 258 + config USB_G_SERIAL 259 + tristate "Serial Gadget (with CDC ACM and CDC OBEX support)" 260 + depends on TTY 261 + select USB_U_SERIAL 262 + select USB_F_ACM 263 + select USB_F_SERIAL 264 + select USB_F_OBEX 265 + select USB_LIBCOMPOSITE 266 + help 267 + The Serial Gadget talks to the Linux-USB generic serial driver. 268 + This driver supports a CDC-ACM module option, which can be used 269 + to interoperate with MS-Windows hosts or with the Linux-USB 270 + "cdc-acm" driver. 271 + 272 + This driver also supports a CDC-OBEX option. You will need a 273 + user space OBEX server talking to /dev/ttyGS*, since the kernel 274 + itself doesn't implement the OBEX protocol. 275 + 276 + Say "y" to link the driver statically, or "m" to build a 277 + dynamically linked module called "g_serial". 278 + 279 + For more information, see Documentation/usb/gadget_serial.txt 280 + which includes instructions and a "driver info file" needed to 281 + make MS-Windows work with CDC ACM. 282 + 283 + config USB_MIDI_GADGET 284 + tristate "MIDI Gadget" 285 + depends on SND 286 + select USB_LIBCOMPOSITE 287 + select SND_RAWMIDI 288 + help 289 + The MIDI Gadget acts as a USB Audio device, with one MIDI 290 + input and one MIDI output. These MIDI jacks appear as 291 + a sound "card" in the ALSA sound system. Other MIDI 292 + connections can then be made on the gadget system, using 293 + ALSA's aconnect utility etc. 294 + 295 + Say "y" to link the driver statically, or "m" to build a 296 + dynamically linked module called "g_midi". 297 + 298 + config USB_G_PRINTER 299 + tristate "Printer Gadget" 300 + select USB_LIBCOMPOSITE 301 + help 302 + The Printer Gadget channels data between the USB host and a 303 + userspace program driving the print engine. The user space 304 + program reads and writes the device file /dev/g_printer to 305 + receive or send printer data. It can use ioctl calls to 306 + the device file to get or set printer status. 307 + 308 + Say "y" to link the driver statically, or "m" to build a 309 + dynamically linked module called "g_printer". 310 + 311 + For more information, see Documentation/usb/gadget_printer.txt 312 + which includes sample code for accessing the device file. 313 + 314 + if TTY 315 + 316 + config USB_CDC_COMPOSITE 317 + tristate "CDC Composite Device (Ethernet and ACM)" 318 + depends on NET 319 + select USB_LIBCOMPOSITE 320 + select USB_U_SERIAL 321 + select USB_U_ETHER 322 + select USB_F_ACM 323 + select USB_F_ECM 324 + help 325 + This driver provides two functions in one configuration: 326 + a CDC Ethernet (ECM) link, and a CDC ACM (serial port) link. 327 + 328 + This driver requires four bulk and two interrupt endpoints, 329 + plus the ability to handle altsettings. Not all peripheral 330 + controllers are that capable. 331 + 332 + Say "y" to link the driver statically, or "m" to build a 333 + dynamically linked module. 334 + 335 + config USB_G_NOKIA 336 + tristate "Nokia composite gadget" 337 + depends on PHONET 338 + select USB_LIBCOMPOSITE 339 + select USB_U_SERIAL 340 + select USB_U_ETHER 341 + select USB_F_ACM 342 + select USB_F_OBEX 343 + select USB_F_PHONET 344 + select USB_F_ECM 345 + help 346 + The Nokia composite gadget provides support for acm, obex 347 + and phonet in only one composite gadget driver. 348 + 349 + It's only really useful for N900 hardware. If you're building 350 + a kernel for N900, say Y or M here. If unsure, say N. 351 + 352 + config USB_G_ACM_MS 353 + tristate "CDC Composite Device (ACM and mass storage)" 354 + depends on BLOCK 355 + select USB_LIBCOMPOSITE 356 + select USB_U_SERIAL 357 + select USB_F_ACM 358 + select USB_F_MASS_STORAGE 359 + help 360 + This driver provides two functions in one configuration: 361 + a mass storage, and a CDC ACM (serial port) link. 362 + 363 + Say "y" to link the driver statically, or "m" to build a 364 + dynamically linked module called "g_acm_ms". 365 + 366 + config USB_G_MULTI 367 + tristate "Multifunction Composite Gadget" 368 + depends on BLOCK && NET 369 + select USB_G_MULTI_CDC if !USB_G_MULTI_RNDIS 370 + select USB_LIBCOMPOSITE 371 + select USB_U_SERIAL 372 + select USB_U_ETHER 373 + select USB_F_ACM 374 + select USB_F_MASS_STORAGE 375 + help 376 + The Multifunction Composite Gadget provides Ethernet (RNDIS 377 + and/or CDC Ethernet), mass storage and ACM serial link 378 + interfaces. 379 + 380 + You will be asked to choose which of the two configurations is 381 + to be available in the gadget. At least one configuration must 382 + be chosen to make the gadget usable. Selecting more than one 383 + configuration will prevent Windows from automatically detecting 384 + the gadget as a composite gadget, so an INF file will be needed to 385 + use the gadget. 386 + 387 + Say "y" to link the driver statically, or "m" to build a 388 + dynamically linked module called "g_multi". 389 + 390 + config USB_G_MULTI_RNDIS 391 + bool "RNDIS + CDC Serial + Storage configuration" 392 + depends on USB_G_MULTI 393 + select USB_F_RNDIS 394 + default y 395 + help 396 + This option enables a configuration with RNDIS, CDC Serial and 397 + Mass Storage functions available in the Multifunction Composite 398 + Gadget. This is the configuration dedicated for Windows since RNDIS 399 + is Microsoft's protocol. 400 + 401 + If unsure, say "y". 402 + 403 + config USB_G_MULTI_CDC 404 + bool "CDC Ethernet + CDC Serial + Storage configuration" 405 + depends on USB_G_MULTI 406 + default n 407 + select USB_F_ECM 408 + help 409 + This option enables a configuration with CDC Ethernet (ECM), CDC 410 + Serial and Mass Storage functions available in the Multifunction 411 + Composite Gadget. 412 + 413 + If unsure, say "y". 414 + 415 + endif # TTY 416 + 417 + config USB_G_HID 418 + tristate "HID Gadget" 419 + select USB_LIBCOMPOSITE 420 + help 421 + The HID gadget driver provides generic emulation of USB 422 + Human Interface Devices (HID). 423 + 424 + For more information, see Documentation/usb/gadget_hid.txt which 425 + includes sample code for accessing the device files. 426 + 427 + Say "y" to link the driver statically, or "m" to build a 428 + dynamically linked module called "g_hid". 429 + 430 + # Standalone / single function gadgets 431 + config USB_G_DBGP 432 + tristate "EHCI Debug Device Gadget" 433 + depends on TTY 434 + select USB_LIBCOMPOSITE 435 + help 436 + This gadget emulates an EHCI Debug device. This is useful when you want 437 + to interact with an EHCI Debug Port. 438 + 439 + Say "y" to link the driver statically, or "m" to build a 440 + dynamically linked module called "g_dbgp". 441 + 442 + if USB_G_DBGP 443 + choice 444 + prompt "EHCI Debug Device mode" 445 + default USB_G_DBGP_SERIAL 446 + 447 + config USB_G_DBGP_PRINTK 448 + depends on USB_G_DBGP 449 + bool "printk" 450 + help 451 + Directly printk() received data. No interaction. 452 + 453 + config USB_G_DBGP_SERIAL 454 + depends on USB_G_DBGP 455 + select USB_U_SERIAL 456 + bool "serial" 457 + help 458 + Userland can interact using /dev/ttyGSxxx. 459 + endchoice 460 + endif 461 + 462 + # put drivers that need isochronous transfer support (for audio 463 + # or video class gadget drivers), or specific hardware, here. 464 + config USB_G_WEBCAM 465 + tristate "USB Webcam Gadget" 466 + depends on VIDEO_DEV 467 + select USB_LIBCOMPOSITE 468 + select VIDEOBUF2_VMALLOC 469 + help 470 + The Webcam Gadget acts as a composite USB Audio and Video Class 471 + device. It provides a userspace API to process UVC control requests 472 + and stream video data to the host. 473 + 474 + Say "y" to link the driver statically, or "m" to build a 475 + dynamically linked module called "g_webcam".
+42
drivers/usb/gadget/legacy/Makefile
··· 1 + # 2 + # USB gadget drivers 3 + # 4 + 5 + ccflags-y := -I$(PWD)/drivers/usb/gadget/ 6 + 7 + g_zero-y := zero.o 8 + g_audio-y := audio.o 9 + g_ether-y := ether.o 10 + g_serial-y := serial.o 11 + g_midi-y := gmidi.o 12 + gadgetfs-y := inode.o 13 + g_mass_storage-y := mass_storage.o 14 + g_printer-y := printer.o 15 + g_cdc-y := cdc2.o 16 + g_multi-y := multi.o 17 + g_hid-y := hid.o 18 + g_dbgp-y := dbgp.o 19 + g_nokia-y := nokia.o 20 + g_webcam-y := webcam.o 21 + g_ncm-y := ncm.o 22 + g_acm_ms-y := acm_ms.o 23 + g_tcm_usb_gadget-y := tcm_usb_gadget.o 24 + 25 + obj-$(CONFIG_USB_ZERO) += g_zero.o 26 + obj-$(CONFIG_USB_AUDIO) += g_audio.o 27 + obj-$(CONFIG_USB_ETH) += g_ether.o 28 + obj-$(CONFIG_USB_GADGETFS) += gadgetfs.o 29 + obj-$(CONFIG_USB_FUNCTIONFS) += g_ffs.o 30 + obj-$(CONFIG_USB_MASS_STORAGE) += g_mass_storage.o 31 + obj-$(CONFIG_USB_G_SERIAL) += g_serial.o 32 + obj-$(CONFIG_USB_G_PRINTER) += g_printer.o 33 + obj-$(CONFIG_USB_MIDI_GADGET) += g_midi.o 34 + obj-$(CONFIG_USB_CDC_COMPOSITE) += g_cdc.o 35 + obj-$(CONFIG_USB_G_HID) += g_hid.o 36 + obj-$(CONFIG_USB_G_DBGP) += g_dbgp.o 37 + obj-$(CONFIG_USB_G_MULTI) += g_multi.o 38 + obj-$(CONFIG_USB_G_NOKIA) += g_nokia.o 39 + obj-$(CONFIG_USB_G_WEBCAM) += g_webcam.o 40 + obj-$(CONFIG_USB_G_NCM) += g_ncm.o 41 + obj-$(CONFIG_USB_G_ACM_MS) += g_acm_ms.o 42 + obj-$(CONFIG_USB_GADGET_TARGET) += tcm_usb_gadget.o
drivers/usb/gadget/mass_storage.c drivers/usb/gadget/legacy/mass_storage.c
drivers/usb/gadget/multi.c drivers/usb/gadget/legacy/multi.c
drivers/usb/gadget/ncm.c drivers/usb/gadget/legacy/ncm.c
drivers/usb/gadget/nokia.c drivers/usb/gadget/legacy/nokia.c
drivers/usb/gadget/printer.c drivers/usb/gadget/legacy/printer.c
drivers/usb/gadget/serial.c drivers/usb/gadget/legacy/serial.c
drivers/usb/gadget/tcm_usb_gadget.c drivers/usb/gadget/legacy/tcm_usb_gadget.c
drivers/usb/gadget/tcm_usb_gadget.h drivers/usb/gadget/legacy/tcm_usb_gadget.h
drivers/usb/gadget/webcam.c drivers/usb/gadget/legacy/webcam.c
drivers/usb/gadget/zero.c drivers/usb/gadget/legacy/zero.c