diff options
| author | MasterPhi <[email protected]> | 2021-06-29 22:40:21 +0200 |
|---|---|---|
| committer | MasterPhi <[email protected]> | 2021-07-04 15:46:10 +0200 |
| commit | 6e9da70c18a0dbabaedb1c9aadcc9fe53a0113a7 (patch) | |
| tree | 458c8141fe7707ef80eda7cc8da185fb2dfdc30f /src/class | |
| parent | 681a61d4795b05d701a651733a1c0358ac2cb546 (diff) | |
Fix audiod_get_AS_interface_index in audio class.
Enhance uac2_headset example with multiple sample rates.
Add macro to calculate EP size.
Diffstat (limited to 'src/class')
| -rw-r--r-- | src/class/audio/audio_device.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/class/audio/audio_device.c b/src/class/audio/audio_device.c index 7263958df..cb35adb82 100644 --- a/src/class/audio/audio_device.c +++ b/src/class/audio/audio_device.c @@ -1997,15 +1997,17 @@ static bool audiod_get_AS_interface_index(uint8_t itf, audiod_function_t * audio while (p_desc < p_desc_end) { // We assume the number of alternate settings is increasing thus we return the index of alternate setting zero! - if (tu_desc_type(p_desc) == TUSB_DESC_INTERFACE && ((tusb_desc_interface_t const * )p_desc)->bInterfaceNumber == itf) + if (tu_desc_type(p_desc) == TUSB_DESC_INTERFACE && ((tusb_desc_interface_t const * )p_desc)->bAlternateSetting == 0) { - *idxItf = tmp; - *pp_desc_int = p_desc; - return true; + if (((tusb_desc_interface_t const * )p_desc)->bInterfaceNumber == itf) + { + *idxItf = tmp; + *pp_desc_int = p_desc; + return true; + } + // Increase index, bytes read, and pointer + tmp++; } - - // Increase index, bytes read, and pointer - tmp++; p_desc = tu_desc_next(p_desc); } } |
