ramips: dont replace the board name

Use fixed led names and add each board variant instead of manipulating
the board name.

It makes the ramips board name function less different to the one used
in other targets and allows to merge them with a common function.

Signed-off-by: Mathias Kresin <dev@kresin.me>
This commit is contained in:
Mathias Kresin 2017-04-08 00:34:48 +02:00
parent 9e468f7829
commit 18618695ae
6 changed files with 88 additions and 45 deletions

View file

@ -15,7 +15,8 @@ board=$(ramips_board_name)
case "$board" in case "$board" in
all0239-3g|\ all0239-3g|\
all0256n|\ all0256n-4M|\
all0256n-8M|\
all5002) all5002)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000" ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
;; ;;

View file

@ -56,11 +56,12 @@ air3gii)
set_wifi_led "$board:green:wlan" set_wifi_led "$board:green:wlan"
set_usb_led "$board:green:mobile" set_usb_led "$board:green:mobile"
;; ;;
all0256n) all0256n-4M|\
all0256n-8M)
ucidef_set_rssimon "wlan0" "200000" "1" ucidef_set_rssimon "wlan0" "200000" "1"
ucidef_set_led_rssi "rssilow" "RSSILOW" "$board:green:rssilow" "wlan0" "1" "40" "0" "6" ucidef_set_led_rssi "rssilow" "RSSILOW" "all0256n:green:rssilow" "wlan0" "1" "40" "0" "6"
ucidef_set_led_rssi "rssimedium" "RSSIMEDIUM" "$board:green:rssimed" "wlan0" "30" "80" "-29" "5" ucidef_set_led_rssi "rssimedium" "RSSIMEDIUM" "all0256n:green:rssimed" "wlan0" "30" "80" "-29" "5"
ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$board:green:rssihigh" "wlan0" "70" "100" "-69" "8" ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "all0256n:green:rssihigh" "wlan0" "70" "100" "-69" "8"
set_wifi_led "rt2800pci-phy0::radio" set_wifi_led "rt2800pci-phy0::radio"
;; ;;
ar670w|\ ar670w|\
@ -68,11 +69,12 @@ ar725w|\
awapn2403) awapn2403)
set_wifi_led "rt2800soc-phy0::radio" set_wifi_led "rt2800soc-phy0::radio"
;; ;;
asl26555) asl26555-8M|\
ucidef_set_led_default "power" "POWER" "$board:green:power" "1" asl26555-16M)
ucidef_set_led_netdev "eth" "ETH" "$board:green:eth" "eth0" ucidef_set_led_default "power" "POWER" "asl26555:green:power" "1"
set_wifi_led "$board:green:wlan" ucidef_set_led_netdev "eth" "ETH" "asl26555:green:eth" "eth0"
set_usb_led "$board:green:3g" set_wifi_led "asl26555:green:wlan"
set_usb_led "asl26555:green:3g"
;; ;;
bc2) bc2)
set_usb_led "$board:blue:usb" set_usb_led "$board:blue:usb"
@ -139,7 +141,8 @@ hlk-rm04|\
sl-r7205|\ sl-r7205|\
v11st-fe|\ v11st-fe|\
w306r-v20|\ w306r-v20|\
wt1520) wt1520-4M|\
wt1520-8M)
set_wifi_led "rt2800pci-phy0::radio" set_wifi_led "rt2800pci-phy0::radio"
;; ;;
dir-615-d|\ dir-615-d|\
@ -292,9 +295,10 @@ psg1218b)
ucidef_set_led_netdev "Network" "Network" "$board:blue:status" "eth0" ucidef_set_led_netdev "Network" "Network" "$board:blue:status" "eth0"
ucidef_set_led_default "status" "STATUS" "$board:yellow:status" "0" ucidef_set_led_default "status" "STATUS" "$board:yellow:status" "0"
;; ;;
px-4885) px-4885-4M|\
set_wifi_led "$board:orange:wifi" px-4885-8M)
set_usb_led "$board:blue:storage" set_wifi_led "px-4885:orange:wifi"
set_usb_led "px-4885:blue:storage"
;; ;;
r6220) r6220)
ucidef_set_led_netdev "wan" "wan" "$board:green:wan" eth0.2 ucidef_set_led_netdev "wan" "wan" "$board:green:wan" eth0.2
@ -324,9 +328,10 @@ tiny-ac)
set_wifi_led "$board:orange:wifi" set_wifi_led "$board:orange:wifi"
set_usb_led "$board:green:usb" set_usb_led "$board:green:usb"
;; ;;
vocore) vocore-8M|\
ucidef_set_led_netdev "eth" "ETH" "$board:orange:eth" "eth0" vocore-16M)
set_wifi_led "$board:green:status" ucidef_set_led_netdev "eth" "ETH" "vocore:orange:eth" "eth0"
set_wifi_led "vocore:green:status"
;; ;;
vocore2) vocore2)
set_wifi_led "$board:fuchsia:status" set_wifi_led "$board:fuchsia:status"
@ -357,8 +362,9 @@ wrh-300cr)
wndr3700v5) wndr3700v5)
ucidef_set_led_default "power" "POWER" "$board:green:power" "0" ucidef_set_led_default "power" "POWER" "$board:green:power" "0"
;; ;;
wt3020) wt3020-4M|\
ucidef_set_led_default "power" "power" "$board:blue:power" "0" wt3020-8M)
ucidef_set_led_default "power" "power" "wt3020:blue:power" "0"
;; ;;
y1) y1)
set_usb_led "$board:blue:usb" set_usb_led "$board:blue:usb"

