ramips: fix leds for TP-Link Archer C20 v4
[openwrt/openwrt.git] / target / linux / ramips / mt76x8 / base-files / etc / board.d / 01_leds
1 #!/bin/sh
2
3 . /lib/functions/leds.sh
4 . /lib/functions/uci-defaults.sh
5
6 set_wifi_led() {
7 ucidef_set_led_netdev "wifi_led" "wifi" "${1}" "${2:-wlan0}"
8 }
9
10
11 board=$(board_name)
12 boardname="${board##*,}"
13
14 board_config_update
15
16 led_wlan="$(get_dt_led wlan)"
17 [ -n "$led_wlan" ] && ucidef_set_led_wlan "wifi_led" "wifi" "$led_wlan" "phy0tpt"
18
19 case $board in
20 alfa-network,awusfree1)
21 set_wifi_led "$boardname:blue:wlan"
22 ;;
23 cudy,wr1000)
24 ucidef_set_led_switch "wan" "wan" "$boardname:blue:wan" "switch0" "0x10"
25 ucidef_set_led_switch "lan1" "lan1" "$boardname:blue:lan1" "switch0" "0x08"
26 ucidef_set_led_switch "lan2" "lan2" "$boardname:blue:lan2" "switch0" "0x04"
27 ;;
28 glinet,gl-mt300n-v2)
29 set_wifi_led "$boardname:red:wlan"
30 ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x1"
31 ;;
32 hilink,hlk-7628n|\
33 skylab,skw92a)
34 set_wifi_led "$boardname:green:wlan"
35 ;;
36 hiwifi,hc5661a|\
37 hiwifi,hc5761a)
38 ucidef_set_led_switch "internet" "internet" "$boardname:blue:internet" "switch0" "0x10"
39 ;;
40 mediatek,linkit-smart-7688)
41 ucidef_set_led_wlan "wifi" "wifi" "linkit-smart-7688:orange:wifi" "phy0tpt"
42 ;;
43 netgear,r6120)
44 ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x0f"
45 ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x10"
46 ucidef_set_led_wlan "wlan2g" "WiFi 2.4GHz" "$boardname:green:wlan2g" "phy0tpt"
47 ;;
48 rakwireless,rak633)
49 set_wifi_led "$boardname:blue:wifi"
50 ;;
51 tama,w06)
52 ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth0"
53 ucidef_set_led_wlan "wlan" "WLAN" "$boardname:green:wlan" "phy0tpt"
54 ;;
55 tplink,archer-c20-v4)
56 ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x1e"
57 ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01"
58 ;;
59 tplink,archer-c50-v3|\
60 tplink,archer-c50-v4)
61 ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x1e"
62 ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01"
63 ucidef_set_led_wlan "wlan2g" "wlan2g" "$boardname:green:wlan2g" "phy0tpt"
64 ucidef_set_led_wlan "wlan5g" "wlan5g" "$boardname:green:wlan5g" "phy1tpt"
65 ;;
66 tplink,tl-mr3020-v3)
67 set_wifi_led "$boardname:green:wlan"
68 ucidef_set_led_netdev "lan" "LAN" "$boardname:green:lan" "eth0"
69 ;;
70 tplink,tl-mr3420-v5|\
71 tplink,tl-wr842n-v5)
72 ucidef_set_led_wlan "wlan2g" "wlan2g" "$boardname:green:wlan" "phy0tpt"
73 ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x1e"
74 ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01"
75 ;;
76 tplink,tl-wa801nd-v5)
77 ucidef_set_led_wlan "wlan" "wlan" "$boardname:green:wlan" "phy0tpt"
78 ucidef_set_led_netdev "lan" "lan" "$boardname:green:lan" "eth0"
79 ;;
80 tplink,tl-wr840n-v4)
81 ucidef_set_led_wlan "wlan2g" "wlan2g" "$boardname:green:wlan" "phy0tpt"
82 ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x1e"
83 ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01"
84 ;;
85 tplink,tl-wr841n-v13)
86 ucidef_set_led_wlan "wlan2g" "wlan2g" "$boardname:green:wlan" "phy0tpt"
87 ucidef_set_led_switch "lan1" "lan1" "$boardname:green:lan1" "switch0" "0x2"
88 ucidef_set_led_switch "lan2" "lan2" "$boardname:green:lan2" "switch0" "0x4"
89 ucidef_set_led_switch "lan3" "lan3" "$boardname:green:lan3" "switch0" "0x8"
90 ucidef_set_led_switch "lan4" "lan4" "$boardname:green:lan4" "switch0" "0x10"
91 ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01"
92 ;;
93 tplink,tl-wr841n-v14)
94 ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x1e"
95 ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01"
96 ;;
97 tplink,tl-wr902ac-v3)
98 ucidef_set_led_wlan "wlan2g" "wlan2g" "$boardname:green:wlan" "phy0tpt"
99 ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x10"
100 ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x10"
101 ;;
102 unielec,u7628-01-16m)
103 ucidef_set_led_switch "lan1" "lan1" "u7628-01:green:lan1" "switch0" "0x2"
104 ucidef_set_led_switch "lan2" "lan2" "u7628-01:green:lan2" "switch0" "0x4"
105 ucidef_set_led_switch "lan3" "lan3" "u7628-01:green:lan3" "switch0" "0x8"
106 ucidef_set_led_switch "lan4" "lan4" "u7628-01:green:lan4" "switch0" "0x10"
107 ucidef_set_led_switch "wan" "wan" "u7628-01:green:wan" "switch0" "0x01"
108 set_wifi_led "u7628-01:green:wlan"
109 ;;
110 wavlink,wl-wn570ha1)
111 ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01"
112 ucidef_set_rssimon "wlan0" "200000" "1"
113 ucidef_set_led_rssi "wifi-low" "wifi-low" "$boardname:green:wifi-low" "wlan0" "1" "49"
114 ucidef_set_led_rssi "wifi-med" "wifi-med" "$boardname:green:wifi-med" "wlan0" "50" "84"
115 ucidef_set_led_rssi "wifi-high" "wifi-high" "$boardname:green:wifi-high" "wlan0" "85" "100"
116 set_wifi_led "$boardname:green:wifi"
117 ;;
118 wavlink,wl-wn575a3)
119 ucidef_set_rssimon "wlan1" "200000" "1"
120 ucidef_set_led_rssi "wifi-low" "wifi-low" "$boardname:green:wifi-low" "wlan1" "1" "49"
121 ucidef_set_led_rssi "wifi-med" "wifi-med" "$boardname:green:wifi-med" "wlan1" "50" "84"
122 ucidef_set_led_rssi "wifi-high" "wifi-high" "$boardname:green:wifi-high" "wlan1" "85" "100"
123 ;;
124 zbtlink,zbt-we1226)
125 set_wifi_led "$boardname:green:wlan"
126 ucidef_set_led_switch "lan1" "LAN1" "$boardname:green:lan1" "switch0" "0x01"
127 ucidef_set_led_switch "lan2" "LAN2" "$boardname:green:lan2" "switch0" "0x02"
128 ucidef_set_led_switch "wan" "WAN" "$boardname:green:wan" "switch0" "0x10"
129 ;;
130 zyxel,keenetic-extra-ii)
131 set_wifi_led "$boardname:green:wifi"
132 ucidef_set_led_switch "internet" "internet" "$boardname:green:internet" "switch0" "0x01"
133 ;;
134 esac
135
136 board_config_flush
137
138 exit 0