Re: [linux-usb-devel] USB devices fail unnecessarily on unpowered hubs

From: David Brownell
Date: Thu Jun 01 2006 - 21:52:50 EST


On Thursday 01 June 2006 5:03 pm, David Liontooth wrote:
>
> However, obeying the USB power rules is not an end in itself -- the
> relevant question is the minimum power the device requires to operate
> correctly and without damage.

We don't know the minimum, or much care about it since the minimum is
generally not what gets drawn.

We know the maximum, which is declared in the configuration descriptor.
And we don't know how much of that maximum a given device uses at any
given moment ... ergo, power budgeting assumes the worst case.


> The MaxPower value does not appear to be a reliable index of this. My
> USB stick has a MaxPower value of 178mA and works flawlessly off an
> unpowered hub.

So you're saying that four of those can work off the same hub? Or
just that one of them can draw two ports' worth of current, because
of the fact that current-limiting is usually on the upstream link,
not individual downstream ones? (If indeed there is current limiting
and/or overcurrent handling in that hub ...) Try that experiment,
and put four on one hub ... now write critical data to all of them
at the same time.


> What are the reasons not to do this? What happens if a USB stick is
> underpowered to one unit? Nothing? Slower transmission? Data loss? Flash
> memory destruction? If it's just speed, it's a price well worth paying.

You mis-understand what's going on. There's a power budget, and if
it gets exceeded then "overcurrent" conditions can happen ... leading
to errors, disconnection, data loss, and yes potentially even memory
destruction; those are all device-specific failure modes, which are
by definition out-of-spec.

The reason to enforce the power budget is that devices guarantee they'll
behave to spec if they can draw that much current. And if they can't
draw enough current, all those rude failure modes happen. Devices
enter brown-out modes if you're lucky, or maybe the hub will cleanly shut
things down before much nastiness happens. The budget is analagous
to a circuit breaker; exceed it and things shut off, which is safer
than most alternatives.


> This is a great opportunity for a small exercise in empathy, utilizing
> that little long-neglected mirror neuron.

Exactly. Preventing random glitchey failure modes makes everyone's
experience a lot better. It's the same reason to fix driver races;
they may not happen all that often, but when they do happen the
result can be disastrous.

- Dave

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/