OpenWrt Forum Archive

Topic: how to turn usb power off

The content of this topic has been archived on 29 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi, is it possible to control usb powering from openwrt? I have tp-link tl-wr842nd. I tried some linux tips, but nothing does work from openwrt sad

If anyone is interested why: Many usb devices such as 3g modems or scanner are behaving strange sometimes and it helps to disconnect and connect them again (or powering them off and on), which would solve a lot of issues, now remotely impossible. Reboot itself does not necessarily power off the usb, so it is not solution.

(Last edited by nozombian on 24 Jun 2013, 23:03)

On a 703n I do like this

root@OpenWrt:/# echo 1 >/sys/class/gpio/gpio8/value

root@OpenWrt:/# echo 0 >/sys/class/gpio/gpio8/value

Halelujah! Five stars reply, thank you very much! Only it is gpio6 on wr842nd. How do you know that? yikes I googled a lot, but have not found a line about that.

(Last edited by nozombian on 28 Jun 2013, 11:53)

On a TP-Link WDR3600 with 2 USB Ports works also:
echo 0 > /sys/devices/virtual/gpio/gpio21/value
echo 0 > /sys/devices/virtual/gpio/gpio22/value

After reboot the settings gone, wonder why...
Any Idea? smile

Because those are not persistent settings?

And how do you make them to be?

You can't. You have to set them every time you start up.

you can add that to /etc/rc.local

When I add it to /etc/rc.local than it will power off USB after init process, but before init, for a short time power will be on. I've tested it. Don't know whether good for an extern HDD. Thanks anyway, I will use it! :-)

If you are concerned about a connected HDD then make sure its not set to auto-mount and add a sleep command before the gpio disable commands, so that the HDD has time to fully spin up before you shut it back down again.  Its not like you will be rebooting every couple of minutes.

I'm trying to control e relay using either the system LED or the USB power on the WR703N, but in both cases the GPIO for that device goes high or blinks during power on. Does anyone know a way to disable that behavior? Or where could I search for a workaround?

XOR 2 GPIO should theoretically work :-\

I couldn't find anywhere which gpio pin powers off USB on TP-LINK WR1043ND. None of the above is working, and on the device page it's not shown which pin is for USB power (I tried pin 15 and 16 too). Can somebody help me out with this?

Anyone, tips for how can I power off USB on 1043ND?

try hdparm package for usb disks
it has the capability.. but i dontknow if works fine on usb

The discussion might have continued from here.