The Led command can be used to activate Led configurations that are defined by the active led.conf file. The led.conf file defines a set of modules used to control the Leds on the outside of the router. Each module has a number of states, for example
Code: Select all
module = usb #
state = 0 # 0 = link down
gpio = 12 # USB LED
mode = 0 # 0 = off
state = 1 # 1 = link up
gpio = 12 # USB LED
mode = 1 # 1 = on
state = 2 # 2 = pkt rcv
gpio = 12 # USB LED
mode = 2 # 2 = blinkoff
param1 = 100 # blink rate in ms
state = 3 # 3 = pkt xmit
gpio = 12 # USB LED
mode = 2 # 2 = blinkoff
param1 = 100 # blink rate in ms
Code: Select all
Led usb 1
Code: Select all
Led usb 0
The RouterTech firmware does not automatically control led modules such as "power" or "status", so these are free to be controlled by the Led command.
NOTE also that, sometimes, the ADSL leds are defined in the led.conf file, but are actually hard-wired to the DSP chip. In such cases, they are likely not be controllable with the Led command.
Custom led.conf files can be loaded using
Code: Select all
ledcfg -f myfile.conf
Custom led.conf files can be configured using a local minix (/nvram) directory using
Code: Select all
setenv led_conf /nvram/myled
The following script can be used to perform a test of GPIOs
Code: Select all
#!/bin/sh
if [ "$1" = "" ]; then
echo "Usage $0 GPIO_Number"
exit
fi
CNF=/var/tmp/ledtest.conf
cat >$CNF<<EOF
module = test
state = 0
gpio = $1
mode = 0 # 0 = off
state = 1
gpio = $1
mode = 1 # 1 = on
state = 2
gpio = $1
mode = 2 # 2 = blinkoff
param1 = 50 # blink/flash rate in ms
state = 3
gpio = $1
mode = 3 # 3 = blinkon
param1 = 50 # blink/flash rate in ms
state = 4
gpio = $1
mode = 4 # 4 = Flash
param1 = 100 # flash on duration in ms
param2 = 200 # flash off duration in ms
EOF
/sbin/ledcfg -f $CNF
LED=/usr/bin/Led
for i in 1 2 0 3 4 ; do
echo "Testing GPIO $1 mode = $i"
$LED test $i
sleep 2
done
Results of using this script on a Linksys ADSL2MUE, GPIO:
11 is the same as the reset button - resets to defaults
19 crashed the serial console interface
28 crashed the Ethernet ssh session