# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.484 -> 1.485 # drivers/usb/core/message.c 1.3 -> 1.4 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 02/06/14 tiwai@suse.de 1.485 # [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. # -------------------------------------------- # diff -Nru a/drivers/usb/core/message.c b/drivers/usb/core/message.c --- a/drivers/usb/core/message.c Fri Jun 14 14:15:28 2002 +++ b/drivers/usb/core/message.c Fri Jun 14 14:15:28 2002 @@ -471,9 +471,13 @@ return 0; } + if (alternate < 0 || alternate >= iface->num_altsetting) + return -EINVAL; + if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), - USB_REQ_SET_INTERFACE, USB_RECIP_INTERFACE, alternate, - interface, NULL, 0, HZ * 5)) < 0) + USB_REQ_SET_INTERFACE, USB_RECIP_INTERFACE, + iface->altsetting[alternate].bAlternateSetting, + interface, NULL, 0, HZ * 5)) < 0) return ret; iface->act_altsetting = alternate;