From patchwork Fri Nov 20 14:22:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Schiffer X-Patchwork-Id: 546931 X-Patchwork-Delegate: jow@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9636C140761 for ; Sat, 21 Nov 2015 01:22:47 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 46FDD280640; Fri, 20 Nov 2015 15:20:18 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 161FE280520 for ; Fri, 20 Nov 2015 15:20:09 +0100 (CET) X-policyd-weight: using cached result; rate: -7.6 Received: from chaos.universe-factory.net (chaos.universe-factory.net [37.72.148.22]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Fri, 20 Nov 2015 15:20:07 +0100 (CET) Received: from avalon.neoraider.dn42 (unknown [IPv6:fd1b:c28a:2fd6:0:a006:78ff:febd:a2f0]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by chaos.universe-factory.net (Postfix) with ESMTPSA id AFF0618AADA for ; Fri, 20 Nov 2015 15:22:05 +0100 (CET) From: Matthias Schiffer To: openwrt-devel@lists.openwrt.org Date: Fri, 20 Nov 2015 15:22:03 +0100 Message-Id: <8c2fd0fb2b291699cb4556b17e63c0a5357f462d.1448029284.git.mschiffer@universe-factory.net> X-Mailer: git-send-email 2.6.2 Subject: [OpenWrt-Devel] [PATCH] ar71xx: fix wndr3700_board_detect for some NETGEAR WNDR3700v2 (again) X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" When fixing the model string for WNDR3700v2 which contain a model string followed by 0xff in r46455, the match for other versions of the WNDR3700v2 which just contain lots of 0xff broke (as the 0xff $model is checked for is stripped off). Fix by stripping off non-printable characters only for the actual output string, but not for the internal matching. Signed-off-by: Matthias Schiffer --- target/linux/ar71xx/base-files/lib/ar71xx.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index cc8c43a..af2df8e 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -37,8 +37,9 @@ wndr3700_board_detect() { machine="NETGEAR WNDR3700" ;; "33373031") - # Use awk to remove everything after the first zero byte - model="$(ar71xx_get_mtd_offset_size_format art 41 32 %c | LC_CTYPE=C awk -v 'FS=[^[:print:]]' '{print $1; exit}')" + model="$(ar71xx_get_mtd_offset_size_format art 41 32 %c)" + # Use awk to remove everything unprintable + model_stripped="$(echo -n "$model" | LC_CTYPE=C awk -v 'FS=[^[:print:]]' '{print $1; exit}')" case $model in $'\xff'*) if [ "${model:24:1}" = 'N' ]; then @@ -48,14 +49,14 @@ wndr3700_board_detect() { fi ;; '29763654+16+64'*) - machine="NETGEAR ${model:14}" + machine="NETGEAR ${model_stripped:14}" ;; '29763654+16+128'*) - machine="NETGEAR ${model:15}" + machine="NETGEAR ${model_stripped:15}" ;; *) # Unknown ID - machine="NETGEAR $model" + machine="NETGEAR ${model_stripped}" esac esac