ramips: remove set_wifi_led function in 01_leds

While we mostly use the ucidef_set_led_* functions directly in 01_leds
we still have the set_wifi_led function in parallel for several old
devices. This is not only inconsistent with the other definitions,
it also links to the wlan0 interface instead of using a phy trigger
which would be independent of the interface name (and is used for
all newer devices anyway). Apart from that, the standard names
"wifi" and "wifi-led" are not very helpful in a world with different
radio bands either.

Thus, this patch removes the set_wifi_led function and puts the
relevant commands into the cases explicitly. This makes the
mechanism used more evident and will hopefully lead to some future
improvements or at least prevent some copy-pasting of the old
setups.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
Adrian Schmutzler 2020-09-27 23:35:11 +02:00
parent ed5933beb6
commit 2230fe3922
6 changed files with 53 additions and 77 deletions

View File

@ -3,10 +3,6 @@
. /lib/functions/leds.sh
. /lib/functions/uci-defaults.sh
set_wifi_led() {
ucidef_set_led_netdev "wifi_led" "wifi" "${1}" "${2:-wlan0}"
}
board=$(board_name)
board_config_update
@ -14,10 +10,10 @@ board_config_update
case $board in
aigale,ai-br100)
ucidef_set_led_netdev "wan" "wan" "blue:wan" "eth0.2"
set_wifi_led "blue:wlan"
ucidef_set_led_netdev "wifi_led" "wifi" "blue:wlan" "wlan0"
;;
alfa-network,ac1200rm)
set_wifi_led "green:wlan2g" "wlan1"
ucidef_set_led_netdev "wifi_led" "wifi" "green:wlan2g" "wlan1"
;;
alfa-network,r36m-e4g)
ucidef_set_led_netdev "4g" "4g" "orange:4g" "wwan0"
@ -30,24 +26,24 @@ alfa-network,tube-e4g)
;;
asus,rp-n53)
ucidef_set_led_netdev "eth" "Network" "white:back" "eth0"
set_wifi_led "blue:wifi"
ucidef_set_led_netdev "wifi_led" "wifi" "blue:wifi" "wlan0"
;;
asus,rt-n12p)
ucidef_set_led_netdev "lan" "lan" "green:lan" eth0.1
ucidef_set_led_netdev "wan" "wan" "green:wan" eth0.2
set_wifi_led "green:air"
ucidef_set_led_netdev "wifi_led" "wifi" "green:air" "wlan0"
;;
asus,rt-n14u)
ucidef_set_led_netdev "lan" "lan" "blue:lan" eth0.1
ucidef_set_led_netdev "wan" "wan" "blue:wan" eth0.2
set_wifi_led "blue:air"
ucidef_set_led_netdev "wifi_led" "wifi" "blue:air" "wlan0"
;;
bdcom,wap2100-sk)
set_wifi_led "green:wlan2g"
ucidef_set_led_netdev "wifi_led" "wifi" "green:wlan2g" "wlan0"
;;
comfast,cf-wr800n)
ucidef_set_led_netdev "lan" "lan" "white:ethernet" eth0.1
set_wifi_led "white:wifi"
ucidef_set_led_netdev "wifi_led" "wifi" "white:wifi" "wlan0"
;;
dlink,dir-810l|\
trendnet,tew-810dr)
@ -63,35 +59,35 @@ zbtlink,zbt-wr8305rt|\
zyxel,keenetic-omni|\
zyxel,keenetic-omni-ii|\
zyxel,keenetic-viva)
set_wifi_led "green:wifi"
ucidef_set_led_netdev "wifi_led" "wifi" "green:wifi" "wlan0"
;;
dlink,dwr-118-a1)
ucidef_set_led_switch "lan" "lan" "green:lan" "switch0" "0x1f"
ucidef_set_led_switch "wan" "wan" "green:wan" "switch0" "0x20"
set_wifi_led "green:wlan2g" "wlan1"
ucidef_set_led_netdev "wifi_led" "wifi" "green:wlan2g" "wlan1"
;;
dlink,dwr-118-a2)
ucidef_set_led_switch "lan" "lan" "green:lan" "switch0" "0x1e"
ucidef_set_led_switch "wan" "wan" "green:wan" "switch0" "0x01"
set_wifi_led "green:wlan2g" "wlan1"
ucidef_set_led_netdev "wifi_led" "wifi" "green:wlan2g" "wlan1"
;;
dlink,dwr-921-c1|\
dlink,dwr-922-e2)
ucidef_set_led_switch "lan" "lan" "green:lan" "switch0" "0x0f"
ucidef_set_led_netdev "signalstrength" "signalstrength" "green:sigstrength" "wwan0" "link"
ucidef_set_led_netdev "4g" "4g" "green:4g" "wwan0" "tx rx"
set_wifi_led "green:wifi"
ucidef_set_led_netdev "wifi_led" "wifi" "green:wifi" "wlan0"
;;
dlink,dwr-960)
ucidef_set_led_switch "lan" "lan" "green:lan" "switch0" "0x2e"
ucidef_set_led_switch "wan" "wan" "green:wan" "switch0" "0x01"
;;
dovado,tiny-ac)
set_wifi_led "orange:wifi"
ucidef_set_led_netdev "wifi_led" "wifi" "orange:wifi" "wlan0"
;;
edimax,br-6478ac-v2|\
edimax,ew-7478apc)
set_wifi_led "blue:wlan"
ucidef_set_led_netdev "wifi_led" "wifi" "blue:wlan" "wlan0"
;;
edimax,ew-7476rpc|\
edimax,ew-7478ac)
@ -99,7 +95,7 @@ edimax,ew-7478ac)
;;
elecom,wrh-300cr)
ucidef_set_led_netdev "lan" "lan" "green:ethernet" "eth0"
set_wifi_led "green:wlan"
ucidef_set_led_netdev "wifi_led" "wifi" "green:wlan" "wlan0"
;;
engenius,esr600)
ucidef_set_led_netdev "wlan5g" "5.0GHz" "blue:wlan5g" "wlan0"
@ -108,7 +104,7 @@ engenius,esr600)
glinet,gl-mt300a|\
glinet,gl-mt300n|\
glinet,gl-mt750)
set_wifi_led "wlan"
ucidef_set_led_netdev "wifi_led" "wifi" "wlan" "wlan0"
;;
hiwifi,hc5661|\
hiwifi,hc5761)
@ -128,16 +124,16 @@ iodata,wn-ac733gr3)
;;
kimax,u25awf-h1)
ucidef_set_led_netdev "eth" "eth" "green:lan" "eth0"
set_wifi_led "red:wifi"
ucidef_set_led_netdev "wifi_led" "wifi" "red:wifi" "wlan0"
;;
kimax,u35wf)
ucidef_set_led_netdev "eth" "ETH" "green:eth" "eth0"
set_wifi_led "blue:wifi"
ucidef_set_led_netdev "wifi_led" "wifi" "blue:wifi" "wlan0"
;;
kingston,mlw221|\
kingston,mlwg2|\
sanlinking,d240)
set_wifi_led "blue:wifi"
ucidef_set_led_netdev "wifi_led" "wifi" "blue:wifi" "wlan0"
;;
lava,lr-25g001)
ucidef_set_led_netdev "wlan2g" "WiFi 2.4GHz" "green:wlan2g" "wlan1"
@ -155,7 +151,7 @@ lenovo,newifi-y1s)
;;
netgear,ex2700|\
netgear,wn3000rp-v3)
set_wifi_led "green:router"
ucidef_set_led_netdev "wifi_led" "wifi" "green:router" "wlan0"
;;
netgear,ex3700|\
netgear,ex6130)
@ -170,11 +166,11 @@ netgear,jwnr2010-v5)
ucidef_set_led_switch "wan" "wan" "green:wan" "switch0" "0x10"
;;
phicomm,psg1208)
set_wifi_led "white:wlan2g"
ucidef_set_led_netdev "wifi_led" "wifi" "white:wlan2g" "wlan0"
;;
planex,mzk-ex750np|\
zbtlink,zbt-we826-e)
set_wifi_led "red:wifi"
ucidef_set_led_netdev "wifi_led" "wifi" "red:wifi" "wlan0"
;;
ravpower,rp-wd03)
ucidef_set_led_netdev "internet" "internet" "green:wifi" "eth0"
@ -201,7 +197,7 @@ tplink,re200-v1)
;;
youku,yk1)
ucidef_set_led_switch "wan" "wan" "blue:wan" "switch0" "0x10"
set_wifi_led "blue:air"
ucidef_set_led_netdev "wifi_led" "wifi" "blue:air" "wlan0"
;;
zbtlink,zbt-ape522ii)
ucidef_set_led_netdev "wlan2g4" "wlan1-link" "green:wlan2g4" "wlan1"
@ -209,19 +205,19 @@ zbtlink,zbt-ape522ii)
ucidef_set_led_netdev "sys2" "wlan0" "green:sys2" "wlan0" "tx rx"
;;
zbtlink,zbt-wa05)
set_wifi_led "blue:air"
ucidef_set_led_netdev "wifi_led" "wifi" "blue:air" "wlan0"
;;
zbtlink,zbt-we1026-5g-16m)
ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth0"
set_wifi_led "green:wifi"
ucidef_set_led_netdev "wifi_led" "wifi" "green:wifi" "wlan0"
;;
zbtlink,zbt-we1026-h-32m)
ucidef_set_led_switch "lan" "lan" "green:lan" "switch0" "0x8"
ucidef_set_led_switch "wan" "wan" "green:wan" "switch0" "0x10"
set_wifi_led "green:wifi"
ucidef_set_led_netdev "wifi_led" "wifi" "green:wifi" "wlan0"
;;
zbtlink,zbt-we2026)
set_wifi_led "green:wlan"
ucidef_set_led_netdev "wifi_led" "wifi" "green:wlan" "wlan0"
;;
esac

