aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/mixer.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 8be6bf2552b0..cb345360f811 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -165,22 +165,24 @@ static int check_mapped_selector_name(struct mixer_build *state, int unitid,
165 165
166/* 166/*
167 * find an audio control unit with the given unit id 167 * find an audio control unit with the given unit id
168 * this doesn't return any clock related units, so they need to be handled elsewhere
169 */ 168 */
170static void *find_audio_control_unit(struct mixer_build *state, unsigned char unit) 169static void *find_audio_control_unit(struct mixer_build *state, unsigned char unit)
171{ 170{
172 unsigned char *p; 171 /* we just parse the header */
172 struct uac_feature_unit_descriptor *hdr = NULL;
173 173
174 p = NULL; 174 while ((hdr = snd_usb_find_desc(state->buffer, state->buflen, hdr,
175 while ((p = snd_usb_find_desc(state->buffer, state->buflen, p, 175 USB_DT_CS_INTERFACE)) != NULL) {
176 USB_DT_CS_INTERFACE)) != NULL) { 176 if (hdr->bLength >= 4 &&
177 if (p[0] >= 4 && p[2] >= UAC_INPUT_TERMINAL && p[2] <= UAC2_EXTENSION_UNIT_V2 && p[3] == unit) 177 hdr->bDescriptorSubtype >= UAC_INPUT_TERMINAL &&
178 return p; 178 hdr->bDescriptorSubtype <= UAC2_SAMPLE_RATE_CONVERTER &&
179 hdr->bUnitID == unit)
180 return hdr;
179 } 181 }
182
180 return NULL; 183 return NULL;
181} 184}
182 185
183
184/* 186/*
185 * copy a string with the given id 187 * copy a string with the given id
186 */ 188 */