You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2807 lines
138KB

  1. /* Teensyduino Core Library
  2. * http://www.pjrc.com/teensy/
  3. * Copyright (c) 2019 PJRC.COM, LLC.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining
  6. * a copy of this software and associated documentation files (the
  7. * "Software"), to deal in the Software without restriction, including
  8. * without limitation the rights to use, copy, modify, merge, publish,
  9. * distribute, sublicense, and/or sell copies of the Software, and to
  10. * permit persons to whom the Software is furnished to do so, subject to
  11. * the following conditions:
  12. *
  13. * 1. The above copyright notice and this permission notice shall be
  14. * included in all copies or substantial portions of the Software.
  15. *
  16. * 2. If the Software is incorporated into a build system that allows
  17. * selection among a list of target devices, then similar target
  18. * devices manufactured by PJRC.COM must be included in the list of
  19. * target devices and selectable in the same manner.
  20. *
  21. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  25. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  26. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  27. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  28. * SOFTWARE.
  29. */
  30. //#if F_CPU >= 20000000
  31. #define USB_DESC_LIST_DEFINE
  32. #include "usb_desc.h"
  33. #ifdef NUM_ENDPOINTS
  34. #include "usb_names.h"
  35. #include "imxrt.h"
  36. #include "avr_functions.h"
  37. #include "avr/pgmspace.h"
  38. // At very slow CPU speeds, the OCRAM just isn't fast enough for
  39. // USB to work reliably. But the precious/limited DTCM is. So
  40. // as an ugly workaround, undefine DMAMEM so all buffers which
  41. // would normally be allocated in OCRAM are placed in DTCM.
  42. #if defined(F_CPU) && F_CPU < 30000000
  43. #undef DMAMEM
  44. #endif
  45. // USB Descriptors are binary data which the USB host reads to
  46. // automatically detect a USB device's capabilities. The format
  47. // and meaning of every field is documented in numerous USB
  48. // standards. When working with USB descriptors, despite the
  49. // complexity of the standards and poor writing quality in many
  50. // of those documents, remember descriptors are nothing more
  51. // than constant binary data that tells the USB host what the
  52. // device can do. Computers will load drivers based on this data.
  53. // Those drivers then communicate on the endpoints specified by
  54. // the descriptors.
  55. // To configure a new combination of interfaces or make minor
  56. // changes to existing configuration (eg, change the name or ID
  57. // numbers), usually you would edit "usb_desc.h". This file
  58. // is meant to be configured by the header, so generally it is
  59. // only edited to add completely new USB interfaces or features.
  60. // **************************************************************
  61. // USB Device
  62. // **************************************************************
  63. #define LSB(n) ((n) & 255)
  64. #define MSB(n) (((n) >> 8) & 255)
  65. // USB Device Descriptor. The USB host reads this first, to learn
  66. // what type of device is connected.
  67. static uint8_t device_descriptor[] = {
  68. 18, // bLength
  69. 1, // bDescriptorType
  70. 0x00, 0x02, // bcdUSB
  71. #ifdef DEVICE_CLASS
  72. DEVICE_CLASS, // bDeviceClass
  73. #else
  74. 0,
  75. #endif
  76. #ifdef DEVICE_SUBCLASS
  77. DEVICE_SUBCLASS, // bDeviceSubClass
  78. #else
  79. 0,
  80. #endif
  81. #ifdef DEVICE_PROTOCOL
  82. DEVICE_PROTOCOL, // bDeviceProtocol
  83. #else
  84. 0,
  85. #endif
  86. EP0_SIZE, // bMaxPacketSize0
  87. LSB(VENDOR_ID), MSB(VENDOR_ID), // idVendor
  88. LSB(PRODUCT_ID), MSB(PRODUCT_ID), // idProduct
  89. #ifdef BCD_DEVICE
  90. LSB(BCD_DEVICE), MSB(BCD_DEVICE), // bcdDevice
  91. #else
  92. // For USB types that don't explicitly define BCD_DEVICE,
  93. // use the minor version number to help teensy_ports
  94. // identify which Teensy model is used.
  95. #if defined(__IMXRT1062__) && defined(ARDUINO_TEENSY40)
  96. 0x79, 0x02, // Teensy 4.0
  97. #elif defined(__IMXRT1062__) && defined(ARDUINO_TEENSY41)
  98. 0x80, 0x02, // Teensy 4.1
  99. #elif defined(__IMXRT1062__) && defined(ARDUINO_TEENSY_MICROMOD)
  100. 0x81, 0x02, // Teensy MicroMod
  101. #else
  102. 0x00, 0x02,
  103. #endif
  104. #endif
  105. 1, // iManufacturer
  106. 2, // iProduct
  107. 3, // iSerialNumber
  108. 1 // bNumConfigurations
  109. };
  110. PROGMEM static const uint8_t qualifier_descriptor[] = { // 9.6.2 Device_Qualifier, page 264
  111. 10, // bLength
  112. 6, // bDescriptorType
  113. 0x00, 0x02, // bcdUSB
  114. #ifdef DEVICE_CLASS
  115. DEVICE_CLASS, // bDeviceClass
  116. #else
  117. 0,
  118. #endif
  119. #ifdef DEVICE_SUBCLASS
  120. DEVICE_SUBCLASS, // bDeviceSubClass
  121. #else
  122. 0,
  123. #endif
  124. #ifdef DEVICE_PROTOCOL
  125. DEVICE_PROTOCOL, // bDeviceProtocol
  126. #else
  127. 0,
  128. #endif
  129. EP0_SIZE, // bMaxPacketSize0
  130. 1, // bNumConfigurations
  131. 0 // bReserved
  132. };
  133. // These descriptors must NOT be "const", because the USB DMA
  134. // has trouble accessing flash memory with enough bandwidth
  135. // while the processor is executing from flash.
  136. // **************************************************************
  137. // HID Report Descriptors
  138. // **************************************************************
  139. // Each HID interface needs a special report descriptor that tells
  140. // the meaning and format of the data.
  141. #ifdef KEYBOARD_INTERFACE
  142. // Keyboard Protocol 1, HID 1.11 spec, Appendix B, page 59-60
  143. static uint8_t keyboard_report_desc[] = {
  144. 0x05, 0x01, // Usage Page (Generic Desktop),
  145. 0x09, 0x06, // Usage (Keyboard),
  146. 0xA1, 0x01, // Collection (Application),
  147. 0x75, 0x01, // Report Size (1),
  148. 0x95, 0x08, // Report Count (8),
  149. 0x05, 0x07, // Usage Page (Key Codes),
  150. 0x19, 0xE0, // Usage Minimum (224),
  151. 0x29, 0xE7, // Usage Maximum (231),
  152. 0x15, 0x00, // Logical Minimum (0),
  153. 0x25, 0x01, // Logical Maximum (1),
  154. 0x81, 0x02, // Input (Data, Variable, Absolute), ;Modifier keys
  155. 0x95, 0x01, // Report Count (1),
  156. 0x75, 0x08, // Report Size (8),
  157. 0x81, 0x03, // Input (Constant), ;Reserved byte
  158. 0x95, 0x05, // Report Count (5),
  159. 0x75, 0x01, // Report Size (1),
  160. 0x05, 0x08, // Usage Page (LEDs),
  161. 0x19, 0x01, // Usage Minimum (1),
  162. 0x29, 0x05, // Usage Maximum (5),
  163. 0x91, 0x02, // Output (Data, Variable, Absolute), ;LED report
  164. 0x95, 0x01, // Report Count (1),
  165. 0x75, 0x03, // Report Size (3),
  166. 0x91, 0x03, // Output (Constant), ;LED report padding
  167. 0x95, 0x06, // Report Count (6),
  168. 0x75, 0x08, // Report Size (8),
  169. 0x15, 0x00, // Logical Minimum (0),
  170. 0x25, 0x7F, // Logical Maximum(104),
  171. 0x05, 0x07, // Usage Page (Key Codes),
  172. 0x19, 0x00, // Usage Minimum (0),
  173. 0x29, 0x7F, // Usage Maximum (104),
  174. 0x81, 0x00, // Input (Data, Array), ;Normal keys
  175. 0xC0 // End Collection
  176. };
  177. #endif
  178. #ifdef KEYMEDIA_INTERFACE
  179. static uint8_t keymedia_report_desc[] = {
  180. 0x05, 0x0C, // Usage Page (Consumer)
  181. 0x09, 0x01, // Usage (Consumer Controls)
  182. 0xA1, 0x01, // Collection (Application)
  183. 0x75, 0x0A, // Report Size (10)
  184. 0x95, 0x04, // Report Count (4)
  185. 0x19, 0x00, // Usage Minimum (0)
  186. 0x2A, 0x9C, 0x02, // Usage Maximum (0x29C)
  187. 0x15, 0x00, // Logical Minimum (0)
  188. 0x26, 0x9C, 0x02, // Logical Maximum (0x29C)
  189. 0x81, 0x00, // Input (Data, Array)
  190. 0x05, 0x01, // Usage Page (Generic Desktop)
  191. 0x75, 0x08, // Report Size (8)
  192. 0x95, 0x03, // Report Count (3)
  193. 0x19, 0x00, // Usage Minimum (0)
  194. 0x29, 0xB7, // Usage Maximum (0xB7)
  195. 0x15, 0x00, // Logical Minimum (0)
  196. 0x26, 0xB7, 0x00, // Logical Maximum (0xB7)
  197. 0x81, 0x00, // Input (Data, Array)
  198. 0xC0 // End Collection
  199. };
  200. #endif
  201. #ifdef MOUSE_INTERFACE
  202. // Mouse Protocol 1, HID 1.11 spec, Appendix B, page 59-60, with wheel extension
  203. static uint8_t mouse_report_desc[] = {
  204. 0x05, 0x01, // Usage Page (Generic Desktop)
  205. 0x09, 0x02, // Usage (Mouse)
  206. 0xA1, 0x01, // Collection (Application)
  207. 0x85, 0x01, // REPORT_ID (1)
  208. 0x05, 0x09, // Usage Page (Button)
  209. 0x19, 0x01, // Usage Minimum (Button #1)
  210. 0x29, 0x08, // Usage Maximum (Button #8)
  211. 0x15, 0x00, // Logical Minimum (0)
  212. 0x25, 0x01, // Logical Maximum (1)
  213. 0x95, 0x08, // Report Count (8)
  214. 0x75, 0x01, // Report Size (1)
  215. 0x81, 0x02, // Input (Data, Variable, Absolute)
  216. 0x05, 0x01, // Usage Page (Generic Desktop)
  217. 0x09, 0x30, // Usage (X)
  218. 0x09, 0x31, // Usage (Y)
  219. 0x09, 0x38, // Usage (Wheel)
  220. 0x15, 0x81, // Logical Minimum (-127)
  221. 0x25, 0x7F, // Logical Maximum (127)
  222. 0x75, 0x08, // Report Size (8),
  223. 0x95, 0x03, // Report Count (3),
  224. 0x81, 0x06, // Input (Data, Variable, Relative)
  225. 0x05, 0x0C, // Usage Page (Consumer)
  226. 0x0A, 0x38, 0x02, // Usage (AC Pan)
  227. 0x15, 0x81, // Logical Minimum (-127)
  228. 0x25, 0x7F, // Logical Maximum (127)
  229. 0x75, 0x08, // Report Size (8),
  230. 0x95, 0x01, // Report Count (1),
  231. 0x81, 0x06, // Input (Data, Variable, Relative)
  232. 0xC0, // End Collection
  233. 0x05, 0x01, // Usage Page (Generic Desktop)
  234. 0x09, 0x02, // Usage (Mouse)
  235. 0xA1, 0x01, // Collection (Application)
  236. 0x85, 0x02, // REPORT_ID (2)
  237. 0x05, 0x01, // Usage Page (Generic Desktop)
  238. 0x09, 0x30, // Usage (X)
  239. 0x09, 0x31, // Usage (Y)
  240. 0x15, 0x00, // Logical Minimum (0)
  241. 0x26, 0xFF, 0x7F, // Logical Maximum (32767)
  242. 0x75, 0x10, // Report Size (16),
  243. 0x95, 0x02, // Report Count (2),
  244. 0x81, 0x02, // Input (Data, Variable, Absolute)
  245. 0xC0 // End Collection
  246. };
  247. #endif
  248. #ifdef JOYSTICK_INTERFACE
  249. #if JOYSTICK_SIZE == 12
  250. static uint8_t joystick_report_desc[] = {
  251. 0x05, 0x01, // Usage Page (Generic Desktop)
  252. 0x09, 0x04, // Usage (Joystick)
  253. 0xA1, 0x01, // Collection (Application)
  254. 0x15, 0x00, // Logical Minimum (0)
  255. 0x25, 0x01, // Logical Maximum (1)
  256. 0x75, 0x01, // Report Size (1)
  257. 0x95, 0x20, // Report Count (32)
  258. 0x05, 0x09, // Usage Page (Button)
  259. 0x19, 0x01, // Usage Minimum (Button #1)
  260. 0x29, 0x20, // Usage Maximum (Button #32)
  261. 0x81, 0x02, // Input (variable,absolute)
  262. 0x15, 0x00, // Logical Minimum (0)
  263. 0x25, 0x07, // Logical Maximum (7)
  264. 0x35, 0x00, // Physical Minimum (0)
  265. 0x46, 0x3B, 0x01, // Physical Maximum (315)
  266. 0x75, 0x04, // Report Size (4)
  267. 0x95, 0x01, // Report Count (1)
  268. 0x65, 0x14, // Unit (20)
  269. 0x05, 0x01, // Usage Page (Generic Desktop)
  270. 0x09, 0x39, // Usage (Hat switch)
  271. 0x81, 0x42, // Input (variable,absolute,null_state)
  272. 0x05, 0x01, // Usage Page (Generic Desktop)
  273. 0x09, 0x01, // Usage (Pointer)
  274. 0xA1, 0x00, // Collection ()
  275. 0x15, 0x00, // Logical Minimum (0)
  276. 0x26, 0xFF, 0x03, // Logical Maximum (1023)
  277. 0x75, 0x0A, // Report Size (10)
  278. 0x95, 0x04, // Report Count (4)
  279. 0x09, 0x30, // Usage (X)
  280. 0x09, 0x31, // Usage (Y)
  281. 0x09, 0x32, // Usage (Z)
  282. 0x09, 0x35, // Usage (Rz)
  283. 0x81, 0x02, // Input (variable,absolute)
  284. 0xC0, // End Collection
  285. 0x15, 0x00, // Logical Minimum (0)
  286. 0x26, 0xFF, 0x03, // Logical Maximum (1023)
  287. 0x75, 0x0A, // Report Size (10)
  288. 0x95, 0x02, // Report Count (2)
  289. 0x09, 0x36, // Usage (Slider)
  290. 0x09, 0x36, // Usage (Slider)
  291. 0x81, 0x02, // Input (variable,absolute)
  292. 0xC0 // End Collection
  293. };
  294. #elif JOYSTICK_SIZE == 64
  295. // extreme joystick (to use this, edit JOYSTICK_SIZE to 64 in usb_desc.h)
  296. // 128 buttons 16
  297. // 6 axes 12
  298. // 17 sliders 34
  299. // 4 pov 2
  300. static uint8_t joystick_report_desc[] = {
  301. 0x05, 0x01, // Usage Page (Generic Desktop)
  302. 0x09, 0x04, // Usage (Joystick)
  303. 0xA1, 0x01, // Collection (Application)
  304. 0x15, 0x00, // Logical Minimum (0)
  305. 0x25, 0x01, // Logical Maximum (1)
  306. 0x75, 0x01, // Report Size (1)
  307. 0x95, 0x80, // Report Count (128)
  308. 0x05, 0x09, // Usage Page (Button)
  309. 0x19, 0x01, // Usage Minimum (Button #1)
  310. 0x29, 0x80, // Usage Maximum (Button #128)
  311. 0x81, 0x02, // Input (variable,absolute)
  312. 0x05, 0x01, // Usage Page (Generic Desktop)
  313. 0x09, 0x01, // Usage (Pointer)
  314. 0xA1, 0x00, // Collection ()
  315. 0x15, 0x00, // Logical Minimum (0)
  316. 0x27, 0xFF, 0xFF, 0, 0, // Logical Maximum (65535)
  317. 0x75, 0x10, // Report Size (16)
  318. 0x95, 23, // Report Count (23)
  319. 0x09, 0x30, // Usage (X)
  320. 0x09, 0x31, // Usage (Y)
  321. 0x09, 0x32, // Usage (Z)
  322. 0x09, 0x33, // Usage (Rx)
  323. 0x09, 0x34, // Usage (Ry)
  324. 0x09, 0x35, // Usage (Rz)
  325. 0x09, 0x36, // Usage (Slider)
  326. 0x09, 0x36, // Usage (Slider)
  327. 0x09, 0x36, // Usage (Slider)
  328. 0x09, 0x36, // Usage (Slider)
  329. 0x09, 0x36, // Usage (Slider)
  330. 0x09, 0x36, // Usage (Slider)
  331. 0x09, 0x36, // Usage (Slider)
  332. 0x09, 0x36, // Usage (Slider)
  333. 0x09, 0x36, // Usage (Slider)
  334. 0x09, 0x36, // Usage (Slider)
  335. 0x09, 0x36, // Usage (Slider)
  336. 0x09, 0x36, // Usage (Slider)
  337. 0x09, 0x36, // Usage (Slider)
  338. 0x09, 0x36, // Usage (Slider)
  339. 0x09, 0x36, // Usage (Slider)
  340. 0x09, 0x36, // Usage (Slider)
  341. 0x09, 0x36, // Usage (Slider)
  342. 0x81, 0x02, // Input (variable,absolute)
  343. 0xC0, // End Collection
  344. 0x15, 0x00, // Logical Minimum (0)
  345. 0x25, 0x07, // Logical Maximum (7)
  346. 0x35, 0x00, // Physical Minimum (0)
  347. 0x46, 0x3B, 0x01, // Physical Maximum (315)
  348. 0x75, 0x04, // Report Size (4)
  349. 0x95, 0x04, // Report Count (4)
  350. 0x65, 0x14, // Unit (20)
  351. 0x05, 0x01, // Usage Page (Generic Desktop)
  352. 0x09, 0x39, // Usage (Hat switch)
  353. 0x09, 0x39, // Usage (Hat switch)
  354. 0x09, 0x39, // Usage (Hat switch)
  355. 0x09, 0x39, // Usage (Hat switch)
  356. 0x81, 0x42, // Input (variable,absolute,null_state)
  357. 0xC0 // End Collection
  358. };
  359. #endif // JOYSTICK_SIZE
  360. #endif // JOYSTICK_INTERFACE
  361. #ifdef MULTITOUCH_INTERFACE
  362. // https://forum.pjrc.com/threads/32331-USB-HID-Touchscreen-support-needed
  363. // https://msdn.microsoft.com/en-us/library/windows/hardware/jj151563%28v=vs.85%29.aspx
  364. // https://msdn.microsoft.com/en-us/library/windows/hardware/jj151565%28v=vs.85%29.aspx
  365. // https://msdn.microsoft.com/en-us/library/windows/hardware/ff553734%28v=vs.85%29.aspx
  366. // https://msdn.microsoft.com/en-us/library/windows/hardware/jj151564%28v=vs.85%29.aspx
  367. // download.microsoft.com/download/a/d/f/adf1347d-08dc-41a4-9084-623b1194d4b2/digitizerdrvs_touch.docx
  368. static uint8_t multitouch_report_desc[] = {
  369. 0x05, 0x0D, // Usage Page (Digitizer)
  370. 0x09, 0x04, // Usage (Touch Screen)
  371. 0xa1, 0x01, // Collection (Application)
  372. 0x09, 0x22, // Usage (Finger)
  373. 0xA1, 0x02, // Collection (Logical)
  374. 0x09, 0x42, // Usage (Tip Switch)
  375. 0x15, 0x00, // Logical Minimum (0)
  376. 0x25, 0x01, // Logical Maximum (1)
  377. 0x75, 0x01, // Report Size (1)
  378. 0x95, 0x01, // Report Count (1)
  379. 0x81, 0x02, // Input (variable,absolute)
  380. 0x09, 0x51, // Usage (Contact Identifier)
  381. 0x25, 0x7F, // Logical Maximum (127)
  382. 0x75, 0x07, // Report Size (7)
  383. 0x95, 0x01, // Report Count (1)
  384. 0x81, 0x02, // Input (variable,absolute)
  385. 0x09, 0x30, // Usage (Pressure)
  386. 0x26, 0xFF, 0x00, // Logical Maximum (255)
  387. 0x75, 0x08, // Report Size (8)
  388. 0x95, 0x01, // Report Count (1)
  389. 0x81, 0x02, // Input (variable,absolute)
  390. 0x05, 0x01, // Usage Page (Generic Desktop)
  391. 0x09, 0x30, // Usage (X)
  392. 0x09, 0x31, // Usage (Y)
  393. 0x26, 0xFF, 0x7F, // Logical Maximum (32767)
  394. 0x65, 0x00, // Unit (None) <-- probably needs real units?
  395. 0x75, 0x10, // Report Size (16)
  396. 0x95, 0x02, // Report Count (2)
  397. 0x81, 0x02, // Input (variable,absolute)
  398. 0xC0, // End Collection
  399. 0x05, 0x0D, // Usage Page (Digitizer)
  400. 0x27, 0xFF, 0xFF, 0, 0, // Logical Maximum (65535)
  401. 0x75, 0x10, // Report Size (16)
  402. 0x95, 0x01, // Report Count (1)
  403. 0x09, 0x56, // Usage (Scan Time)
  404. 0x81, 0x02, // Input (variable,absolute)
  405. 0x09, 0x54, // USAGE (Contact count)
  406. 0x25, 0x7f, // LOGICAL_MAXIMUM (127)
  407. 0x95, 0x01, // REPORT_COUNT (1)
  408. 0x75, 0x08, // REPORT_SIZE (8)
  409. 0x81, 0x02, // INPUT (Data,Var,Abs)
  410. 0x05, 0x0D, // Usage Page (Digitizers)
  411. 0x09, 0x55, // Usage (Contact Count Maximum)
  412. 0x25, MULTITOUCH_FINGERS, // Logical Maximum (10)
  413. 0x75, 0x08, // Report Size (8)
  414. 0x95, 0x01, // Report Count (1)
  415. 0xB1, 0x02, // Feature (variable,absolute)
  416. 0xC0 // End Collection
  417. };
  418. #endif
  419. #ifdef SEREMU_INTERFACE
  420. static uint8_t seremu_report_desc[] = {
  421. 0x06, 0xC9, 0xFF, // Usage Page 0xFFC9 (vendor defined)
  422. 0x09, 0x04, // Usage 0x04
  423. 0xA1, 0x5C, // Collection 0x5C
  424. 0x75, 0x08, // report size = 8 bits (global)
  425. 0x15, 0x00, // logical minimum = 0 (global)
  426. 0x26, 0xFF, 0x00, // logical maximum = 255 (global)
  427. 0x95, SEREMU_TX_SIZE, // report count (global)
  428. 0x09, 0x75, // usage (local)
  429. 0x81, 0x02, // Input
  430. 0x95, SEREMU_RX_SIZE, // report count (global)
  431. 0x09, 0x76, // usage (local)
  432. 0x91, 0x02, // Output
  433. 0x95, 0x04, // report count (global)
  434. 0x09, 0x76, // usage (local)
  435. 0xB1, 0x02, // Feature
  436. 0xC0 // end collection
  437. };
  438. #endif
  439. #ifdef RAWHID_INTERFACE
  440. static uint8_t rawhid_report_desc[] = {
  441. 0x06, LSB(RAWHID_USAGE_PAGE), MSB(RAWHID_USAGE_PAGE),
  442. 0x0A, LSB(RAWHID_USAGE), MSB(RAWHID_USAGE),
  443. 0xA1, 0x01, // Collection 0x01
  444. 0x75, 0x08, // report size = 8 bits
  445. 0x15, 0x00, // logical minimum = 0
  446. 0x26, 0xFF, 0x00, // logical maximum = 255
  447. 0x95, RAWHID_TX_SIZE, // report count
  448. 0x09, 0x01, // usage
  449. 0x81, 0x02, // Input (array)
  450. 0x95, RAWHID_RX_SIZE, // report count
  451. 0x09, 0x02, // usage
  452. 0x91, 0x02, // Output (array)
  453. 0xC0 // end collection
  454. };
  455. #endif
  456. #ifdef FLIGHTSIM_INTERFACE
  457. static uint8_t flightsim_report_desc[] = {
  458. 0x06, 0x1C, 0xFF, // Usage page = 0xFF1C
  459. 0x0A, 0x39, 0xA7, // Usage = 0xA739
  460. 0xA1, 0x01, // Collection 0x01
  461. 0x75, 0x08, // report size = 8 bits
  462. 0x15, 0x00, // logical minimum = 0
  463. 0x26, 0xFF, 0x00, // logical maximum = 255
  464. 0x95, FLIGHTSIM_TX_SIZE, // report count
  465. 0x09, 0x01, // usage
  466. 0x81, 0x02, // Input (array)
  467. 0x95, FLIGHTSIM_RX_SIZE, // report count
  468. 0x09, 0x02, // usage
  469. 0x91, 0x02, // Output (array)
  470. 0xC0 // end collection
  471. };
  472. #endif
  473. // **************************************************************
  474. // USB Descriptor Sizes
  475. // **************************************************************
  476. // pre-compute the size and position of everything in the config descriptor
  477. //
  478. #define CONFIG_HEADER_DESCRIPTOR_SIZE 9
  479. #define CDC_IAD_DESCRIPTOR_POS CONFIG_HEADER_DESCRIPTOR_SIZE
  480. #ifdef CDC_IAD_DESCRIPTOR
  481. #define CDC_IAD_DESCRIPTOR_SIZE 8
  482. #else
  483. #define CDC_IAD_DESCRIPTOR_SIZE 0
  484. #endif
  485. #define CDC_DATA_INTERFACE_DESC_POS CDC_IAD_DESCRIPTOR_POS+CDC_IAD_DESCRIPTOR_SIZE
  486. #ifdef CDC_DATA_INTERFACE
  487. #define CDC_DATA_INTERFACE_DESC_SIZE 9+5+5+4+5+7+9+7+7
  488. #else
  489. #define CDC_DATA_INTERFACE_DESC_SIZE 0
  490. #endif
  491. #define CDC2_DATA_INTERFACE_DESC_POS CDC_DATA_INTERFACE_DESC_POS+CDC_DATA_INTERFACE_DESC_SIZE
  492. #ifdef CDC2_DATA_INTERFACE
  493. #define CDC2_DATA_INTERFACE_DESC_SIZE 8 + 9+5+5+4+5+7+9+7+7
  494. #else
  495. #define CDC2_DATA_INTERFACE_DESC_SIZE 0
  496. #endif
  497. #define CDC3_DATA_INTERFACE_DESC_POS CDC2_DATA_INTERFACE_DESC_POS+CDC2_DATA_INTERFACE_DESC_SIZE
  498. #ifdef CDC3_DATA_INTERFACE
  499. #define CDC3_DATA_INTERFACE_DESC_SIZE 8 + 9+5+5+4+5+7+9+7+7
  500. #else
  501. #define CDC3_DATA_INTERFACE_DESC_SIZE 0
  502. #endif
  503. #define MIDI_INTERFACE_DESC_POS CDC3_DATA_INTERFACE_DESC_POS+CDC3_DATA_INTERFACE_DESC_SIZE
  504. #ifdef MIDI_INTERFACE
  505. #if !defined(MIDI_NUM_CABLES) || MIDI_NUM_CABLES < 1 || MIDI_NUM_CABLES > 16
  506. #error "MIDI_NUM_CABLES must be defined between 1 to 16"
  507. #endif
  508. #define MIDI_INTERFACE_DESC_SIZE 9+7+((6+6+9+9)*MIDI_NUM_CABLES)+(9+4+MIDI_NUM_CABLES)*2
  509. #else
  510. #define MIDI_INTERFACE_DESC_SIZE 0
  511. #endif
  512. #define KEYBOARD_INTERFACE_DESC_POS MIDI_INTERFACE_DESC_POS+MIDI_INTERFACE_DESC_SIZE
  513. #ifdef KEYBOARD_INTERFACE
  514. #define KEYBOARD_INTERFACE_DESC_SIZE 9+9+7
  515. #define KEYBOARD_HID_DESC_OFFSET KEYBOARD_INTERFACE_DESC_POS+9
  516. #else
  517. #define KEYBOARD_INTERFACE_DESC_SIZE 0
  518. #endif
  519. #define MOUSE_INTERFACE_DESC_POS KEYBOARD_INTERFACE_DESC_POS+KEYBOARD_INTERFACE_DESC_SIZE
  520. #ifdef MOUSE_INTERFACE
  521. #define MOUSE_INTERFACE_DESC_SIZE 9+9+7
  522. #define MOUSE_HID_DESC_OFFSET MOUSE_INTERFACE_DESC_POS+9
  523. #else
  524. #define MOUSE_INTERFACE_DESC_SIZE 0
  525. #endif
  526. #define RAWHID_INTERFACE_DESC_POS MOUSE_INTERFACE_DESC_POS+MOUSE_INTERFACE_DESC_SIZE
  527. #ifdef RAWHID_INTERFACE
  528. #define RAWHID_INTERFACE_DESC_SIZE 9+9+7+7
  529. #define RAWHID_HID_DESC_OFFSET RAWHID_INTERFACE_DESC_POS+9
  530. #else
  531. #define RAWHID_INTERFACE_DESC_SIZE 0
  532. #endif
  533. #define FLIGHTSIM_INTERFACE_DESC_POS RAWHID_INTERFACE_DESC_POS+RAWHID_INTERFACE_DESC_SIZE
  534. #ifdef FLIGHTSIM_INTERFACE
  535. #define FLIGHTSIM_INTERFACE_DESC_SIZE 9+9+7+7
  536. #define FLIGHTSIM_HID_DESC_OFFSET FLIGHTSIM_INTERFACE_DESC_POS+9
  537. #else
  538. #define FLIGHTSIM_INTERFACE_DESC_SIZE 0
  539. #endif
  540. #define SEREMU_INTERFACE_DESC_POS FLIGHTSIM_INTERFACE_DESC_POS+FLIGHTSIM_INTERFACE_DESC_SIZE
  541. #ifdef SEREMU_INTERFACE
  542. #define SEREMU_INTERFACE_DESC_SIZE 9+9+7+7
  543. #define SEREMU_HID_DESC_OFFSET SEREMU_INTERFACE_DESC_POS+9
  544. #else
  545. #define SEREMU_INTERFACE_DESC_SIZE 0
  546. #endif
  547. #define JOYSTICK_INTERFACE_DESC_POS SEREMU_INTERFACE_DESC_POS+SEREMU_INTERFACE_DESC_SIZE
  548. #ifdef JOYSTICK_INTERFACE
  549. #define JOYSTICK_INTERFACE_DESC_SIZE 9+9+7
  550. #define JOYSTICK_HID_DESC_OFFSET JOYSTICK_INTERFACE_DESC_POS+9
  551. #else
  552. #define JOYSTICK_INTERFACE_DESC_SIZE 0
  553. #endif
  554. #define MTP_INTERFACE_DESC_POS JOYSTICK_INTERFACE_DESC_POS+JOYSTICK_INTERFACE_DESC_SIZE
  555. #ifdef MTP_INTERFACE
  556. #define MTP_INTERFACE_DESC_SIZE 9+7+7+7
  557. #else
  558. #define MTP_INTERFACE_DESC_SIZE 0
  559. #endif
  560. #define KEYMEDIA_INTERFACE_DESC_POS MTP_INTERFACE_DESC_POS+MTP_INTERFACE_DESC_SIZE
  561. #ifdef KEYMEDIA_INTERFACE
  562. #define KEYMEDIA_INTERFACE_DESC_SIZE 9+9+7
  563. #define KEYMEDIA_HID_DESC_OFFSET KEYMEDIA_INTERFACE_DESC_POS+9
  564. #else
  565. #define KEYMEDIA_INTERFACE_DESC_SIZE 0
  566. #endif
  567. #define AUDIO_INTERFACE_DESC_POS KEYMEDIA_INTERFACE_DESC_POS+KEYMEDIA_INTERFACE_DESC_SIZE
  568. #ifdef AUDIO_INTERFACE
  569. #define AUDIO_INTERFACE_DESC_SIZE 8 + 9+10+12+9+12+10+9 + 9+9+7+11+9+7 + 9+9+7+11+9+7+9
  570. #else
  571. #define AUDIO_INTERFACE_DESC_SIZE 0
  572. #endif
  573. #define MULTITOUCH_INTERFACE_DESC_POS AUDIO_INTERFACE_DESC_POS+AUDIO_INTERFACE_DESC_SIZE
  574. #ifdef MULTITOUCH_INTERFACE
  575. #define MULTITOUCH_INTERFACE_DESC_SIZE 9+9+7
  576. #define MULTITOUCH_HID_DESC_OFFSET MULTITOUCH_INTERFACE_DESC_POS+9
  577. #else
  578. #define MULTITOUCH_INTERFACE_DESC_SIZE 0
  579. #endif
  580. #define EXPERIMENTAL_INTERFACE_DESC_POS MULTITOUCH_INTERFACE_DESC_POS+MULTITOUCH_INTERFACE_DESC_SIZE
  581. #ifdef EXPERIMENTAL_INTERFACE
  582. #define EXPERIMENTAL_INTERFACE_DESC_SIZE 9+7+7
  583. #define EXPERIMENTAL_HID_DESC_OFFSET MULTITOUCH_INTERFACE_DESC_POS+9
  584. #else
  585. #define EXPERIMENTAL_INTERFACE_DESC_SIZE 0
  586. #endif
  587. #define CONFIG_DESC_SIZE EXPERIMENTAL_INTERFACE_DESC_POS+EXPERIMENTAL_INTERFACE_DESC_SIZE
  588. // **************************************************************
  589. // USB Configuration
  590. // **************************************************************
  591. // USB Configuration Descriptor. This huge descriptor tells all
  592. // of the devices capbilities.
  593. PROGMEM const uint8_t usb_config_descriptor_480[CONFIG_DESC_SIZE] = {
  594. // configuration descriptor, USB spec 9.6.3, page 264-266, Table 9-10
  595. 9, // bLength;
  596. 2, // bDescriptorType;
  597. LSB(CONFIG_DESC_SIZE), // wTotalLength
  598. MSB(CONFIG_DESC_SIZE),
  599. NUM_INTERFACE, // bNumInterfaces
  600. 1, // bConfigurationValue
  601. 0, // iConfiguration
  602. 0xC0, // bmAttributes
  603. 50, // bMaxPower
  604. #ifdef CDC_IAD_DESCRIPTOR
  605. // interface association descriptor, USB ECN, Table 9-Z
  606. 8, // bLength
  607. 11, // bDescriptorType
  608. CDC_STATUS_INTERFACE, // bFirstInterface
  609. 2, // bInterfaceCount
  610. 0x02, // bFunctionClass
  611. 0x02, // bFunctionSubClass
  612. 0x01, // bFunctionProtocol
  613. 0, // iFunction
  614. #endif
  615. #ifdef CDC_DATA_INTERFACE
  616. // configuration for 480 Mbit/sec speed
  617. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  618. 9, // bLength
  619. 4, // bDescriptorType
  620. CDC_STATUS_INTERFACE, // bInterfaceNumber
  621. 0, // bAlternateSetting
  622. 1, // bNumEndpoints
  623. 0x02, // bInterfaceClass
  624. 0x02, // bInterfaceSubClass
  625. 0x01, // bInterfaceProtocol
  626. 0, // iInterface
  627. // CDC Header Functional Descriptor, CDC Spec 5.2.3.1, Table 26
  628. 5, // bFunctionLength
  629. 0x24, // bDescriptorType
  630. 0x00, // bDescriptorSubtype
  631. 0x10, 0x01, // bcdCDC
  632. // Call Management Functional Descriptor, CDC Spec 5.2.3.2, Table 27
  633. 5, // bFunctionLength
  634. 0x24, // bDescriptorType
  635. 0x01, // bDescriptorSubtype
  636. 0x01, // bmCapabilities
  637. 1, // bDataInterface
  638. // Abstract Control Management Functional Descriptor, CDC Spec 5.2.3.3, Table 28
  639. 4, // bFunctionLength
  640. 0x24, // bDescriptorType
  641. 0x02, // bDescriptorSubtype
  642. 0x06, // bmCapabilities
  643. // Union Functional Descriptor, CDC Spec 5.2.3.8, Table 33
  644. 5, // bFunctionLength
  645. 0x24, // bDescriptorType
  646. 0x06, // bDescriptorSubtype
  647. CDC_STATUS_INTERFACE, // bMasterInterface
  648. CDC_DATA_INTERFACE, // bSlaveInterface0
  649. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  650. 7, // bLength
  651. 5, // bDescriptorType
  652. CDC_ACM_ENDPOINT | 0x80, // bEndpointAddress
  653. 0x03, // bmAttributes (0x03=intr)
  654. LSB(CDC_ACM_SIZE),MSB(CDC_ACM_SIZE), // wMaxPacketSize
  655. 5, // bInterval
  656. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  657. 9, // bLength
  658. 4, // bDescriptorType
  659. CDC_DATA_INTERFACE, // bInterfaceNumber
  660. 0, // bAlternateSetting
  661. 2, // bNumEndpoints
  662. 0x0A, // bInterfaceClass
  663. 0x00, // bInterfaceSubClass
  664. 0x00, // bInterfaceProtocol
  665. 0, // iInterface
  666. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  667. 7, // bLength
  668. 5, // bDescriptorType
  669. CDC_RX_ENDPOINT, // bEndpointAddress
  670. 0x02, // bmAttributes (0x02=bulk)
  671. LSB(CDC_RX_SIZE_480),MSB(CDC_RX_SIZE_480),// wMaxPacketSize
  672. 0, // bInterval
  673. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  674. 7, // bLength
  675. 5, // bDescriptorType
  676. CDC_TX_ENDPOINT | 0x80, // bEndpointAddress
  677. 0x02, // bmAttributes (0x02=bulk)
  678. LSB(CDC_TX_SIZE_480),MSB(CDC_TX_SIZE_480),// wMaxPacketSize
  679. 0, // bInterval
  680. #endif // CDC_DATA_INTERFACE
  681. #ifdef CDC2_DATA_INTERFACE
  682. // configuration for 480 Mbit/sec speed
  683. // interface association descriptor, USB ECN, Table 9-Z
  684. 8, // bLength
  685. 11, // bDescriptorType
  686. CDC2_STATUS_INTERFACE, // bFirstInterface
  687. 2, // bInterfaceCount
  688. 0x02, // bFunctionClass
  689. 0x02, // bFunctionSubClass
  690. 0x01, // bFunctionProtocol
  691. 0, // iFunction
  692. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  693. 9, // bLength
  694. 4, // bDescriptorType
  695. CDC2_STATUS_INTERFACE, // bInterfaceNumber
  696. 0, // bAlternateSetting
  697. 1, // bNumEndpoints
  698. 0x02, // bInterfaceClass
  699. 0x02, // bInterfaceSubClass
  700. 0x01, // bInterfaceProtocol
  701. 0, // iInterface
  702. // CDC Header Functional Descriptor, CDC Spec 5.2.3.1, Table 26
  703. 5, // bFunctionLength
  704. 0x24, // bDescriptorType
  705. 0x00, // bDescriptorSubtype
  706. 0x10, 0x01, // bcdCDC
  707. // Call Management Functional Descriptor, CDC Spec 5.2.3.2, Table 27
  708. 5, // bFunctionLength
  709. 0x24, // bDescriptorType
  710. 0x01, // bDescriptorSubtype
  711. 0x01, // bmCapabilities
  712. 1, // bDataInterface
  713. // Abstract Control Management Functional Descriptor, CDC Spec 5.2.3.3, Table 28
  714. 4, // bFunctionLength
  715. 0x24, // bDescriptorType
  716. 0x02, // bDescriptorSubtype
  717. 0x06, // bmCapabilities
  718. // Union Functional Descriptor, CDC Spec 5.2.3.8, Table 33
  719. 5, // bFunctionLength
  720. 0x24, // bDescriptorType
  721. 0x06, // bDescriptorSubtype
  722. CDC2_STATUS_INTERFACE, // bMasterInterface
  723. CDC2_DATA_INTERFACE, // bSlaveInterface0
  724. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  725. 7, // bLength
  726. 5, // bDescriptorType
  727. CDC2_ACM_ENDPOINT | 0x80, // bEndpointAddress
  728. 0x03, // bmAttributes (0x03=intr)
  729. CDC_ACM_SIZE, 0, // wMaxPacketSize
  730. 5, // bInterval
  731. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  732. 9, // bLength
  733. 4, // bDescriptorType
  734. CDC2_DATA_INTERFACE, // bInterfaceNumber
  735. 0, // bAlternateSetting
  736. 2, // bNumEndpoints
  737. 0x0A, // bInterfaceClass
  738. 0x00, // bInterfaceSubClass
  739. 0x00, // bInterfaceProtocol
  740. 0, // iInterface
  741. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  742. 7, // bLength
  743. 5, // bDescriptorType
  744. CDC2_RX_ENDPOINT, // bEndpointAddress
  745. 0x02, // bmAttributes (0x02=bulk)
  746. LSB(CDC_RX_SIZE_480),MSB(CDC_RX_SIZE_480),// wMaxPacketSize
  747. 0, // bInterval
  748. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  749. 7, // bLength
  750. 5, // bDescriptorType
  751. CDC2_TX_ENDPOINT | 0x80, // bEndpointAddress
  752. 0x02, // bmAttributes (0x02=bulk)
  753. LSB(CDC_TX_SIZE_480),MSB(CDC_TX_SIZE_480),// wMaxPacketSize
  754. 0, // bInterval
  755. #endif // CDC2_DATA_INTERFACE
  756. #ifdef CDC3_DATA_INTERFACE
  757. // configuration for 480 Mbit/sec speed
  758. // interface association descriptor, USB ECN, Table 9-Z
  759. 8, // bLength
  760. 11, // bDescriptorType
  761. CDC3_STATUS_INTERFACE, // bFirstInterface
  762. 2, // bInterfaceCount
  763. 0x02, // bFunctionClass
  764. 0x02, // bFunctionSubClass
  765. 0x01, // bFunctionProtocol
  766. 0, // iFunction
  767. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  768. 9, // bLength
  769. 4, // bDescriptorType
  770. CDC3_STATUS_INTERFACE, // bInterfaceNumber
  771. 0, // bAlternateSetting
  772. 1, // bNumEndpoints
  773. 0x02, // bInterfaceClass
  774. 0x02, // bInterfaceSubClass
  775. 0x01, // bInterfaceProtocol
  776. 0, // iInterface
  777. // CDC Header Functional Descriptor, CDC Spec 5.2.3.1, Table 26
  778. 5, // bFunctionLength
  779. 0x24, // bDescriptorType
  780. 0x00, // bDescriptorSubtype
  781. 0x10, 0x01, // bcdCDC
  782. // Call Management Functional Descriptor, CDC Spec 5.2.3.2, Table 27
  783. 5, // bFunctionLength
  784. 0x24, // bDescriptorType
  785. 0x01, // bDescriptorSubtype
  786. 0x01, // bmCapabilities
  787. 1, // bDataInterface
  788. // Abstract Control Management Functional Descriptor, CDC Spec 5.2.3.3, Table 28
  789. 4, // bFunctionLength
  790. 0x24, // bDescriptorType
  791. 0x02, // bDescriptorSubtype
  792. 0x06, // bmCapabilities
  793. // Union Functional Descriptor, CDC Spec 5.2.3.8, Table 33
  794. 5, // bFunctionLength
  795. 0x24, // bDescriptorType
  796. 0x06, // bDescriptorSubtype
  797. CDC3_STATUS_INTERFACE, // bMasterInterface
  798. CDC3_DATA_INTERFACE, // bSlaveInterface0
  799. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  800. 7, // bLength
  801. 5, // bDescriptorType
  802. CDC3_ACM_ENDPOINT | 0x80, // bEndpointAddress
  803. 0x03, // bmAttributes (0x03=intr)
  804. CDC_ACM_SIZE, 0, // wMaxPacketSize
  805. 5, // bInterval
  806. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  807. 9, // bLength
  808. 4, // bDescriptorType
  809. CDC3_DATA_INTERFACE, // bInterfaceNumber
  810. 0, // bAlternateSetting
  811. 2, // bNumEndpoints
  812. 0x0A, // bInterfaceClass
  813. 0x00, // bInterfaceSubClass
  814. 0x00, // bInterfaceProtocol
  815. 0, // iInterface
  816. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  817. 7, // bLength
  818. 5, // bDescriptorType
  819. CDC3_RX_ENDPOINT, // bEndpointAddress
  820. 0x02, // bmAttributes (0x02=bulk)
  821. LSB(CDC_RX_SIZE_480),MSB(CDC_RX_SIZE_480),// wMaxPacketSize
  822. 0, // bInterval
  823. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  824. 7, // bLength
  825. 5, // bDescriptorType
  826. CDC3_TX_ENDPOINT | 0x80, // bEndpointAddress
  827. 0x02, // bmAttributes (0x02=bulk)
  828. LSB(CDC_TX_SIZE_480),MSB(CDC_TX_SIZE_480),// wMaxPacketSize
  829. 0, // bInterval
  830. #endif // CDC3_DATA_INTERFACE
  831. #ifdef MIDI_INTERFACE
  832. // configuration for 480 Mbit/sec speed
  833. // Standard MS Interface Descriptor,
  834. 9, // bLength
  835. 4, // bDescriptorType
  836. MIDI_INTERFACE, // bInterfaceNumber
  837. 0, // bAlternateSetting
  838. 2, // bNumEndpoints
  839. 0x01, // bInterfaceClass (0x01 = Audio)
  840. 0x03, // bInterfaceSubClass (0x03 = MIDI)
  841. 0x00, // bInterfaceProtocol (unused for MIDI)
  842. 0, // iInterface
  843. // MIDI MS Interface Header, USB MIDI 6.1.2.1, page 21, Table 6-2
  844. 7, // bLength
  845. 0x24, // bDescriptorType = CS_INTERFACE
  846. 0x01, // bDescriptorSubtype = MS_HEADER
  847. 0x00, 0x01, // bcdMSC = revision 01.00
  848. LSB(7+(6+6+9+9)*MIDI_NUM_CABLES), // wTotalLength
  849. MSB(7+(6+6+9+9)*MIDI_NUM_CABLES),
  850. // MIDI IN Jack Descriptor, B.4.3, Table B-7 (embedded), page 40
  851. 6, // bLength
  852. 0x24, // bDescriptorType = CS_INTERFACE
  853. 0x02, // bDescriptorSubtype = MIDI_IN_JACK
  854. 0x01, // bJackType = EMBEDDED
  855. 1, // bJackID, ID = 1
  856. 0, // iJack
  857. // MIDI IN Jack Descriptor, B.4.3, Table B-8 (external), page 40
  858. 6, // bLength
  859. 0x24, // bDescriptorType = CS_INTERFACE
  860. 0x02, // bDescriptorSubtype = MIDI_IN_JACK
  861. 0x02, // bJackType = EXTERNAL
  862. 2, // bJackID, ID = 2
  863. 0, // iJack
  864. // MIDI OUT Jack Descriptor, B.4.4, Table B-9, page 41
  865. 9,
  866. 0x24, // bDescriptorType = CS_INTERFACE
  867. 0x03, // bDescriptorSubtype = MIDI_OUT_JACK
  868. 0x01, // bJackType = EMBEDDED
  869. 3, // bJackID, ID = 3
  870. 1, // bNrInputPins = 1 pin
  871. 2, // BaSourceID(1) = 2
  872. 1, // BaSourcePin(1) = first pin
  873. 0, // iJack
  874. // MIDI OUT Jack Descriptor, B.4.4, Table B-10, page 41
  875. 9,
  876. 0x24, // bDescriptorType = CS_INTERFACE
  877. 0x03, // bDescriptorSubtype = MIDI_OUT_JACK
  878. 0x02, // bJackType = EXTERNAL
  879. 4, // bJackID, ID = 4
  880. 1, // bNrInputPins = 1 pin
  881. 1, // BaSourceID(1) = 1
  882. 1, // BaSourcePin(1) = first pin
  883. 0, // iJack
  884. #if MIDI_NUM_CABLES >= 2
  885. #define MIDI_INTERFACE_JACK_PAIR(a, b, c, d) \
  886. 6, 0x24, 0x02, 0x01, (a), 0, \
  887. 6, 0x24, 0x02, 0x02, (b), 0, \
  888. 9, 0x24, 0x03, 0x01, (c), 1, (b), 1, 0, \
  889. 9, 0x24, 0x03, 0x02, (d), 1, (a), 1, 0,
  890. MIDI_INTERFACE_JACK_PAIR(5, 6, 7, 8)
  891. #endif
  892. #if MIDI_NUM_CABLES >= 3
  893. MIDI_INTERFACE_JACK_PAIR(9, 10, 11, 12)
  894. #endif
  895. #if MIDI_NUM_CABLES >= 4
  896. MIDI_INTERFACE_JACK_PAIR(13, 14, 15, 16)
  897. #endif
  898. #if MIDI_NUM_CABLES >= 5
  899. MIDI_INTERFACE_JACK_PAIR(17, 18, 19, 20)
  900. #endif
  901. #if MIDI_NUM_CABLES >= 6
  902. MIDI_INTERFACE_JACK_PAIR(21, 22, 23, 24)
  903. #endif
  904. #if MIDI_NUM_CABLES >= 7
  905. MIDI_INTERFACE_JACK_PAIR(25, 26, 27, 28)
  906. #endif
  907. #if MIDI_NUM_CABLES >= 8
  908. MIDI_INTERFACE_JACK_PAIR(29, 30, 31, 32)
  909. #endif
  910. #if MIDI_NUM_CABLES >= 9
  911. MIDI_INTERFACE_JACK_PAIR(33, 34, 35, 36)
  912. #endif
  913. #if MIDI_NUM_CABLES >= 10
  914. MIDI_INTERFACE_JACK_PAIR(37, 38, 39, 40)
  915. #endif
  916. #if MIDI_NUM_CABLES >= 11
  917. MIDI_INTERFACE_JACK_PAIR(41, 42, 43, 44)
  918. #endif
  919. #if MIDI_NUM_CABLES >= 12
  920. MIDI_INTERFACE_JACK_PAIR(45, 46, 47, 48)
  921. #endif
  922. #if MIDI_NUM_CABLES >= 13
  923. MIDI_INTERFACE_JACK_PAIR(49, 50, 51, 52)
  924. #endif
  925. #if MIDI_NUM_CABLES >= 14
  926. MIDI_INTERFACE_JACK_PAIR(53, 54, 55, 56)
  927. #endif
  928. #if MIDI_NUM_CABLES >= 15
  929. MIDI_INTERFACE_JACK_PAIR(57, 58, 59, 60)
  930. #endif
  931. #if MIDI_NUM_CABLES >= 16
  932. MIDI_INTERFACE_JACK_PAIR(61, 62, 63, 64)
  933. #endif
  934. // Standard Bulk OUT Endpoint Descriptor, B.5.1, Table B-11, pae 42
  935. 9, // bLength
  936. 5, // bDescriptorType = ENDPOINT
  937. MIDI_RX_ENDPOINT, // bEndpointAddress
  938. 0x02, // bmAttributes (0x02=bulk)
  939. LSB(MIDI_RX_SIZE_480),MSB(MIDI_RX_SIZE_480),// wMaxPacketSize
  940. 0, // bInterval
  941. 0, // bRefresh
  942. 0, // bSynchAddress
  943. // Class-specific MS Bulk OUT Endpoint Descriptor, B.5.2, Table B-12, page 42
  944. 4+MIDI_NUM_CABLES, // bLength
  945. 0x25, // bDescriptorSubtype = CS_ENDPOINT
  946. 0x01, // bJackType = MS_GENERAL
  947. MIDI_NUM_CABLES, // bNumEmbMIDIJack = number of jacks
  948. 1, // BaAssocJackID(1) = jack ID #1
  949. #if MIDI_NUM_CABLES >= 2
  950. 5,
  951. #endif
  952. #if MIDI_NUM_CABLES >= 3
  953. 9,
  954. #endif
  955. #if MIDI_NUM_CABLES >= 4
  956. 13,
  957. #endif
  958. #if MIDI_NUM_CABLES >= 5
  959. 17,
  960. #endif
  961. #if MIDI_NUM_CABLES >= 6
  962. 21,
  963. #endif
  964. #if MIDI_NUM_CABLES >= 7
  965. 25,
  966. #endif
  967. #if MIDI_NUM_CABLES >= 8
  968. 29,
  969. #endif
  970. #if MIDI_NUM_CABLES >= 9
  971. 33,
  972. #endif
  973. #if MIDI_NUM_CABLES >= 10
  974. 37,
  975. #endif
  976. #if MIDI_NUM_CABLES >= 11
  977. 41,
  978. #endif
  979. #if MIDI_NUM_CABLES >= 12
  980. 45,
  981. #endif
  982. #if MIDI_NUM_CABLES >= 13
  983. 49,
  984. #endif
  985. #if MIDI_NUM_CABLES >= 14
  986. 53,
  987. #endif
  988. #if MIDI_NUM_CABLES >= 15
  989. 57,
  990. #endif
  991. #if MIDI_NUM_CABLES >= 16
  992. 61,
  993. #endif
  994. // Standard Bulk IN Endpoint Descriptor, B.5.1, Table B-11, pae 42
  995. 9, // bLength
  996. 5, // bDescriptorType = ENDPOINT
  997. MIDI_TX_ENDPOINT | 0x80, // bEndpointAddress
  998. 0x02, // bmAttributes (0x02=bulk)
  999. LSB(MIDI_TX_SIZE_480),MSB(MIDI_TX_SIZE_480),// wMaxPacketSize
  1000. 0, // bInterval
  1001. 0, // bRefresh
  1002. 0, // bSynchAddress
  1003. // Class-specific MS Bulk IN Endpoint Descriptor, B.5.2, Table B-12, page 42
  1004. 4+MIDI_NUM_CABLES, // bLength
  1005. 0x25, // bDescriptorSubtype = CS_ENDPOINT
  1006. 0x01, // bJackType = MS_GENERAL
  1007. MIDI_NUM_CABLES, // bNumEmbMIDIJack = number of jacks
  1008. 3, // BaAssocJackID(1) = jack ID #3
  1009. #if MIDI_NUM_CABLES >= 2
  1010. 7,
  1011. #endif
  1012. #if MIDI_NUM_CABLES >= 3
  1013. 11,
  1014. #endif
  1015. #if MIDI_NUM_CABLES >= 4
  1016. 15,
  1017. #endif
  1018. #if MIDI_NUM_CABLES >= 5
  1019. 19,
  1020. #endif
  1021. #if MIDI_NUM_CABLES >= 6
  1022. 23,
  1023. #endif
  1024. #if MIDI_NUM_CABLES >= 7
  1025. 27,
  1026. #endif
  1027. #if MIDI_NUM_CABLES >= 8
  1028. 31,
  1029. #endif
  1030. #if MIDI_NUM_CABLES >= 9
  1031. 35,
  1032. #endif
  1033. #if MIDI_NUM_CABLES >= 10
  1034. 39,
  1035. #endif
  1036. #if MIDI_NUM_CABLES >= 11
  1037. 43,
  1038. #endif
  1039. #if MIDI_NUM_CABLES >= 12
  1040. 47,
  1041. #endif
  1042. #if MIDI_NUM_CABLES >= 13
  1043. 51,
  1044. #endif
  1045. #if MIDI_NUM_CABLES >= 14
  1046. 55,
  1047. #endif
  1048. #if MIDI_NUM_CABLES >= 15
  1049. 59,
  1050. #endif
  1051. #if MIDI_NUM_CABLES >= 16
  1052. 63,
  1053. #endif
  1054. #endif // MIDI_INTERFACE
  1055. #ifdef KEYBOARD_INTERFACE
  1056. // configuration for 480 Mbit/sec speed
  1057. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  1058. 9, // bLength
  1059. 4, // bDescriptorType
  1060. KEYBOARD_INTERFACE, // bInterfaceNumber
  1061. 0, // bAlternateSetting
  1062. 1, // bNumEndpoints
  1063. 0x03, // bInterfaceClass (0x03 = HID)
  1064. 0x01, // bInterfaceSubClass (0x01 = Boot)
  1065. 0x01, // bInterfaceProtocol (0x01 = Keyboard)
  1066. 0, // iInterface
  1067. // HID interface descriptor, HID 1.11 spec, section 6.2.1
  1068. 9, // bLength
  1069. 0x21, // bDescriptorType
  1070. 0x11, 0x01, // bcdHID
  1071. 0, // bCountryCode
  1072. 1, // bNumDescriptors
  1073. 0x22, // bDescriptorType
  1074. LSB(sizeof(keyboard_report_desc)), // wDescriptorLength
  1075. MSB(sizeof(keyboard_report_desc)),
  1076. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1077. 7, // bLength
  1078. 5, // bDescriptorType
  1079. KEYBOARD_ENDPOINT | 0x80, // bEndpointAddress
  1080. 0x03, // bmAttributes (0x03=intr)
  1081. KEYBOARD_SIZE, 0, // wMaxPacketSize
  1082. KEYBOARD_INTERVAL, // bInterval
  1083. #endif // KEYBOARD_INTERFACE
  1084. #ifdef MOUSE_INTERFACE
  1085. // configuration for 480 Mbit/sec speed
  1086. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  1087. 9, // bLength
  1088. 4, // bDescriptorType
  1089. MOUSE_INTERFACE, // bInterfaceNumber
  1090. 0, // bAlternateSetting
  1091. 1, // bNumEndpoints
  1092. 0x03, // bInterfaceClass (0x03 = HID)
  1093. 0x00, // bInterfaceSubClass (0x01 = Boot)
  1094. 0x00, // bInterfaceProtocol (0x02 = Mouse)
  1095. 0, // iInterface
  1096. // HID interface descriptor, HID 1.11 spec, section 6.2.1
  1097. 9, // bLength
  1098. 0x21, // bDescriptorType
  1099. 0x11, 0x01, // bcdHID
  1100. 0, // bCountryCode
  1101. 1, // bNumDescriptors
  1102. 0x22, // bDescriptorType
  1103. LSB(sizeof(mouse_report_desc)), // wDescriptorLength
  1104. MSB(sizeof(mouse_report_desc)),
  1105. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1106. 7, // bLength
  1107. 5, // bDescriptorType
  1108. MOUSE_ENDPOINT | 0x80, // bEndpointAddress
  1109. 0x03, // bmAttributes (0x03=intr)
  1110. MOUSE_SIZE, 0, // wMaxPacketSize
  1111. MOUSE_INTERVAL, // bInterval
  1112. #endif // MOUSE_INTERFACE
  1113. #ifdef RAWHID_INTERFACE
  1114. // configuration for 480 Mbit/sec speed
  1115. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  1116. 9, // bLength
  1117. 4, // bDescriptorType
  1118. RAWHID_INTERFACE, // bInterfaceNumber
  1119. 0, // bAlternateSetting
  1120. 2, // bNumEndpoints
  1121. 0x03, // bInterfaceClass (0x03 = HID)
  1122. 0x00, // bInterfaceSubClass
  1123. 0x00, // bInterfaceProtocol
  1124. 0, // iInterface
  1125. // HID interface descriptor, HID 1.11 spec, section 6.2.1
  1126. 9, // bLength
  1127. 0x21, // bDescriptorType
  1128. 0x11, 0x01, // bcdHID
  1129. 0, // bCountryCode
  1130. 1, // bNumDescriptors
  1131. 0x22, // bDescriptorType
  1132. LSB(sizeof(rawhid_report_desc)), // wDescriptorLength
  1133. MSB(sizeof(rawhid_report_desc)),
  1134. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1135. 7, // bLength
  1136. 5, // bDescriptorType
  1137. RAWHID_TX_ENDPOINT | 0x80, // bEndpointAddress
  1138. 0x03, // bmAttributes (0x03=intr)
  1139. RAWHID_TX_SIZE, 0, // wMaxPacketSize
  1140. RAWHID_TX_INTERVAL, // bInterval
  1141. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1142. 7, // bLength
  1143. 5, // bDescriptorType
  1144. RAWHID_RX_ENDPOINT, // bEndpointAddress
  1145. 0x03, // bmAttributes (0x03=intr)
  1146. RAWHID_RX_SIZE, 0, // wMaxPacketSize
  1147. RAWHID_RX_INTERVAL, // bInterval
  1148. #endif // RAWHID_INTERFACE
  1149. #ifdef FLIGHTSIM_INTERFACE
  1150. // configuration for 480 Mbit/sec speed
  1151. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  1152. 9, // bLength
  1153. 4, // bDescriptorType
  1154. FLIGHTSIM_INTERFACE, // bInterfaceNumber
  1155. 0, // bAlternateSetting
  1156. 2, // bNumEndpoints
  1157. 0x03, // bInterfaceClass (0x03 = HID)
  1158. 0x00, // bInterfaceSubClass
  1159. 0x00, // bInterfaceProtocol
  1160. 0, // iInterface
  1161. // HID interface descriptor, HID 1.11 spec, section 6.2.1
  1162. 9, // bLength
  1163. 0x21, // bDescriptorType
  1164. 0x11, 0x01, // bcdHID
  1165. 0, // bCountryCode
  1166. 1, // bNumDescriptors
  1167. 0x22, // bDescriptorType
  1168. LSB(sizeof(flightsim_report_desc)), // wDescriptorLength
  1169. MSB(sizeof(flightsim_report_desc)),
  1170. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1171. 7, // bLength
  1172. 5, // bDescriptorType
  1173. FLIGHTSIM_TX_ENDPOINT | 0x80, // bEndpointAddress
  1174. 0x03, // bmAttributes (0x03=intr)
  1175. FLIGHTSIM_TX_SIZE, 0, // wMaxPacketSize
  1176. FLIGHTSIM_TX_INTERVAL, // bInterval
  1177. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1178. 7, // bLength
  1179. 5, // bDescriptorType
  1180. FLIGHTSIM_RX_ENDPOINT, // bEndpointAddress
  1181. 0x03, // bmAttributes (0x03=intr)
  1182. FLIGHTSIM_RX_SIZE, 0, // wMaxPacketSize
  1183. FLIGHTSIM_RX_INTERVAL, // bInterval
  1184. #endif // FLIGHTSIM_INTERFACE
  1185. #ifdef SEREMU_INTERFACE
  1186. // configuration for 480 Mbit/sec speed
  1187. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  1188. 9, // bLength
  1189. 4, // bDescriptorType
  1190. SEREMU_INTERFACE, // bInterfaceNumber
  1191. 0, // bAlternateSetting
  1192. 2, // bNumEndpoints
  1193. 0x03, // bInterfaceClass (0x03 = HID)
  1194. 0x00, // bInterfaceSubClass
  1195. 0x00, // bInterfaceProtocol
  1196. 0, // iInterface
  1197. // HID interface descriptor, HID 1.11 spec, section 6.2.1
  1198. 9, // bLength
  1199. 0x21, // bDescriptorType
  1200. 0x11, 0x01, // bcdHID
  1201. 0, // bCountryCode
  1202. 1, // bNumDescriptors
  1203. 0x22, // bDescriptorType
  1204. LSB(sizeof(seremu_report_desc)), // wDescriptorLength
  1205. MSB(sizeof(seremu_report_desc)),
  1206. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1207. 7, // bLength
  1208. 5, // bDescriptorType
  1209. SEREMU_TX_ENDPOINT | 0x80, // bEndpointAddress
  1210. 0x03, // bmAttributes (0x03=intr)
  1211. SEREMU_TX_SIZE, 0, // wMaxPacketSize
  1212. SEREMU_TX_INTERVAL, // bInterval
  1213. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1214. 7, // bLength
  1215. 5, // bDescriptorType
  1216. SEREMU_RX_ENDPOINT, // bEndpointAddress
  1217. 0x03, // bmAttributes (0x03=intr)
  1218. SEREMU_RX_SIZE, 0, // wMaxPacketSize
  1219. SEREMU_RX_INTERVAL, // bInterval
  1220. #endif // SEREMU_INTERFACE
  1221. #ifdef JOYSTICK_INTERFACE
  1222. // configuration for 480 Mbit/sec speed
  1223. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  1224. 9, // bLength
  1225. 4, // bDescriptorType
  1226. JOYSTICK_INTERFACE, // bInterfaceNumber
  1227. 0, // bAlternateSetting
  1228. 1, // bNumEndpoints
  1229. 0x03, // bInterfaceClass (0x03 = HID)
  1230. 0x00, // bInterfaceSubClass
  1231. 0x00, // bInterfaceProtocol
  1232. 0, // iInterface
  1233. // HID interface descriptor, HID 1.11 spec, section 6.2.1
  1234. 9, // bLength
  1235. 0x21, // bDescriptorType
  1236. 0x11, 0x01, // bcdHID
  1237. 0, // bCountryCode
  1238. 1, // bNumDescriptors
  1239. 0x22, // bDescriptorType
  1240. LSB(sizeof(joystick_report_desc)), // wDescriptorLength
  1241. MSB(sizeof(joystick_report_desc)),
  1242. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1243. 7, // bLength
  1244. 5, // bDescriptorType
  1245. JOYSTICK_ENDPOINT | 0x80, // bEndpointAddress
  1246. 0x03, // bmAttributes (0x03=intr)
  1247. JOYSTICK_SIZE, 0, // wMaxPacketSize
  1248. JOYSTICK_INTERVAL, // bInterval
  1249. #endif // JOYSTICK_INTERFACE
  1250. #ifdef MTP_INTERFACE
  1251. // configuration for 480 Mbit/sec speed
  1252. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  1253. 9, // bLength
  1254. 4, // bDescriptorType
  1255. MTP_INTERFACE, // bInterfaceNumber
  1256. 0, // bAlternateSetting
  1257. 3, // bNumEndpoints
  1258. 0x06, // bInterfaceClass (0x06 = still image)
  1259. 0x01, // bInterfaceSubClass
  1260. 0x01, // bInterfaceProtocol
  1261. 0, // iInterface
  1262. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1263. 7, // bLength
  1264. 5, // bDescriptorType
  1265. MTP_TX_ENDPOINT | 0x80, // bEndpointAddress
  1266. 0x02, // bmAttributes (0x02=bulk)
  1267. LSB(MTP_TX_SIZE_480),MSB(MTP_TX_SIZE_480), // wMaxPacketSize
  1268. 0, // bInterval
  1269. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1270. 7, // bLength
  1271. 5, // bDescriptorType
  1272. MTP_RX_ENDPOINT, // bEndpointAddress
  1273. 0x02, // bmAttributes (0x02=bulk)
  1274. LSB(MTP_RX_SIZE_480),MSB(MTP_RX_SIZE_480), // wMaxPacketSize
  1275. 0, // bInterval
  1276. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1277. 7, // bLength
  1278. 5, // bDescriptorType
  1279. MTP_EVENT_ENDPOINT | 0x80, // bEndpointAddress
  1280. 0x03, // bmAttributes (0x03=intr)
  1281. MTP_EVENT_SIZE, 0, // wMaxPacketSize
  1282. MTP_EVENT_INTERVAL_480, // bInterval
  1283. #endif // MTP_INTERFACE
  1284. #ifdef KEYMEDIA_INTERFACE
  1285. // configuration for 480 Mbit/sec speed
  1286. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  1287. 9, // bLength
  1288. 4, // bDescriptorType
  1289. KEYMEDIA_INTERFACE, // bInterfaceNumber
  1290. 0, // bAlternateSetting
  1291. 1, // bNumEndpoints
  1292. 0x03, // bInterfaceClass (0x03 = HID)
  1293. 0x00, // bInterfaceSubClass
  1294. 0x00, // bInterfaceProtocol
  1295. 0, // iInterface
  1296. // HID interface descriptor, HID 1.11 spec, section 6.2.1
  1297. 9, // bLength
  1298. 0x21, // bDescriptorType
  1299. 0x11, 0x01, // bcdHID
  1300. 0, // bCountryCode
  1301. 1, // bNumDescriptors
  1302. 0x22, // bDescriptorType
  1303. LSB(sizeof(keymedia_report_desc)), // wDescriptorLength
  1304. MSB(sizeof(keymedia_report_desc)),
  1305. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1306. 7, // bLength
  1307. 5, // bDescriptorType
  1308. KEYMEDIA_ENDPOINT | 0x80, // bEndpointAddress
  1309. 0x03, // bmAttributes (0x03=intr)
  1310. KEYMEDIA_SIZE, 0, // wMaxPacketSize
  1311. KEYMEDIA_INTERVAL, // bInterval
  1312. #endif // KEYMEDIA_INTERFACE
  1313. #ifdef AUDIO_INTERFACE
  1314. // configuration for 480 Mbit/sec speed
  1315. // interface association descriptor, USB ECN, Table 9-Z
  1316. 8, // bLength
  1317. 11, // bDescriptorType
  1318. AUDIO_INTERFACE, // bFirstInterface
  1319. 3, // bInterfaceCount
  1320. 0x01, // bFunctionClass
  1321. 0x01, // bFunctionSubClass
  1322. 0x00, // bFunctionProtocol
  1323. 0, // iFunction
  1324. // Standard AudioControl (AC) Interface Descriptor
  1325. // USB DCD for Audio Devices 1.0, Table 4-1, page 36
  1326. 9, // bLength
  1327. 4, // bDescriptorType, 4 = INTERFACE
  1328. AUDIO_INTERFACE, // bInterfaceNumber
  1329. 0, // bAlternateSetting
  1330. 0, // bNumEndpoints
  1331. 1, // bInterfaceClass, 1 = AUDIO
  1332. 1, // bInterfaceSubclass, 1 = AUDIO_CONTROL
  1333. 0, // bInterfaceProtocol
  1334. 0, // iInterface
  1335. // Class-specific AC Interface Header Descriptor
  1336. // USB DCD for Audio Devices 1.0, Table 4-2, page 37-38
  1337. 10, // bLength
  1338. 0x24, // bDescriptorType, 0x24 = CS_INTERFACE
  1339. 0x01, // bDescriptorSubtype, 1 = HEADER
  1340. 0x00, 0x01, // bcdADC (version 1.0)
  1341. LSB(62), MSB(62), // wTotalLength
  1342. 2, // bInCollection
  1343. AUDIO_INTERFACE+1, // baInterfaceNr(1) - Transmit to PC
  1344. AUDIO_INTERFACE+2, // baInterfaceNr(2) - Receive from PC
  1345. // Input Terminal Descriptor
  1346. // USB DCD for Audio Devices 1.0, Table 4-3, page 39
  1347. 12, // bLength
  1348. 0x24, // bDescriptorType, 0x24 = CS_INTERFACE
  1349. 0x02, // bDescriptorSubType, 2 = INPUT_TERMINAL
  1350. 1, // bTerminalID
  1351. //0x01, 0x02, // wTerminalType, 0x0201 = MICROPHONE
  1352. //0x03, 0x06, // wTerminalType, 0x0603 = Line Connector
  1353. 0x02, 0x06, // wTerminalType, 0x0602 = Digital Audio
  1354. 0, // bAssocTerminal, 0 = unidirectional
  1355. 2, // bNrChannels
  1356. 0x03, 0x00, // wChannelConfig, 0x0003 = Left & Right Front
  1357. 0, // iChannelNames
  1358. 0, // iTerminal
  1359. // Output Terminal Descriptor
  1360. // USB DCD for Audio Devices 1.0, Table 4-4, page 40
  1361. 9, // bLength
  1362. 0x24, // bDescriptorType, 0x24 = CS_INTERFACE
  1363. 3, // bDescriptorSubtype, 3 = OUTPUT_TERMINAL
  1364. 2, // bTerminalID
  1365. 0x01, 0x01, // wTerminalType, 0x0101 = USB_STREAMING
  1366. 0, // bAssocTerminal, 0 = unidirectional
  1367. 1, // bCSourceID, connected to input terminal, ID=1
  1368. 0, // iTerminal
  1369. // Input Terminal Descriptor
  1370. // USB DCD for Audio Devices 1.0, Table 4-3, page 39
  1371. 12, // bLength
  1372. 0x24, // bDescriptorType, 0x24 = CS_INTERFACE
  1373. 2, // bDescriptorSubType, 2 = INPUT_TERMINAL
  1374. 3, // bTerminalID
  1375. 0x01, 0x01, // wTerminalType, 0x0101 = USB_STREAMING
  1376. 0, // bAssocTerminal, 0 = unidirectional
  1377. 2, // bNrChannels
  1378. 0x03, 0x00, // wChannelConfig, 0x0003 = Left & Right Front
  1379. 0, // iChannelNames
  1380. 0, // iTerminal
  1381. // Volume feature descriptor
  1382. 10, // bLength
  1383. 0x24, // bDescriptorType = CS_INTERFACE
  1384. 0x06, // bDescriptorSubType = FEATURE_UNIT
  1385. 0x31, // bUnitID
  1386. 0x03, // bSourceID (Input Terminal)
  1387. 0x01, // bControlSize (each channel is 1 byte, 3 channels)
  1388. 0x01, // bmaControls(0) Master: Mute
  1389. 0x02, // bmaControls(1) Left: Volume
  1390. 0x02, // bmaControls(2) Right: Volume
  1391. 0x00, // iFeature
  1392. // Output Terminal Descriptor
  1393. // USB DCD for Audio Devices 1.0, Table 4-4, page 40
  1394. 9, // bLength
  1395. 0x24, // bDescriptorType, 0x24 = CS_INTERFACE
  1396. 3, // bDescriptorSubtype, 3 = OUTPUT_TERMINAL
  1397. 4, // bTerminalID
  1398. //0x02, 0x03, // wTerminalType, 0x0302 = Headphones
  1399. 0x02, 0x06, // wTerminalType, 0x0602 = Digital Audio
  1400. 0, // bAssocTerminal, 0 = unidirectional
  1401. 0x31, // bCSourceID, connected to feature, ID=31
  1402. 0, // iTerminal
  1403. // Standard AS Interface Descriptor
  1404. // USB DCD for Audio Devices 1.0, Section 4.5.1, Table 4-18, page 59
  1405. // Alternate 0: default setting, disabled zero bandwidth
  1406. 9, // bLenght
  1407. 4, // bDescriptorType = INTERFACE
  1408. AUDIO_INTERFACE+1, // bInterfaceNumber
  1409. 0, // bAlternateSetting
  1410. 0, // bNumEndpoints
  1411. 1, // bInterfaceClass, 1 = AUDIO
  1412. 2, // bInterfaceSubclass, 2 = AUDIO_STREAMING
  1413. 0, // bInterfaceProtocol
  1414. 0, // iInterface
  1415. // Alternate 1: streaming data
  1416. 9, // bLenght
  1417. 4, // bDescriptorType = INTERFACE
  1418. AUDIO_INTERFACE+1, // bInterfaceNumber
  1419. 1, // bAlternateSetting
  1420. 1, // bNumEndpoints
  1421. 1, // bInterfaceClass, 1 = AUDIO
  1422. 2, // bInterfaceSubclass, 2 = AUDIO_STREAMING
  1423. 0, // bInterfaceProtocol
  1424. 0, // iInterface
  1425. // Class-Specific AS Interface Descriptor
  1426. // USB DCD for Audio Devices 1.0, Section 4.5.2, Table 4-19, page 60
  1427. 7, // bLength
  1428. 0x24, // bDescriptorType = CS_INTERFACE
  1429. 1, // bDescriptorSubtype, 1 = AS_GENERAL
  1430. 2, // bTerminalLink: Terminal ID = 2
  1431. 3, // bDelay (approx 3ms delay, audio lib updates)
  1432. 0x01, 0x00, // wFormatTag, 0x0001 = PCM
  1433. // Type I Format Descriptor
  1434. // USB DCD for Audio Data Formats 1.0, Section 2.2.5, Table 2-1, page 10
  1435. 11, // bLength
  1436. 0x24, // bDescriptorType = CS_INTERFACE
  1437. 2, // bDescriptorSubtype = FORMAT_TYPE
  1438. 1, // bFormatType = FORMAT_TYPE_I
  1439. 2, // bNrChannels = 2
  1440. 2, // bSubFrameSize = 2 byte
  1441. 16, // bBitResolution = 16 bits
  1442. 1, // bSamFreqType = 1 frequency
  1443. LSB(44100), MSB(44100), 0, // tSamFreq
  1444. // Standard AS Isochronous Audio Data Endpoint Descriptor
  1445. // USB DCD for Audio Devices 1.0, Section 4.6.1.1, Table 4-20, page 61-62
  1446. 9, // bLength
  1447. 5, // bDescriptorType, 5 = ENDPOINT_DESCRIPTOR
  1448. AUDIO_TX_ENDPOINT | 0x80, // bEndpointAddress
  1449. 0x09, // bmAttributes = isochronous, adaptive
  1450. LSB(AUDIO_TX_SIZE), MSB(AUDIO_TX_SIZE), // wMaxPacketSize
  1451. 4, // bInterval, 4 = every 8 micro-frames
  1452. 0, // bRefresh
  1453. 0, // bSynchAddress
  1454. // Class-Specific AS Isochronous Audio Data Endpoint Descriptor
  1455. // USB DCD for Audio Devices 1.0, Section 4.6.1.2, Table 4-21, page 62-63
  1456. 7, // bLength
  1457. 0x25, // bDescriptorType, 0x25 = CS_ENDPOINT
  1458. 1, // bDescriptorSubtype, 1 = EP_GENERAL
  1459. 0x00, // bmAttributes
  1460. 0, // bLockDelayUnits, 1 = ms
  1461. 0x00, 0x00, // wLockDelay
  1462. // Standard AS Interface Descriptor
  1463. // USB DCD for Audio Devices 1.0, Section 4.5.1, Table 4-18, page 59
  1464. // Alternate 0: default setting, disabled zero bandwidth
  1465. 9, // bLenght
  1466. 4, // bDescriptorType = INTERFACE
  1467. AUDIO_INTERFACE+2, // bInterfaceNumber
  1468. 0, // bAlternateSetting
  1469. 0, // bNumEndpoints
  1470. 1, // bInterfaceClass, 1 = AUDIO
  1471. 2, // bInterfaceSubclass, 2 = AUDIO_STREAMING
  1472. 0, // bInterfaceProtocol
  1473. 0, // iInterface
  1474. // Alternate 1: streaming data
  1475. 9, // bLenght
  1476. 4, // bDescriptorType = INTERFACE
  1477. AUDIO_INTERFACE+2, // bInterfaceNumber
  1478. 1, // bAlternateSetting
  1479. 2, // bNumEndpoints
  1480. 1, // bInterfaceClass, 1 = AUDIO
  1481. 2, // bInterfaceSubclass, 2 = AUDIO_STREAMING
  1482. 0, // bInterfaceProtocol
  1483. 0, // iInterface
  1484. // Class-Specific AS Interface Descriptor
  1485. // USB DCD for Audio Devices 1.0, Section 4.5.2, Table 4-19, page 60
  1486. 7, // bLength
  1487. 0x24, // bDescriptorType = CS_INTERFACE
  1488. 1, // bDescriptorSubtype, 1 = AS_GENERAL
  1489. 3, // bTerminalLink: Terminal ID = 3
  1490. 3, // bDelay (approx 3ms delay, audio lib updates)
  1491. 0x01, 0x00, // wFormatTag, 0x0001 = PCM
  1492. // Type I Format Descriptor
  1493. // USB DCD for Audio Data Formats 1.0, Section 2.2.5, Table 2-1, page 10
  1494. 11, // bLength
  1495. 0x24, // bDescriptorType = CS_INTERFACE
  1496. 2, // bDescriptorSubtype = FORMAT_TYPE
  1497. 1, // bFormatType = FORMAT_TYPE_I
  1498. 2, // bNrChannels = 2
  1499. 2, // bSubFrameSize = 2 byte
  1500. 16, // bBitResolution = 16 bits
  1501. 1, // bSamFreqType = 1 frequency
  1502. LSB(44100), MSB(44100), 0, // tSamFreq
  1503. // Standard AS Isochronous Audio Data Endpoint Descriptor
  1504. // USB DCD for Audio Devices 1.0, Section 4.6.1.1, Table 4-20, page 61-62
  1505. 9, // bLength
  1506. 5, // bDescriptorType, 5 = ENDPOINT_DESCRIPTOR
  1507. AUDIO_RX_ENDPOINT, // bEndpointAddress
  1508. 0x05, // bmAttributes = isochronous, asynchronous
  1509. LSB(AUDIO_RX_SIZE), MSB(AUDIO_RX_SIZE), // wMaxPacketSize
  1510. 4, // bInterval, 4 = every 8 micro-frames
  1511. 0, // bRefresh
  1512. AUDIO_SYNC_ENDPOINT | 0x80, // bSynchAddress
  1513. // Class-Specific AS Isochronous Audio Data Endpoint Descriptor
  1514. // USB DCD for Audio Devices 1.0, Section 4.6.1.2, Table 4-21, page 62-63
  1515. 7, // bLength
  1516. 0x25, // bDescriptorType, 0x25 = CS_ENDPOINT
  1517. 1, // bDescriptorSubtype, 1 = EP_GENERAL
  1518. 0x00, // bmAttributes
  1519. 0, // bLockDelayUnits, 1 = ms
  1520. 0x00, 0x00, // wLockDelay
  1521. // Standard AS Isochronous Audio Synch Endpoint Descriptor
  1522. // USB DCD for Audio Devices 1.0, Section 4.6.2.1, Table 4-22, page 63-64
  1523. 9, // bLength
  1524. 5, // bDescriptorType, 5 = ENDPOINT_DESCRIPTOR
  1525. AUDIO_SYNC_ENDPOINT | 0x80, // bEndpointAddress
  1526. 0x11, // bmAttributes = isochronous, feedback
  1527. 4, 0, // wMaxPacketSize, 4 bytes
  1528. 4, // bInterval, 4 = 4 = every 8 micro-frames
  1529. 7, // bRefresh,
  1530. 0, // bSynchAddress
  1531. #endif
  1532. #ifdef MULTITOUCH_INTERFACE
  1533. // configuration for 480 Mbit/sec speed
  1534. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  1535. 9, // bLength
  1536. 4, // bDescriptorType
  1537. MULTITOUCH_INTERFACE, // bInterfaceNumber
  1538. 0, // bAlternateSetting
  1539. 1, // bNumEndpoints
  1540. 0x03, // bInterfaceClass (0x03 = HID)
  1541. 0x00, // bInterfaceSubClass
  1542. 0x00, // bInterfaceProtocol
  1543. 0, // iInterface
  1544. // HID interface descriptor, HID 1.11 spec, section 6.2.1
  1545. 9, // bLength
  1546. 0x21, // bDescriptorType
  1547. 0x11, 0x01, // bcdHID
  1548. 0, // bCountryCode
  1549. 1, // bNumDescriptors
  1550. 0x22, // bDescriptorType
  1551. LSB(sizeof(multitouch_report_desc)), // wDescriptorLength
  1552. MSB(sizeof(multitouch_report_desc)),
  1553. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1554. 7, // bLength
  1555. 5, // bDescriptorType
  1556. MULTITOUCH_ENDPOINT | 0x80, // bEndpointAddress
  1557. 0x03, // bmAttributes (0x03=intr)
  1558. MULTITOUCH_SIZE, 0, // wMaxPacketSize
  1559. 4, // bInterval, 4 = 1ms
  1560. #endif // MULTITOUCH_INTERFACE
  1561. #ifdef EXPERIMENTAL_INTERFACE
  1562. // configuration for 480 Mbit/sec speed
  1563. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  1564. 9, // bLength
  1565. 4, // bDescriptorType
  1566. EXPERIMENTAL_INTERFACE, // bInterfaceNumber
  1567. 0, // bAlternateSetting
  1568. 1, // bNumEndpoints
  1569. 0xFF, // bInterfaceClass (0xFF = Vendor)
  1570. 0x6A, // bInterfaceSubClass
  1571. 0xFF, // bInterfaceProtocol
  1572. 0, // iInterface
  1573. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1574. 7, // bLength
  1575. 5, // bDescriptorType
  1576. 1 | 0x80, // bEndpointAddress
  1577. 0x02, // bmAttributes (0x02=bulk)
  1578. LSB(512), MSB(512), // wMaxPacketSize
  1579. 1, // bInterval
  1580. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1581. 7, // bLength
  1582. 5, // bDescriptorType
  1583. 1, // bEndpointAddress
  1584. 0x02, // bmAttributes (0x02=bulk)
  1585. LSB(512), MSB(512), // wMaxPacketSize
  1586. 1, // bInterval
  1587. #endif // EXPERIMENTAL_INTERFACE
  1588. };
  1589. PROGMEM const uint8_t usb_config_descriptor_12[CONFIG_DESC_SIZE] = {
  1590. // configuration descriptor, USB spec 9.6.3, page 264-266, Table 9-10
  1591. 9, // bLength;
  1592. 2, // bDescriptorType;
  1593. LSB(CONFIG_DESC_SIZE), // wTotalLength
  1594. MSB(CONFIG_DESC_SIZE),
  1595. NUM_INTERFACE, // bNumInterfaces
  1596. 1, // bConfigurationValue
  1597. 0, // iConfiguration
  1598. 0xC0, // bmAttributes
  1599. 50, // bMaxPower
  1600. #ifdef CDC_IAD_DESCRIPTOR
  1601. // interface association descriptor, USB ECN, Table 9-Z
  1602. 8, // bLength
  1603. 11, // bDescriptorType
  1604. CDC_STATUS_INTERFACE, // bFirstInterface
  1605. 2, // bInterfaceCount
  1606. 0x02, // bFunctionClass
  1607. 0x02, // bFunctionSubClass
  1608. 0x01, // bFunctionProtocol
  1609. 0, // iFunction
  1610. #endif
  1611. #ifdef CDC_DATA_INTERFACE
  1612. // configuration for 12 Mbit/sec speed
  1613. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  1614. 9, // bLength
  1615. 4, // bDescriptorType
  1616. CDC_STATUS_INTERFACE, // bInterfaceNumber
  1617. 0, // bAlternateSetting
  1618. 1, // bNumEndpoints
  1619. 0x02, // bInterfaceClass
  1620. 0x02, // bInterfaceSubClass
  1621. 0x01, // bInterfaceProtocol
  1622. 0, // iInterface
  1623. // CDC Header Functional Descriptor, CDC Spec 5.2.3.1, Table 26
  1624. 5, // bFunctionLength
  1625. 0x24, // bDescriptorType
  1626. 0x00, // bDescriptorSubtype
  1627. 0x10, 0x01, // bcdCDC
  1628. // Call Management Functional Descriptor, CDC Spec 5.2.3.2, Table 27
  1629. 5, // bFunctionLength
  1630. 0x24, // bDescriptorType
  1631. 0x01, // bDescriptorSubtype
  1632. 0x01, // bmCapabilities
  1633. 1, // bDataInterface
  1634. // Abstract Control Management Functional Descriptor, CDC Spec 5.2.3.3, Table 28
  1635. 4, // bFunctionLength
  1636. 0x24, // bDescriptorType
  1637. 0x02, // bDescriptorSubtype
  1638. 0x06, // bmCapabilities
  1639. // Union Functional Descriptor, CDC Spec 5.2.3.8, Table 33
  1640. 5, // bFunctionLength
  1641. 0x24, // bDescriptorType
  1642. 0x06, // bDescriptorSubtype
  1643. CDC_STATUS_INTERFACE, // bMasterInterface
  1644. CDC_DATA_INTERFACE, // bSlaveInterface0
  1645. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1646. 7, // bLength
  1647. 5, // bDescriptorType
  1648. CDC_ACM_ENDPOINT | 0x80, // bEndpointAddress
  1649. 0x03, // bmAttributes (0x03=intr)
  1650. CDC_ACM_SIZE, 0, // wMaxPacketSize
  1651. 16, // bInterval
  1652. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  1653. 9, // bLength
  1654. 4, // bDescriptorType
  1655. CDC_DATA_INTERFACE, // bInterfaceNumber
  1656. 0, // bAlternateSetting
  1657. 2, // bNumEndpoints
  1658. 0x0A, // bInterfaceClass
  1659. 0x00, // bInterfaceSubClass
  1660. 0x00, // bInterfaceProtocol
  1661. 0, // iInterface
  1662. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1663. 7, // bLength
  1664. 5, // bDescriptorType
  1665. CDC_RX_ENDPOINT, // bEndpointAddress
  1666. 0x02, // bmAttributes (0x02=bulk)
  1667. LSB(CDC_RX_SIZE_12),MSB(CDC_RX_SIZE_12),// wMaxPacketSize
  1668. 0, // bInterval
  1669. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1670. 7, // bLength
  1671. 5, // bDescriptorType
  1672. CDC_TX_ENDPOINT | 0x80, // bEndpointAddress
  1673. 0x02, // bmAttributes (0x02=bulk)
  1674. LSB(CDC_TX_SIZE_12),MSB(CDC_TX_SIZE_12),// wMaxPacketSize
  1675. 0, // bInterval
  1676. #endif // CDC_DATA_INTERFACE
  1677. #ifdef CDC2_DATA_INTERFACE
  1678. // configuration for 12 Mbit/sec speed
  1679. // interface association descriptor, USB ECN, Table 9-Z
  1680. 8, // bLength
  1681. 11, // bDescriptorType
  1682. CDC2_STATUS_INTERFACE, // bFirstInterface
  1683. 2, // bInterfaceCount
  1684. 0x02, // bFunctionClass
  1685. 0x02, // bFunctionSubClass
  1686. 0x01, // bFunctionProtocol
  1687. 0, // iFunction
  1688. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  1689. 9, // bLength
  1690. 4, // bDescriptorType
  1691. CDC2_STATUS_INTERFACE, // bInterfaceNumber
  1692. 0, // bAlternateSetting
  1693. 1, // bNumEndpoints
  1694. 0x02, // bInterfaceClass
  1695. 0x02, // bInterfaceSubClass
  1696. 0x01, // bInterfaceProtocol
  1697. 0, // iInterface
  1698. // CDC Header Functional Descriptor, CDC Spec 5.2.3.1, Table 26
  1699. 5, // bFunctionLength
  1700. 0x24, // bDescriptorType
  1701. 0x00, // bDescriptorSubtype
  1702. 0x10, 0x01, // bcdCDC
  1703. // Call Management Functional Descriptor, CDC Spec 5.2.3.2, Table 27
  1704. 5, // bFunctionLength
  1705. 0x24, // bDescriptorType
  1706. 0x01, // bDescriptorSubtype
  1707. 0x01, // bmCapabilities
  1708. 1, // bDataInterface
  1709. // Abstract Control Management Functional Descriptor, CDC Spec 5.2.3.3, Table 28
  1710. 4, // bFunctionLength
  1711. 0x24, // bDescriptorType
  1712. 0x02, // bDescriptorSubtype
  1713. 0x06, // bmCapabilities
  1714. // Union Functional Descriptor, CDC Spec 5.2.3.8, Table 33
  1715. 5, // bFunctionLength
  1716. 0x24, // bDescriptorType
  1717. 0x06, // bDescriptorSubtype
  1718. CDC2_STATUS_INTERFACE, // bMasterInterface
  1719. CDC2_DATA_INTERFACE, // bSlaveInterface0
  1720. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1721. 7, // bLength
  1722. 5, // bDescriptorType
  1723. CDC2_ACM_ENDPOINT | 0x80, // bEndpointAddress
  1724. 0x03, // bmAttributes (0x03=intr)
  1725. CDC_ACM_SIZE, 0, // wMaxPacketSize
  1726. 64, // bInterval
  1727. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  1728. 9, // bLength
  1729. 4, // bDescriptorType
  1730. CDC2_DATA_INTERFACE, // bInterfaceNumber
  1731. 0, // bAlternateSetting
  1732. 2, // bNumEndpoints
  1733. 0x0A, // bInterfaceClass
  1734. 0x00, // bInterfaceSubClass
  1735. 0x00, // bInterfaceProtocol
  1736. 0, // iInterface
  1737. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1738. 7, // bLength
  1739. 5, // bDescriptorType
  1740. CDC2_RX_ENDPOINT, // bEndpointAddress
  1741. 0x02, // bmAttributes (0x02=bulk)
  1742. CDC_RX_SIZE_12, 0, // wMaxPacketSize
  1743. 0, // bInterval
  1744. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1745. 7, // bLength
  1746. 5, // bDescriptorType
  1747. CDC2_TX_ENDPOINT | 0x80, // bEndpointAddress
  1748. 0x02, // bmAttributes (0x02=bulk)
  1749. CDC_TX_SIZE_12, 0, // wMaxPacketSize
  1750. 0, // bInterval
  1751. #endif // CDC2_DATA_INTERFACE
  1752. #ifdef CDC3_DATA_INTERFACE
  1753. // configuration for 12 Mbit/sec speed
  1754. // interface association descriptor, USB ECN, Table 9-Z
  1755. 8, // bLength
  1756. 11, // bDescriptorType
  1757. CDC3_STATUS_INTERFACE, // bFirstInterface
  1758. 2, // bInterfaceCount
  1759. 0x02, // bFunctionClass
  1760. 0x02, // bFunctionSubClass
  1761. 0x01, // bFunctionProtocol
  1762. 0, // iFunction
  1763. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  1764. 9, // bLength
  1765. 4, // bDescriptorType
  1766. CDC3_STATUS_INTERFACE, // bInterfaceNumber
  1767. 0, // bAlternateSetting
  1768. 1, // bNumEndpoints
  1769. 0x02, // bInterfaceClass
  1770. 0x02, // bInterfaceSubClass
  1771. 0x01, // bInterfaceProtocol
  1772. 0, // iInterface
  1773. // CDC Header Functional Descriptor, CDC Spec 5.2.3.1, Table 26
  1774. 5, // bFunctionLength
  1775. 0x24, // bDescriptorType
  1776. 0x00, // bDescriptorSubtype
  1777. 0x10, 0x01, // bcdCDC
  1778. // Call Management Functional Descriptor, CDC Spec 5.2.3.2, Table 27
  1779. 5, // bFunctionLength
  1780. 0x24, // bDescriptorType
  1781. 0x01, // bDescriptorSubtype
  1782. 0x01, // bmCapabilities
  1783. 1, // bDataInterface
  1784. // Abstract Control Management Functional Descriptor, CDC Spec 5.2.3.3, Table 28
  1785. 4, // bFunctionLength
  1786. 0x24, // bDescriptorType
  1787. 0x02, // bDescriptorSubtype
  1788. 0x06, // bmCapabilities
  1789. // Union Functional Descriptor, CDC Spec 5.2.3.8, Table 33
  1790. 5, // bFunctionLength
  1791. 0x24, // bDescriptorType
  1792. 0x06, // bDescriptorSubtype
  1793. CDC3_STATUS_INTERFACE, // bMasterInterface
  1794. CDC3_DATA_INTERFACE, // bSlaveInterface0
  1795. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1796. 7, // bLength
  1797. 5, // bDescriptorType
  1798. CDC3_ACM_ENDPOINT | 0x80, // bEndpointAddress
  1799. 0x03, // bmAttributes (0x03=intr)
  1800. CDC_ACM_SIZE, 0, // wMaxPacketSize
  1801. 64, // bInterval
  1802. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  1803. 9, // bLength
  1804. 4, // bDescriptorType
  1805. CDC3_DATA_INTERFACE, // bInterfaceNumber
  1806. 0, // bAlternateSetting
  1807. 2, // bNumEndpoints
  1808. 0x0A, // bInterfaceClass
  1809. 0x00, // bInterfaceSubClass
  1810. 0x00, // bInterfaceProtocol
  1811. 0, // iInterface
  1812. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1813. 7, // bLength
  1814. 5, // bDescriptorType
  1815. CDC3_RX_ENDPOINT, // bEndpointAddress
  1816. 0x02, // bmAttributes (0x02=bulk)
  1817. CDC_RX_SIZE_12, 0, // wMaxPacketSize
  1818. 0, // bInterval
  1819. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  1820. 7, // bLength
  1821. 5, // bDescriptorType
  1822. CDC3_TX_ENDPOINT | 0x80, // bEndpointAddress
  1823. 0x02, // bmAttributes (0x02=bulk)
  1824. CDC_TX_SIZE_12, 0, // wMaxPacketSize
  1825. 0, // bInterval
  1826. #endif // CDC3_DATA_INTERFACE
  1827. #ifdef MIDI_INTERFACE
  1828. // configuration for 12 Mbit/sec speed
  1829. // Standard MS Interface Descriptor,
  1830. 9, // bLength
  1831. 4, // bDescriptorType
  1832. MIDI_INTERFACE, // bInterfaceNumber
  1833. 0, // bAlternateSetting
  1834. 2, // bNumEndpoints
  1835. 0x01, // bInterfaceClass (0x01 = Audio)
  1836. 0x03, // bInterfaceSubClass (0x03 = MIDI)
  1837. 0x00, // bInterfaceProtocol (unused for MIDI)
  1838. 0, // iInterface
  1839. // MIDI MS Interface Header, USB MIDI 6.1.2.1, page 21, Table 6-2
  1840. 7, // bLength
  1841. 0x24, // bDescriptorType = CS_INTERFACE
  1842. 0x01, // bDescriptorSubtype = MS_HEADER
  1843. 0x00, 0x01, // bcdMSC = revision 01.00
  1844. LSB(7+(6+6+9+9)*MIDI_NUM_CABLES), // wTotalLength
  1845. MSB(7+(6+6+9+9)*MIDI_NUM_CABLES),
  1846. // MIDI IN Jack Descriptor, B.4.3, Table B-7 (embedded), page 40
  1847. 6, // bLength
  1848. 0x24, // bDescriptorType = CS_INTERFACE
  1849. 0x02, // bDescriptorSubtype = MIDI_IN_JACK
  1850. 0x01, // bJackType = EMBEDDED
  1851. 1, // bJackID, ID = 1
  1852. 0, // iJack
  1853. // MIDI IN Jack Descriptor, B.4.3, Table B-8 (external), page 40
  1854. 6, // bLength
  1855. 0x24, // bDescriptorType = CS_INTERFACE
  1856. 0x02, // bDescriptorSubtype = MIDI_IN_JACK
  1857. 0x02, // bJackType = EXTERNAL
  1858. 2, // bJackID, ID = 2
  1859. 0, // iJack
  1860. // MIDI OUT Jack Descriptor, B.4.4, Table B-9, page 41
  1861. 9,
  1862. 0x24, // bDescriptorType = CS_INTERFACE
  1863. 0x03, // bDescriptorSubtype = MIDI_OUT_JACK
  1864. 0x01, // bJackType = EMBEDDED
  1865. 3, // bJackID, ID = 3
  1866. 1, // bNrInputPins = 1 pin
  1867. 2, // BaSourceID(1) = 2
  1868. 1, // BaSourcePin(1) = first pin
  1869. 0, // iJack
  1870. // MIDI OUT Jack Descriptor, B.4.4, Table B-10, page 41
  1871. 9,
  1872. 0x24, // bDescriptorType = CS_INTERFACE
  1873. 0x03, // bDescriptorSubtype = MIDI_OUT_JACK
  1874. 0x02, // bJackType = EXTERNAL
  1875. 4, // bJackID, ID = 4
  1876. 1, // bNrInputPins = 1 pin
  1877. 1, // BaSourceID(1) = 1
  1878. 1, // BaSourcePin(1) = first pin
  1879. 0, // iJack
  1880. #if MIDI_NUM_CABLES >= 2
  1881. #define MIDI_INTERFACE_JACK_PAIR(a, b, c, d) \
  1882. 6, 0x24, 0x02, 0x01, (a), 0, \
  1883. 6, 0x24, 0x02, 0x02, (b), 0, \
  1884. 9, 0x24, 0x03, 0x01, (c), 1, (b), 1, 0, \
  1885. 9, 0x24, 0x03, 0x02, (d), 1, (a), 1, 0,
  1886. MIDI_INTERFACE_JACK_PAIR(5, 6, 7, 8)
  1887. #endif
  1888. #if MIDI_NUM_CABLES >= 3
  1889. MIDI_INTERFACE_JACK_PAIR(9, 10, 11, 12)
  1890. #endif
  1891. #if MIDI_NUM_CABLES >= 4
  1892. MIDI_INTERFACE_JACK_PAIR(13, 14, 15, 16)
  1893. #endif
  1894. #if MIDI_NUM_CABLES >= 5
  1895. MIDI_INTERFACE_JACK_PAIR(17, 18, 19, 20)
  1896. #endif
  1897. #if MIDI_NUM_CABLES >= 6
  1898. MIDI_INTERFACE_JACK_PAIR(21, 22, 23, 24)
  1899. #endif
  1900. #if MIDI_NUM_CABLES >= 7
  1901. MIDI_INTERFACE_JACK_PAIR(25, 26, 27, 28)
  1902. #endif
  1903. #if MIDI_NUM_CABLES >= 8
  1904. MIDI_INTERFACE_JACK_PAIR(29, 30, 31, 32)
  1905. #endif
  1906. #if MIDI_NUM_CABLES >= 9
  1907. MIDI_INTERFACE_JACK_PAIR(33, 34, 35, 36)
  1908. #endif
  1909. #if MIDI_NUM_CABLES >= 10
  1910. MIDI_INTERFACE_JACK_PAIR(37, 38, 39, 40)
  1911. #endif
  1912. #if MIDI_NUM_CABLES >= 11
  1913. MIDI_INTERFACE_JACK_PAIR(41, 42, 43, 44)
  1914. #endif
  1915. #if MIDI_NUM_CABLES >= 12
  1916. MIDI_INTERFACE_JACK_PAIR(45, 46, 47, 48)
  1917. #endif
  1918. #if MIDI_NUM_CABLES >= 13
  1919. MIDI_INTERFACE_JACK_PAIR(49, 50, 51, 52)
  1920. #endif
  1921. #if MIDI_NUM_CABLES >= 14
  1922. MIDI_INTERFACE_JACK_PAIR(53, 54, 55, 56)
  1923. #endif
  1924. #if MIDI_NUM_CABLES >= 15
  1925. MIDI_INTERFACE_JACK_PAIR(57, 58, 59, 60)
  1926. #endif
  1927. #if MIDI_NUM_CABLES >= 16
  1928. MIDI_INTERFACE_JACK_PAIR(61, 62, 63, 64)
  1929. #endif
  1930. // Standard Bulk OUT Endpoint Descriptor, B.5.1, Table B-11, pae 42
  1931. 9, // bLength
  1932. 5, // bDescriptorType = ENDPOINT
  1933. MIDI_RX_ENDPOINT, // bEndpointAddress
  1934. 0x02, // bmAttributes (0x02=bulk)
  1935. LSB(MIDI_RX_SIZE_12),MSB(MIDI_RX_SIZE_12),// wMaxPacketSize
  1936. 0, // bInterval
  1937. 0, // bRefresh
  1938. 0, // bSynchAddress
  1939. // Class-specific MS Bulk OUT Endpoint Descriptor, B.5.2, Table B-12, page 42
  1940. 4+MIDI_NUM_CABLES, // bLength
  1941. 0x25, // bDescriptorSubtype = CS_ENDPOINT
  1942. 0x01, // bJackType = MS_GENERAL
  1943. MIDI_NUM_CABLES, // bNumEmbMIDIJack = number of jacks
  1944. 1, // BaAssocJackID(1) = jack ID #1
  1945. #if MIDI_NUM_CABLES >= 2
  1946. 5,
  1947. #endif
  1948. #if MIDI_NUM_CABLES >= 3
  1949. 9,
  1950. #endif
  1951. #if MIDI_NUM_CABLES >= 4
  1952. 13,
  1953. #endif
  1954. #if MIDI_NUM_CABLES >= 5
  1955. 17,
  1956. #endif
  1957. #if MIDI_NUM_CABLES >= 6
  1958. 21,
  1959. #endif
  1960. #if MIDI_NUM_CABLES >= 7
  1961. 25,
  1962. #endif
  1963. #if MIDI_NUM_CABLES >= 8
  1964. 29,
  1965. #endif
  1966. #if MIDI_NUM_CABLES >= 9
  1967. 33,
  1968. #endif
  1969. #if MIDI_NUM_CABLES >= 10
  1970. 37,
  1971. #endif
  1972. #if MIDI_NUM_CABLES >= 11
  1973. 41,
  1974. #endif
  1975. #if MIDI_NUM_CABLES >= 12
  1976. 45,
  1977. #endif
  1978. #if MIDI_NUM_CABLES >= 13
  1979. 49,
  1980. #endif
  1981. #if MIDI_NUM_CABLES >= 14
  1982. 53,
  1983. #endif
  1984. #if MIDI_NUM_CABLES >= 15
  1985. 57,
  1986. #endif
  1987. #if MIDI_NUM_CABLES >= 16
  1988. 61,
  1989. #endif
  1990. // Standard Bulk IN Endpoint Descriptor, B.5.1, Table B-11, pae 42
  1991. 9, // bLength
  1992. 5, // bDescriptorType = ENDPOINT
  1993. MIDI_TX_ENDPOINT | 0x80, // bEndpointAddress
  1994. 0x02, // bmAttributes (0x02=bulk)
  1995. LSB(MIDI_TX_SIZE_12),MSB(MIDI_TX_SIZE_12),// wMaxPacketSize
  1996. 0, // bInterval
  1997. 0, // bRefresh
  1998. 0, // bSynchAddress
  1999. // Class-specific MS Bulk IN Endpoint Descriptor, B.5.2, Table B-12, page 42
  2000. 4+MIDI_NUM_CABLES, // bLength
  2001. 0x25, // bDescriptorSubtype = CS_ENDPOINT
  2002. 0x01, // bJackType = MS_GENERAL
  2003. MIDI_NUM_CABLES, // bNumEmbMIDIJack = number of jacks
  2004. 3, // BaAssocJackID(1) = jack ID #3
  2005. #if MIDI_NUM_CABLES >= 2
  2006. 7,
  2007. #endif
  2008. #if MIDI_NUM_CABLES >= 3
  2009. 11,
  2010. #endif
  2011. #if MIDI_NUM_CABLES >= 4
  2012. 15,
  2013. #endif
  2014. #if MIDI_NUM_CABLES >= 5
  2015. 19,
  2016. #endif
  2017. #if MIDI_NUM_CABLES >= 6
  2018. 23,
  2019. #endif
  2020. #if MIDI_NUM_CABLES >= 7
  2021. 27,
  2022. #endif
  2023. #if MIDI_NUM_CABLES >= 8
  2024. 31,
  2025. #endif
  2026. #if MIDI_NUM_CABLES >= 9
  2027. 35,
  2028. #endif
  2029. #if MIDI_NUM_CABLES >= 10
  2030. 39,
  2031. #endif
  2032. #if MIDI_NUM_CABLES >= 11
  2033. 43,
  2034. #endif
  2035. #if MIDI_NUM_CABLES >= 12
  2036. 47,
  2037. #endif
  2038. #if MIDI_NUM_CABLES >= 13
  2039. 51,
  2040. #endif
  2041. #if MIDI_NUM_CABLES >= 14
  2042. 55,
  2043. #endif
  2044. #if MIDI_NUM_CABLES >= 15
  2045. 59,
  2046. #endif
  2047. #if MIDI_NUM_CABLES >= 16
  2048. 63,
  2049. #endif
  2050. #endif // MIDI_INTERFACE
  2051. #ifdef KEYBOARD_INTERFACE
  2052. // configuration for 12 Mbit/sec speed
  2053. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  2054. 9, // bLength
  2055. 4, // bDescriptorType
  2056. KEYBOARD_INTERFACE, // bInterfaceNumber
  2057. 0, // bAlternateSetting
  2058. 1, // bNumEndpoints
  2059. 0x03, // bInterfaceClass (0x03 = HID)
  2060. 0x01, // bInterfaceSubClass (0x01 = Boot)
  2061. 0x01, // bInterfaceProtocol (0x01 = Keyboard)
  2062. 0, // iInterface
  2063. // HID interface descriptor, HID 1.11 spec, section 6.2.1
  2064. 9, // bLength
  2065. 0x21, // bDescriptorType
  2066. 0x11, 0x01, // bcdHID
  2067. 0, // bCountryCode
  2068. 1, // bNumDescriptors
  2069. 0x22, // bDescriptorType
  2070. LSB(sizeof(keyboard_report_desc)), // wDescriptorLength
  2071. MSB(sizeof(keyboard_report_desc)),
  2072. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  2073. 7, // bLength
  2074. 5, // bDescriptorType
  2075. KEYBOARD_ENDPOINT | 0x80, // bEndpointAddress
  2076. 0x03, // bmAttributes (0x03=intr)
  2077. KEYBOARD_SIZE, 0, // wMaxPacketSize
  2078. KEYBOARD_INTERVAL, // bInterval
  2079. #endif // KEYBOARD_INTERFACE
  2080. #ifdef MOUSE_INTERFACE
  2081. // configuration for 12 Mbit/sec speed
  2082. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  2083. 9, // bLength
  2084. 4, // bDescriptorType
  2085. MOUSE_INTERFACE, // bInterfaceNumber
  2086. 0, // bAlternateSetting
  2087. 1, // bNumEndpoints
  2088. 0x03, // bInterfaceClass (0x03 = HID)
  2089. 0x00, // bInterfaceSubClass (0x01 = Boot)
  2090. 0x00, // bInterfaceProtocol (0x02 = Mouse)
  2091. 0, // iInterface
  2092. // HID interface descriptor, HID 1.11 spec, section 6.2.1
  2093. 9, // bLength
  2094. 0x21, // bDescriptorType
  2095. 0x11, 0x01, // bcdHID
  2096. 0, // bCountryCode
  2097. 1, // bNumDescriptors
  2098. 0x22, // bDescriptorType
  2099. LSB(sizeof(mouse_report_desc)), // wDescriptorLength
  2100. MSB(sizeof(mouse_report_desc)),
  2101. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  2102. 7, // bLength
  2103. 5, // bDescriptorType
  2104. MOUSE_ENDPOINT | 0x80, // bEndpointAddress
  2105. 0x03, // bmAttributes (0x03=intr)
  2106. MOUSE_SIZE, 0, // wMaxPacketSize
  2107. MOUSE_INTERVAL, // bInterval
  2108. #endif // MOUSE_INTERFACE
  2109. #ifdef RAWHID_INTERFACE
  2110. // configuration for 12 Mbit/sec speed
  2111. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  2112. 9, // bLength
  2113. 4, // bDescriptorType
  2114. RAWHID_INTERFACE, // bInterfaceNumber
  2115. 0, // bAlternateSetting
  2116. 2, // bNumEndpoints
  2117. 0x03, // bInterfaceClass (0x03 = HID)
  2118. 0x00, // bInterfaceSubClass
  2119. 0x00, // bInterfaceProtocol
  2120. 0, // iInterface
  2121. // HID interface descriptor, HID 1.11 spec, section 6.2.1
  2122. 9, // bLength
  2123. 0x21, // bDescriptorType
  2124. 0x11, 0x01, // bcdHID
  2125. 0, // bCountryCode
  2126. 1, // bNumDescriptors
  2127. 0x22, // bDescriptorType
  2128. LSB(sizeof(rawhid_report_desc)), // wDescriptorLength
  2129. MSB(sizeof(rawhid_report_desc)),
  2130. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  2131. 7, // bLength
  2132. 5, // bDescriptorType
  2133. RAWHID_TX_ENDPOINT | 0x80, // bEndpointAddress
  2134. 0x03, // bmAttributes (0x03=intr)
  2135. RAWHID_TX_SIZE, 0, // wMaxPacketSize
  2136. RAWHID_TX_INTERVAL, // bInterval
  2137. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  2138. 7, // bLength
  2139. 5, // bDescriptorType
  2140. RAWHID_RX_ENDPOINT, // bEndpointAddress
  2141. 0x03, // bmAttributes (0x03=intr)
  2142. RAWHID_RX_SIZE, 0, // wMaxPacketSize
  2143. RAWHID_RX_INTERVAL, // bInterval
  2144. #endif // RAWHID_INTERFACE
  2145. #ifdef FLIGHTSIM_INTERFACE
  2146. // configuration for 12 Mbit/sec speed
  2147. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  2148. 9, // bLength
  2149. 4, // bDescriptorType
  2150. FLIGHTSIM_INTERFACE, // bInterfaceNumber
  2151. 0, // bAlternateSetting
  2152. 2, // bNumEndpoints
  2153. 0x03, // bInterfaceClass (0x03 = HID)
  2154. 0x00, // bInterfaceSubClass
  2155. 0x00, // bInterfaceProtocol
  2156. 0, // iInterface
  2157. // HID interface descriptor, HID 1.11 spec, section 6.2.1
  2158. 9, // bLength
  2159. 0x21, // bDescriptorType
  2160. 0x11, 0x01, // bcdHID
  2161. 0, // bCountryCode
  2162. 1, // bNumDescriptors
  2163. 0x22, // bDescriptorType
  2164. LSB(sizeof(flightsim_report_desc)), // wDescriptorLength
  2165. MSB(sizeof(flightsim_report_desc)),
  2166. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  2167. 7, // bLength
  2168. 5, // bDescriptorType
  2169. FLIGHTSIM_TX_ENDPOINT | 0x80, // bEndpointAddress
  2170. 0x03, // bmAttributes (0x03=intr)
  2171. FLIGHTSIM_TX_SIZE, 0, // wMaxPacketSize
  2172. FLIGHTSIM_TX_INTERVAL, // bInterval
  2173. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  2174. 7, // bLength
  2175. 5, // bDescriptorType
  2176. FLIGHTSIM_RX_ENDPOINT, // bEndpointAddress
  2177. 0x03, // bmAttributes (0x03=intr)
  2178. FLIGHTSIM_RX_SIZE, 0, // wMaxPacketSize
  2179. FLIGHTSIM_RX_INTERVAL, // bInterval
  2180. #endif // FLIGHTSIM_INTERFACE
  2181. #ifdef SEREMU_INTERFACE
  2182. // configuration for 12 Mbit/sec speed
  2183. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  2184. 9, // bLength
  2185. 4, // bDescriptorType
  2186. SEREMU_INTERFACE, // bInterfaceNumber
  2187. 0, // bAlternateSetting
  2188. 2, // bNumEndpoints
  2189. 0x03, // bInterfaceClass (0x03 = HID)
  2190. 0x00, // bInterfaceSubClass
  2191. 0x00, // bInterfaceProtocol
  2192. 0, // iInterface
  2193. // HID interface descriptor, HID 1.11 spec, section 6.2.1
  2194. 9, // bLength
  2195. 0x21, // bDescriptorType
  2196. 0x11, 0x01, // bcdHID
  2197. 0, // bCountryCode
  2198. 1, // bNumDescriptors
  2199. 0x22, // bDescriptorType
  2200. LSB(sizeof(seremu_report_desc)), // wDescriptorLength
  2201. MSB(sizeof(seremu_report_desc)),
  2202. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  2203. 7, // bLength
  2204. 5, // bDescriptorType
  2205. SEREMU_TX_ENDPOINT | 0x80, // bEndpointAddress
  2206. 0x03, // bmAttributes (0x03=intr)
  2207. SEREMU_TX_SIZE, 0, // wMaxPacketSize
  2208. SEREMU_TX_INTERVAL, // bInterval
  2209. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  2210. 7, // bLength
  2211. 5, // bDescriptorType
  2212. SEREMU_RX_ENDPOINT, // bEndpointAddress
  2213. 0x03, // bmAttributes (0x03=intr)
  2214. SEREMU_RX_SIZE, 0, // wMaxPacketSize
  2215. SEREMU_RX_INTERVAL, // bInterval
  2216. #endif // SEREMU_INTERFACE
  2217. #ifdef JOYSTICK_INTERFACE
  2218. // configuration for 12 Mbit/sec speed
  2219. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  2220. 9, // bLength
  2221. 4, // bDescriptorType
  2222. JOYSTICK_INTERFACE, // bInterfaceNumber
  2223. 0, // bAlternateSetting
  2224. 1, // bNumEndpoints
  2225. 0x03, // bInterfaceClass (0x03 = HID)
  2226. 0x00, // bInterfaceSubClass
  2227. 0x00, // bInterfaceProtocol
  2228. 0, // iInterface
  2229. // HID interface descriptor, HID 1.11 spec, section 6.2.1
  2230. 9, // bLength
  2231. 0x21, // bDescriptorType
  2232. 0x11, 0x01, // bcdHID
  2233. 0, // bCountryCode
  2234. 1, // bNumDescriptors
  2235. 0x22, // bDescriptorType
  2236. LSB(sizeof(joystick_report_desc)), // wDescriptorLength
  2237. MSB(sizeof(joystick_report_desc)),
  2238. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  2239. 7, // bLength
  2240. 5, // bDescriptorType
  2241. JOYSTICK_ENDPOINT | 0x80, // bEndpointAddress
  2242. 0x03, // bmAttributes (0x03=intr)
  2243. JOYSTICK_SIZE, 0, // wMaxPacketSize
  2244. JOYSTICK_INTERVAL, // bInterval
  2245. #endif // JOYSTICK_INTERFACE
  2246. #ifdef MTP_INTERFACE
  2247. // configuration for 12 Mbit/sec speed
  2248. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  2249. 9, // bLength
  2250. 4, // bDescriptorType
  2251. MTP_INTERFACE, // bInterfaceNumber
  2252. 0, // bAlternateSetting
  2253. 3, // bNumEndpoints
  2254. 0x06, // bInterfaceClass (0x06 = still image)
  2255. 0x01, // bInterfaceSubClass
  2256. 0x01, // bInterfaceProtocol
  2257. 0, // iInterface
  2258. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  2259. 7, // bLength
  2260. 5, // bDescriptorType
  2261. MTP_TX_ENDPOINT | 0x80, // bEndpointAddress
  2262. 0x02, // bmAttributes (0x02=bulk)
  2263. LSB(MTP_TX_SIZE_12),MSB(MTP_TX_SIZE_12),// wMaxPacketSize
  2264. 0, // bInterval
  2265. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  2266. 7, // bLength
  2267. 5, // bDescriptorType
  2268. MTP_RX_ENDPOINT, // bEndpointAddress
  2269. 0x02, // bmAttributes (0x02=bulk)
  2270. LSB(MTP_RX_SIZE_12),MSB(MTP_RX_SIZE_12),// wMaxPacketSize
  2271. 0, // bInterval
  2272. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  2273. 7, // bLength
  2274. 5, // bDescriptorType
  2275. MTP_EVENT_ENDPOINT | 0x80, // bEndpointAddress
  2276. 0x03, // bmAttributes (0x03=intr)
  2277. MTP_EVENT_SIZE, 0, // wMaxPacketSize
  2278. MTP_EVENT_INTERVAL_12, // bInterval
  2279. #endif // MTP_INTERFACE
  2280. #ifdef KEYMEDIA_INTERFACE
  2281. // configuration for 12 Mbit/sec speed
  2282. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  2283. 9, // bLength
  2284. 4, // bDescriptorType
  2285. KEYMEDIA_INTERFACE, // bInterfaceNumber
  2286. 0, // bAlternateSetting
  2287. 1, // bNumEndpoints
  2288. 0x03, // bInterfaceClass (0x03 = HID)
  2289. 0x00, // bInterfaceSubClass
  2290. 0x00, // bInterfaceProtocol
  2291. 0, // iInterface
  2292. // HID interface descriptor, HID 1.11 spec, section 6.2.1
  2293. 9, // bLength
  2294. 0x21, // bDescriptorType
  2295. 0x11, 0x01, // bcdHID
  2296. 0, // bCountryCode
  2297. 1, // bNumDescriptors
  2298. 0x22, // bDescriptorType
  2299. LSB(sizeof(keymedia_report_desc)), // wDescriptorLength
  2300. MSB(sizeof(keymedia_report_desc)),
  2301. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  2302. 7, // bLength
  2303. 5, // bDescriptorType
  2304. KEYMEDIA_ENDPOINT | 0x80, // bEndpointAddress
  2305. 0x03, // bmAttributes (0x03=intr)
  2306. KEYMEDIA_SIZE, 0, // wMaxPacketSize
  2307. KEYMEDIA_INTERVAL, // bInterval
  2308. #endif // KEYMEDIA_INTERFACE
  2309. #ifdef AUDIO_INTERFACE
  2310. // configuration for 12 Mbit/sec speed
  2311. // interface association descriptor, USB ECN, Table 9-Z
  2312. 8, // bLength
  2313. 11, // bDescriptorType
  2314. AUDIO_INTERFACE, // bFirstInterface
  2315. 3, // bInterfaceCount
  2316. 0x01, // bFunctionClass
  2317. 0x01, // bFunctionSubClass
  2318. 0x00, // bFunctionProtocol
  2319. 0, // iFunction
  2320. // Standard AudioControl (AC) Interface Descriptor
  2321. // USB DCD for Audio Devices 1.0, Table 4-1, page 36
  2322. 9, // bLength
  2323. 4, // bDescriptorType, 4 = INTERFACE
  2324. AUDIO_INTERFACE, // bInterfaceNumber
  2325. 0, // bAlternateSetting
  2326. 0, // bNumEndpoints
  2327. 1, // bInterfaceClass, 1 = AUDIO
  2328. 1, // bInterfaceSubclass, 1 = AUDIO_CONTROL
  2329. 0, // bInterfaceProtocol
  2330. 0, // iInterface
  2331. // Class-specific AC Interface Header Descriptor
  2332. // USB DCD for Audio Devices 1.0, Table 4-2, page 37-38
  2333. 10, // bLength
  2334. 0x24, // bDescriptorType, 0x24 = CS_INTERFACE
  2335. 0x01, // bDescriptorSubtype, 1 = HEADER
  2336. 0x00, 0x01, // bcdADC (version 1.0)
  2337. LSB(62), MSB(62), // wTotalLength
  2338. 2, // bInCollection
  2339. AUDIO_INTERFACE+1, // baInterfaceNr(1) - Transmit to PC
  2340. AUDIO_INTERFACE+2, // baInterfaceNr(2) - Receive from PC
  2341. // Input Terminal Descriptor
  2342. // USB DCD for Audio Devices 1.0, Table 4-3, page 39
  2343. 12, // bLength
  2344. 0x24, // bDescriptorType, 0x24 = CS_INTERFACE
  2345. 0x02, // bDescriptorSubType, 2 = INPUT_TERMINAL
  2346. 1, // bTerminalID
  2347. //0x01, 0x02, // wTerminalType, 0x0201 = MICROPHONE
  2348. //0x03, 0x06, // wTerminalType, 0x0603 = Line Connector
  2349. 0x02, 0x06, // wTerminalType, 0x0602 = Digital Audio
  2350. 0, // bAssocTerminal, 0 = unidirectional
  2351. 2, // bNrChannels
  2352. 0x03, 0x00, // wChannelConfig, 0x0003 = Left & Right Front
  2353. 0, // iChannelNames
  2354. 0, // iTerminal
  2355. // Output Terminal Descriptor
  2356. // USB DCD for Audio Devices 1.0, Table 4-4, page 40
  2357. 9, // bLength
  2358. 0x24, // bDescriptorType, 0x24 = CS_INTERFACE
  2359. 3, // bDescriptorSubtype, 3 = OUTPUT_TERMINAL
  2360. 2, // bTerminalID
  2361. 0x01, 0x01, // wTerminalType, 0x0101 = USB_STREAMING
  2362. 0, // bAssocTerminal, 0 = unidirectional
  2363. 1, // bCSourceID, connected to input terminal, ID=1
  2364. 0, // iTerminal
  2365. // Input Terminal Descriptor
  2366. // USB DCD for Audio Devices 1.0, Table 4-3, page 39
  2367. 12, // bLength
  2368. 0x24, // bDescriptorType, 0x24 = CS_INTERFACE
  2369. 2, // bDescriptorSubType, 2 = INPUT_TERMINAL
  2370. 3, // bTerminalID
  2371. 0x01, 0x01, // wTerminalType, 0x0101 = USB_STREAMING
  2372. 0, // bAssocTerminal, 0 = unidirectional
  2373. 2, // bNrChannels
  2374. 0x03, 0x00, // wChannelConfig, 0x0003 = Left & Right Front
  2375. 0, // iChannelNames
  2376. 0, // iTerminal
  2377. // Volume feature descriptor
  2378. 10, // bLength
  2379. 0x24, // bDescriptorType = CS_INTERFACE
  2380. 0x06, // bDescriptorSubType = FEATURE_UNIT
  2381. 0x31, // bUnitID
  2382. 0x03, // bSourceID (Input Terminal)
  2383. 0x01, // bControlSize (each channel is 1 byte, 3 channels)
  2384. 0x01, // bmaControls(0) Master: Mute
  2385. 0x02, // bmaControls(1) Left: Volume
  2386. 0x02, // bmaControls(2) Right: Volume
  2387. 0x00, // iFeature
  2388. // Output Terminal Descriptor
  2389. // USB DCD for Audio Devices 1.0, Table 4-4, page 40
  2390. 9, // bLength
  2391. 0x24, // bDescriptorType, 0x24 = CS_INTERFACE
  2392. 3, // bDescriptorSubtype, 3 = OUTPUT_TERMINAL
  2393. 4, // bTerminalID
  2394. //0x02, 0x03, // wTerminalType, 0x0302 = Headphones
  2395. 0x02, 0x06, // wTerminalType, 0x0602 = Digital Audio
  2396. 0, // bAssocTerminal, 0 = unidirectional
  2397. 0x31, // bCSourceID, connected to feature, ID=31
  2398. 0, // iTerminal
  2399. // Standard AS Interface Descriptor
  2400. // USB DCD for Audio Devices 1.0, Section 4.5.1, Table 4-18, page 59
  2401. // Alternate 0: default setting, disabled zero bandwidth
  2402. 9, // bLenght
  2403. 4, // bDescriptorType = INTERFACE
  2404. AUDIO_INTERFACE+1, // bInterfaceNumber
  2405. 0, // bAlternateSetting
  2406. 0, // bNumEndpoints
  2407. 1, // bInterfaceClass, 1 = AUDIO
  2408. 2, // bInterfaceSubclass, 2 = AUDIO_STREAMING
  2409. 0, // bInterfaceProtocol
  2410. 0, // iInterface
  2411. // Alternate 1: streaming data
  2412. 9, // bLenght
  2413. 4, // bDescriptorType = INTERFACE
  2414. AUDIO_INTERFACE+1, // bInterfaceNumber
  2415. 1, // bAlternateSetting
  2416. 1, // bNumEndpoints
  2417. 1, // bInterfaceClass, 1 = AUDIO
  2418. 2, // bInterfaceSubclass, 2 = AUDIO_STREAMING
  2419. 0, // bInterfaceProtocol
  2420. 0, // iInterface
  2421. // Class-Specific AS Interface Descriptor
  2422. // USB DCD for Audio Devices 1.0, Section 4.5.2, Table 4-19, page 60
  2423. 7, // bLength
  2424. 0x24, // bDescriptorType = CS_INTERFACE
  2425. 1, // bDescriptorSubtype, 1 = AS_GENERAL
  2426. 2, // bTerminalLink: Terminal ID = 2
  2427. 3, // bDelay (approx 3ms delay, audio lib updates)
  2428. 0x01, 0x00, // wFormatTag, 0x0001 = PCM
  2429. // Type I Format Descriptor
  2430. // USB DCD for Audio Data Formats 1.0, Section 2.2.5, Table 2-1, page 10
  2431. 11, // bLength
  2432. 0x24, // bDescriptorType = CS_INTERFACE
  2433. 2, // bDescriptorSubtype = FORMAT_TYPE
  2434. 1, // bFormatType = FORMAT_TYPE_I
  2435. 2, // bNrChannels = 2
  2436. 2, // bSubFrameSize = 2 byte
  2437. 16, // bBitResolution = 16 bits
  2438. 1, // bSamFreqType = 1 frequency
  2439. LSB(44100), MSB(44100), 0, // tSamFreq
  2440. // Standard AS Isochronous Audio Data Endpoint Descriptor
  2441. // USB DCD for Audio Devices 1.0, Section 4.6.1.1, Table 4-20, page 61-62
  2442. 9, // bLength
  2443. 5, // bDescriptorType, 5 = ENDPOINT_DESCRIPTOR
  2444. AUDIO_TX_ENDPOINT | 0x80, // bEndpointAddress
  2445. 0x09, // bmAttributes = isochronous, adaptive
  2446. LSB(AUDIO_TX_SIZE), MSB(AUDIO_TX_SIZE), // wMaxPacketSize
  2447. 1, // bInterval, 1 = every frame
  2448. 0, // bRefresh
  2449. 0, // bSynchAddress
  2450. // Class-Specific AS Isochronous Audio Data Endpoint Descriptor
  2451. // USB DCD for Audio Devices 1.0, Section 4.6.1.2, Table 4-21, page 62-63
  2452. 7, // bLength
  2453. 0x25, // bDescriptorType, 0x25 = CS_ENDPOINT
  2454. 1, // bDescriptorSubtype, 1 = EP_GENERAL
  2455. 0x00, // bmAttributes
  2456. 0, // bLockDelayUnits, 1 = ms
  2457. 0x00, 0x00, // wLockDelay
  2458. // Standard AS Interface Descriptor
  2459. // USB DCD for Audio Devices 1.0, Section 4.5.1, Table 4-18, page 59
  2460. // Alternate 0: default setting, disabled zero bandwidth
  2461. 9, // bLenght
  2462. 4, // bDescriptorType = INTERFACE
  2463. AUDIO_INTERFACE+2, // bInterfaceNumber
  2464. 0, // bAlternateSetting
  2465. 0, // bNumEndpoints
  2466. 1, // bInterfaceClass, 1 = AUDIO
  2467. 2, // bInterfaceSubclass, 2 = AUDIO_STREAMING
  2468. 0, // bInterfaceProtocol
  2469. 0, // iInterface
  2470. // Alternate 1: streaming data
  2471. 9, // bLenght
  2472. 4, // bDescriptorType = INTERFACE
  2473. AUDIO_INTERFACE+2, // bInterfaceNumber
  2474. 1, // bAlternateSetting
  2475. 2, // bNumEndpoints
  2476. 1, // bInterfaceClass, 1 = AUDIO
  2477. 2, // bInterfaceSubclass, 2 = AUDIO_STREAMING
  2478. 0, // bInterfaceProtocol
  2479. 0, // iInterface
  2480. // Class-Specific AS Interface Descriptor
  2481. // USB DCD for Audio Devices 1.0, Section 4.5.2, Table 4-19, page 60
  2482. 7, // bLength
  2483. 0x24, // bDescriptorType = CS_INTERFACE
  2484. 1, // bDescriptorSubtype, 1 = AS_GENERAL
  2485. 3, // bTerminalLink: Terminal ID = 3
  2486. 3, // bDelay (approx 3ms delay, audio lib updates)
  2487. 0x01, 0x00, // wFormatTag, 0x0001 = PCM
  2488. // Type I Format Descriptor
  2489. // USB DCD for Audio Data Formats 1.0, Section 2.2.5, Table 2-1, page 10
  2490. 11, // bLength
  2491. 0x24, // bDescriptorType = CS_INTERFACE
  2492. 2, // bDescriptorSubtype = FORMAT_TYPE
  2493. 1, // bFormatType = FORMAT_TYPE_I
  2494. 2, // bNrChannels = 2
  2495. 2, // bSubFrameSize = 2 byte
  2496. 16, // bBitResolution = 16 bits
  2497. 1, // bSamFreqType = 1 frequency
  2498. LSB(44100), MSB(44100), 0, // tSamFreq
  2499. // Standard AS Isochronous Audio Data Endpoint Descriptor
  2500. // USB DCD for Audio Devices 1.0, Section 4.6.1.1, Table 4-20, page 61-62
  2501. 9, // bLength
  2502. 5, // bDescriptorType, 5 = ENDPOINT_DESCRIPTOR
  2503. AUDIO_RX_ENDPOINT, // bEndpointAddress
  2504. 0x05, // bmAttributes = isochronous, asynchronous
  2505. LSB(AUDIO_RX_SIZE), MSB(AUDIO_RX_SIZE), // wMaxPacketSize
  2506. 1, // bInterval, 1 = every frame
  2507. 0, // bRefresh
  2508. AUDIO_SYNC_ENDPOINT | 0x80, // bSynchAddress
  2509. // Class-Specific AS Isochronous Audio Data Endpoint Descriptor
  2510. // USB DCD for Audio Devices 1.0, Section 4.6.1.2, Table 4-21, page 62-63
  2511. 7, // bLength
  2512. 0x25, // bDescriptorType, 0x25 = CS_ENDPOINT
  2513. 1, // bDescriptorSubtype, 1 = EP_GENERAL
  2514. 0x00, // bmAttributes
  2515. 0, // bLockDelayUnits, 1 = ms
  2516. 0x00, 0x00, // wLockDelay
  2517. // Standard AS Isochronous Audio Synch Endpoint Descriptor
  2518. // USB DCD for Audio Devices 1.0, Section 4.6.2.1, Table 4-22, page 63-64
  2519. 9, // bLength
  2520. 5, // bDescriptorType, 5 = ENDPOINT_DESCRIPTOR
  2521. AUDIO_SYNC_ENDPOINT | 0x80, // bEndpointAddress
  2522. 0x11, // bmAttributes = isochronous, feedback
  2523. 3, 0, // wMaxPacketSize, 3 bytes
  2524. 1, // bInterval, 1 = every frame
  2525. 5, // bRefresh, 5 = 32ms
  2526. 0, // bSynchAddress
  2527. #endif
  2528. #ifdef MULTITOUCH_INTERFACE
  2529. // configuration for 12 Mbit/sec speed
  2530. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  2531. 9, // bLength
  2532. 4, // bDescriptorType
  2533. MULTITOUCH_INTERFACE, // bInterfaceNumber
  2534. 0, // bAlternateSetting
  2535. 1, // bNumEndpoints
  2536. 0x03, // bInterfaceClass (0x03 = HID)
  2537. 0x00, // bInterfaceSubClass
  2538. 0x00, // bInterfaceProtocol
  2539. 0, // iInterface
  2540. // HID interface descriptor, HID 1.11 spec, section 6.2.1
  2541. 9, // bLength
  2542. 0x21, // bDescriptorType
  2543. 0x11, 0x01, // bcdHID
  2544. 0, // bCountryCode
  2545. 1, // bNumDescriptors
  2546. 0x22, // bDescriptorType
  2547. LSB(sizeof(multitouch_report_desc)), // wDescriptorLength
  2548. MSB(sizeof(multitouch_report_desc)),
  2549. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  2550. 7, // bLength
  2551. 5, // bDescriptorType
  2552. MULTITOUCH_ENDPOINT | 0x80, // bEndpointAddress
  2553. 0x03, // bmAttributes (0x03=intr)
  2554. MULTITOUCH_SIZE, 0, // wMaxPacketSize
  2555. 1, // bInterval
  2556. #endif // MULTITOUCH_INTERFACE
  2557. #ifdef EXPERIMENTAL_INTERFACE
  2558. // configuration for 12 Mbit/sec speed
  2559. // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
  2560. 9, // bLength
  2561. 4, // bDescriptorType
  2562. EXPERIMENTAL_INTERFACE, // bInterfaceNumber
  2563. 0, // bAlternateSetting
  2564. 1, // bNumEndpoints
  2565. 0xFF, // bInterfaceClass (0xFF = Vendor)
  2566. 0x6A, // bInterfaceSubClass
  2567. 0xFF, // bInterfaceProtocol
  2568. 0, // iInterface
  2569. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  2570. 7, // bLength
  2571. 5, // bDescriptorType
  2572. 1 | 0x80, // bEndpointAddress
  2573. 0x02, // bmAttributes (0x02=bulk)
  2574. LSB(64), MSB(64), // wMaxPacketSize
  2575. 1, // bInterval
  2576. // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
  2577. 7, // bLength
  2578. 5, // bDescriptorType
  2579. 1, // bEndpointAddress
  2580. 0x02, // bmAttributes (0x02=bulk)
  2581. LSB(64), MSB(64), // wMaxPacketSize
  2582. 1, // bInterval
  2583. #endif // EXPERIMENTAL_INTERFACE
  2584. };
  2585. __attribute__ ((section(".dmabuffers"), aligned(32)))
  2586. uint8_t usb_descriptor_buffer[CONFIG_DESC_SIZE];
  2587. // **************************************************************
  2588. // String Descriptors
  2589. // **************************************************************
  2590. // The descriptors above can provide human readable strings,
  2591. // referenced by index numbers. These descriptors are the
  2592. // actual string data
  2593. /* defined in usb_names.h
  2594. struct usb_string_descriptor_struct {
  2595. uint8_t bLength;
  2596. uint8_t bDescriptorType;
  2597. uint16_t wString[];
  2598. };
  2599. */
  2600. extern struct usb_string_descriptor_struct usb_string_manufacturer_name
  2601. __attribute__ ((weak, alias("usb_string_manufacturer_name_default")));
  2602. extern struct usb_string_descriptor_struct usb_string_product_name
  2603. __attribute__ ((weak, alias("usb_string_product_name_default")));
  2604. extern struct usb_string_descriptor_struct usb_string_serial_number
  2605. __attribute__ ((weak, alias("usb_string_serial_number_default")));
  2606. PROGMEM const struct usb_string_descriptor_struct string0 = {
  2607. 4,
  2608. 3,
  2609. {0x0409}
  2610. };
  2611. PROGMEM const struct usb_string_descriptor_struct usb_string_manufacturer_name_default = {
  2612. 2 + MANUFACTURER_NAME_LEN * 2,
  2613. 3,
  2614. MANUFACTURER_NAME
  2615. };
  2616. PROGMEM const struct usb_string_descriptor_struct usb_string_product_name_default = {
  2617. 2 + PRODUCT_NAME_LEN * 2,
  2618. 3,
  2619. PRODUCT_NAME
  2620. };
  2621. struct usb_string_descriptor_struct usb_string_serial_number_default = {
  2622. 12,
  2623. 3,
  2624. {0,0,0,0,0,0,0,0,0,0}
  2625. };
  2626. #ifdef MTP_INTERFACE
  2627. PROGMEM const struct usb_string_descriptor_struct usb_string_mtp = {
  2628. 2 + 3 * 2,
  2629. 3,
  2630. {'M','T','P'}
  2631. };
  2632. #endif
  2633. void usb_init_serialnumber(void)
  2634. {
  2635. char buf[11];
  2636. uint32_t i, num;
  2637. num = HW_OCOTP_MAC0 & 0xFFFFFF;
  2638. // add extra zero to work around OS-X CDC-ACM driver bug
  2639. if (num < 10000000) num = num * 10;
  2640. ultoa(num, buf, 10);
  2641. for (i=0; i<10; i++) {
  2642. char c = buf[i];
  2643. if (!c) break;
  2644. usb_string_serial_number_default.wString[i] = c;
  2645. }
  2646. usb_string_serial_number_default.bLength = i * 2 + 2;
  2647. }
  2648. // **************************************************************
  2649. // Descriptors List
  2650. // **************************************************************
  2651. // This table provides access to all the descriptor data above.
  2652. const usb_descriptor_list_t usb_descriptor_list[] = {
  2653. //wValue, wIndex, address, length
  2654. {0x0100, 0x0000, device_descriptor, sizeof(device_descriptor)},
  2655. {0x0600, 0x0000, qualifier_descriptor, sizeof(qualifier_descriptor)},
  2656. {0x0200, 0x0000, usb_config_descriptor_480, CONFIG_DESC_SIZE},
  2657. {0x0700, 0x0000, usb_config_descriptor_12, CONFIG_DESC_SIZE},
  2658. #ifdef SEREMU_INTERFACE
  2659. {0x2200, SEREMU_INTERFACE, seremu_report_desc, sizeof(seremu_report_desc)},
  2660. {0x2100, SEREMU_INTERFACE, usb_config_descriptor_480+SEREMU_HID_DESC_OFFSET, 9},
  2661. #endif
  2662. #ifdef KEYBOARD_INTERFACE
  2663. {0x2200, KEYBOARD_INTERFACE, keyboard_report_desc, sizeof(keyboard_report_desc)},
  2664. {0x2100, KEYBOARD_INTERFACE, usb_config_descriptor_480+KEYBOARD_HID_DESC_OFFSET, 9},
  2665. #endif
  2666. #ifdef MOUSE_INTERFACE
  2667. {0x2200, MOUSE_INTERFACE, mouse_report_desc, sizeof(mouse_report_desc)},
  2668. {0x2100, MOUSE_INTERFACE, usb_config_descriptor_480+MOUSE_HID_DESC_OFFSET, 9},
  2669. #endif
  2670. #ifdef JOYSTICK_INTERFACE
  2671. {0x2200, JOYSTICK_INTERFACE, joystick_report_desc, sizeof(joystick_report_desc)},
  2672. {0x2100, JOYSTICK_INTERFACE, usb_config_descriptor_480+JOYSTICK_HID_DESC_OFFSET, 9},
  2673. #endif
  2674. #ifdef RAWHID_INTERFACE
  2675. {0x2200, RAWHID_INTERFACE, rawhid_report_desc, sizeof(rawhid_report_desc)},
  2676. {0x2100, RAWHID_INTERFACE, usb_config_descriptor_480+RAWHID_HID_DESC_OFFSET, 9},
  2677. #endif
  2678. #ifdef FLIGHTSIM_INTERFACE
  2679. {0x2200, FLIGHTSIM_INTERFACE, flightsim_report_desc, sizeof(flightsim_report_desc)},
  2680. {0x2100, FLIGHTSIM_INTERFACE, usb_config_descriptor_480+FLIGHTSIM_HID_DESC_OFFSET, 9},
  2681. #endif
  2682. #ifdef KEYMEDIA_INTERFACE
  2683. {0x2200, KEYMEDIA_INTERFACE, keymedia_report_desc, sizeof(keymedia_report_desc)},
  2684. {0x2100, KEYMEDIA_INTERFACE, usb_config_descriptor_480+KEYMEDIA_HID_DESC_OFFSET, 9},
  2685. #endif
  2686. #ifdef MULTITOUCH_INTERFACE
  2687. {0x2200, MULTITOUCH_INTERFACE, multitouch_report_desc, sizeof(multitouch_report_desc)},
  2688. {0x2100, MULTITOUCH_INTERFACE, usb_config_descriptor_480+MULTITOUCH_HID_DESC_OFFSET, 9},
  2689. #endif
  2690. #ifdef MTP_INTERFACE
  2691. {0x0304, 0x0409, (const uint8_t *)&usb_string_mtp, 0},
  2692. #endif
  2693. {0x0300, 0x0000, (const uint8_t *)&string0, 0},
  2694. {0x0301, 0x0409, (const uint8_t *)&usb_string_manufacturer_name, 0},
  2695. {0x0302, 0x0409, (const uint8_t *)&usb_string_product_name, 0},
  2696. {0x0303, 0x0409, (const uint8_t *)&usb_string_serial_number, 0},
  2697. {0, 0, NULL, 0}
  2698. };
  2699. #endif // NUM_ENDPOINTS
  2700. //#endif // F_CPU >= 20 MHz