View file

@ -41,7 +41,8 @@ ramips_setup_interfaces()
3g150b|\ 3g150b|\
3g300m|\ 3g300m|\
a5-v11|\ a5-v11|\
all0256n|\ all0256n-4M|\
all0256n-8M|\
all5002|\ all5002|\
all5003|\ all5003|\
broadway|\ broadway|\
@ -91,7 +92,8 @@ ramips_setup_interfaces()
mt7628|\ mt7628|\
mzk-750dhp|\ mzk-750dhp|\
mzk-w300nh2|\ mzk-w300nh2|\
nixcore|\ nixcore-x1-8M|\
nixcore-x1-16M|\
oy-0001|\ oy-0001|\
pbr-m1|\ pbr-m1|\
psg1208|\ psg1208|\
@ -104,7 +106,8 @@ ramips_setup_interfaces()
witi|\ witi|\
wl-wn575a3|\ wl-wn575a3|\
wndr3700v5|\ wndr3700v5|\
wt1520|\ wt1520-4M|\
wt1520-8M|\
y1|\ y1|\
youku-yk1|\ youku-yk1|\
zbt-ape522ii|\ zbt-ape522ii|\
@ -133,13 +136,15 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0" "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0"
;; ;;
asl26555|\ asl26555-8M|\
asl26555-16M|\
rp-n53) rp-n53)
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0"
;; ;;
atp-52b|\ atp-52b|\
awm002-evb|\ awm002-evb-4M|\
awm002-evb-8M|\
awm003-evb|\ awm003-evb|\
c20i|\ c20i|\
c50|\ c50|\
@ -161,7 +166,8 @@ ramips_setup_interfaces()
wrtnode|\ wrtnode|\
wrtnode2p | \ wrtnode2p | \
wrtnode2r | \ wrtnode2r | \
wt3020|\ wt3020-4M|\
wt3020-8M|\
zbt-wa05) zbt-wa05)
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
@ -241,7 +247,8 @@ ramips_setup_interfaces()
ucidef_set_interface_wan "usb0" ucidef_set_interface_wan "usb0"
;; ;;
mzk-dp150n|\ mzk-dp150n|\
vocore) vocore-8M|\
vocore-16M)
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"0:lan" "4:lan" "6t@eth0" "0:lan" "4:lan" "6t@eth0"
;; ;;
@ -382,7 +389,8 @@ ramips_setup_macs()
lan_mac=$(macaddr_setbit_la "$wan_mac") lan_mac=$(macaddr_setbit_la "$wan_mac")
;; ;;
m3|\ m3|\
m4|\ m4-4M|\
m4-8M|\
x5|\ x5|\
x8) x8)
lan_mac=$(cat /sys/class/net/eth0/address) lan_mac=$(cat /sys/class/net/eth0/address)

View file

