From 2524febf7927a1bf430d64b7790feb126023e3d1 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Fri, 19 Jan 2018 12:58:40 +0100 Subject: ar71xx: Add TP-Link Pharos v2 board detection Add support for detecting TP-Link Pharos v2 boards. They use different format in product-info partition than v1 boards. Code was written mostly by Alexander Couzens Signed-off-by: Robert Marko Signed-off-by: Adrian Schmutzler --- target/linux/ar71xx/base-files/lib/ar71xx.sh | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'target/linux/ar71xx/base-files/lib/ar71xx.sh') diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index b8f9a705ee..63b7a4f108 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -371,7 +371,7 @@ tplink_pharos_get_model_string() { } tplink_pharos_board_detect() { - local model_string="$(tplink_pharos_get_model_string | tr -d '\r')" + local model_string="$1" local oIFS="$IFS"; IFS=":"; set -- $model_string; IFS="$oIFS" local model="${1%%\(*}" @@ -379,6 +379,14 @@ tplink_pharos_board_detect() { AR71XX_MODEL="TP-Link $model v$2" } +tplink_pharos_v2_get_model_string() { + local part + part=$(find_mtd_part 'product-info') + [ -z "$part" ] && return 1 + + dd if=$part bs=1 skip=4360 count=64 2>/dev/null | tr -d '\r\0' | head -n 1 +} + ar71xx_board_detect() { local machine local name @@ -563,14 +571,18 @@ ar71xx_board_detect() { ;; *"CPE210/220") name="cpe210" - tplink_pharos_board_detect + tplink_pharos_board_detect "$(tplink_pharos_get_model_string | tr -d '\r')" + ;; + *"CPE210 v2") + name="cpe210-v2" + tplink_pharos_board_detect "$(tplink_pharos_v2_get_model_string)" ;; *"CPE505N") name="cpe505n" ;; *"CPE510/520") name="cpe510" - tplink_pharos_board_detect + tplink_pharos_board_detect "$(tplink_pharos_get_model_string | tr -d '\r')" ;; *"CPE830") name="cpe830" @@ -671,7 +683,7 @@ ar71xx_board_detect() { ;; *"EAP120") name="eap120" - tplink_pharos_board_detect + tplink_pharos_board_detect "$(tplink_pharos_get_model_string | tr -d '\r')" ;; *"EAP300 v2") name="eap300v2" @@ -1370,11 +1382,11 @@ ar71xx_board_detect() { ;; *"WBS210") name="wbs210" - tplink_pharos_board_detect + tplink_pharos_board_detect "$(tplink_pharos_get_model_string | tr -d '\r')" ;; *"WBS510") name="wbs510" - tplink_pharos_board_detect + tplink_pharos_board_detect "$(tplink_pharos_get_model_string | tr -d '\r')" ;; "WeIO"*) name="weio" -- cgit v1.2.3