2010-04-11 17:47:23 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (C) 2010 OpenWrt.org
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
. /lib/ramips.sh
|
|
|
|
|
|
|
|
status_led=""
|
|
|
|
|
|
|
|
led_set_attr() {
|
|
|
|
[ -f "/sys/class/leds/$1/$2" ] && echo "$3" > "/sys/class/leds/$1/$2"
|
|
|
|
}
|
|
|
|
|
|
|
|
status_led_set_timer() {
|
|
|
|
led_set_attr $status_led "trigger" "timer"
|
|
|
|
led_set_attr $status_led "delay_on" "$1"
|
|
|
|
led_set_attr $status_led "delay_off" "$2"
|
|
|
|
}
|
|
|
|
|
|
|
|
status_led_on() {
|
|
|
|
led_set_attr $status_led "trigger" "none"
|
|
|
|
led_set_attr $status_led "brightness" 255
|
|
|
|
}
|
|
|
|
|
|
|
|
status_led_off() {
|
|
|
|
led_set_attr $status_led "trigger" "none"
|
|
|
|
led_set_attr $status_led "brightness" 0
|
|
|
|
}
|
|
|
|
|
|
|
|
get_status_led() {
|
|
|
|
case $(ramips_board_name) in
|
2012-07-12 13:29:46 +00:00
|
|
|
3g-6200n)
|
|
|
|
status_led="edimax:green:power"
|
|
|
|
;;
|
2012-01-23 10:23:32 +00:00
|
|
|
argus-atp52b)
|
|
|
|
status_led="argus-atp52b:green:run"
|
|
|
|
;;
|
2012-08-17 17:56:05 +00:00
|
|
|
dir-300-b1 | dir-600-b1 | dir-600-b2 | dir-615-h1 | dir-620-a1)
|
2011-07-28 10:56:21 +00:00
|
|
|
status_led="d-link:green:status"
|
2010-04-11 17:47:23 +00:00
|
|
|
;;
|
2012-07-24 20:38:43 +00:00
|
|
|
dap-1350)
|
|
|
|
status_led="d-link:blue:power"
|
|
|
|
;;
|
2011-12-23 14:27:10 +00:00
|
|
|
esr-9753)
|
|
|
|
status_led="esr-9753:orange:power"
|
|
|
|
;;
|
2012-01-23 10:23:32 +00:00
|
|
|
f5d8235-v2)
|
|
|
|
status_led="f5d8235v2:blue:router"
|
2011-12-28 08:43:43 +00:00
|
|
|
;;
|
2010-04-11 17:47:23 +00:00
|
|
|
fonera20n)
|
|
|
|
status_led="fonera20n:green:power"
|
|
|
|
;;
|
2012-08-17 17:56:07 +00:00
|
|
|
all0239-3g|\
|
2011-03-27 19:19:40 +00:00
|
|
|
hw550-3g)
|
|
|
|
status_led="hw550-3g:green:status"
|
|
|
|
;;
|
2011-04-04 08:43:07 +00:00
|
|
|
mofi3500-3gn)
|
|
|
|
status_led="mofi3500-3gn:green:status"
|
|
|
|
;;
|
2011-08-22 20:41:49 +00:00
|
|
|
nbg-419n)
|
|
|
|
status_led="nbg-419n:green:power"
|
|
|
|
;;
|
2011-07-28 10:56:32 +00:00
|
|
|
nw718)
|
|
|
|
status_led="nw718:amber:cpu"
|
|
|
|
;;
|
2011-12-14 20:51:26 +00:00
|
|
|
omni-emb)
|
|
|
|
status_led="emb:green:status"
|
|
|
|
;;
|
2012-06-19 09:52:15 +00:00
|
|
|
psr-680w)
|
|
|
|
status_led="psr-680w:red:wan"
|
|
|
|
;;
|
2011-07-06 08:05:00 +00:00
|
|
|
pwh2004)
|
|
|
|
status_led="pwh2004:green:power"
|
|
|
|
;;
|
|
|
|
rt-n15)
|
|
|
|
status_led="rt-n15:blue:power"
|
|
|
|
;;
|
2012-03-04 16:09:11 +00:00
|
|
|
rt-n10-plus)
|
|
|
|
status_led="asus:green:wps"
|
|
|
|
;;
|
2012-04-23 16:56:05 +00:00
|
|
|
rt-n56u | wl-330n | wl-330n3g)
|
2012-02-13 15:18:04 +00:00
|
|
|
status_led="asus:blue:power"
|
|
|
|
;;
|
2012-02-19 16:44:49 +00:00
|
|
|
sl-r7205)
|
|
|
|
status_led="sl-r7205:green:status"
|
|
|
|
;;
|
2012-02-15 21:13:11 +00:00
|
|
|
v11st-fe)
|
|
|
|
status_led="v11st-fe:green:status"
|
|
|
|
;;
|
2011-07-06 08:05:00 +00:00
|
|
|
v22rw-2x2)
|
|
|
|
status_led="v22rw-2x2:green:security"
|
|
|
|
;;
|
2012-04-21 12:30:40 +00:00
|
|
|
w306r-v20)
|
2012-05-02 19:17:59 +00:00
|
|
|
status_led="w306r-v20:green:sys"
|
2012-04-21 12:30:40 +00:00
|
|
|
;;
|
2011-12-28 08:43:32 +00:00
|
|
|
w502u)
|
|
|
|
status_led="alfa:blue:wps"
|
|
|
|
;;
|
2012-01-23 10:23:32 +00:00
|
|
|
wcr-150gn)
|
|
|
|
status_led="wcr150gn:amber:power"
|
|
|
|
;;
|
2011-07-06 08:05:00 +00:00
|
|
|
whr-g300n)
|
|
|
|
status_led="whr-g300n:green:router"
|
|
|
|
;;
|
2011-12-27 16:56:30 +00:00
|
|
|
wli-tx4-ag300n)
|
|
|
|
status_led="buffalo:blue:power"
|
|
|
|
;;
|
2011-12-23 14:27:16 +00:00
|
|
|
wl-351)
|
|
|
|
status_led="wl-351:amber:power"
|
|
|
|
;;
|
2012-01-22 13:43:23 +00:00
|
|
|
wr512-3gn)
|
|
|
|
status_led="wr512:green:wps"
|
|
|
|
;;
|
2012-04-23 16:56:06 +00:00
|
|
|
ur-336un)
|
|
|
|
status_led="ur336:green:wps"
|
|
|
|
;;
|
2012-03-04 16:09:13 +00:00
|
|
|
xdxrn502j)
|
|
|
|
status_led="xdxrn502j:green:power"
|
|
|
|
;;
|
2011-03-27 19:19:40 +00:00
|
|
|
esac
|
2010-04-11 17:47:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set_state() {
|
|
|
|
get_status_led
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
preinit)
|
|
|
|
insmod leds-gpio
|
|
|
|
status_led_set_timer 200 200
|
|
|
|
;;
|
|
|
|
failsafe)
|
|
|
|
status_led_set_timer 50 50
|
|
|
|
;;
|
|
|
|
done)
|
|
|
|
status_led_on
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|