d8bcb90ce707468e747d94c605a1f3be7c022bcf
[openwrt.git] / target / linux / ar71xx / base-files / etc / diag.sh
1 #!/bin/sh
2 #
3 # Copyright (C) 2009 OpenWrt.org
4 #
5 #
6
7 . /lib/ar71xx.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 $(ar71xx_board_name) in
33 alfa-nx)
34 status_led="alfa:green:led_8"
35 ;;
36 ap81)
37 status_led="ap81:green:status"
38 ;;
39 ap83)
40 status_led="ap83:green:power"
41 ;;
42 ap96)
43 status_led="ap96:green:led2"
44 ;;
45 aw-nr580)
46 status_led="aw-nr580:green:ready"
47 ;;
48 bullet-m | rocket-m | nano-m | nanostation-m)
49 status_led="ubnt:green:link4"
50 ;;
51 db120)
52 status_led="db120:green:status"
53 ;;
54 dir-600-a1)
55 status_led="dir-600-a1:green:power"
56 ;;
57 dir-615-c1)
58 status_led="dir-615c1:green:status"
59 ;;
60 dir-825-b1)
61 status_led="dir825b1:orange:power"
62 ;;
63 eap7660d)
64 status_led="eap7660d:green:ds4"
65 ;;
66 hornet-ub)
67 status_led="alfa:blue:wps"
68 ;;
69 ja76pf)
70 status_led="ja76pf:green:led1"
71 ;;
72 ls-sr71)
73 status_led="ubnt:green:d22"
74 ;;
75 mzk-w04nu | \
76 mzk-w300nh)
77 status_led="planex:green:status"
78 ;;
79 nbg460n_550n_550nh)
80 status_led="nbg460n:green:power"
81 ;;
82 om2p)
83 status_led="om2p:blue:power"
84 ;;
85 pb44)
86 status_led="pb44:amber:jump1"
87 ;;
88 rb-411 | rb-411u | rb-433 | rb-433u | rb-450 | rb-450g | rb-493)
89 status_led="rb4xx:yellow:user"
90 ;;
91 routerstation | routerstation-pro)
92 status_led="ubnt:green:rf"
93 ;;
94 tew-632brp)
95 status_led="tew-632brp:green:status"
96 ;;
97 tl-mr3020 | \
98 tl-mr3220 | \
99 tl-mr3420 | \
100 tl-wa901nd | \
101 tl-wa901nd-v2 | \
102 tl-wr1043nd | \
103 tl-wr741nd | \
104 tl-wr741nd-v4 | \
105 tl-wr841n-v1 | \
106 tl-wr941nd)
107 status_led="tp-link:green:system"
108 ;;
109 tl-wr703n)
110 status_led="tp-link:blue:system"
111 ;;
112 unifi)
113 status_led="ubnt:green:dome"
114 ;;
115 whr-g301n | \
116 whr-hp-g300n | \
117 whr-hp-gn | \
118 wzr-hp-g300nh)
119 status_led="buffalo:green:router"
120 ;;
121 wzr-hp-g300nh2)
122 status_led="buffalo:red:diag"
123 ;;
124 wndr3700)
125 status_led="wndr3700:green:power"
126 ;;
127 wnr2000)
128 status_led="wnr2000:green:power"
129 ;;
130 wp543)
131 status_led="wp543:green:diag"
132 ;;
133 wrt400n)
134 status_led="wrt400n:blue:wps"
135 ;;
136 wrt160nl)
137 status_led="wrt160nl:blue:wps"
138 ;;
139 zcn-1523h-2 | zcn-1523h-5)
140 status_led="zcn-1523h:amber:init"
141 ;;
142 esac;
143 }
144
145 set_state() {
146 get_status_led
147
148 case "$1" in
149 preinit)
150 insmod leds-gpio
151 status_led_set_timer 200 200
152 ;;
153 failsafe)
154 status_led_set_timer 50 50
155 ;;
156 done)
157 status_led_on
158 ;;
159 esac
160 }
This page took 0.056376 seconds and 3 git commands to generate.