summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMengsk <[email protected]>2025-09-30 15:38:51 +0200
committerMengsk <[email protected]>2025-09-30 16:30:34 +0200
commite463e87097edb592ca3d0d2cc3b7a17af90e5813 (patch)
treea261e4802ed26fd6d4597b119cffe3f3e432bd82
parent56b1ce2aed825d03d3bc56a530f90c37e4ce8889 (diff)
support UAC1 without IAD
Signed-off-by: Mengsk <[email protected]>
-rw-r--r--src/device/usbd.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c
index b1aef0b38..f1065a649 100644
--- a/src/device/usbd.c
+++ b/src/device/usbd.c
@@ -1087,6 +1087,28 @@ static bool process_set_config(uint8_t rhport, uint8_t cfg_num)
#if CFG_TUD_BTH && CFG_TUD_BTH_ISO_ALT_COUNT
if ( driver->open == btd_open ) assoc_itf_count = 2;
#endif
+
+ #if CFG_TUD_AUDIO
+ if (driver->open == audiod_open) {
+ // UAC1 device doesn't have IAD, needs to read AS interface count from CS AC descriptor
+ if (TUSB_CLASS_AUDIO == desc_itf->bInterfaceClass &&
+ AUDIO_SUBCLASS_CONTROL == desc_itf->bInterfaceSubClass &&
+ AUDIO_FUNC_PROTOCOL_CODE_UNDEF == desc_itf->bInterfaceProtocol) {
+ uint8_t const* p = tu_desc_next(p_desc);
+ uint8_t const* const itf_end = p_desc + remaining_len;
+ while (p < itf_end) {
+ if (TUSB_DESC_CS_INTERFACE == tu_desc_type(p) &&
+ AUDIO10_CS_AC_INTERFACE_HEADER == ((audio10_desc_cs_ac_interface_1_t const *) p)->bDescriptorSubType) {
+ audio10_desc_cs_ac_interface_1_t const * p_header = (audio10_desc_cs_ac_interface_1_t const *) p;
+ // AC + AS interfaces
+ assoc_itf_count = tu_le16toh(p_header->bInCollection) + 1;
+ break;
+ }
+ p = tu_desc_next(p);
+ }
+ }
+ }
+ #endif
}
// bind (associated) interfaces to found driver