0045-ar71xx-another-fix-to-wndr3700_board_detect.patch 1.3 KB

1234567891011121314151617181920212223242526272829
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Sat, 2 Jan 2016 23:36:25 +0100
  3. Subject: ar71xx: another fix to wndr3700_board_detect
  4. My last bugfix (r47538) introduced a new bug in wndr3700_board_detect
  5. (again...).
  6. Assigning the result of ar71xx_get_mtd_offset_size_format to the model
  7. variable before stripping of garbage using awk will cause all NUL bytes to
  8. be removed before awk is applied, leading to model strings like
  9. "NETGEAR WNDRMACv2NETGEAR", where a NUL byte after the v2 is supposed to
  10. terminate the string.
  11. Fix by calling ar71xx_get_mtd_offset_size_format twice, once piping to awk
  12. directly.
  13. diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  14. index daebaa4..d0abf42 100755
  15. --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
  16. +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
  17. @@ -39,7 +39,7 @@ wndr3700_board_detect() {
  18. "33373031")
  19. model="$(ar71xx_get_mtd_offset_size_format art 41 32 %c)"
  20. # Use awk to remove everything unprintable
  21. - model_stripped="$(echo -n "$model" | LC_CTYPE=C awk -v 'FS=[^[:print:]]' '{print $1; exit}')"
  22. + model_stripped="$(ar71xx_get_mtd_offset_size_format art 41 32 %c | LC_CTYPE=C awk -v 'FS=[^[:print:]]' '{print $1; exit}')"
  23. case $model in
  24. $'\xff'*)
  25. if [ "${model:24:1}" = 'N' ]; then