Author: nbd
Date: 2016-01-03 15:48:06 +0100 (Sun, 03 Jan 2016)
New Revision: 48087

Modified:
   branches/chaos_calmer/target/linux/ar71xx/base-files/lib/ar71xx.sh
Log:
ar71xx: fix wndr3700_board_detect for some NETGEAR WNDR3700v2

There are a few NETGEAR devices which don't terminate the model name in the
ART with a NUL byte, at least some NETGEAR WNDR3700v2. The current awk
expression doesn't match 0xFF bytes, so AR71XX_MODEL contains lots of
trailing 0xFF garbage in this case.

Fix this by matching for the first non-printable character and explicitly
setting LC_CTYPE=C (probably not strictly necessary on OpenWrt, but will
definitely work like this, even when awk supports locales and LANG is set).

Signed-off-by: Matthias Schiffer <[email protected]>

Backport of r46455

Modified: branches/chaos_calmer/target/linux/ar71xx/base-files/lib/ar71xx.sh
===================================================================
--- branches/chaos_calmer/target/linux/ar71xx/base-files/lib/ar71xx.sh  
2016-01-03 14:47:47 UTC (rev 48086)
+++ branches/chaos_calmer/target/linux/ar71xx/base-files/lib/ar71xx.sh  
2016-01-03 14:48:06 UTC (rev 48087)
@@ -38,7 +38,7 @@
                ;;
        "33373031")
                # Use awk to remove everything after the first zero byte
-               model="$(ar71xx_get_mtd_offset_size_format art 41 32 %c | awk 
'BEGIN{FS="[[:cntrl:]]"} {print $1; exit}')"
+               model="$(ar71xx_get_mtd_offset_size_format art 41 32 %c | 
LC_CTYPE=C awk -v 'FS=[^[:print:]]' '{print $1; exit}')"
                case $model in
                $'\xff'*)
                        if [ "${model:24:1}" = 'N' ]; then
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to