0001 ==============================
0002 Multifunction Composite Gadget
0003 ==============================
0004
0005 Overview
0006 ========
0007
0008 The Multifunction Composite Gadget (or g_multi) is a composite gadget
0009 that makes extensive use of the composite framework to provide
0010 a... multifunction gadget.
0011
0012 In it's standard configuration it provides a single USB configuration
0013 with RNDIS[1] (that is Ethernet), USB CDC[2] ACM (that is serial) and
0014 USB Mass Storage functions.
0015
0016 A CDC ECM (Ethernet) function may be turned on via a Kconfig option
0017 and RNDIS can be turned off. If they are both enabled the gadget will
0018 have two configurations -- one with RNDIS and another with CDC ECM[3].
0019
0020 Please note that if you use non-standard configuration (that is enable
0021 CDC ECM) you may need to change vendor and/or product ID.
0022
0023 Host drivers
0024 ============
0025
0026 To make use of the gadget one needs to make it work on host side --
0027 without that there's no hope of achieving anything with the gadget.
0028 As one might expect, things one need to do very from system to system.
0029
0030 Linux host drivers
0031 ------------------
0032
0033 Since the gadget uses standard composite framework and appears as such
0034 to Linux host it does not need any additional drivers on Linux host
0035 side. All the functions are handled by respective drivers developed
0036 for them.
0037
0038 This is also true for two configuration set-up with RNDIS
0039 configuration being the first one. Linux host will use the second
0040 configuration with CDC ECM which should work better under Linux.
0041
0042 Windows host drivers
0043 --------------------
0044
0045 For the gadget to work under Windows two conditions have to be met:
0046
0047 Detecting as composite gadget
0048 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0049
0050 First of all, Windows need to detect the gadget as an USB composite
0051 gadget which on its own have some conditions[4]. If they are met,
0052 Windows lets USB Generic Parent Driver[5] handle the device which then
0053 tries to match drivers for each individual interface (sort of, don't
0054 get into too many details).
0055
0056 The good news is: you do not have to worry about most of the
0057 conditions!
0058
0059 The only thing to worry is that the gadget has to have a single
0060 configuration so a dual RNDIS and CDC ECM gadget won't work unless you
0061 create a proper INF -- and of course, if you do submit it!
0062
0063 Installing drivers for each function
0064 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0065
0066 The other, trickier thing is making Windows install drivers for each
0067 individual function.
0068
0069 For mass storage it is trivial since Windows detect it's an interface
0070 implementing USB Mass Storage class and selects appropriate driver.
0071
0072 Things are harder with RDNIS and CDC ACM.
0073
0074 RNDIS
0075 .....
0076
0077 To make Windows select RNDIS drivers for the first function in the
0078 gadget, one needs to use the [[file:linux.inf]] file provided with this
0079 document. It "attaches" Window's RNDIS driver to the first interface
0080 of the gadget.
0081
0082 Please note, that while testing we encountered some issues[6] when
0083 RNDIS was not the first interface. You do not need to worry abut it
0084 unless you are trying to develop your own gadget in which case watch
0085 out for this bug.
0086
0087 CDC ACM
0088 .......
0089
0090 Similarly, [[file:linux-cdc-acm.inf]] is provided for CDC ACM.
0091
0092 Customising the gadget
0093 ......................
0094
0095 If you intend to hack the g_multi gadget be advised that rearranging
0096 functions will obviously change interface numbers for each of the
0097 functionality. As an effect provided INFs won't work since they have
0098 interface numbers hard-coded in them (it's not hard to change those
0099 though[7]).
0100
0101 This also means, that after experimenting with g_multi and changing
0102 provided functions one should change gadget's vendor and/or product ID
0103 so there will be no collision with other customised gadgets or the
0104 original gadget.
0105
0106 Failing to comply may cause brain damage after wondering for hours why
0107 things don't work as intended before realising Windows have cached
0108 some drivers information (changing USB port may sometimes help plus
0109 you might try using USBDeview[8] to remove the phantom device).
0110
0111 INF testing
0112 ...........
0113
0114 Provided INF files have been tested on Windows XP SP3, Windows Vista
0115 and Windows 7, all 32-bit versions. It should work on 64-bit versions
0116 as well. It most likely won't work on Windows prior to Windows XP
0117 SP2.
0118
0119 Other systems
0120 -------------
0121
0122 At this moment, drivers for any other systems have not been tested.
0123 Knowing how MacOS is based on BSD and BSD is an Open Source it is
0124 believed that it should (read: "I have no idea whether it will") work
0125 out-of-the-box.
0126
0127 For more exotic systems I have even less to say...
0128
0129 Any testing and drivers *are* *welcome*!
0130
0131 Authors
0132 =======
0133
0134 This document has been written by Michal Nazarewicz
0135 ([[mailto:mina86@mina86.com]]). INF files have been hacked with
0136 support of Marek Szyprowski ([[mailto:m.szyprowski@samsung.com]]) and
0137 Xiaofan Chen ([[mailto:xiaofanc@gmail.com]]) basing on the MS RNDIS
0138 template[9], Microchip's CDC ACM INF file and David Brownell's
0139 ([[mailto:dbrownell@users.sourceforge.net]]) original INF files.
0140
0141 Footnotes
0142 =========
0143
0144 [1] Remote Network Driver Interface Specification,
0145 [[https://msdn.microsoft.com/en-us/library/ee484414.aspx]].
0146
0147 [2] Communications Device Class Abstract Control Model, spec for this
0148 and other USB classes can be found at
0149 [[http://www.usb.org/developers/devclass_docs/]].
0150
0151 [3] CDC Ethernet Control Model.
0152
0153 [4] [[https://msdn.microsoft.com/en-us/library/ff537109(v=VS.85).aspx]]
0154
0155 [5] [[https://msdn.microsoft.com/en-us/library/ff539234(v=VS.85).aspx]]
0156
0157 [6] To put it in some other nice words, Windows failed to respond to
0158 any user input.
0159
0160 [7] You may find [[http://www.cygnal.org/ubb/Forum9/HTML/001050.html]]
0161 useful.
0162
0163 [8] https://www.nirsoft.net/utils/usb_devices_view.html
0164
0165 [9] [[https://msdn.microsoft.com/en-us/library/ff570620.aspx]]