@@ -66,15 +66,10 @@ void Adafruit_USBD_Device::clearConfiguration(void)
66
66
.bLength = sizeof (tusb_desc_device_t ),
67
67
.bDescriptorType = TUSB_DESC_DEVICE,
68
68
.bcdUSB = 0x0200 ,
69
-
70
- // Use Interface Association Descriptor (IAD) for CDC
71
- // As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
72
- .bDeviceClass = TUSB_CLASS_MISC,
73
- .bDeviceSubClass = MISC_SUBCLASS_COMMON,
74
- .bDeviceProtocol = MISC_PROTOCOL_IAD,
75
-
69
+ .bDeviceClass = 0 ,
70
+ .bDeviceSubClass = 0 ,
71
+ .bDeviceProtocol = 0 ,
76
72
.bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
77
-
78
73
.idVendor = 0 ,
79
74
.idProduct = 0 ,
80
75
.bcdDevice = 0x0100 ,
@@ -84,7 +79,7 @@ void Adafruit_USBD_Device::clearConfiguration(void)
84
79
.bNumConfigurations = 0x01
85
80
};
86
81
87
- memcpy ( _desc_device, &desc_dev, sizeof ( tusb_desc_device_t )) ;
82
+ _desc_device = desc_dev ;
88
83
89
84
uint8_t const dev_cfg [sizeof (tusb_desc_configuration_t )] =
90
85
{
@@ -124,7 +119,7 @@ bool Adafruit_USBD_Device::addInterface(Adafruit_USBD_Interface& itf)
124
119
if ( !len ) return false ;
125
120
126
121
// Parse interface descriptor to update
127
- // - Interface Number & string descrioptor
122
+ // - Interface Number & string descriptor
128
123
// - Endpoint address
129
124
while (desc < desc_end)
130
125
{
@@ -175,18 +170,18 @@ void Adafruit_USBD_Device::setConfigurationBuffer(uint8_t* buf, uint32_t buflen)
175
170
176
171
void Adafruit_USBD_Device::setID (uint16_t vid, uint16_t pid)
177
172
{
178
- (( tusb_desc_device_t *) _desc_device)-> idVendor = vid;
179
- (( tusb_desc_device_t *) _desc_device)-> idProduct = pid;
173
+ _desc_device. idVendor = vid;
174
+ _desc_device. idProduct = pid;
180
175
}
181
176
182
177
void Adafruit_USBD_Device::setVersion (uint16_t bcd)
183
178
{
184
- (( tusb_desc_device_t *) _desc_device)-> bcdUSB = bcd;
179
+ _desc_device. bcdUSB = bcd;
185
180
}
186
181
187
182
void Adafruit_USBD_Device::setDeviceVersion (uint16_t bcd)
188
183
{
189
- (( tusb_desc_device_t *) _desc_device)-> bcdDevice = bcd;
184
+ _desc_device. bcdDevice = bcd;
190
185
}
191
186
192
187
void Adafruit_USBD_Device::setLanguageDescriptor (uint16_t language_id)
@@ -233,6 +228,12 @@ bool Adafruit_USBD_Device::begin(uint8_t rhport)
233
228
setID (USB_VID, USB_PID);
234
229
235
230
// Serial is always added by default
231
+ // Use Interface Association Descriptor (IAD) for CDC
232
+ // As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
233
+ _desc_device.bDeviceClass = TUSB_CLASS_MISC;
234
+ _desc_device.bDeviceSubClass = MISC_SUBCLASS_COMMON;
235
+ _desc_device.bDeviceProtocol = MISC_PROTOCOL_IAD;
236
+
236
237
Serial.begin (115200 );
237
238
238
239
TinyUSB_Port_InitDeviceController (rhport);
@@ -317,7 +318,7 @@ extern "C"
317
318
// Application return pointer to descriptor
318
319
uint8_t const * tud_descriptor_device_cb (void )
319
320
{
320
- return USBDevice._desc_device ;
321
+ return ( uint8_t const * ) & USBDevice._desc_device ;
321
322
}
322
323
323
324
// Invoked when received GET CONFIGURATION DESCRIPTOR
0 commit comments