gadget_multi.txt 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. -*- org -*-
  2. * Overview
  3. The Multifunction Composite Gadget (or g_multi) is a composite gadget
  4. that makes extensive use of the composite framework to provide
  5. a... multifunction gadget.
  6. In it's standard configuration it provides a single USB configuration
  7. with RNDIS[1] (that is Ethernet), USB CDC[2] ACM (that is serial) and
  8. USB Mass Storage functions.
  9. A CDC ECM (Ethernet) function may be turned on via a Kconfig option
  10. and RNDIS can be turned off. If they are both enabled the gadget will
  11. have two configurations -- one with RNDIS and another with CDC ECM[3].
  12. Please note that if you use non-standard configuration (that is enable
  13. CDC ECM) you may need to change vendor and/or product ID.
  14. * Host drivers
  15. To make use of the gadget one needs to make it work on host side --
  16. without that there's no hope of achieving anything with the gadget.
  17. As one might expect, things one need to do very from system to system.
  18. ** Linux host drivers
  19. Since the gadget uses standard composite framework and appears as such
  20. to Linux host it does not need any additional drivers on Linux host
  21. side. All the functions are handled by respective drivers developed
  22. for them.
  23. This is also true for two configuration set-up with RNDIS
  24. configuration being the first one. Linux host will use the second
  25. configuration with CDC ECM which should work better under Linux.
  26. ** Windows host drivers
  27. For the gadget two work under Windows two conditions have to be met:
  28. *** Detecting as composite gadget
  29. First of all, Windows need to detect the gadget as an USB composite
  30. gadget which on its own have some conditions[4]. If they are met,
  31. Windows lets USB Generic Parent Driver[5] handle the device which then
  32. tries to much drivers for each individual interface (sort of, don't
  33. get into too many details).
  34. The good news is: you do not have to worry about most of the
  35. conditions!
  36. The only thing to worry is that the gadget has to have a single
  37. configuration so a dual RNDIS and CDC ECM gadget won't work unless you
  38. create a proper INF -- and of course, if you do submit it!
  39. *** Installing drivers for each function
  40. The other, trickier thing is making Windows install drivers for each
  41. individual function.
  42. For mass storage it is trivial since Windows detect it's an interface
  43. implementing USB Mass Storage class and selects appropriate driver.
  44. Things are harder with RDNIS and CDC ACM.
  45. **** RNDIS
  46. To make Windows select RNDIS drivers for the first function in the
  47. gadget, one needs to use the [[file:linux.inf]] file provided with this
  48. document. It "attaches" Window's RNDIS driver to the first interface
  49. of the gadget.
  50. Please note, that while testing we encountered some issues[6] when
  51. RNDIS was not the first interface. You do not need to worry abut it
  52. unless you are trying to develop your own gadget in which case watch
  53. out for this bug.
  54. **** CDC ACM
  55. Similarly, [[file:linux-cdc-acm.inf]] is provided for CDC ACM.
  56. **** Customising the gadget
  57. If you intend to hack the g_multi gadget be advised that rearranging
  58. functions will obviously change interface numbers for each of the
  59. functionality. As an effect provided INFs won't work since they have
  60. interface numbers hard-coded in them (it's not hard to change those
  61. though[7]).
  62. This also means, that after experimenting with g_multi and changing
  63. provided functions one should change gadget's vendor and/or product ID
  64. so there will be no collision with other customised gadgets or the
  65. original gadget.
  66. Failing to comply may cause brain damage after wondering for hours why
  67. things don't work as intended before realising Windows have cached
  68. some drivers information (changing USB port may sometimes help plus
  69. you might try using USBDeview[8] to remove the phantom device).
  70. **** INF testing
  71. Provided INF files have been tested on Windows XP SP3, Windows Vista
  72. and Windows 7, all 32-bit versions. It should work on 64-bit versions
  73. as well. It most likely won't work on Windows prior to Windows XP
  74. SP2.
  75. ** Other systems
  76. At this moment, drivers for any other systems have not been tested.
  77. Knowing how MacOS is based on BSD and BSD is an Open Source it is
  78. believed that it should (read: "I have no idea whether it will") work
  79. out-of-the-box.
  80. For more exotic systems I have even less to say...
  81. Any testing and drivers *are* *welcome*!
  82. * Authors
  83. This document has been written by Michal Nazarewicz
  84. ([[mailto:mina86@mina86.com]]). INF files have been hacked with
  85. support of Marek Szyprowski ([[mailto:m.szyprowski@samsung.com]]) and
  86. Xiaofan Chen ([[mailto:xiaofanc@gmail.com]]) basing on the MS RNDIS
  87. template[9], Microchip's CDC ACM INF file and David Brownell's
  88. ([[mailto:dbrownell@users.sourceforge.net]]) original INF files.
  89. * Footnotes
  90. [1] Remote Network Driver Interface Specification,
  91. [[http://msdn.microsoft.com/en-us/library/ee484414.aspx]].
  92. [2] Communications Device Class Abstract Control Model, spec for this
  93. and other USB classes can be found at
  94. [[http://www.usb.org/developers/devclass_docs/]].
  95. [3] CDC Ethernet Control Model.
  96. [4] [[http://msdn.microsoft.com/en-us/library/ff537109(v=VS.85).aspx]]
  97. [5] [[http://msdn.microsoft.com/en-us/library/ff539234(v=VS.85).aspx]]
  98. [6] To put it in some other nice words, Windows failed to respond to
  99. any user input.
  100. [7] You may find [[http://www.cygnal.org/ubb/Forum9/HTML/001050.html]]
  101. useful.
  102. [8] http://www.nirsoft.net/utils/usb_devices_view.html
  103. [9] [[http://msdn.microsoft.com/en-us/library/ff570620.aspx]]