ar71xx: simplify model detection for TP-Link Pharos devices
authorMatthias Schiffer <mschiffer@universe-factory.net>
Sun, 11 Dec 2016 16:54:49 +0000 (17:54 +0100)
committerMatthias Schiffer <mschiffer@universe-factory.net>
Mon, 12 Dec 2016 12:45:37 +0000 (13:45 +0100)
This also makes the detection more flexible, as it doesn't need to check
for each model explicitly.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
target/linux/ar71xx/base-files/lib/ar71xx.sh

index 7d3038216b7398e1493b530a69d78fc7c7fe0f70..a543d3e3e350d6dcf7beba4eaa74c47dabde6c49 100755 (executable)
@@ -350,27 +350,10 @@ tplink_pharos_get_model_string() {
 tplink_pharos_board_detect() {
        local model_string="$(tplink_pharos_get_model_string | tr -d '\r')"
        local oIFS="$IFS"; IFS=":"; set -- $model_string; IFS="$oIFS"
-       local model
 
-       case "$1" in
-       'CPE210(TP-LINK|UN|N300-2)')
-               model='TP-Link CPE210'
-               ;;
-       'CPE220(TP-LINK|UN|N300-2)')
-               model='TP-Link CPE220'
-               ;;
-       'CPE510(TP-LINK|UN|N300-5)')
-               model='TP-Link CPE510'
-               ;;
-       'CPE520(TP-LINK|UN|N300-5)')
-               model='TP-Link CPE520'
-               ;;
-       'EAP120(TP-LINK|UN|N300-2)')
-               model='TP-Link EAP120'
-               ;;
-       esac
+       local model="${1%%\(*}"
 
-       [ -n "$model" ] && AR71XX_MODEL="$model v$2"
+       AR71XX_MODEL="TP-Link $model v$2"
 }
 
 gl_inet_board_detect() {