0040-ar71xx-fix-wndr3700_board_detect-for-some-NETGEAR-WNDR3700v2-again.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Fri, 20 Nov 2015 15:09:03 +0100
  3. Subject: ar71xx: fix wndr3700_board_detect for some NETGEAR WNDR3700v2 (again)
  4. When fixing the model string for WNDR3700v2 which contain a model string
  5. followed by 0xff in r46455, the match for other versions of the WNDR3700v2
  6. which just contain lots of 0xff broke (as the 0xff $model is checked for
  7. is stripped off).
  8. Fix by stripping off non-printable characters only for the actual output
  9. string, but not for the internal matching.
  10. diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  11. index 388cf38..daebaa4 100755
  12. --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
  13. +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  14. @@ -37,8 +37,9 @@ wndr3700_board_detect() {
  15. machine="NETGEAR WNDR3700"
  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 | LC_CTYPE=C awk -v 'FS=[^[:print:]]' '{print $1; exit}')"
  20. + model="$(ar71xx_get_mtd_offset_size_format art 41 32 %c)"
  21. + # Use awk to remove everything unprintable
  22. + model_stripped="$(echo -n "$model" | LC_CTYPE=C awk -v 'FS=[^[:print:]]' '{print $1; exit}')"
  23. case $model in
  24. $'\xff'*)
  25. if [ "${model:24:1}" = 'N' ]; then
  26. @@ -48,14 +49,14 @@ wndr3700_board_detect() {
  27. fi
  28. ;;
  29. '29763654+16+64'*)
  30. - machine="NETGEAR ${model:14}"
  31. + machine="NETGEAR ${model_stripped:14}"
  32. ;;
  33. '29763654+16+128'*)
  34. - machine="NETGEAR ${model:15}"
  35. + machine="NETGEAR ${model_stripped:15}"
  36. ;;
  37. *)
  38. # Unknown ID
  39. - machine="NETGEAR $model"
  40. + machine="NETGEAR ${model_stripped}"
  41. esac
  42. esac