View File

@ -3,10 +3,6 @@
. /lib/functions/leds.sh
. /lib/functions/uci-defaults.sh
set_wifi_led() {
ucidef_set_led_netdev "wifi_led" "wifi" "${1}" "${2:-wlan0}"
}
board=$(board_name)
board_config_update

View File

@ -3,17 +3,13 @@
. /lib/functions/leds.sh
. /lib/functions/uci-defaults.sh
set_wifi_led() {
ucidef_set_led_netdev "wifi_led" "wifi" "${1}" "${2:-wlan0}"
}
board=$(board_name)
board_config_update
case $board in
alfa-network,awusfree1)
set_wifi_led "blue:wlan"
ucidef_set_led_netdev "wifi_led" "wifi" "blue:wlan" "wlan0"
;;
asus,rt-n10p-v3|\
asus,rt-n11p-b1|\
@ -30,12 +26,12 @@ cudy,wr1000)
ucidef_set_led_switch "lan2" "lan2" "blue:lan2" "switch0" "0x04"
;;
glinet,gl-mt300n-v2)
set_wifi_led "red:wlan"
ucidef_set_led_netdev "wifi_led" "wifi" "red:wlan" "wlan0"
ucidef_set_led_switch "wan" "wan" "green:wan" "switch0" "0x1"
;;
hilink,hlk-7628n|\
skylab,skw92a)
set_wifi_led "green:wlan"
ucidef_set_led_netdev "wifi_led" "wifi" "green:wlan" "wlan0"
;;
hiwifi,hc5661a|\
hiwifi,hc5761a)
@ -45,7 +41,7 @@ mediatek,linkit-smart-7688)
ucidef_set_led_wlan "wifi" "wifi" "orange:wifi" "phy0tpt"
;;
rakwireless,rak633)
set_wifi_led "blue:wifi"
ucidef_set_led_netdev "wifi_led" "wifi" "blue:wifi" "wlan0"
;;
tama,w06)
ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth0"
@ -102,7 +98,7 @@ unielec,u7628-01-16m)
ucidef_set_led_switch "lan3" "lan3" "green:lan3" "switch0" "0x8"
ucidef_set_led_switch "lan4" "lan4" "green:lan4" "switch0" "0x10"
ucidef_set_led_switch "wan" "wan" "green:wan" "switch0" "0x01"
set_wifi_led "green:wlan"
ucidef_set_led_netdev "wifi_led" "wifi" "green:wlan" "wlan0"
;;
wavlink,wl-wn570ha1)
ucidef_set_led_switch "wan" "wan" "green:wan" "switch0" "0x01"
@ -110,7 +106,7 @@ wavlink,wl-wn570ha1)
ucidef_set_led_rssi "wifi-low" "wifi-low" "green:wifi-low" "wlan0" "1" "49"
ucidef_set_led_rssi "wifi-med" "wifi-med" "green:wifi-med" "wlan0" "50" "84"
ucidef_set_led_rssi "wifi-high" "wifi-high" "green:wifi-high" "wlan0" "85" "100"
set_wifi_led "green:wifi"
ucidef_set_led_netdev "wifi_led" "wifi" "green:wifi" "wlan0"
;;
wavlink,wl-wn575a3)
ucidef_set_rssimon "wlan1" "200000" "1"
@ -123,13 +119,13 @@ wavlink,wl-wn577a2)
ucidef_set_led_switch "wan" "wan" "green:wan" "switch0" "0x10"
;;
zbtlink,zbt-we1226)
set_wifi_led "green:wlan"
ucidef_set_led_netdev "wifi_led" "wifi" "green:wlan" "wlan0"
ucidef_set_led_switch "lan1" "LAN1" "green:lan1" "switch0" "0x01"
ucidef_set_led_switch "lan2" "LAN2" "green:lan2" "switch0" "0x02"
ucidef_set_led_switch "wan" "WAN" "green:wan" "switch0" "0x10"
;;
zyxel,keenetic-extra-ii)
set_wifi_led "green:wifi"
ucidef_set_led_netdev "wifi_led" "wifi" "green:wifi" "wlan0"
ucidef_set_led_switch "internet" "internet" "green:internet" "switch0" "0x01"
;;
esac

