Subject: Re: soft control of +5V at a USB hub port?
To: J Chapman Flack <flack@cs.purdue.edu>
From: Nathan J. Williams <nathanw@wasabisystems.com>
List: tech-kern
Date: 05/04/2005 13:31:14
J Chapman Flack <flack@cs.purdue.edu> writes:

> I have heard just enough about the inner workings of USB to wonder
> if it's possible on some or all USB hubs to command down the +5V on
> a particular port through software.

The correct answer is "some hubs", though I can't say for sure how
likely they are in practice. The relevant chunk of the USB
specification is section 11.11, "Hub Port Power Control":
 
  Self-powered hubs may have power switches that control delivery of
  power downstream facing ports but it is not required. Bus-powered
  hubs are required to have power switches. A hub with power switches
  can switch power to all ports as a group/gang, to each port
  individually, or have an arbitrary number of gangs of one or more
  ports.

You can check any particular hub by running usbctl (from usbitil in
pkgsrc) and looking at the bottom bits of wHubCharacteristics. For
example, one of the two hubs I have handy are a small 4-port
bus-powered hub which probes as:

uhub5: Atmel Standard USB Hub, class 9/0, rev 1.10/3.00, addr 2
uhub5: 4 ports with 4 removable, bus powered

which shows, with usbctl:

HUB descriptor:
bDescLength=9 bDescriptorType=41 bNbrPorts=4 wHubCharacteristics=00
bPwrOn2PwrGood=50 bHubContrCurrent=64 DeviceRemovable=0

so it doesn't have per-port power control (the bottom two bits of
wHubCharacteristics being 00 is "ganged power control")

The other, a Belkin 7-port hub (F5U027), which probes as:

uhub4: Texas Instruments General Purpose USB Hub, class 9/0, rev 1.10/1.00, addr 2
uhub4: 4 ports with 4 removable, bus powered

shows:

HUB descriptor:
bDescLength=9 bDescriptorType=41 bNbrPorts=4 wHubCharacteristics=09
bPwrOn2PwrGood=50 bHubContrCurrent=100 DeviceRemovable=0

so it does have per-port control (bottom two bits are 01), and it
additionally has per-port overcurrent detection.

        - Nathan