From: Greg KH <greg@kroah.com>
To: marcelo@conectiva.com.br 
Cc: linux-usb-devel@lists.sourceforge.net
Subject: [PATCH 1 of 6] USB module ownership change

Hi,

Here's a patch against 2.4.18-pre4 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 12:10:58 2002
+++ b/drivers/usb/usb.c	Wed Jan 16 12:10:58 2002
@@ -1952,6 +1952,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)

