ar71xx:add support for E750A v4
[openwrt/openwrt.git] / target / linux / ar71xx / base-files / lib / ar71xx.sh
index f0742c1e7b020377cdbd82ecc0e580d019b2a3bb..fb7328875f2ddc8b2e797b1fc751ac820bcd21a0 100755 (executable)
@@ -98,6 +98,27 @@ ubnt_xm_board_detect() {
        [ -z "$model" ] || AR71XX_MODEL="${model}${magic:3:1}"
 }
 
+ubnt_ac_lite_get_mtd_part_magic() {
+       ar71xx_get_mtd_offset_size_format EEPROM 12 2 %02x
+}
+
+ubnt_ac_lite_board_detect() {
+       local model
+       local magic
+
+       magic="$(ubnt_ac_lite_get_mtd_part_magic)"
+       case ${magic:0:4} in
+       "e517")
+               model="Ubiquiti UniFi-AC-LITE"
+               ;;
+       "e557")
+               model="Ubiquiti UniFi-AC-MESH"
+               ;;
+       esac
+
+       [ -z "$model" ] || AR71XX_MODEL="${model}"
+}
+
 cybertan_get_hw_magic() {
        local part
 
@@ -290,12 +311,6 @@ tplink_board_detect() {
        "360000"*)
                model="TP-Link TL-WDR3600"
                ;;
-       "3C0001"*)
-               model="OOLITE"
-               ;;
-       "3C0002"*)
-               model="MINIBOX_V1"
-               ;;
        "430000"*)
                model="TP-Link TL-WDR4300"
                ;;
@@ -356,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%%\(*}"
@@ -364,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
@@ -461,6 +484,9 @@ ar71xx_board_detect() {
        *"Archer C7 v4")
                name="archer-c7-v4"
                ;;
+       *"Archer C7 v5")
+               name="archer-c7-v5"
+               ;;
        *"Archer C58 v1")
                name="archer-c58-v1"
                ;;
@@ -470,6 +496,9 @@ ar71xx_board_detect() {
        *"Archer C60 v1")
                name="archer-c60-v1"
                ;;
+       *"Archer C60 v2")
+               name="archer-c60-v2"
+               ;;
        *"Archer C7")
                name="archer-c7"
                ;;
@@ -516,8 +545,11 @@ ar71xx_board_detect() {
        *"CF-E320N v2")
                name="cf-e320n-v2"
                ;;
-       *"CF-E355AC")
-               name="cf-e355ac"
+       *"CF-E355AC v1")
+               name="cf-e355ac-v1"
+               ;;
+       *"CF-E355AC v2")
+               name="cf-e355ac-v2"
                ;;
        *"CF-E375AC")
                name="cf-e375ac"
@@ -528,6 +560,9 @@ ar71xx_board_detect() {
        *"CF-E380AC v2")
                name="cf-e380ac-v2"
                ;;
+       *"CF-E385AC")
+               name="cf-e385ac"
+               ;;
        *"CF-E520N")
                name="cf-e520n"
                ;;
@@ -536,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"
@@ -557,6 +596,9 @@ ar71xx_board_detect() {
        *"CR5000")
                name="cr5000"
                ;;
+       *"DAP-1330 Rev. A1")
+               name="dap-1330-a1"
+               ;;
        *"DAP-2695 rev. A1")
                name="dap-2695-a1"
                ;;
@@ -627,12 +669,27 @@ ar71xx_board_detect() {
        *"DW33D")
                name="dw33d"
                ;;
+       *"E1700AC v2")
+               name="e1700ac-v2"
+               ;;
        *"E2100L")
                name="e2100l"
                ;;
+       *"E558 v2")
+               name="e558-v2"
+               ;;
+       *"E600G v2")
+               name="e600g-v2"
+               ;;
+       *"E600GAC v2")
+               name="e600gac-v2"
+               ;;
+       *"E750A v4")
+               name="e750a-v4"
+               ;;
        *"EAP120")
                name="eap120"
