aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2006-05-02 15:22:41 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-05-09 02:43:55 -0400
commit436f5762bcd4929825a0725d4bc78337e6fc0d8f (patch)
treef2f709575ddec3b58d1c7c13af82bdcfc82dbfcf
parentdb4cefaaea4c6d67cdaebfd315abc791c5c9d22f (diff)
[PATCH] USB: usbcore: don't check the device's power source
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>
-rw-r--r--drivers/usb/core/hub.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 0c87f73f2933..90b8d43c6b33 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1168,19 +1168,9 @@ static inline const char *plural(int n)
1168static int choose_configuration(struct usb_device *udev) 1168static int choose_configuration(struct usb_device *udev)
1169{ 1169{
1170 int i; 1170 int i;
1171 u16 devstatus;
1172 int bus_powered;
1173 int num_configs; 1171 int num_configs;
1174 struct usb_host_config *c, *best; 1172 struct usb_host_config *c, *best;
1175 1173
1176 /* If this fails, assume the device is bus-powered */
1177 devstatus = 0;
1178 usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus);
1179 le16_to_cpus(&devstatus);
1180 bus_powered = ((devstatus & (1 << USB_DEVICE_SELF_POWERED)) == 0);
1181 dev_dbg(&udev->dev, "device is %s-powered\n",
1182 bus_powered ? "bus" : "self");
1183
1184 best = NULL; 1174 best = NULL;
1185 c = udev->config; 1175 c = udev->config;
1186 num_configs = udev->descriptor.bNumConfigurations; 1176 num_configs = udev->descriptor.bNumConfigurations;
@@ -1197,6 +1187,19 @@ static int choose_configuration(struct usb_device *udev)
1197 * similar errors in their descriptors. If the next test 1187 * similar errors in their descriptors. If the next test
1198 * were allowed to execute, such configurations would always 1188 * were allowed to execute, such configurations would always
1199 * be rejected and the devices would not work as expected. 1189 * be rejected and the devices would not work as expected.
1190 * In the meantime, we run the risk of selecting a config
1191 * that requires external power at a time when that power
1192 * isn't available. It seems to be the lesser of two evils.
1193 *
1194 * Bugzilla #6448 reports a device that appears to crash
1195 * when it receives a GET_DEVICE_STATUS request! We don't
1196 * have any other way to tell whether a device is self-powered,
1197 * but since we don't use that information anywhere but here,
1198 * the call has been removed.
1199 *
1200 * Maybe the GET_DEVICE_STATUS call and the test below can
1201 * be reinstated when device firmwares become more reliable.
1202 * Don't hold your breath.
1200 */ 1203 */
1201#if 0 1204#if 0
1202 /* Rule out self-powered configs for a bus-powered device */ 1205 /* Rule out self-powered configs for a bus-powered device */