[rdc] improve sitecom device support
[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 ap81)
34 status_led="ap81:green:status"
35 ;;
36 ap83)
37 status_led="ap83:green:power"
38 ;;
39 aw-nr580)
40 status_led="aw-nr580:green:ready"
41 ;;
42 bullet-m | rocket-m | nano-m)
43 status_led="ubnt:green:link4"
44 ;;
45 dir-600-a1)
46 status_led="dir-600-a1:green:power"
47 ;;
48 dir-615-c1)
49 status_led="dir-615c1:green:status"
50 ;;
51 dir-825-b1)
52 status_led="dir825b1:orange:power"
53 ;;
54 ls-sr71)
55 status_led="ubnt:green:d22"
56 ;;
57 mzk-w04nu)
58 status_led="mzk-w04nu:green:status"
59 ;;
60 mzk-w300nh)
61 status_led="mzk-w300nh:green:status"
62 ;;
63 pb44)
64 status_led="pb44:amber:jump1"
65 ;;
66 routerstation | routerstation-pro)
67 status_led="ubnt:green:rf"
68 ;;
69 tew-632brp)
70 status_led="tew-632brp:green:status"
71 ;;
72 tl-wr1043nd)
73 status_led="tl-wr1043nd:green:system"
74 ;;
75 tl-wr741nd)
76 status_led="tl-wr741nd:green:system"
77 ;;
78 tl-wr841n-v1)
79 status_led="tl-wr841n:green:system"
80 ;;
81 tl-wr941nd)
82 status_led="tl-wr941nd:green:system"
83 ;;
84 wndr3700)
85 status_led="wndr3700:green:power"
86 ;;
87 wnr2000)
88 status_led="wnr2000:green:power"
89 ;;
90 wp543)
91 status_led="wp543:green:diag"
92 ;;
93 wrt400n)
94 status_led="wrt400n:green:status"
95 ;;
96 wrt160nl)
97 status_led="wrt160nl:blue:wps"
98 ;;
99 wzr-hp-g300nh)
100 status_led="wzr-hp-g300nh:green:router"
101 ;;
102 esac;
103 }
104
105 set_state() {
106 get_status_led
107
108 case "$1" in
109 preinit)
110 insmod leds-gpio
111 status_led_set_timer 200 200
112 ;;
113 failsafe)
114 status_led_set_timer 50 50
115 ;;
116 done)
117 status_led_on
118 ;;
119 esac
120 }
This page took 0.043468 seconds and 5 git commands to generate.