@@ -240,90 +240,6 @@ bool Adafruit_USBD_Device::addInterface(Adafruit_USBD_Interface &itf) {
240
240
return false ;
241
241
}
242
242
243
- #if 0
244
- uint8_t *desc_end = desc + len;
245
- const char *desc_str = itf.getStringDescriptor();
246
-
247
- // Parse interface descriptor to update
248
- // - IAD: interface number
249
- // - Interface: number & string descriptor
250
- // - Endpoint: address
251
- while (desc < desc_end) {
252
- switch (tu_desc_type(desc)) {
253
- case TUSB_DESC_INTERFACE_ASSOCIATION: {
254
- tusb_desc_interface_assoc_t *desc_iad =
255
- (tusb_desc_interface_assoc_t *)desc;
256
- desc_iad->bFirstInterface = _itf_count;
257
- break;
258
- }
259
-
260
- case TUSB_DESC_INTERFACE: {
261
- tusb_desc_interface_t *desc_itf = (tusb_desc_interface_t *)desc;
262
- desc_itf->bInterfaceNumber = _itf_count;
263
-
264
- #if CFG_TUD_VIDEO && CFG_TUD_VIDEO_STREAMING
265
- if (TUSB_CLASS_VIDEO == desc_itf->bInterfaceClass) {
266
- desc += tu_desc_len(desc); // next to CS Interface
267
-
268
- if (TUSB_DESC_CS_INTERFACE == tu_desc_type(desc)) {
269
- uint8_t const subtype = desc[2];
270
-
271
- if (VIDEO_SUBCLASS_CONTROL == desc_itf->bInterfaceSubClass) {
272
- // Adjust stream interface number in VC Header
273
- if (subtype == VIDEO_CS_ITF_VC_HEADER) {
274
- uint8_t const vs_count = desc[11];
275
- for (uint8_t i = 0; i < vs_count; i++) {
276
- desc[12 + i] += _itf_count;
277
- }
278
- }
279
- } else if (VIDEO_SUBCLASS_STREAMING == desc_itf->bInterfaceSubClass) {
280
- // Adjust the endpoint address in CS VS Input/Output Header
281
- if (subtype == VIDEO_CS_ITF_VS_INPUT_HEADER) {
282
- desc[6] = 0x80 | _epin_count;
283
- } else if (subtype == VIDEO_CS_ITF_VS_OUTPUT_HEADER) {
284
- desc[6] = _epout_count;
285
- }
286
- }
287
- }
288
- }
289
- #endif
290
-
291
- if (desc_itf->bAlternateSetting == 0) {
292
- _itf_count++;
293
- if (desc_str && (_desc_str_count < STRING_DESCRIPTOR_MAX)) {
294
- _desc_str_arr[_desc_str_count] = desc_str;
295
- desc_itf->iInterface = _desc_str_count;
296
- _desc_str_count++;
297
-
298
- // only assign string index to first interface
299
- desc_str = NULL;
300
- } else {
301
- desc_itf->iInterface = 0;
302
- }
303
- }
304
-
305
- break;
306
- }
307
-
308
- case TUSB_DESC_ENDPOINT: {
309
- tusb_desc_endpoint_t *desc_ep = (tusb_desc_endpoint_t *)desc;
310
- desc_ep->bEndpointAddress |=
311
- (desc_ep->bEndpointAddress & 0x80) ? _epin_count++ : _epout_count++;
312
- break;
313
- }
314
-
315
- default:
316
- break;
317
- }
318
-
319
- if (desc[0] == 0) {
320
- return false;
321
- }
322
-
323
- desc += tu_desc_len(desc);
324
- }
325
- #endif
326
-
327
243
_desc_cfg_len += len;
328
244
329
245
// Update configuration descriptor
0 commit comments