From f27f2fec4fe62411e427efb6fa737dd3292ca6cd Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Mon, 14 Jul 2014 16:03:35 +0000 Subject: [PATCH] ar71xx: add user-space support for the Tube2H board Signed-off-by: Gabor Juhos SVN-Revision: 41650 --- target/linux/ar71xx/base-files/etc/diag.sh | 3 ++ .../base-files/etc/uci-defaults/01_leds | 9 ++++++ .../base-files/etc/uci-defaults/02_network | 1 + target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 ++ .../ar71xx/base-files/lib/upgrade/platform.sh | 30 +++++++++++++++++++ 5 files changed, 46 insertions(+) diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index af3439f8b95c..174684d0ae30 100755 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -217,6 +217,9 @@ get_status_led() { tl-wr2543n) status_led="tp-link:green:wps" ;; + tube2h) + status_led="alfa:green:signal4" + ;; unifi) status_led="ubnt:green:dome" ;; diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds index 34fed026b551..ccfc846af48f 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds @@ -348,6 +348,15 @@ tl-wr2543n) ucidef_set_led_usbdev "usb" "USB" "tp-link:green:usb" "1-1" ;; +tube2h) + ucidef_set_led_netdev "lan" "LAN" "alfa:blue:lan" "eth0" + ucidef_set_rssimon "wlan0" "40000" "1" + ucidef_set_led_rssi "signal1" "SIGNAL1" "alfa:red:signal1" "wlan0" "1" "100" "0" "13" + ucidef_set_led_rssi "signal2" "SIGNAL2" "alfa:orange:signal2" "wlan0" "26" "100" "-25" "13" + ucidef_set_led_rssi "signal3" "SIGNAL3" "alfa:green:signal3" "wlan0" "51" "100" "-50" "13" + ucidef_set_led_rssi "signal4" "SIGNAL4" "alfa:green:signal4" "wlan0" "76" "100" "-75" "13" + ;; + wrt160nl) ucidef_set_led_wlan "wlan" "WLAN" "wrt160nl:blue:wlan" "phy0tpt" ;; diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network index d4fb5770ce10..8dd04d4ef491 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network @@ -300,6 +300,7 @@ tl-wa901nd |\ tl-wa901nd-v2 |\ tl-wa901nd-v3 |\ tl-wr703n |\ +tube2h |\ wndap360 |\ mynet-rext |\ wp543) diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index bc26d8b1dc54..94f758a8097a 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -625,6 +625,9 @@ ar71xx_board_detect() { *"TL-MR13U") name="tl-mr13u" ;; + *"Tube2H") + name="tube2h" + ;; *UniFi) name="unifi" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index d42a704e57e0..910da52bb772 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -2,6 +2,7 @@ # Copyright (C) 2011 OpenWrt.org # +. /lib/functions/system.sh . /lib/ar71xx.sh PART_NAME=firmware @@ -106,6 +107,29 @@ platform_do_upgrade_compex() { fi } +alfa_check_image() { + local magic_long="$(get_magic_long "$1")" + local fw_part_size=$(mtd_get_part_size firmware) + + case "$magic_long" in + "27051956") + [ "$fw_part_size" != "16318464" ] && { + echo "Invalid image magic \"$magic_long\" for $fw_part_size bytes" + return 1 + } + ;; + + "68737173") + [ "$fw_part_size" != "7929856" ] && { + echo "Invalid image magic \"$magic_long\" for $fw_part_size bytes" + return 1 + } + ;; + esac + + return 0 +} + platform_check_image() { local board=$(ar71xx_board_name) local magic="$(get_magic_word "$1")" @@ -293,6 +317,12 @@ platform_check_image() { return 0 ;; + + tube2h) + alfa_check_image "$1" && return 0 + return 1 + ;; + uap-pro) [ "$magic_long" != "19852003" ] && { echo "Invalid image type." -- 2.30.2