[How-To] disable unused USB ports to reduce router power consumption

opkg update && opkg install hub-ctrl

check USB ports startus:

hub-ctrl -v

you will see something similar (in this example TL-WR710n):

Hub #0 at 001:001
INFO: individual power switching.
WARN: Port indicators are NOT supported.
Hub Port Status:
Port 1: 0000.0100 power

Port 1: 0000.0000 = USB off
Port 1: 0000.0100 power = USB on

USB off:

 hub-ctrl -h 0 -P 1 -p 0

That says to control hub 0 (-h 0) port 1 (-P 1) and to turn the power off (-p 0)

USB on:

 hub-ctrl -h 0 -P 1 -p 1

You can also use ”-p 1” to turn the power back on


Practical use (example):
you have a router running on a solar system or on a battery, that collects and sends data via 3G USB dongle (that is quite power hungry).
To reduce power consumption you can switch on the 3G USB dongle just when it is needed and just for a few minutes during the day.

Important to say that this will only work with hubs that are capable of individual power switching (in contrast to ganged or no power switching capabilities at all).


Thank you very much! I'm tested on 3020 v3.

And probably you want to enable Power Management in your kernel and use Power Efficient Worqueues by default to reduce a bit more of power. That's what Android does by default. The kernel Power Management can do things that hub-ctrl and hd-idle can't. Schedutil promises more performance per watt so maybe want to give it a try.
That's a note for some people that want to build a custom image to save power, tho. Not part of the OpenWrt kernel.


That's worth a separate topic.
Quite interesting for users with limited power supply like solar pantels in winter time.

Thank you. I will definitely try.

For Newifi D1
Turn off

echo 0 > /sys/class/gpio/usb2power/value
echo 0 > /sys/class/gpio/usb3power/value

Turn on

echo 1 > /sys/class/gpio/usb2power/value
echo 1 > /sys/class/gpio/usb3power/value
1 Like