0041-ar71xx-fix-wndr3700_board_detect-for-some-NETGEAR-WNDR3700v2.patch 1.3 KB

1234567891011121314151617181920212223242526
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Thu, 23 Jul 2015 01:31:05 +0200
  3. Subject: ar71xx: fix wndr3700_board_detect for some NETGEAR WNDR3700v2
  4. There are a few NETGEAR devices which don't terminate the model name in the
  5. ART with a NUL byte, at least some NETGEAR WNDR3700v2. The current awk
  6. expression doesn't match 0xFF bytes, so AR71XX_MODEL contains lots of
  7. trailing 0xFF garbage in this case.
  8. Fix this by matching for the first non-printable character and explicitly
  9. setting LC_CTYPE=C (probably not strictly necessary on OpenWrt, but will
  10. definitely work like this, even when awk supports locales and LANG is set).
  11. diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  12. index d79776b..6ba40aa 100755
  13. --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
  14. +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  15. @@ -38,7 +38,7 @@ wndr3700_board_detect() {
  16. ;;
  17. "33373031")
  18. # Use awk to remove everything after the first zero byte
  19. - model="$(ar71xx_get_mtd_offset_size_format art 41 32 %c | awk 'BEGIN{FS="[[:cntrl:]]"} {print $1; exit}')"
  20. + model="$(ar71xx_get_mtd_offset_size_format art 41 32 %c | LC_CTYPE=C awk -v 'FS=[^[:print:]]' '{print $1; exit}')"
  21. case $model in
  22. $'\xff'*)
  23. if [ "${model:24:1}" = 'N' ]; then