Re: [linux-usb-devel] 2.6.16 regression: Non-powered hubs no longer capable of operating some devices

2006-05-24 Thread Daniel Drake

Alan Stern wrote:
The idea is that the kernel now keeps track of USB power budgets.  When a 
bus-powered device requires more current than its upstream hub is capable 
of providing, the kernel will not configure it.


Thanks for the explanation. I wrote a quick patch to make the reasoning 
visible to users. Any comments?



Index: linux/drivers/usb/core/hub.c
===
--- linux.orig/drivers/usb/core/hub.c
+++ linux/drivers/usb/core/hub.c
@@ -1171,6 +1171,7 @@ static int choose_configuration(struct u
 	u16 devstatus;
 	int bus_powered;
 	int num_configs;
+	int insufficient_power = 0;
 	struct usb_host_config *c, *best;
 
 	/* If this fails, assume the device is bus-powered */
@@ -1218,8 +1219,10 @@ static int choose_configuration(struct u
 		 */
 
 		/* Rule out configs that draw too much bus current */
-		if (c-desc.bMaxPower * 2  udev-bus_mA)
+		if (c-desc.bMaxPower * 2  udev-bus_mA) {
+			insufficient_power++;
 			continue;
+		}
 
 		/* If the first config's first interface is COMM/2/0xff
 		 * (MSFT RNDIS), rule it out unless Linux has host-side
@@ -1263,6 +1266,10 @@ static int choose_configuration(struct u
 		dev_warn(udev-dev,
 			no configuration chosen from %d choice%s\n,
 			num_configs, plural(num_configs));
+		if (insufficient_power  0)
+			dev_info(udev-dev, rejected %d configuration%s 
+due to insufficient available bus power\n,
+insufficient_power, plural(insufficient_power));
 	}
 	return i;
 }


Re: [linux-usb-devel] 2.6.16 regression: Non-powered hubs no longer capable of operating some devices

2006-05-24 Thread Alan Stern
On Wed, 24 May 2006, Daniel Drake wrote:

 Alan Stern wrote:
  The idea is that the kernel now keeps track of USB power budgets.  When a 
  bus-powered device requires more current than its upstream hub is capable 
  of providing, the kernel will not configure it.
 
 Thanks for the explanation. I wrote a quick patch to make the reasoning 
 visible to users. Any comments?

It looks good, except that perhaps you might want to move the final log 
message outside the if (best)... statement, so that it will get printed 
even when a configuration _is_ selected.

Alan Stern



---
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnkkid=107521bid=248729dat=121642
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] 2.6.16 regression: Non-powered hubs no longer capable of operating some devices

2006-05-16 Thread Alan Stern
On Mon, 15 May 2006, Daniel Drake wrote:

 Hi,
 
 Several Gentoo users are reporting that usb-storage devices no longer
 work on 2.6.16 with unpowered hubs.
 
 Here's some logs:
 
 hub 2-2:1.0: state 7 ports 3 chg  evt 0002
 hub 2-2:1.0: port 1, status 0101, change 0001, 12 Mb/s
 hub 2-2:1.0: debounce: port 1: total 100ms stable 100ms status 0x101
 usb 2-2.1: new full speed USB device using uhci_hcd and address 7
 usb 2-2.1: not running at top speed; connect to a high speed hub
 usb 2-2.1: default language 0x0409
 usb 2-2.1: new device strings: Mfr=1, Product=2, SerialNumber=3
 usb 2-2.1: Product: Store 'n' Go
 usb 2-2.1: Manufacturer: Verbatim
 usb 2-2.1: SerialNumber: 0CD177515381390D
 usb 2-2.1: uevent
 usb 2-2.1: device is bus-powered
 usb 2-2.1: no configuration chosen from 1 choice
 drivers/usb/core/inode.c: creating file '007'
 hub 2-2:1.0: 100mA power budget left
 hub 2-2:1.0: state 7 ports 3 chg  evt 0002
 
 This device works in the same hub in 2.6.15, and works when plugged 
 directly into a USB port on both 2.6.15 and 2.6.16. The problem has been 
 reproduced on 2.6.17-rc4.
 
 I'm working on getting a complete report filed at the kernel bugzilla, 
 but thought I would throw some attention to it here first, is it a known 
 issue?
 
 The Gentoo bug report is at
 https://bugs.gentoo.org/show_bug.cgi?id=132721
 but it's a bit of a mess..

A couple of other people have made similar reports.  It's not really a
regression; it is correct behavior that was not implemented until 2.6.16.

The idea is that the kernel now keeps track of USB power budgets.  When a 
bus-powered device requires more current than its upstream hub is capable 
of providing, the kernel will not configure it.

Computers' USB ports are capable of providing a full 500 mA, so devices
plugged directly into the computer will work okay.  However unpowered hubs
can provide only 100 mA to each port.  Some devices require (or claim they
require) more current than that.  As a result, they don't get configured
when plugged into an unpowered hub.

There are several possible ways to deal with this.  The device can be 
plugged directly into the computer instead of into the hub.  The 
unpowered hub can be replaced with a powered hub.

Or, if the users don't mind living a little dangerously, they can 
configure the devices manually.  As root, do something like this:

echo -n 1 /sys/bus/usb/devices/2-2.1/bConfigurationValue

The 2-2.1 must be replaced with the correct path to the USB device, and 
the 1 must be replaced with the correct configuration value (which can 
be found in the output from lsusb -v, along with the device's power 
requirement).

Alan Stern



---
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel