Usb power toggle

i own a wrt3200acm in which, among other things, i have plugged a huawei 3g modem. every once in a while the modem hangs and the only solution is to do a power cycle on the thing. usbreset and bind/unbind work only at logic level and therefore do not help recover the modem. does anyone know which gpio (if any) control the usb power line for the wrt3200acm? or any other solution to make a power line toggle over the usb ports so the modem can recover? i do not mind doing it by hand by i am 200km away from it most of the time :slight_smile:

Have you already tried hub-ctrl?

it's not working. in /sys none of the usb's have a power option so i doubt the armada 385 "knows" how to control the power directly. my best bet is on a gpio which controls the Vcc line...

afaik not possible.
This is your device dts from upstream
There is no GPIO to control that.

I think the only option is to do a hardware contraption with a USB relay (that will be controlled by the router with crelay package), should be easy enough.

  1. Buy a Y usb cable (a cable that has one female end for the modem and two male ends, one of the two male cables is only for power, it usually has a different color than the full USB cable)
  2. buy a separate 5v power supply for the modem, 5V 2A will be ok for all modems that are powered by a USB port,
  3. buy a supported usb relay (see article below)
  4. cover the USB power contacts (the one on the right and the one on the left, central contacts are two data lines) with tape in the end you insert in the router USB,
  5. cut the second USB port (the power-only one) to get at the power wires (usually red is positive and black is negative) and connect them to a USB relay, install crelay to operate this switch remotely (or with a script)

Could there be an undiscovered GPIO that managed the power to the USB ports? Is it worth trying to find them?

Sorry I misread the dts file, yes there is a GPIO at the end of the file, this:

&usb3_1_vbus {
	gpio = <&gpio1 12 GPIO_ACTIVE_HIGH>;

You may need to operate it manually through the GPIO subsystem as it's not assigned a specific "switch", see here

This is gpio 12 of bank 1, so "gpio 28" for the instructions in the link

Tried tho change the value of GPIO28 from 0 to 1:

root@router:~# cd /sys/class/gpio/
root@router:/sys/class/gpio# echo 28 > export
root@router:/sys/class/gpio# echo out > gpio28/direction 
root@router:/sys/class/gpio# echo 1 > gpio28/value 

Device began to spew I/O errors (not related to USB, there was no USB memory connected), it unusable (all commands failed with I/O errors), and had to shut it down. Looks like a dead end to me.

tried it a few mins ago - same thing happened...

I suspect that this GPIO is claimed by the USB driver (unrelated hardware)

Try to unload the USB drivers first.

1 Like