Electronic – USB descriptor of a dual powered device

powerusbusb device

Consider a USB 2.0 device that can be powered either from the bus, from an external power supply, or from both simultaneously. The source of power can be switched at run time while USB is operating. The maximum current consumption is known and does not exceed the 500 mA limited by USB 2.0.

Should such a device report itself to the host as self-powered or bus-powered?

Best Answer

If it is capable of being bus-powered, then I would report it as such. The end result of the power negotiation is a maximum that you're not allowed to exceed, but you don't actually have to use it. (The maximum power is rarely enforced, but every once in a while it is.)

To make your device a bit smarter, and if you don't mind some extra work, you might want to have two configurations, as Simon mentioned. The tricky part would be to determine what to do if you're in self-power mode and you lose the external power. You're not allowed more than 2mA from the bus without dropping off the bus and re-enumerating (which may not succeed in giving you more power), and you just lost your supply to do your intended function. So now what?