Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

2384 linhas
113KB

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