gluon/patches/openwrt/0113-ar71xx-add-revision-detection-for-D-Link-DIR-505-A1-A2.patch
2016-07-28 16:33:49 +02:00

39 lines
1.2 KiB
Diff

From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 28 Jul 2016 15:43:25 +0200
Subject: ar71xx: add revision detection for D-Link DIR-505 A1/A2
The A1 image also works on the A2, correctly set AR71XX_MODEL in this case.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Backport of LEDE 500a67a167a256002f8ab05171f49dfb86b03260
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index beca73a..480cf93 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -107,6 +107,15 @@ cybertan_get_hw_magic() {
dd bs=8 count=1 skip=0 if=$part 2>/dev/null | hexdump -v -n 8 -e '1/1 "%02x"'
}
+dir505_board_detect() {
+ local dev=$(find_mtd_part 'mac')
+ [ -z "$dev" ] && return
+
+ # The revision is stored at the beginning of the "mac" partition
+ local rev="$(LC_CTYPE=C awk -v 'FS=[^[:print:]]' '{print $1; exit}' $dev)"
+ AR71XX_MODEL="D-Link DIR-505 rev. $rev"
+}
+
tplink_get_hwid() {
local part
@@ -453,6 +462,7 @@ ar71xx_board_detect() {
;;
*"DIR-505 rev. A1")
name="dir-505-a1"
+ dir505_board_detect
;;
*"DIR-600 rev. A1")
name="dir-600-a1"