diff options
| author | hathach <[email protected]> | 2023-01-31 18:40:07 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2023-01-31 18:40:07 +0700 |
| commit | 95403ed9ac88077062c03525d44818b10be1cf6f (patch) | |
| tree | 43cfc7c36d9b27094b54190a08ad59f8377c6108 /src | |
| parent | b03a688b247e42ca161ec415ada773927a1190a5 (diff) | |
fix host issue when mounting an CDC device without IAD
Diffstat (limited to 'src')
| -rw-r--r-- | src/host/usbh.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/host/usbh.c b/src/host/usbh.c index 5ac9e9cca..12b0ed203 100644 --- a/src/host/usbh.c +++ b/src/host/usbh.c @@ -1522,7 +1522,7 @@ static bool _parse_configuration_descriptor(uint8_t dev_addr, tusb_desc_configur #if CFG_TUH_MIDI // MIDI has 2 interfaces (Audio Control v1 + MIDIStreaming) but does not have IAD - // manually increase the associated count + // manually force associated count = 2 if (1 == assoc_itf_count && TUSB_CLASS_AUDIO == desc_itf->bInterfaceClass && AUDIO_SUBCLASS_CONTROL == desc_itf->bInterfaceSubClass && @@ -1532,6 +1532,17 @@ static bool _parse_configuration_descriptor(uint8_t dev_addr, tusb_desc_configur } #endif +#if CFG_TUH_CDC + // Some legacy CDC device does not use IAD but rather use device class as hint to combine 2 interfaces + // manually force associated count = 2 + if (1 == assoc_itf_count && + TUSB_CLASS_CDC == desc_itf->bInterfaceClass && + CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL == desc_itf->bInterfaceSubClass) + { + assoc_itf_count = 2; + } +#endif + uint16_t const drv_len = tu_desc_get_interface_total_len(desc_itf, assoc_itf_count, (uint16_t) (desc_end-p_desc)); TU_ASSERT(drv_len >= sizeof(tusb_desc_interface_t)); |
