0061-ar71xx-add-revision-detection-for-D-Link-DIR-505-A1-A2.patch 1.2 KB

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