]> git.hungrycats.org Git - linux/commitdiff
[PATCH] USB: Allow configuration #0
authorAlan Stern <stern@rowland.harvard.edu>
Fri, 12 Dec 2003 03:57:12 +0000 (19:57 -0800)
committerGreg Kroah-Hartman <greg@kroah.com>
Fri, 12 Dec 2003 03:57:12 +0000 (19:57 -0800)
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

index f97aa07084cde02b18b84da28d4cf820630d7559..04d08713e2bf430fd57ed0c10903e43c423fdf93 100644 (file)
@@ -1086,6 +1086,11 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
                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 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
                goto out;
 
        dev->actconfig = cp;
-       if (!configuration)
+       if (!cp)
                dev->state = USB_STATE_ADDRESS;
        else {
                dev->state = USB_STATE_CONFIGURED;