diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2005-11-23 12:03:12 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-04 16:48:34 -0500 |
commit | 55c527187c9d78f840b284d596a0b298bc1493af (patch) | |
tree | 17f42fb911ecc70301f5a22d4c0e85ba7348a67a /include | |
parent | 949bf6431189c62eeebd3b52201406ba9978f525 (diff) |
[PATCH] USB: Consider power budget when choosing configuration
This patch (as609) changes the way we keep track of power budgeting for
USB hubs and devices, and it updates the choose_configuration routine to
take this information into account. (This is something we should have
been doing all along.) A new field in struct usb_device holds the amount
of bus current available from the upstream port, and the usb_hub structure
keeps track of the current available for each downstream port.
Two new rules for configuration selection are added:
Don't select a self-powered configuration when only bus power
is available.
Don't select a configuration requiring more bus power than is
available.
However the first rule is #if-ed out, because I found that the internal
hub in my HP USB keyboard claims that its only configuration is
self-powered. The rule would prevent the configuration from being chosen,
leaving the hub & keyboard unconfigured. Since similar descriptor errors
may turn out to be fairly common, it seemed wise not to include a rule
that would break automatic configuration unnecessarily for such devices.
The second rule may also trigger unnecessarily, although this should be
less common. More likely it will annoy people by sometimes failing to
accept configurations that should never have been chosen in the first
place.
The patch also changes usbcore's reaction when no configuration is
suitable. Instead of raising an error and rejecting the device, now
the core will simply leave the device unconfigured. People can always
work around such problems by installing configurations manually through
sysfs.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/usb.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h index 46dc0421d19e..27575e678a7c 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -347,6 +347,8 @@ struct usb_device { | |||
347 | 347 | ||
348 | char **rawdescriptors; /* Raw descriptors for each config */ | 348 | char **rawdescriptors; /* Raw descriptors for each config */ |
349 | 349 | ||
350 | unsigned short bus_mA; /* Current available from the bus */ | ||
351 | |||
350 | int have_langid; /* whether string_langid is valid */ | 352 | int have_langid; /* whether string_langid is valid */ |
351 | int string_langid; /* language ID for strings */ | 353 | int string_langid; /* language ID for strings */ |
352 | 354 | ||