ChangeSet 1.1504.2.46, 2003/12/12 11:57:12-08:00, stern@rowland.harvard.edu

[PATCH] USB: Allow configuration #0

This patch helped Jon Wilson.  It allows devices to have a configuration
numbered 0, in spite of the standard convention that config #0 really
means unconfigured.


 drivers/usb/core/message.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletion(-)


diff -Nru a/drivers/usb/core/message.c b/drivers/usb/core/message.c
--- a/drivers/usb/core/message.c	Mon Dec 29 14:21:51 2003
+++ b/drivers/usb/core/message.c	Mon Dec 29 14:21:51 2003
@@ -1086,6 +1086,11 @@
 		ret = -EINVAL;
 		goto out;
 	}
+
+	/* The USB spec says configuration 0 means unconfigured.
+	 * But if a device includes a configuration numbered 0,
+	 * we will accept it as a correctly configured state.
+	 */
 	if (cp && configuration == 0)
 		dev_warn(&dev->dev, "config 0 descriptor??\n");
 
@@ -1101,7 +1106,7 @@
 		goto out;
 
 	dev->actconfig = cp;
-	if (!configuration)
+	if (!cp)
 		dev->state = USB_STATE_ADDRESS;
 	else {
 		dev->state = USB_STATE_CONFIGURED;