-               tplink_pharos_board_detect
+               tplink_pharos_board_detect "$(tplink_pharos_get_model_string | tr -d '\r')"
                ;;
        *"EAP300 v2")
                name="eap300v2"
@@ -673,9 +730,15 @@ ar71xx_board_detect() {
        *"eTactica EG-200")
                name="rme-eg200"
                ;;
+       *"FRITZ!Box 4020")
+               name="fritz4020"
+               ;;
        *"FRITZ!WLAN Repeater 300E")
                name="fritz300e"
                ;;
+       *"FRITZ!WLAN Repeater 450E")
+               name="fritz450e"
+               ;;
        *"GL-AR150")
                name="gl-ar150"
                ;;
@@ -726,9 +789,18 @@ ar71xx_board_detect() {
        *"JWAP230")
                name="jwap230"
                ;;
+       *"Koala")
+               name="koala"
+               ;;
+       *"LAN Turtle")
+               name="lan-turtle"
+               ;;
        *"Lima"*)
                name="lima"
                ;;
+       *"Litebeam M5"*)
+               name="lbe-m5"
+               ;;
        *"Loco M XW")
                name="loco-m-xw"
                ;;
@@ -848,7 +920,16 @@ ar71xx_board_detect() {
                name="onion-omega"
                ;;
        *"Oolite V1.0")
-               name="oolite"
+               name="oolite-v1"
+               ;;
+       *"Packet Squirrel")
+               name="packet-squirrel"
+               ;;
+       *"Oolite V5.2")
+               name="oolite-v5.2"
+               ;;
+       *"Oolite V5.2-Dev")
+               name="oolite-v5.2-dev"
                ;;
        *"PB42")
                name="pb42"
@@ -893,6 +974,9 @@ ar71xx_board_detect() {
        *"RouterBOARD 2011iL")
                name="rb-2011il"
                ;;
+       *"RouterBOARD 2011iLS")
+               name="rb-2011ils"
+               ;;
        *"RouterBOARD 2011L")
                name="rb-2011l"
                ;;
@@ -1049,6 +1133,9 @@ ar71xx_board_detect() {
        *"SR3200")
                name="sr3200"
                ;;
+       *"T830")
+               name="t830"
+               ;;
        *"TellStick ZNet Lite")
                name="tellstick-znet-lite"
                ;;
@@ -1250,6 +1337,9 @@ ar71xx_board_detect() {
        *"TL-WR940N v4")
                name="tl-wr940n-v4"
                ;;
+       *"TL-WR940N v6")
+               name="tl-wr940n-v6"
+               ;;
        *"TL-WR941N/ND v5")
                name="tl-wr941nd-v5"
                ;;
@@ -1262,6 +1352,9 @@ ar71xx_board_detect() {
        *"TL-WR942N v1")
                name="tl-wr942n-v1"
                ;;
+       *"TS-D084")
+               name="ts-d084"
+               ;;
        *"Tube2H")
                name="tube2h"
                ;;
@@ -1273,6 +1366,7 @@ ar71xx_board_detect() {
                ;;
        *"UniFi-AC-LITE/MESH")
                name="unifiac-lite"
+               ubnt_ac_lite_board_detect
                ;;
        *"UniFi-AC-PRO")
                name="unifiac-pro"
@@ -1283,13 +1377,16 @@ ar71xx_board_detect() {
        *"UniFiAP Outdoor+")
                name="unifi-outdoor-plus"
                ;;
+       *"WAM250")
+               name="wam250"
+               ;;
        *"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"
@@ -1306,6 +1403,9 @@ ar71xx_board_detect() {
        *"WHR-HP-GN")
                name="whr-hp-gn"
                ;;
+       *"WiFi Pineapple NANO")
+               name="wifi-pineapple-nano"
+               ;;
        *"WLAE-AG300N")
                name="wlae-ag300n"
                ;;