Commit 09776353 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

[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.
parent 41d75b5b
...@@ -1086,6 +1086,11 @@ int usb_set_configuration(struct usb_device *dev, int configuration) ...@@ -1086,6 +1086,11 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
ret = -EINVAL; ret = -EINVAL;
goto out; 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) if (cp && configuration == 0)
dev_warn(&dev->dev, "config 0 descriptor??\n"); dev_warn(&dev->dev, "config 0 descriptor??\n");
...@@ -1101,7 +1106,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration) ...@@ -1101,7 +1106,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
goto out; goto out;
dev->actconfig = cp; dev->actconfig = cp;
if (!configuration) if (!cp)
dev->state = USB_STATE_ADDRESS; dev->state = USB_STATE_ADDRESS;
else { else {
dev->state = USB_STATE_CONFIGURED; dev->state = USB_STATE_CONFIGURED;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment