At 07:47 AM 9/28/2007 -0700, John Nemeth wrote:I'm not sure that anybody but me is interested in the following trivia, but (with apologies to Adam Smith) one should willing to risk being tedious in order to be clear. Technically speaking, those fans, lights and other such "devices" are not legal USB devices. They don't present USB descriptors and they rely on the root hub port (or the non-root hub port) to provide 100mA forever. That's not specified behavior of any hub, but it works well enough for Wal-Mart and Fry's (i.e., very low level of returns from customers). Legal USB devices have four collections of power-relevant states: *) the states (powered, default, address) before the host selects a USB configuration, *) the state (configured) after a USB configuration has been selected by the host (in this case, normally we say "the device is configured"), *) the state in which the device is suspended and cannot wake up the host, and *) the state in which the device is suspended and CAN wake up the host. If a device is suspended and cannot wake up the computer, it can only draw 0.5mA. If a device is suspended and can wake up the computer, it can draw 2.5mA. If a device is not suspended, but has not been configured, it is only permitted to draw up 100mA. If a device is not suspended, but has been configured, it may draw as much current as the device specified in its description of the selected USB configuration (from 0mA to 500mA, normally either 100mA or 500mA). The only state in which there's enough power to charge a phone is the last one. To further complicate matters, not all hubs can provide 500mA. Worse, you can't tell, because hubs lie about their capabilities in this area (to work better with Windows?). [I'm eliding a number of details, but this is easily demonstrable.] The USB host stack cannot actually tell whether 500mA will really work. So on Windows, the USB class driver often needs to do some guessing. Sometimes this is assisted by clever hardware that disconnects, and reconnects with a different personality after it determines that it's got a "working partner" on the host side. Since some host-side software is needed in order to do things right, often the product manager makes the conservative choice to "do no harm" -- which means (for such devices on NetBSD) that just plugging the device in won't let you charge. BTW, I don't know how ugen works, but I suspect/hope that it doesn't send set-config until after an app opens the device. (That would limit you to 100mA.) On laptops, I'd further hope that ugen would suspend the port to minimize power consumption until an app opens the device. In that case, you won't get any power at all for charging. Umass has to configure the device in order to talk to it. However, the configuration that it chooses might not be the right one (if the device offers multiple choices). Most phones offer a mode in which they are concurrently wireless modems and mass storage devices (for example), and this is called a "composite" device in USB-speak. Normally, in this case, the function drivers can't choose, because they can't get loaded until the overall (device-level) driver has selected a configuration. This is all to say "it's not that simple" -- don't expect that the right answer for a Blackberry will be the right answer for a SonyEricsson phone. (In fact, don't expect that the right answer for one model from vendor X is the right answer for all models from vendor X -- SymbianOS phones may work differently from WinCE phones, which may work differently from "feature phones". And so forth.) If people want more info, I'll be happy to offer free advice (worth every penny, as the saying goes). No time to write code, alas, too busy attending standards committee meetings..... Best regards, --Terry
| Karl Meyer | PROBLEM: 2.6.23-rc "NETDEV WATCHDOG: eth0: transmit timed out" |
| David Miller | Slow DOWN, please!!! |
| Mark Fasheh | [PATCH 0/39] Ocfs2 updates for 2.6.28 |
| Bart Van Assche | Integration of SCST in the mainstream Linux kernel |
git: | |
| Shawn O. Pearce | Re: pack operation is thrashing my server |
| Pierre Habouzit | git send-email improvements |
| Matthieu Moy | git push to a non-bare repository |
| Shawn O. Pearce | libgit2 - a true git library |
| Elad Efrat | Integrating securelevel and kauth(9) |
| Hubert Feyrer | Re: Compressed vnd handling tested successfully |
| Lord Isildur | Re: Fork bomb protection patch |
| Matt Thomas | Re: FFS journal |
| Will Maier | cron doesn't run commands in /etc/crontab? |
| Richard Stallman | Real men don't attack straw men |
| Harald Dunkel | Re: Packet Filter: how to keep device names on hardware failure? |
| Jordi Espasa Clofent | Resolving dependencies with pkg_add |
| Question on swap as ramdisk partition | 1 hour ago | Linux kernel |
| Netfilter kernel module | 12 hours ago | Linux kernel |
| serial driver xmit problem | 14 hours ago | Linux kernel |
| Why Windows is better than Linux | 14 hours ago | Linux general |
| How can I see my kernel messages in vt12? | 21 hours ago | Linux kernel |
| Grub | 1 day ago | Linux general |
| vmalloc_fault handling in x86_64 | 1 day ago | Linux kernel |
| epoll_wait()ing on epoll FD | 1 day ago | Linux kernel |
| Framebuffer in x86_64 causes problems to multiseat | 1 day ago | Linux kernel |
| Difference between 2.4 and 2.6 regarding thread creation | 2 days ago | Linux general |