View File

@ -3,10 +3,6 @@
. /lib/functions/leds.sh
. /lib/functions/uci-defaults.sh
set_wifi_led() {
ucidef_set_led_netdev "wifi_led" "wifi" "${1}" "${2:-wlan0}"
}
board=$(board_name)
board_config_update
@ -14,13 +10,13 @@ board_config_update
case $board in
airlink101,ar670w|\
airlink101,ar725w)
set_wifi_led "rt2800soc-phy0::radio"
ucidef_set_led_netdev "wifi_led" "wifi" "rt2800soc-phy0::radio" "wlan0"
;;
belkin,f5d8235-v1)
set_wifi_led "blue:wireless"
ucidef_set_led_netdev "wifi_led" "wifi" "blue:wireless" "wlan0"
;;
ralink,v11st-fe)
set_wifi_led "rt2800pci-phy0::radio"
ucidef_set_led_netdev "wifi_led" "wifi" "rt2800pci-phy0::radio" "wlan0"
;;
esac

View File

@ -3,10 +3,6 @@
. /lib/functions/leds.sh
. /lib/functions/uci-defaults.sh
set_wifi_led() {
ucidef_set_led_netdev "wifi_led" "wifi" "${1}" "${2:-wlan0}"
}
board=$(board_name)
board_config_update
@ -15,13 +11,13 @@ case $board in
7links,px-4885-4m|\
7links,px-4885-8m|\
fon,fonera-20n)
set_wifi_led "orange:wifi"
ucidef_set_led_netdev "wifi_led" "wifi" "orange:wifi" "wlan0"
;;
airlive,air3gii|\
aximcom,mr-102n|\
edimax,3g-6200nl|\
netgear,wnce2001)
set_wifi_led "green:wlan"
ucidef_set_led_netdev "wifi_led" "wifi" "green:wlan" "wlan0"
;;
alfa-network,w502u|\
dlink,dir-300-b1|\
@ -40,7 +36,7 @@ tenda,w306r-v2|\
zyxel,keenetic-start|\
zyxel,keenetic|\
zyxel,nbg-419n-v2)
set_wifi_led "rt2800pci-phy0::radio"
ucidef_set_led_netdev "wifi_led" "wifi" "rt2800pci-phy0::radio" "wlan0"
;;
allnet,all0256n-4m|\
allnet,all0256n-8m)
@ -48,48 +44,48 @@ allnet,all0256n-8m)
ucidef_set_led_rssi "rssilow" "RSSILOW" "green:rssilow" "wlan0" "1" "40" "0" "6"
ucidef_set_led_rssi "rssimedium" "RSSIMEDIUM" "green:rssimed" "wlan0" "30" "80" "-29" "5"
ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "green:rssihigh" "wlan0" "70" "100" "-69" "8"
set_wifi_led "rt2800pci-phy0::radio"
ucidef_set_led_netdev "wifi_led" "wifi" "rt2800pci-phy0::radio" "wlan0"
;;
alphanetworks,asl26555-8m|\
alphanetworks,asl26555-16m)
ucidef_set_led_netdev "eth" "ETH" "green:eth" "eth0"
set_wifi_led "green:wlan"
ucidef_set_led_netdev "wifi_led" "wifi" "green:wlan" "wlan0"
;;
asiarf,awapn2403)
set_wifi_led "rt2800soc-phy0::radio"
ucidef_set_led_netdev "wifi_led" "wifi" "rt2800soc-phy0::radio" "wlan0"
;;
dlink,dcs-930l-b1)
ucidef_set_led_netdev "wifi" "WiFi" "blue:wps"
;;
dlink,dir-615-d)
ucidef_set_led_netdev "wan" "WAN (green)" "green:wan" "eth0.2"
set_wifi_led "rt2800soc-phy0::radio"
ucidef_set_led_netdev "wifi_led" "wifi" "rt2800soc-phy0::radio" "wlan0"
;;
dlink,dir-620-d1|\
trendnet,tew-714tru)
set_wifi_led "green:wifi"
ucidef_set_led_netdev "wifi_led" "wifi" "green:wifi" "wlan0"
;;
edimax,3g-6200n|\
planex,mzk-w300nh2)
set_wifi_led "amber:wlan"
ucidef_set_led_netdev "wifi_led" "wifi" "amber:wlan" "wlan0"
;;
hauppauge,broadway)
set_wifi_led "red:wps_active"
ucidef_set_led_netdev "wifi_led" "wifi" "red:wps_active" "wlan0"
;;
hootoo,ht-tm02)
ucidef_set_led_netdev "eth" "Ethernet" "green:lan" "eth0"
set_wifi_led "blue:wlan"
ucidef_set_led_netdev "wifi_led" "wifi" "blue:wlan" "wlan0"
;;
huawei,hg255d)
set_wifi_led "green:wlan"
ucidef_set_led_netdev "wifi_led" "wifi" "green:wlan" "wlan0"
ucidef_set_led_netdev "internet" "internet" "green:internet" "eth0.2"
;;
intenso,memory2move)
set_wifi_led "blue:wifi"
ucidef_set_led_netdev "wifi_led" "wifi" "blue:wifi" "wlan0"
ucidef_set_led_netdev "eth" "Ethernet" "green:wan" "eth0"
;;
omnima,miniembplug)
set_wifi_led "red:wlan"
ucidef_set_led_netdev "wifi_led" "wifi" "red:wlan" "wlan0"
;;
vocore,vocore-8m|\
vocore,vocore-16m)

View File

@ -3,10 +3,6 @@
. /lib/functions/leds.sh
. /lib/functions/uci-defaults.sh
set_wifi_led() {
ucidef_set_led_netdev "wifi_led" "wifi" "${1}" "${2:-wlan0}"
}
board=$(board_name)
board_config_update
@ -16,11 +12,11 @@ belkin,f9k1109v1)
ucidef_set_led_netdev "lan" "lan" "blue:wps" "eth0"
;;
edimax,br-6475nd)
set_wifi_led "amber:wlan"
ucidef_set_led_netdev "wifi_led" "wifi" "amber:wlan" "wlan0"
;;
omnima,hpm)
ucidef_set_led_netdev "eth" "ETH" "green:eth" "eth0"
set_wifi_led "green:wifi"
ucidef_set_led_netdev "wifi_led" "wifi" "green:wifi" "wlan0"
;;
esac