firmware/src/packages/fff/fff-network/files/lib/functions/fff/portorder
Adrian Schmutzler cb4bce7cc2 fff-network: move PORTORDER to function/library
So far, we define PORTORDER individually in each network.* file.
This creates a lot of duplications, and makes the code to parse those
values very ugly (and it's only used outside of configurenetwork
anyway).

Therefore, move the assignment to a library file, and wrap it into
a function for tidyness. This gives us more overview and nicer
implementation of the retrieval.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Acked-by: Christian Dresel <freifunk@dresel.systems>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
2021-02-09 22:37:20 +01:00

48 lines
797 B
Plaintext

# Copyright 2019 Adrian Schmutzler
# License GPLv3
get_port_order() {
local BOARD=$(uci get board.model.name)
local PORTORDER
case "$BOARD" in
glinet,gl-ar150)
PORTORDER="1"
;;
r6220)
PORTORDER="4 3 2 1 0"
;;
tplink,archer-c25-v1|\
tplink,archer-c60-v1|\
tplink,archer-c60-v2|\
tplink,tl-wr841-v10|\
tplink,tl-wr841-v11|\
tplink,tl-wr841-v12)
PORTORDER="4 3 2 1"
;;
tplink,c50-v4|\
tl-wr841n-v13)
PORTORDER="0 1 2 3 4"
;;
tplink,archer-c7-v2|\
tplink,archer-c7-v5|\
tplink,tl-wdr4300-v1)
PORTORDER="1 2 3 4 5"
;;
tplink,c2600|\
tplink,tl-wr1043nd-v4|\
tplink,tl-wr1043n-v5)
PORTORDER="5 4 3 2 1"
;;
cpe210|\
cpe510)
PORTORDER="5 4"
;;
tplink,tl-wr841-v8)
PORTORDER="2 3 4 1"
;;
esac
echo "$PORTORDER"
}