What's new

Control the USB Power supply (on/off) with commands

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

On AX88U the command works:

Code:
admin@Router:/tmp/home/root# hub-ctrl -v
Hub #0 at       BUS:DEV         002:001
                USB VEND:PROD:  1d6b:0001
 Hub Port Status: (2)
   Port 1: 0000.0100 power
   Port 2: 0000.0100 power
Hub #1 at       BUS:DEV         001:001
                USB VEND:PROD:  1d6b:0002
 INFO: individual power switching.
 WARN: Port indicators are NOT supported.
 Hub Port Status: (2)
   Port 1: 0000.0100 power
   Port 2: 0000.0503 highspeed power enable connect
 
RT-AC68U using John's fork also doesn't work.
Fix sent....
Code:
admin@RT-AC68P-xxxx:/tmp/home/root# hub-ctrl -v
Hub #0 at     BUS:DEV        001:001
        USB VEND:PROD:     1d6b:0003
 Hub Port Status: (1)
   Port 1: 0000.8103 5gbps enable connect
Hub #1 at     BUS:DEV        002:001
        USB VEND:PROD:     1d6b:0002
 INFO: individual power switching.
 WARN: Port indicators are NOT supported.
 Hub Port Status: (2)
   Port 1: 0000.0100 power
   Port 2: 0000.0503 highspeed power enable connect
Hub #2 at     BUS:DEV        003:001
        USB VEND:PROD:     1d6b:0001
 Hub Port Status: (2)
   Port 1: 0000.0100 power
   Port 2: 0000.0100 power
admin@RT-AC68P-xxxx:/tmp/home/root#
 
RT-AX56U rather verbose compared to other models such as RT-AC68U etc.????

Code:
hub-ctrl -v

Hub #0 at  BUS:DEV  006:001
  USB VEND:PROD:  1d6b:0001
 Hub Port Status: (1)
   Port 1: 0000.0100 power
Hub #1 at  BUS:DEV  005:001
  USB VEND:PROD:  1d6b:0001
 Hub Port Status: (1)
   Port 1: 0000.0100 power
Hub #2 at  BUS:DEV  004:001
  USB VEND:PROD:  1d6b:0002
 INFO: individual power switching.
 WARN: Port indicators are NOT supported.
 Hub Port Status: (1)
   Port 1: 0000.0100 power
Hub #3 at  BUS:DEV  003:001
  USB VEND:PROD:  1d6b:0002
 INFO: individual power switching.
 WARN: Port indicators are NOT supported.
 Hub Port Status: (1)
   Port 1: 0000.0100 power
Hub #4 at  BUS:DEV  001:001
  USB VEND:PROD:  1d6b:0002
 INFO: individual power switching.
 WARN: Port indicators are NOT supported.
 Hub Port Status: (0)
Hub #5 at  BUS:DEV  002:001
  USB VEND:PROD:  1d6b:0003
 INFO: individual power switching.
 WARN: Port indicators are NOT supported.
 Hub Port Status: (1)
   Port 1: 0000.0203 5gbps power enable connect
 
RT-AX56U rather verbose compared to other models such as RT-AC68U etc.????

Code:
hub-ctrl -v

Hub #0 at  BUS:DEV  006:001
  USB VEND:PROD:  1d6b:0001
 Hub Port Status: (1)
   Port 1: 0000.0100 power
Hub #1 at  BUS:DEV  005:001
  USB VEND:PROD:  1d6b:0001
 Hub Port Status: (1)
   Port 1: 0000.0100 power
Hub #2 at  BUS:DEV  004:001
  USB VEND:PROD:  1d6b:0002
 INFO: individual power switching.
 WARN: Port indicators are NOT supported.
 Hub Port Status: (1)
   Port 1: 0000.0100 power
Hub #3 at  BUS:DEV  003:001
  USB VEND:PROD:  1d6b:0002
 INFO: individual power switching.
 WARN: Port indicators are NOT supported.
 Hub Port Status: (1)
   Port 1: 0000.0100 power
Hub #4 at  BUS:DEV  001:001
  USB VEND:PROD:  1d6b:0002
 INFO: individual power switching.
 WARN: Port indicators are NOT supported.
 Hub Port Status: (0)
Hub #5 at  BUS:DEV  002:001
  USB VEND:PROD:  1d6b:0003
 INFO: individual power switching.
 WARN: Port indicators are NOT supported.
 Hub Port Status: (1)
   Port 1: 0000.0203 5gbps power enable connect
I can't believe there are 6 hubs!!
 
Any thoughts on this?
Nothing works, USB can't be disabled.
I can only see the result of -v:
Code:
hub-ctrl -v
Hub #0 at 003:001
 INFO: individual power switching.
 WARN: Port indicators are NOT supported.
 Hub Port Status:
   Port 1: 0000.0503 highspeed power enable connect
   Port 2: 0000.0100 power

but when I do hub-ctrl -P 2 or 1, nothing happens
 
but when I do hub-ctrl -P 2 or 1, nothing happens
My guess is that all you are doing is changing one of the attributes of the USB interface. You're not actually turning off the 5v power available at the USB socket. So if your fan is just a 2-wire fan plugged into the socket nothing will happen.
 
