ramips: add D-Link DIR-620 A1 support
[openwrt/svn-archive/archive.git] / target / linux / ramips / base-files / etc / diag.sh
1 #!/bin/sh
2 #
3 # Copyright (C) 2010 OpenWrt.org
4 #
5 #
6
7 . /lib/ramips.sh
8
9 status_led=""
10
11 led_set_attr() {
12 [ -f "/sys/class/leds/$1/$2" ] && echo "$3" > "/sys/class/leds/$1/$2"
13 }
14
15 status_led_set_timer() {
16 led_set_attr $status_led "trigger" "timer"
17 led_set_attr $status_led "delay_on" "$1"
18 led_set_attr $status_led "delay_off" "$2"
19 }
20
21 status_led_on() {
22 led_set_attr $status_led "trigger" "none"
23 led_set_attr $status_led "brightness" 255
24 }
25
26 status_led_off() {
27 led_set_attr $status_led "trigger" "none"
28 led_set_attr $status_led "brightness" 0
29 }
30
31 get_status_led() {
32 case $(ramips_board_name) in
33 3g-6200n)
34 status_led="edimax:green:power"
35 ;;
36 argus-atp52b)
37 status_led="argus-atp52b:green:run"
38 ;;
39 dir-300-b1 | dir-600-b1 | dir-600-b2 | dir-620-a1)
40 status_led="d-link:green:status"
41 ;;
42 dap-1350)
43 status_led="d-link:blue:power"
44 ;;
45 esr-9753)
46 status_led="esr-9753:orange:power"
47 ;;
48 f5d8235-v2)
49 status_led="f5d8235v2:blue:router"
50 ;;
51 fonera20n)
52 status_led="fonera20n:green:power"
53 ;;
54 hw550-3g)
55 status_led="hw550-3g:green:status"
56 ;;
57 mofi3500-3gn)
58 status_led="mofi3500-3gn:green:status"
59 ;;
60 nbg-419n)
61 status_led="nbg-419n:green:power"
62 ;;
63 nw718)
64 status_led="nw718:amber:cpu"
65 ;;
66 omni-emb)
67 status_led="emb:green:status"
68 ;;
69 psr-680w)
70 status_led="psr-680w:red:wan"
71 ;;
72 pwh2004)
73 status_led="pwh2004:green:power"
74 ;;
75 rt-n15)
76 status_led="rt-n15:blue:power"
77 ;;
78 rt-n10-plus)
79 status_led="asus:green:wps"
80 ;;
81 rt-n56u | wl-330n | wl-330n3g)
82 status_led="asus:blue:power"
83 ;;
84 sl-r7205)
85 status_led="sl-r7205:green:status"
86 ;;
87 v11st-fe)
88 status_led="v11st-fe:green:status"
89 ;;
90 v22rw-2x2)
91 status_led="v22rw-2x2:green:security"
92 ;;
93 w306r-v20)
94 status_led="w306r-v20:green:sys"
95 ;;
96 w502u)
97 status_led="alfa:blue:wps"
98 ;;
99 wcr-150gn)
100 status_led="wcr150gn:amber:power"
101 ;;
102 whr-g300n)
103 status_led="whr-g300n:green:router"
104 ;;
105 wli-tx4-ag300n)
106 status_led="buffalo:blue:power"
107 ;;
108 wl-351)
109 status_led="wl-351:amber:power"
110 ;;
111 wr512-3gn)
112 status_led="wr512:green:wps"
113 ;;
114 ur-336un)
115 status_led="ur336:green:wps"
116 ;;
117 xdxrn502j)
118 status_led="xdxrn502j:green:power"
119 ;;
120 esac
121 }
122
123 set_state() {
124 get_status_led
125
126 case "$1" in
127 preinit)
128 insmod leds-gpio
129 status_led_set_timer 200 200
130 ;;
131 failsafe)
132 status_led_set_timer 50 50
133 ;;
134 done)
135 status_led_on
136 ;;
137 esac
138 }