On Mon, 30 Nov 2009, Sarah Sharp wrote: > Refactor out the code to find alternate interface settings into > usb_find_alt_setting(). Print a debugging message and return null if the > alt setting is not found. > diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c > index b1b85ab..24c0aab 100644 > --- a/drivers/usb/core/usb.c > +++ b/drivers/usb/core/usb.c > @@ -64,6 +64,35 @@ MODULE_PARM_DESC(autosuspend, "default autosuspend delay"); > > > /** > + * usb_find_alt_setting() - Given a configuration, find the alternate setting > + * for the given interface. > + * @config - the configuration to search (not necessarily the current config). > + * @iface_num - interface number to search in > + * @alt_num - alternate interface setting number to search for. > + * > + * Search the configuration's interface cache for the given alt setting. > + */ > +struct usb_host_interface *usb_find_alt_setting( > + struct usb_host_config *config, > + unsigned int iface_num, > + unsigned int alt_num) > +{ > + struct usb_interface_cache *intf_cache; > + int i; > + > + intf_cache = config->intf_cache[iface_num]; This is wrong. The entries in the interface_cache array are not stored in order (more accurately, they are stored in the order of the descriptors sent by the device, whatever that happens to be). You have to search to find the right one. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html