Yota
Very Senior Member
Many people have asked how to control the asuswrt USB power supply with commands? now I found the way.
Well, the simple answer is:
Use the hub-ctrl
Help documentation
How do I find it
Just ready to write a script that wants to control the fan by controlling the USB power supply. but, searched the forum and Google didn't find it.
However, this thread helped me, and after testing some commands, I found it. this command should work on both stock and merlin firmware.
Usage example
You can use a simple script to control USB fan on and off, like this:
Don't forget to create a scheduled task, like this:
Enjoy!
References
User scripts asuswrt-merlin
Scheduled tasks (cron jobs) & Scheduled Reboot
Command to get the correct temperature value by sfx2000
Power on/off USB ports on hubs with hub-ctrl from the openwrt forum
Toggling USB subsystem via ssh from the dd-wrt forum
Well, the simple answer is:
Use the hub-ctrl
Help documentation
Code:
/tmp# hub-ctrl --help
Usage: hub-ctrl [{-h HUBNUM | -b BUSNUM -d DEVNUM}] \
[-P PORT] [{-p [VALUE]|-l [VALUE]}]
Examples:
* # hub-ctrl -v // List hubs available
* # hub-ctrl -P 1 // Power off at port 1
* # hub-ctrl -P 1 -p 1 // Power on at port 1
* # hub-ctrl -P 2 -l // LED on at port 2
How do I find it
Just ready to write a script that wants to control the fan by controlling the USB power supply. but, searched the forum and Google didn't find it.
However, this thread helped me, and after testing some commands, I found it. this command should work on both stock and merlin firmware.
Usage example
You can use a simple script to control USB fan on and off, like this:
Code:
#!/bin/sh
# Turn the fan on above 100 celsius, else turn it off.
# NOTE: Different models have different temperature commands.
if [ "$(cat /sys/class/thermal/thermal_zone0/temp | sed 's/.\{3\}$/.&/')" -ge "100" ]; then
hub-ctrl -P 1 -p 1
else
hub-ctrl -P 1
fi
Code:
# Run your script every 30 minutes.
cru a CTRLUSB "*/30 * * * * /jffs/scripts/your_script"
Enjoy!
References
User scripts asuswrt-merlin
Scheduled tasks (cron jobs) & Scheduled Reboot
Command to get the correct temperature value by sfx2000
Power on/off USB ports on hubs with hub-ctrl from the openwrt forum
Toggling USB subsystem via ssh from the dd-wrt forum
Last edited: