Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
CTCaer
GitHub Repository: CTCaer/hekate
Path: blob/master/bdk/usb/usb_descriptors.c
1476 views
1
/*
2
* USB driver for Tegra X1
3
*
4
* Copyright (c) 2019-2020 CTCaer
5
*
6
* This program is free software; you can redistribute it and/or modify it
7
* under the terms and conditions of the GNU General Public License,
8
* version 2, as published by the Free Software Foundation.
9
*
10
* This program is distributed in the hope it will be useful, but WITHOUT
11
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13
* more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#include <usb/usb_descriptor_types.h>
20
#include <utils/types.h>
21
22
static usb_dev_descr_t usb_device_descriptor_ums =
23
{
24
.bLength = 18,
25
.bDescriptorType = USB_DESCRIPTOR_DEVICE,
26
.bcdUSB = 0x210,
27
.bDeviceClass = 0x00,
28
.bDeviceSubClass = 0x00,
29
.bDeviceProtocol = 0x00,
30
.bMaxPacketSize = 0x40,
31
.idVendor = 0x11EC, // Nintendo: 0x057E, Nvidia: 0x0955
32
.idProduct = 0xA7E0, // Switch: 0x2000, usbd: 0x3000
33
.bcdDevice = 0x0101,
34
.iManufacturer = 1,
35
.iProduct = 2,
36
.iSerialNumber = 3,
37
.bNumConfigs = 1
38
};
39
40
static usb_dev_qual_descr_t usb_device_qualifier_descriptor =
41
{
42
.bLength = 10,
43
.bDescriptorType = USB_DESCRIPTOR_DEVICE_QUALIFIER,
44
.bcdUSB = 0x210,
45
.bDeviceClass = 0x00,
46
.bDeviceSubClass = 0x00,
47
.bDeviceProtocol = 0x00,
48
.bMaxPacketSize = 0x40,
49
.bNumOtherConfigs = 0x01,
50
.bReserved = 0x00
51
};
52
53
static usb_cfg_simple_descr_t usb_configuration_descriptor_ums =
54
{
55
/* Configuration descriptor structure */
56
.config.bLength = 9,
57
.config.bDescriptorType = USB_DESCRIPTOR_CONFIGURATION,
58
.config.wTotalLength = 0x20,
59
.config.bNumInterfaces = 0x01,
60
.config.bConfigurationValue = 0x01,
61
.config.iConfiguration = 0x00,
62
.config.bmAttributes = USB_ATTR_SELF_POWERED | USB_ATTR_BUS_POWERED_RSVD,
63
.config.bMaxPower = 32 / 2,
64
65
/* Interface descriptor structure */
66
.interface.bLength = 9,
67
.interface.bDescriptorType = USB_DESCRIPTOR_INTERFACE,
68
.interface.bInterfaceNumber = 0,
69
.interface.bAlternateSetting = 0,
70
.interface.bNumEndpoints = 2,
71
.interface.bInterfaceClass = 0x08, // Mass Storage Class.
72
.interface.bInterfaceSubClass = 0x06, // SCSI Transparent Command Set.
73
.interface.bInterfaceProtocol = 0x50, // Bulk-Only Transport.
74
.interface.iInterface = 0x00,
75
76
/* Endpoint descriptor structure EP1 IN */
77
.endpoint[0].bLength = 7,
78
.endpoint[0].bDescriptorType = USB_DESCRIPTOR_ENDPOINT,
79
.endpoint[0].bEndpointAddress = 0x81, // USB_EP_ADDR_BULK_IN.
80
.endpoint[0].bmAttributes = USB_EP_TYPE_BULK,
81
.endpoint[0].wMaxPacketSize = 0x200,
82
.endpoint[0].bInterval = 0x00,
83
84
/* Endpoint descriptor structure EP1 OUT */
85
.endpoint[1].bLength = 7,
86
.endpoint[1].bDescriptorType = USB_DESCRIPTOR_ENDPOINT,
87
.endpoint[1].bEndpointAddress = 0x01, // USB_EP_ADDR_BULK_OUT.
88
.endpoint[1].bmAttributes = USB_EP_TYPE_BULK,
89
.endpoint[1].wMaxPacketSize = 0x200,
90
.endpoint[1].bInterval = 0x00
91
};
92
93
static usb_cfg_simple_descr_t usb_other_speed_config_descriptor_ums =
94
{
95
/* Other Speed Configuration descriptor structure */
96
.config.bLength = 9,
97
.config.bDescriptorType = USB_DESCRIPTOR_OTHER_SPEED_CONFIGURATION,
98
.config.wTotalLength = 0x20,
99
.config.bNumInterfaces = 0x01,
100
.config.bConfigurationValue = 0x01,
101
.config.iConfiguration = 0x00,
102
.config.bmAttributes = USB_ATTR_SELF_POWERED | USB_ATTR_BUS_POWERED_RSVD,
103
.config.bMaxPower = 32 / 2,
104
105
/* Interface descriptor structure */
106
.interface.bLength = 9,
107
.interface.bDescriptorType = USB_DESCRIPTOR_INTERFACE,
108
.interface.bInterfaceNumber = 0x00,
109
.interface.bAlternateSetting = 0x00,
110
.interface.bNumEndpoints = 2,
111
.interface.bInterfaceClass = 0x08, // Mass Storage Class.
112
.interface.bInterfaceSubClass = 0x06, // SCSI Transparent Command Set.
113
.interface.bInterfaceProtocol = 0x50, // Bulk-Only Transport.
114
.interface.iInterface = 0x00,
115
116
/* Endpoint descriptor structure EP1 IN */
117
.endpoint[0].bLength = 7,
118
.endpoint[0].bDescriptorType = USB_DESCRIPTOR_ENDPOINT,
119
.endpoint[0].bEndpointAddress = 0x81, // USB_EP_ADDR_BULK_IN.
120
.endpoint[0].bmAttributes = USB_EP_TYPE_BULK,
121
.endpoint[0].wMaxPacketSize = 0x40,
122
.endpoint[0].bInterval = 0,
123
124
/* Endpoint descriptor structure EP1 OUT */
125
.endpoint[1].bLength = 7,
126
.endpoint[1].bDescriptorType = USB_DESCRIPTOR_ENDPOINT,
127
.endpoint[1].bEndpointAddress = 0x01, // USB_EP_ADDR_BULK_OUT.
128
.endpoint[1].bmAttributes = USB_EP_TYPE_BULK,
129
.endpoint[1].wMaxPacketSize = 0x40,
130
.endpoint[1].bInterval = 0
131
};
132
133
static usb_dev_bot_t usb_device_binary_object_descriptor =
134
{
135
.bLength = 5,
136
.bDescriptorType = USB_DESCRIPTOR_DEVICE_BINARY_OBJECT,
137
.wTotalLength = 22,
138
.bNumDeviceCaps = 2,
139
140
/* Device Capability USB 2.0 Extension Descriptor */
141
.bLengthCap0 = 7,
142
.bDescriptorTypeCap0 = USB_DESCRIPTOR_DEVICE_BINARY_OBJECT_CAP,
143
.bDevCapabilityTypeCap0 = 2, // USB2.
144
.bmAttributesCap0 = 0,
145
146
/* Device Capability SuperSpeed Descriptor */
147
/* Needed for a USB2.10 device. */
148
.bLengthCap1 = 10,
149
.bDescriptorTypeCap1 = USB_DESCRIPTOR_DEVICE_BINARY_OBJECT_CAP,
150
.bDevCapabilityTypeCap1 = 3, // USB3.
151
.bmAttributesCap1 = 0,
152
.wSpeedsSupported = 0x6, // FS | HS.
153
.bFunctionalitySupport = 1, // FS and above.
154
.bU1DevExitLat = 0,
155
.wU2DevExitLat = 0
156
};
157
158
static u8 usb_lang_id_string_descriptor[4] =
159
{
160
4, 3,
161
0x09, 0x04
162
};
163
164
static u8 usb_serial_string_descriptor[26] =
165
{
166
26, 0x03,
167
'C', 0x00, '7', 0x00, 'C', 0x00, '0', 0x00,
168
'9', 0x00, '2', 0x00, '4', 0x00, '2', 0x00, 'F', 0x00, '7', 0x00, '0', 0x00, '3', 0x00
169
};
170
171
static u8 usb_vendor_string_descriptor_ums[32] =
172
{
173
26, 0x03,
174
'N', 0, 'y', 0, 'x', 0, ' ', 0, 'U', 0, 'S', 0, 'B', 0, ' ', 0,
175
'D', 0, 'i', 0, 's', 0, 'k', 0
176
};
177
178
static u8 usb_product_string_descriptor_ums[22] =
179
{
180
8, 0x03,
181
'U', 0, 'M', 0, 'S', 0
182
};
183
184
static usb_ms_os_descr_t usb_ms_os_descriptor =
185
{
186
.bLength = 0x28,
187
.bDescriptorType = 0x03,
188
.wSignature[0] = 'M',
189
.wSignature[1] = 'S',
190
.wSignature[2] = 'F',
191
.wSignature[3] = 'T',
192
.wSignature[4] = '1',
193
.wSignature[5] = '0',
194
.wSignature[6] = '0',
195
.bVendorCode = 0x99,
196
};
197
198
static usb_ms_cid_descr_t usb_ms_cid_descriptor =
199
{
200
.dLength = 0x28,
201
.wVersion = 0x100,
202
.wCompatibilityId = USB_DESCRIPTOR_MS_COMPAT_ID,
203
.bSections = 1,
204
.bInterfaceNumber = 0,
205
.bReserved1 = 1,
206
207
.bCompatibleId[0] = 'N',
208
.bCompatibleId[1] = 'Y',
209
.bCompatibleId[2] = 'X',
210
.bCompatibleId[3] = 'U',
211
.bCompatibleId[4] = 'S',
212
.bCompatibleId[5] = 'B',
213
};
214
215
static usb_ms_ext_prop_descr_t usb_ms_ext_prop_descriptor_ums =
216
{
217
.dLength = 0x48,
218
.wVersion = 0x100,
219
.wExtendedProperty = USB_DESCRIPTOR_MS_EXTENDED_PROPERTIES,
220
.wSections = 1,
221
222
.dPropertySize = 0x3E,
223
.dPropertyType = 4, // DWORD
224
225
.wPropertyNameLength = 0x2C,
226
.wPropertyName[0] = 'M', // MaximumTransferLength.
227
.wPropertyName[1] = 'a',
228
.wPropertyName[2] = 'x',
229
.wPropertyName[3] = 'i',
230
.wPropertyName[4] = 'm',
231
.wPropertyName[5] = 'u',
232
.wPropertyName[6] = 'm',
233
.wPropertyName[7] = 'T',
234
.wPropertyName[8] = 'r',
235
.wPropertyName[9] = 'a',
236
.wPropertyName[10] = 'n',
237
.wPropertyName[11] = 's',
238
.wPropertyName[12] = 'f',
239
.wPropertyName[13] = 'e',
240
.wPropertyName[14] = 'r',
241
.wPropertyName[15] = 'L',
242
.wPropertyName[16] = 'e',
243
.wPropertyName[17] = 'n',
244
.wPropertyName[18] = 'g',
245
.wPropertyName[19] = 't',
246
.wPropertyName[20] = 'h',
247
.wPropertyName[21] = 0,
248
249
.dPropertyDataLength = 0x4,
250
.wPropertyData[0] = 0x00, // 1MB.
251
.wPropertyData[1] = 0x10,
252
};
253
254
static usb_ms_ext_prop_descr_t usb_ms_ext_prop_descriptor_hid =
255
{
256
.dLength = 7,
257
.wVersion = 0x100,
258
.wExtendedProperty = USB_DESCRIPTOR_MS_EXTENDED_PROPERTIES,
259
.wSections = 0,
260
};
261
262
static usb_dev_descr_t usb_device_descriptor_hid_jc =
263
{
264
.bLength = 18,
265
.bDescriptorType = USB_DESCRIPTOR_DEVICE,
266
.bcdUSB = 0x210,
267
.bDeviceClass = 0x00,
268
.bDeviceSubClass = 0x00,
269
.bDeviceProtocol = 0x00,
270
.bMaxPacketSize = 0x40,
271
.idVendor = 0x11EC, // Nintendo: 0x057E, Nvidia: 0x0955
272
.idProduct = 0xA7E1, // Switch: 0x2000, usbd: 0x3000
273
.bcdDevice = 0x0101,
274
.iManufacturer = 1,
275
.iProduct = 2,
276
.iSerialNumber = 3,
277
.bNumConfigs = 1
278
};
279
280
static usb_dev_descr_t usb_device_descriptor_hid_touch =
281
{
282
.bLength = 18,
283
.bDescriptorType = USB_DESCRIPTOR_DEVICE,
284
.bcdUSB = 0x210,
285
.bDeviceClass = 0x00,
286
.bDeviceSubClass = 0x00,
287
.bDeviceProtocol = 0x00,
288
.bMaxPacketSize = 0x40,
289
.idVendor = 0x11EC, // Nintendo: 0x057E, Nvidia: 0x0955
290
.idProduct = 0xA7E2, // Switch: 0x2000, usbd: 0x3000
291
.bcdDevice = 0x0101,
292
.iManufacturer = 1,
293
.iProduct = 2,
294
.iSerialNumber = 3,
295
.bNumConfigs = 1
296
};
297
298
u8 hid_report_descriptor_jc[] =
299
{
300
0x05, 0x01, // USAGE_PAGE (Generic Desktop),
301
0x09, 0x04, // USAGE (Joystick),
302
0xa1, 0x01, // COLLECTION (Application),
303
0xa1, 0x02, // COLLECTION (Logical),
304
0x75, 0x08, // REPORT_SIZE (8),
305
0x95, 0x04, // REPORT_COUNT (4),
306
0x15, 0x00, // LOGICAL_MINIMUM (0),
307
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255),
308
0x35, 0x00, // PHYSICAL_MINIMUM (0),
309
0x46, 0xff, 0x00, // PHYSICAL_MAXIMUM (255),
310
0x09, 0x30, // USAGE (X_ID),
311
0x09, 0x31, // USAGE (Y_ID),
312
0x09, 0x32, // USAGE (Z_ID),
313
0x09, 0x35, // USAGE (Rz_ID),
314
0x81, 0x02, // INPUT (IOF_Variable),
315
0x75, 0x04, // REPORT_SIZE (4),
316
0x95, 0x01, // REPORT_COUNT (1),
317
0x25, 0x07, // LOGICAL_MAXIMUM (7),
318
0x46, 0x3b, 0x01, // PHYSICAL_MAXIMUM (315),
319
0x65, 0x14, // UNIT (Eng_Rot_Angular_Pos),
320
0x09, 0x39, // USAGE (Hat_Switch),
321
0x81, 0x42, // INPUT (IOF_NullposVar),
322
0x65, 0x00, // UNIT (Unit_None),
323
0x75, 0x01, // REPORT_SIZE (1),
324
0x95, 0x0c, // REPORT_COUNT (12),
325
0x25, 0x01, // LOGICAL_MAXIMUM (1),
326
0x45, 0x01, // PHYSICAL_MAXIMUM (1),
327
0x05, 0x09, // USAGE_PAGE (Button_ID),
328
0x19, 0x01, // USAGE_MINIMUM (1),
329
0x29, 0x0c, // USAGE_MAXIMUM (12),
330
0x81, 0x02, // INPUT (IOF_Variable),
331
0xc0, // END_COLLECTION(),
332
0xc0 // END_COLLECTION(),
333
};
334
335
u32 hid_report_descriptor_jc_size = sizeof(hid_report_descriptor_jc);
336
337
u8 hid_report_descriptor_touch[] =
338
{
339
0x05, 0x0d, // USAGE_PAGE (Digitizers)
340
0x09, 0x05, // USAGE (Touch Pad)
341
0xa1, 0x01, // COLLECTION (Application)
342
0x85, 0x05, // REPORT_ID (Touch pad)
343
0x09, 0x22, // USAGE (Finger)
344
0xa1, 0x02, // COLLECTION (Logical)
345
0x15, 0x00, // LOGICAL_MINIMUM (0)
346
0x25, 0x01, // LOGICAL_MAXIMUM (1)
347
0x09, 0x42, // USAGE (Tip switch)
348
0x95, 0x01, // REPORT_COUNT (1)
349
0x75, 0x01, // REPORT_SIZE (1)
350
0x81, 0x02, // INPUT (Data,Var,Abs)
351
352
0x15, 0x00, // LOGICAL_MINIMUM (1)
353
0x25, 0x01, // LOGICAL_MAXIMUM (1)
354
0x75, 0x01, // REPORT_SIZE (1)
355
0x95, 0x07, // REPORT_COUNT (7)
356
0x09, 0x54, // USAGE (Contact Count)
357
0x81, 0x02, // INPUT (Data,Var,Abs)
358
359
0x95, 0x01, // REPORT_COUNT (1)
360
0x75, 0x08, // REPORT_SIZE (8)
361
0x15, 0x00, // LOGICAL_MINIMUM (0)
362
0x25, 0x0A, // LOGICAL_MAXIMUM (10)
363
0x09, 0x51, // USAGE (Contact Identifier)
364
0x81, 0x02, // INPUT (Data,Var,Abs)
365
366
// 0x15, 0x00, // LOGICAL_MINIMUM (0)
367
// 0x26, 0xF8, 0x2A, // LOGICAL_MAXIMUM (11000)
368
// 0x95, 0x01, // REPORT_COUNT (1)
369
// 0x75, 0x08, // REPORT_SIZE (16)
370
// 0x09, 0x30, // USAGE (Pressure)
371
// 0x81, 0x02, // INPUT (Data,Var,Abs)
372
373
0x05, 0x01, // USAGE_PAGE (Generic Desk..
374
0x15, 0x00, // LOGICAL_MINIMUM (0)
375
0x26, 0xff, 0x04, // LOGICAL_MAXIMUM (1279)
376
0x75, 0x10, // REPORT_SIZE (16)
377
0x55, 0x0e, // UNIT_EXPONENT (-2)
378
0x65, 0x13, // UNIT(Inch,EngLinear)
379
0x09, 0x30, // USAGE (X)
380
0x35, 0x00, // PHYSICAL_MINIMUM (0)
381
0x46, 0xFF, 0x04, // PHYSICAL_MAXIMUM (1279)
382
0x95, 0x01, // REPORT_COUNT (1)
383
0x81, 0x02, // INPUT (Data,Var,Abs)
384
0x26, 0xCF, 0x02, // LOGICAL_MAXIMUM (719)
385
0x46, 0xCF, 0x02, // PHYSICAL_MAXIMUM (719)
386
0x09, 0x31, // USAGE (Y)
387
0x81, 0x02, // INPUT (Data,Var,Abs)
388
389
0x05, 0x0d, // USAGE PAGE (Digitizers)
390
0xc0, // END_COLLECTION
391
0xc0, // END_COLLECTION
392
};
393
u32 hid_report_descriptor_touch_size = sizeof(hid_report_descriptor_touch);
394
395
static usb_cfg_hid_descr_t usb_configuration_descriptor_hid_jc =
396
{
397
/* Configuration descriptor structure */
398
.config.bLength = 9,
399
.config.bDescriptorType = USB_DESCRIPTOR_CONFIGURATION,
400
.config.wTotalLength = sizeof(usb_cfg_hid_descr_t),
401
.config.bNumInterfaces = 0x01,
402
.config.bConfigurationValue = 0x01,
403
.config.iConfiguration = 0x00,
404
.config.bmAttributes = USB_ATTR_SELF_POWERED | USB_ATTR_BUS_POWERED_RSVD,
405
.config.bMaxPower = 32 / 2,
406
407
/* Interface descriptor structure */
408
.interface.bLength = 9,
409
.interface.bDescriptorType = USB_DESCRIPTOR_INTERFACE,
410
.interface.bInterfaceNumber = 0,
411
.interface.bAlternateSetting = 0,
412
.interface.bNumEndpoints = 2,
413
.interface.bInterfaceClass = 0x03, // Human Interface Device Class.
414
.interface.bInterfaceSubClass = 0x00, // SCSI Transparent Command Set.
415
.interface.bInterfaceProtocol = 0x00, // Bulk-Only Transport.
416
.interface.iInterface = 0x00,
417
418
.hid.bLength = 9,
419
.hid.bDescriptorType = USB_DESCRIPTOR_HID,
420
.hid.bcdHID = 0x110,
421
.hid.bCountryCode = 0,
422
.hid.bNumDescriptors = 1,
423
.hid.bClassDescriptorType = USB_DESCRIPTOR_HID_REPORT,
424
.hid.bDescriptorLength = sizeof(hid_report_descriptor_jc),
425
426
/* Endpoint descriptor structure EP1 IN */
427
.endpoint[0].bLength = 7,
428
.endpoint[0].bDescriptorType = USB_DESCRIPTOR_ENDPOINT,
429
.endpoint[0].bEndpointAddress = 0x81, // USB_EP_ADDR_BULK_IN.
430
.endpoint[0].bmAttributes = USB_EP_TYPE_INTR,
431
.endpoint[0].wMaxPacketSize = 0x200,
432
.endpoint[0].bInterval = 4, // 8ms on HS.
433
434
/* Endpoint descriptor structure EP1 OUT */
435
.endpoint[1].bLength = 7,
436
.endpoint[1].bDescriptorType = USB_DESCRIPTOR_ENDPOINT,
437
.endpoint[1].bEndpointAddress = 0x01, // USB_EP_ADDR_BULK_OUT.
438
.endpoint[1].bmAttributes = USB_EP_TYPE_INTR,
439
.endpoint[1].wMaxPacketSize = 0x200,
440
.endpoint[1].bInterval = 4 // 8ms on HS.
441
};
442
443
static u8 usb_vendor_string_descriptor_hid[22] =
444
{
445
16, 0x03,
446
'N', 0, 'y', 0, 'x', 0, ' ', 0,
447
'U', 0, 'S', 0, 'B', 0
448
};
449
450
static u8 usb_product_string_descriptor_hid_jc[24] =
451
{
452
24, 0x03,
453
'N', 0, 'y', 0, 'x', 0, ' ', 0,
454
'J', 0, 'o', 0, 'y', 0, '-', 0, 'C', 0, 'o', 0, 'n', 0
455
};
456
457
static u8 usb_product_string_descriptor_hid_touch[26] =
458
{
459
26, 0x03,
460
'N', 0, 'y', 0, 'x', 0, ' ', 0,
461
'T', 0, 'o', 0, 'u', 0, 'c', 0, 'h', 0, 'p', 0, 'a', 0, 'd', 0
462
};
463
464
static usb_cfg_hid_descr_t usb_configuration_descriptor_hid_touch =
465
{
466
/* Configuration descriptor structure */
467
.config.bLength = 9,
468
.config.bDescriptorType = USB_DESCRIPTOR_CONFIGURATION,
469
.config.wTotalLength = sizeof(usb_cfg_hid_descr_t),
470
.config.bNumInterfaces = 0x01,
471
.config.bConfigurationValue = 0x01,
472
.config.iConfiguration = 0x00,
473
.config.bmAttributes = USB_ATTR_SELF_POWERED | USB_ATTR_BUS_POWERED_RSVD,
474
.config.bMaxPower = 32 / 2,
475
476
/* Interface descriptor structure */
477
.interface.bLength = 9,
478
.interface.bDescriptorType = USB_DESCRIPTOR_INTERFACE,
479
.interface.bInterfaceNumber = 0,
480
.interface.bAlternateSetting = 0,
481
.interface.bNumEndpoints = 2,
482
.interface.bInterfaceClass = 0x03, // Human Interface Device Class.
483
.interface.bInterfaceSubClass = 0x00, // SCSI Transparent Command Set.
484
.interface.bInterfaceProtocol = 0x00, // Bulk-Only Transport.
485
.interface.iInterface = 0x00,
486
487
.hid.bLength = 9,
488
.hid.bDescriptorType = USB_DESCRIPTOR_HID,
489
.hid.bcdHID = 0x111,
490
.hid.bCountryCode = 0,
491
.hid.bNumDescriptors = 1,
492
.hid.bClassDescriptorType = USB_DESCRIPTOR_HID_REPORT,
493
.hid.bDescriptorLength = sizeof(hid_report_descriptor_touch),
494
495
/* Endpoint descriptor structure EP1 IN */
496
.endpoint[0].bLength = 7,
497
.endpoint[0].bDescriptorType = USB_DESCRIPTOR_ENDPOINT,
498
.endpoint[0].bEndpointAddress = 0x81, // USB_EP_ADDR_BULK_IN.
499
.endpoint[0].bmAttributes = USB_EP_TYPE_INTR,
500
.endpoint[0].wMaxPacketSize = 0x200,
501
.endpoint[0].bInterval = 3, // 4ms on HS.
502
503
/* Endpoint descriptor structure EP1 OUT */
504
.endpoint[1].bLength = 7,
505
.endpoint[1].bDescriptorType = USB_DESCRIPTOR_ENDPOINT,
506
.endpoint[1].bEndpointAddress = 0x01, // USB_EP_ADDR_BULK_OUT.
507
.endpoint[1].bmAttributes = USB_EP_TYPE_INTR,
508
.endpoint[1].wMaxPacketSize = 0x200,
509
.endpoint[1].bInterval = 3 // 4ms on HS.
510
};
511
512
usb_desc_t usb_gadget_ums_descriptors =
513
{
514
.dev = &usb_device_descriptor_ums,
515
.dev_qual = &usb_device_qualifier_descriptor,
516
.cfg = &usb_configuration_descriptor_ums,
517
.cfg_other = &usb_other_speed_config_descriptor_ums,
518
.dev_bot = &usb_device_binary_object_descriptor,
519
.vendor = usb_vendor_string_descriptor_ums,
520
.product = usb_product_string_descriptor_ums,
521
.serial = usb_serial_string_descriptor,
522
.lang_id = usb_lang_id_string_descriptor,
523
.ms_os = &usb_ms_os_descriptor,
524
.ms_cid = &usb_ms_cid_descriptor,
525
.mx_ext = &usb_ms_ext_prop_descriptor_ums
526
};
527
528
usb_desc_t usb_gadget_hid_jc_descriptors =
529
{
530
.dev = &usb_device_descriptor_hid_jc,
531
.dev_qual = &usb_device_qualifier_descriptor,
532
.cfg = (usb_cfg_simple_descr_t *)&usb_configuration_descriptor_hid_jc,
533
.cfg_other = NULL,
534
.dev_bot = &usb_device_binary_object_descriptor,
535
.vendor = usb_vendor_string_descriptor_hid,
536
.product = usb_product_string_descriptor_hid_jc,
537
.serial = usb_serial_string_descriptor,
538
.lang_id = usb_lang_id_string_descriptor,
539
.ms_os = &usb_ms_os_descriptor,
540
.ms_cid = &usb_ms_cid_descriptor,
541
.mx_ext = &usb_ms_ext_prop_descriptor_hid
542
};
543
544
usb_desc_t usb_gadget_hid_touch_descriptors =
545
{
546
.dev = &usb_device_descriptor_hid_touch,
547
.dev_qual = &usb_device_qualifier_descriptor,
548
.cfg = (usb_cfg_simple_descr_t *)&usb_configuration_descriptor_hid_touch,
549
.cfg_other = NULL,
550
.dev_bot = &usb_device_binary_object_descriptor,
551
.vendor = usb_vendor_string_descriptor_hid,
552
.product = usb_product_string_descriptor_hid_touch,
553
.serial = usb_serial_string_descriptor,
554
.lang_id = usb_lang_id_string_descriptor,
555
.ms_os = &usb_ms_os_descriptor,
556
.ms_cid = &usb_ms_cid_descriptor,
557
.mx_ext = &usb_ms_ext_prop_descriptor_hid
558
};
559
560