mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-21 21:41:09 +00:00
Merge pull request #1877 from hathach/fix-host-cdc-without-iad
Fix host cdc without iad
This commit is contained in:
commit
d6354a2aa7
@ -1,7 +1,7 @@
|
||||
.. figure:: docs/assets/logo.svg
|
||||
:alt: TinyUSB
|
||||
|
||||
|Build Status| |Documentation Status| |License|
|
||||
|Build Status| |Documentation Status| |Fuzzing Status| |License|
|
||||
|
||||
TinyUSB is an open-source cross-platform USB Host/Device stack for
|
||||
embedded system, designed to be memory-safe with no dynamic allocation
|
||||
@ -130,6 +130,8 @@ in your project.
|
||||
:target: https://github.com/hathach/tinyusb/actions
|
||||
.. |Documentation Status| image:: https://readthedocs.org/projects/tinyusb/badge/?version=latest
|
||||
:target: https://docs.tinyusb.org/en/latest/?badge=latest
|
||||
.. |Fuzzing Status| image:: https://oss-fuzz-build-logs.storage.googleapis.com/badges/tinyusb.svg
|
||||
:target: https://oss-fuzz-build-logs.storage.googleapis.com/index.html#tinyusb
|
||||
.. |License| image:: https://img.shields.io/badge/license-MIT-brightgreen.svg
|
||||
:target: https://opensource.org/licenses/MIT
|
||||
|
||||
|
@ -103,7 +103,7 @@ uint8_t const desc_configuration[] =
|
||||
// Config number, interface count, string index, total length, attribute, power in mA
|
||||
TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, 0x00, 100),
|
||||
|
||||
// Interface number, string index, protocol, report descriptor len, EP In & Out address, size & polling interval
|
||||
// Interface number, string index, protocol, report descriptor len, EP Out & In address, size & polling interval
|
||||
TUD_HID_INOUT_DESCRIPTOR(ITF_NUM_HID, 0, HID_ITF_PROTOCOL_NONE, sizeof(desc_hid_report), EPNUM_HID, 0x80 | EPNUM_HID, CFG_TUD_HID_EP_BUFSIZE, 10)
|
||||
};
|
||||
|
||||
|
@ -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));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user