diff options
Diffstat (limited to 'sound/usb/mixer.c')
-rw-r--r-- | sound/usb/mixer.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index a060d005e209..6939d0f517d9 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c | |||
@@ -297,20 +297,27 @@ static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request, int v | |||
297 | 297 | ||
298 | static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret) | 298 | static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret) |
299 | { | 299 | { |
300 | unsigned char buf[14]; /* enough space for one range of 4 bytes */ | 300 | unsigned char buf[2 + 3*sizeof(__u16)]; /* enough space for one range */ |
301 | unsigned char *val; | 301 | unsigned char *val; |
302 | int ret; | 302 | int ret, size; |
303 | __u8 bRequest; | 303 | __u8 bRequest; |
304 | 304 | ||
305 | bRequest = (request == UAC_GET_CUR) ? | 305 | if (request == UAC_GET_CUR) { |
306 | UAC2_CS_CUR : UAC2_CS_RANGE; | 306 | bRequest = UAC2_CS_CUR; |
307 | size = sizeof(__u16); | ||
308 | } else { | ||
309 | bRequest = UAC2_CS_RANGE; | ||
310 | size = sizeof(buf); | ||
311 | } | ||
312 | |||
313 | memset(buf, 0, sizeof(buf)); | ||
307 | 314 | ||
308 | ret = snd_usb_ctl_msg(cval->mixer->chip->dev, | 315 | ret = snd_usb_ctl_msg(cval->mixer->chip->dev, |
309 | usb_rcvctrlpipe(cval->mixer->chip->dev, 0), | 316 | usb_rcvctrlpipe(cval->mixer->chip->dev, 0), |
310 | bRequest, | 317 | bRequest, |
311 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, | 318 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, |
312 | validx, cval->mixer->ctrlif | (cval->id << 8), | 319 | validx, cval->mixer->ctrlif | (cval->id << 8), |
313 | buf, sizeof(buf), 1000); | 320 | buf, size, 1000); |
314 | 321 | ||
315 | if (ret < 0) { | 322 | if (ret < 0) { |
316 | snd_printk(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", | 323 | snd_printk(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", |
@@ -318,6 +325,8 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int v | |||
318 | return ret; | 325 | return ret; |
319 | } | 326 | } |
320 | 327 | ||
328 | /* FIXME: how should we handle multiple triplets here? */ | ||
329 | |||
321 | switch (request) { | 330 | switch (request) { |
322 | case UAC_GET_CUR: | 331 | case UAC_GET_CUR: |
323 | val = buf; | 332 | val = buf; |