@ -16,7 +16,6 @@ get_status_led() {
3g-6200n|\ 3g-6200n|\
ar670w|\ ar670w|\
ar725w|\ ar725w|\
asl26555|\
br-6425|\ br-6425|\
br-6475nd|\ br-6475nd|\
c50|\ c50|\
@ -79,7 +78,6 @@ get_status_led() {
mofi3500-3gn|\ mofi3500-3gn|\
rut5xx|\ rut5xx|\
v11st-fe|\ v11st-fe|\
vocore|\
wmr-300|\ wmr-300|\
zbt-wg2626|\ zbt-wg2626|\
zbt-wg3526) zbt-wg3526)
@ -89,6 +87,10 @@ get_status_led() {
ht-tm02) ht-tm02)
status_led="$board:blue:wlan" status_led="$board:blue:wlan"
;; ;;
asl26555-8M|\
asl26555-16M)
status_led="asl26555:green:power"
;;
atp-52b|\ atp-52b|\
ew1200|\ ew1200|\
ip2202) ip2202)
@ -123,7 +125,6 @@ get_status_led() {
wl-330n|\ wl-330n|\
wl-330n3g|\ wl-330n3g|\
wli-tx4-ag300n|\ wli-tx4-ag300n|\
wt3020|\
y1|\ y1|\
y1s) y1s)
status_led="$board:blue:power" status_led="$board:blue:power"
@ -162,10 +163,13 @@ get_status_led() {
status_led="$board:blue:wifi" status_led="$board:blue:wifi"
;; ;;
m3|\ m3|\
m4|\
miwifi-nano) miwifi-nano)
status_led="$board:blue:status" status_led="$board:blue:status"
;; ;;
m4-4M|\
m4-8M)
status_led="m4:blue:status"
;;
miwifi-mini|\ miwifi-mini|\
zte-q7) zte-q7)
status_led="$board:red:status" status_led="$board:red:status"
@ -194,7 +198,10 @@ get_status_led() {
psr-680w) psr-680w)
status_led="$board:red:wan" status_led="$board:red:wan"
;; ;;
px-4885|\ px-4885-4M|\
px-4885-8M)
status_led="px-4885:orange:wifi"
;;
re6500|\ re6500|\
whr-1166d|\ whr-1166d|\
whr-600d|\ whr-600d|\
@ -207,8 +214,7 @@ get_status_led() {
tew-692gr|\ tew-692gr|\
ur-326n4g|\ ur-326n4g|\
ur-336un|\ ur-336un|\
wf-2881|\ wf-2881)
wr512-3gn)
status_led="$board:green:wps" status_led="$board:green:wps"
;; ;;
rb750gr3) rb750gr3)
@ -220,6 +226,10 @@ get_status_led() {
v22rw-2x2) v22rw-2x2)
status_led="$board:green:security" status_led="$board:green:security"
;; ;;
vocore-8M|\
vocore-16M)
status_led="vocore:green:status"
;;
vocore2) vocore2)
status_led="$board:fuchsia:status" status_led="$board:fuchsia:status"
;; ;;
@ -249,11 +259,19 @@ get_status_led() {
wizfi630a) wizfi630a)
status_led="$board::run" status_led="$board::run"
;; ;;
wr512-3gn-4M|\
wr512-3gn-8M)
status_led="wr512-3gn:green:wps"
;;
wrtnode2r | \ wrtnode2r | \
wrtnode2p | \ wrtnode2p | \
wrtnode) wrtnode)
status_led="wrtnode:blue:indicator" status_led="wrtnode:blue:indicator"
;; ;;
wt3020-4M|\
wt3020-8M)
status_led="wt3020:blue:power"
;;
zbt-cpe102) zbt-cpe102)
status_led="$board:green:4g-0" status_led="$board:green:4g-0"
;; ;;

View file

@ -696,5 +696,5 @@ ramips_board_name() {
[ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name) [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
[ -z "$name" ] && name="unknown" [ -z "$name" ] && name="unknown"
echo "${name%-[0-9]*M}" echo "${name}"
} }

View file

@ -21,13 +21,16 @@ platform_check_image() {
ai-br100|\ ai-br100|\
air3gii|\ air3gii|\
all0239-3g|\ all0239-3g|\
all0256n|\ all0256n-4M|\
all0256n-8M|\
all5002|\ all5002|\
all5003|\ all5003|\
ar725w|\ ar725w|\
asl26555|\ asl26555-8M|\
asl26555-16M|\
awapn2403|\ awapn2403|\
awm002-evb|\ awm002-evb-4M|\
awm002-evb-8M|\
awm003-evb|\ awm003-evb|\
bc2|\ bc2|\
broadway|\ broadway|\
@ -81,7 +84,8 @@ platform_check_image() {
linkits7688d|\ linkits7688d|\
m2m|\ m2m|\
m3|\ m3|\
m4|\ m4-4M|\
m4-8M|\
mac1200rv2|\ mac1200rv2|\
microwrt|\ microwrt|\
miniembplug|\ miniembplug|\
@ -104,7 +108,8 @@ platform_check_image() {
nbg-419n|\ nbg-419n|\
nbg-419n2|\ nbg-419n2|\
newifi-d1|\ newifi-d1|\
nixcore|\ nixcore-x1-8M|\
nixcore-x1-16M|\
nw718|\ nw718|\
omega2|\ omega2|\
omega2p|\ omega2p|\
@ -115,7 +120,8 @@ platform_check_image() {
psg1218a|\ psg1218a|\
psg1218b|\ psg1218b|\
psr-680w|\ psr-680w|\
px-4885|\ px-4885-4M|\
px-4885-8M|\
rb750gr3|\ rb750gr3|\
re6500|\ re6500|\
rp-n53|\ rp-n53|\
@ -139,7 +145,8 @@ platform_check_image() {
ur-326n4g|\ ur-326n4g|\
ur-336un|\ ur-336un|\
v22rw-2x2|\ v22rw-2x2|\
vocore|\ vocore-8M|\
vocore-16M|\
vocore2|\ vocore2|\
vr500|\ vr500|\
w150m|\ w150m|\
@ -165,15 +172,18 @@ platform_check_image() {
wn3000rpv3|\ wn3000rpv3|\
wnce2001|\ wnce2001|\
wndr3700v5|\ wndr3700v5|\
wr512-3gn|\ wr512-3gn-4M|\
wr512-3gn-8M|\
wr6202|\ wr6202|\
wrh-300cr|\ wrh-300cr|\
wrtnode|\ wrtnode|\
wrtnode2r |\ wrtnode2r |\
wrtnode2p |\ wrtnode2p |\
wsr-600|\ wsr-600|\
wt1520|\ wt1520-4M|\
wt3020|\ wt1520-8M|\
wt3020-4M|\
wt3020-8M|\
wzr-agl300nh|\ wzr-agl300nh|\
x5|\ x5|\
x8|\ x8|\