Skip to content

Commit

Permalink
[PATCH] USB: usbcore: don't check the device's power source
Browse files Browse the repository at this point in the history
The choose_configuration() routine contains code the determine the
device's power source, so that configurations requiring external power
can be ruled out if the device is running on bus power.  Unfortunately
it turns out that some devices have errors in their config descriptors
and other devices don't like the GET_DEVICE_STATUS request.

Since that information wasn't used for anything else, this patch (as673)
removes the code, leaving only a comment.  It fixes bugzilla entry
#6448.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed May 9, 2006
1 parent db4cefa commit 436f576
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions drivers/usb/core/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -1168,19 +1168,9 @@ static inline const char *plural(int n)
static int choose_configuration(struct usb_device *udev)
{
int i;
u16 devstatus;
int bus_powered;
int num_configs;
struct usb_host_config *c, *best;

/* If this fails, assume the device is bus-powered */
devstatus = 0;
usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus);
le16_to_cpus(&devstatus);
bus_powered = ((devstatus & (1 << USB_DEVICE_SELF_POWERED)) == 0);
dev_dbg(&udev->dev, "device is %s-powered\n",
bus_powered ? "bus" : "self");

best = NULL;
c = udev->config;
num_configs = udev->descriptor.bNumConfigurations;
Expand All @@ -1197,6 +1187,19 @@ static int choose_configuration(struct usb_device *udev)
* similar errors in their descriptors. If the next test
* were allowed to execute, such configurations would always
* be rejected and the devices would not work as expected.
* In the meantime, we run the risk of selecting a config
* that requires external power at a time when that power
* isn't available. It seems to be the lesser of two evils.
*
* Bugzilla #6448 reports a device that appears to crash
* when it receives a GET_DEVICE_STATUS request! We don't
* have any other way to tell whether a device is self-powered,
* but since we don't use that information anywhere but here,
* the call has been removed.
*
* Maybe the GET_DEVICE_STATUS call and the test below can
* be reinstated when device firmwares become more reliable.
* Don't hold your breath.
*/
#if 0
/* Rule out self-powered configs for a bus-powered device */
Expand Down

0 comments on commit 436f576

Please sign in to comment.