Commit 15d55742 authored by Takashi Iwai's avatar Takashi Iwai Committed by Greg Kroah-Hartman

[PATCH] usb_set_interface for discontinous altsettings

during debugging ALSA's usb audio driver, it's found out that there
are devices with insuccessive alternate settings.

for example, m-audio's quattro usb audio has audio streaming
descriptors jumping from altset 0 to 4 or 3.

apparently, usb_set_interface() sends the array index instead of the
actual altset value.  the attached patch fixes this behavior.
parent 4e562171
...@@ -471,9 +471,13 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) ...@@ -471,9 +471,13 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
return 0; return 0;
} }
if (alternate < 0 || alternate >= iface->num_altsetting)
return -EINVAL;
if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
USB_REQ_SET_INTERFACE, USB_RECIP_INTERFACE, alternate, USB_REQ_SET_INTERFACE, USB_RECIP_INTERFACE,
interface, NULL, 0, HZ * 5)) < 0) iface->altsetting[alternate].bAlternateSetting,
interface, NULL, 0, HZ * 5)) < 0)
return ret; return ret;
iface->act_altsetting = alternate; iface->act_altsetting = alternate;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment