1 (edited by nozombian 2013-06-24 21:03:04)

Topic: how to turn usb power off

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.

Re: how to turn usb power off

On a 703n I do like this

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


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

3 (edited by nozombian 2013-06-28 09:53:11)

Re: how to turn usb power off

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.

Re: how to turn usb power off

Feel free to update the wiki from time to time:

http://wiki.openwrt.org/doc/faq/after.installation#how.do.i.turn.usb.power.off

Re: how to turn usb power off

kirschwasser wrote:

Feel free to update the wiki from time to time:

Done ;-)
http://wiki.openwrt.org/toh/tp-link/tl-mr3420#turn.usb.power.off

Netgear WNR854T (ARM Marvell Orion CPU 500MHz, Marvell 88W8361P mini-PCI STA only, 8/32MB) - trunk r17427 since 09/09/09 to 06-06-12 GLOD
TP-LINK TL-WR741ND v1.9 (Atheros AR7240 CPU 350MHz, Atheros AR9285 Chipset, 4/32MB) - trunk r23281 since 10/10/10
TP-LINK TL-MR3420 v1.1, TL-MR3220 v1.2 - trunk r25302 since 11/11/11
TP-LINK TL-WR842ND v1.0, TL-WR1043ND v1.8 - 12.09-rc1 since 12/12/12

Re: how to turn usb power off

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

Re: how to turn usb power off

Because those are not persistent settings?

Re: how to turn usb power off

And how do you make them to be?

Re: how to turn usb power off

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

Re: how to turn usb power off

you can add that to /etc/rc.local

Re: how to turn usb power off

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! :-)

Re: how to turn usb power off

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.

ISP: Origin Broadband (70Mbit/18Mbit) Steam/XBOX: Alex Atkin UK PSN/WiiU: AlexAtkinUK Website: http://csdprojects.co.uk
pfSense: Intel Atom DN2800MT (Router) OpenWRT: TP-Link Archer C7 v2 (WiFi), TP-Link WDR3600 x 2 (WDS/WiFi).

Re: how to turn usb power off

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?

Re: how to turn usb power off

XOR 2 GPIO should theoretically work :-\

Netgear WNR854T (ARM Marvell Orion CPU 500MHz, Marvell 88W8361P mini-PCI STA only, 8/32MB) - trunk r17427 since 09/09/09 to 06-06-12 GLOD
TP-LINK TL-WR741ND v1.9 (Atheros AR7240 CPU 350MHz, Atheros AR9285 Chipset, 4/32MB) - trunk r23281 since 10/10/10
TP-LINK TL-MR3420 v1.1, TL-MR3220 v1.2 - trunk r25302 since 11/11/11
TP-LINK TL-WR842ND v1.0, TL-WR1043ND v1.8 - 12.09-rc1 since 12/12/12

Re: how to turn usb power off

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?

Re: how to turn usb power off

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

Re: how to turn usb power off

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

tp-link 1043nd fw 1.8 / attitude adj 12.09-rc2 / winxp / ubuntu box

Good morning, and in case I don't see ya, good afternoon, good evening, and good night! Truman Show