diff options
| author | HiFiPHile <[email protected]> | 2026-08-25 09:29:07 +0200 |
|---|---|---|
| committer | HiFiPHile <[email protected]> | 2026-08-25 09:29:07 +0200 |
| commit | 87511ce87280e986545149e4ad017ccf2392671c (patch) | |
| tree | 6f0cc082e286f5f00795152389fb450d1f18e8ad /src/class | |
| parent | ea7d4ef12a4cd2b6fb6986a091888bc838b12574 (diff) | |
fix(audio): release instances without supported streams
Retain an audio function when at least one direction has a supported configuration, but release the tentative instance when neither direction does. Unsupported and MIDI-only functions no longer consume host slots or emit mount callbacks.
Signed-off-by: HiFiPHile <[email protected]>
Diffstat (limited to 'src/class')
| -rw-r--r-- | src/class/audio/audio_host.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/class/audio/audio_host.c b/src/class/audio/audio_host.c index 2aad4040e..c29db658c 100644 --- a/src/class/audio/audio_host.c +++ b/src/class/audio/audio_host.c @@ -798,7 +798,6 @@ uint16_t audioh_open(uint8_t rhport, uint8_t dev_addr, const tusb_desc_interface uint8_t usb_input_terminal_id = 0; uint8_t usb_output_source_id = 0; - bool found_as_interface = false; // A Feature Unit may precede the USB terminal that identifies its stream. typedef struct { uint8_t id; @@ -887,15 +886,14 @@ uint16_t audioh_open(uint8_t rhport, uint8_t dev_addr, const tusb_desc_interface break; } - found_as_interface = true; TU_LOG_DRV(" Found AS Interface %u (alt = %u)\r\n", desc_interface->bInterfaceNumber, desc_interface->bAlternateSetting); p_desc = audioh_parse_as(p_audio, desc_interface, p_desc, desc_end); } - // This AC interface belongs to MIDI or another Audio subclass. Release the - // tentative instance and let the next class driver claim the interface. - if (!found_as_interface) { + // Release the tentative instance when no supported stream configuration was + // collected, including MIDI-only and unsupported Audio functions. + if (p_audio->in_stream.config_count == 0 && p_audio->out_stream.config_count == 0) { audioh_stream_reset(&p_audio->in_stream); audioh_stream_reset(&p_audio->out_stream); p_audio->daddr = 0; |