Last edited:
Thanks for sharing.
Tried these tip on my old RT-N66W (Merlin LTS Fork 374.43_43E6j9527) with small external USB plugged fan, sadly no luck:

Bash:
RT-N66W:/tmp/home/root# hub-ctrl -v
Hub #0 at       BUS:DEV         001:066
                USB VEND:PROD:  058f:6254
INFO: ganged switching.
Hub Port Status: (4)
   Port 1: 0000.0301 lowspeed power connect
   Port 2: 0000.0100 power
   Port 3: 0000.0100 power
   Port 4: 0000.0503 highspeed power enable connect
Hub #1 at       BUS:DEV         002:001
                USB VEND:PROD:  1d6b:0001
Hub Port Status: (2)
   Port 1: 0000.0100 power
   Port 2: 0000.0100 power
Hub #2 at       BUS:DEV         001:001
                USB VEND:PROD:  1d6b:0002
INFO: individual power switching.
WARN: Port indicators are NOT supported.
Hub Port Status: (2)
   Port 1: 0000.0503 highspeed power enable connect
   Port 2: 0000.0000

But, then i switching power like this:

Bash:
hub-ctrl -h 2 -P 1 -p 0

Nothing happens, fan still running and port status not changed, tried all ports and hubs. However i can change port status on Hub#0, checking with -v command, but i have no idea what is this hub for and where it locates.
 
Thanks for sharing.
Tried these tip on my old RT-N66W (Merlin LTS Fork 374.43_43E6j9527) with small external USB plugged fan, sadly no luck:

Bash:
RT-N66W:/tmp/home/root# hub-ctrl -v
Hub #0 at       BUS:DEV         001:066
                USB VEND:PROD:  058f:6254
INFO: ganged switching.
Hub Port Status: (4)
   Port 1: 0000.0301 lowspeed power connect
   Port 2: 0000.0100 power
   Port 3: 0000.0100 power
   Port 4: 0000.0503 highspeed power enable connect
Hub #1 at       BUS:DEV         002:001
                USB VEND:PROD:  1d6b:0001
Hub Port Status: (2)
   Port 1: 0000.0100 power
   Port 2: 0000.0100 power
Hub #2 at       BUS:DEV         001:001
                USB VEND:PROD:  1d6b:0002
INFO: individual power switching.
WARN: Port indicators are NOT supported.
Hub Port Status: (2)
   Port 1: 0000.0503 highspeed power enable connect
   Port 2: 0000.0000

But, then i switching power like this:

Bash:
hub-ctrl -h 2 -P 1 -p 0

Nothing happens, fan still running and port status not changed, tried all ports and hubs. However i can change port status on Hub#0, checking with -v command, but i have no idea what is this hub for and where it locates.
Sorry for the late reply
I recently tried the command again and I found that the problem is that the hub-ctrl cannot control the power of the 0th hub, and whatever the model is. But with routers like RT-AC68U, the USB ports are controlled by other hub, not hub 0, which is why it only works on some routers and not others.


More research on it from the developers is required, which is beyond my control. but I tend to look for another way to control USB power, I'm sure there will be some out there. for example, you can watch the USB ports power up multiple times when the router reboots, and there will be a software control method there. I tried below command but it doesn't work:
Code:
echo "0" > /sys/power/bpcm/usb/zone0/power

But what's interesting is that when you set the power of all USB ports (./zoneX/power) to 0, and when you enter the command hub-ctrl, it causes all ports, including the ethernet ports, to power cycle. So basically there must be a way to make it work, just haven't been found.
 
Last edited:
How to remotely reboot the USB modem on the router?

Code:
# hub-ctrl -P 1  && hub-ctrl -P 1 -p 1
Is this the correct command?

Code:
# hub-ctrl -v
Hub #0 at     BUS:DEV        003:001
        USB VEND:PROD:     1d6b:0001
 Hub Port Status: (2)
   Port 1: 0000.0100 power
   Port 2: 0000.0100 power
Hub #1 at     BUS:DEV        002:001
        USB VEND:PROD:     1d6b:0002
 INFO: individual power switching.
 WARN: Port indicators are NOT supported.
 Hub Port Status: (2)
   Port 1: 0000.0503 highspeed power enable connect
   Port 2: 0000.0100 power
Hub #2 at     BUS:DEV        001:001
        USB VEND:PROD:     1d6b:0003
 Hub Port Status: (1)
   Port 1: 0000.0100
 
Asus customer service told me don't connect a usb fan to the router, as this could cause the router to overload and even damage the capacitors.
But I think they will no objection to using a phone adapter to power the fan.

I think ASUS main concern here is that hubs can be powered (or not) - a powered hub, I think would be fine from a bus power perspective... an unpowered hub means that everything plugged into that hub is going to need power from the router...

That being said - hub-ctl sounds a bit scary, as it would be ok for things like USB fans, and even to bounce a USB modem (there's better ways to do that), but yoinking power from a USB drive sounds like a bad plan...
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top