From: Greg KH <greg@kroah.com>
To: torvalds@transmeta.com
Cc: linux-usb-devel@lists.sourceforge.net
Subject: [PATCH 01 of 11] USB core bugfix

Hi,

Here's a patch against 2.5.3-pre1 for the USB core that fixes
usb_set_interface() from doing anything when a device only has one
interface.  This follows the USB spec.  The patch was written by Sancho
Dauskardt.

thanks,

greg k-h



diff -Nru a/drivers/usb/usb.c b/drivers/usb/usb.c
--- a/drivers/usb/usb.c	Wed Jan 16 09:57:46 2002
+++ b/drivers/usb/usb.c	Wed Jan 16 09:57:46 2002
@@ -2252,6 +2252,14 @@
 		return -EINVAL;
 	}
 
+	/* 9.4.10 says devices don't need this, if the interface
+	   only has one alternate setting */
+	if (iface->num_altsetting == 1) {
+		warn("ignoring set_interface for dev %d, iface %d, alt %d",
+			dev->devnum, interface, alternate);
+		return 0;
+	}
+
 	if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
 	    USB_REQ_SET_INTERFACE, USB_RECIP_INTERFACE, alternate,
 	    interface, NULL, 0, HZ * 5)) < 0)
