USB Per Port Power Switching

Increasing numbers of single board computers are powered by USB ports using a cable like this:


Wouldn’t it be cool if you could plug these into a USB hub and have the hub individually power up and down the computers? Like a cheap APC power management board.

It turns out you can — with difficulty. The USB standard defines Per-Port Power Switching (PPPS) but unfortunately almost no hub in existence actually supports it. To save a few cents on the BOM, the manufacturers generally leave out the extra power transistors needed to make it work. One guy has modified his USB hub to add the extra part and full marks to him but that’s a lot of effort.

There is one hub which actually supports this: The D-Link DUB-H7, but only the first version (the silver/grey case). In the second version (black case), D-Link too realized their “mistake” and saved on the extra bits.

Armed with this knowledge, I bought one of these from the US (shipping cost 3x the cost of the hub itself).

And it works! Well, for a while.


I used the C hub-ctrl program from this page, and the instructions from here.

# lsusb
Bus 003 Device 005: ID 2001:f103 D-Link Corp. DUB-H7 7-port USB 2.0 hub

Switch off port 7 (right-most port):

# ./hub-ctrl -b 3 -d 5 -P 4 -p 0

Switch on port 7:

# ./hub-ctrl -b 3 -d 5 -P 4 -p 1

The ports are not numbered in the same sequence as the ports on the hub itself. I found by experimentation that the ports correspond as follows. I don’t know if it’ll be the same on every model:

Port hub-ctrl option
1 (left) -P 5
2 -P 6
3 -P 1
4 -P 2
5 -P 7
6 -P 3
7 (right) -P 4

The bigger problem is the hub is fairly unreliable. Switching ports on or off too frequently seems to result in the hub crashing, which appears to only be recoverable by powering the hub off for several seconds.

So I’m not quite there.



Filed under Uncategorized

7 responses to “USB Per Port Power Switching

  1. Richard Hughes did some work with USB hubs and also mapping port number to port sequence… HTH:

    • rich

      One thing about this hub is there is a per-port light, which can be flashed by powering down and up the port (of course, that risks crashing the hub, so you win some, you lose some).

  2. chip

    At my place of employment, we needed to remotely power-cycle USB JTAG probes, and a coworker found and ordered some of these:×4-0

    Not the most economic option available, but if your project budget can afford it, the use case should be explicitly supported.

  3. Conrad Neilands

    If you only need to power cycle 2 ports the B&B Electronics UHR-402 seems to work very reliably. Pricey though.

  4. It’s not ideal — especially from a size standpoint — but using straightforward wall-warts, and a Ubiquity has a line of outlets that have power monitoring and relay controls with a REST API. I picked up an mPower Pro for doing total-cost-of-transaction tests of distributed datastores (… down to the power-draw level).

  5. j has a 3 port power switchable hub

  6. Paul Chvostek

    I purchased some Plugable USB2-HUB-AG7 hubs, which include PPPS support. Plugable also sells one other PPPS-capable hub, the USB2-HUB10S. Plugable claims they have no plans to discontinue these models. I use to control the switches. These hubs are not the cheapest, but I’ve had no problems with them so far.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s