A word about switching USB ports on and off

For various reasons it may be beneficial to be able to turn off or toggle an USB connection or a USB port.

Basically you got three options:

Hubs with manual switches

No, not really an option.

Using the Per-Port-Power-Switching (PPPS)

USB 2.0 Specification contains a part about disabling/enabling power (the VBUS line) on USB-Hubs. Most (if not nearly every) Hub uses a chip that either does not support switching or the manufacturer saves a few cents and omits the external components on the circuitboard to switch power. (Then you can tell the hub chip to disable a port but nothing will happen).

One of the few hubs that does support that is D-Link’s DUB-H7 in the older (gray) revision

D-Link Hub

Great Hub, by the way. Allows PPPS, has LED indicators for every single port, has overcurrent protection, etc. Only mounting holes are missing, cheap bastards… No, for sure: It’s reasonably priced and performs well in it’s intended function as a regular USB hub.

uhubctl allows listing and toggling PPPS and works great for that reason.
Turn off a port:

uhubctl -a off -p 2

Only problem: the DUB-H7 is quite strict about the current limits in the USB specification. When using large loads (>500mA) the hub ist not able to supply enough power and turns off the ports.

In addition to that this blog post claims that even when switching off a port, the output voltage of the port is just reduced to slightly above 1 volts (depending on the voltage converter in the USB device, that still allows operation).

See uhubctl’s github repository for a list of known and tested hubs.

Apple Thunderbolt Displays and Apple Keyboards with integrated Hubs support PPPS out of the box, by the way. If you are using one of those, just test uhubctl to see if that suffices for you.

Raspberry Pi

One special case are Raspberry Pi’s. Some versions (models B+, 2B, 3B, 3B+ and 4B) do not support PPPS but allow turning off/resetting the USB-Controller (and thus let you turn on and off all connected USB-devices). See this forum post for more info.

External hardware: Yepkit / ykush

The portugese company Yepkit sells USB-hubs with a PIC microcontroller and a TI load switch. They provide their firmware code and example programs as well as their schematics.

Yepkit page
Yepkit github


Nice stuff. Got one, works well.

Build your own stuff

Yeah, that’s always an option, though not quite sure if it’s worth the hassle. But if you don’t need to physically disconnect the actual data lines but you just want to cut power I regularly use the AP2553 IC from Diodes. It has an adjustable current limit and is reasonably well solderable by hand. Big plus: no additional mosfets required, only up to 4 capacitors and 2 resistors.

AP2553 circuit

(However, don’t trust me, I’m not an electrical engineer)