ar71xx: fix wndr3700_board_detect for some NETGEAR WNDR3700v2 (again)

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 <mschiffer@universe-factory.net>

SVN-Revision: 47538
This commit is contained in:
Jo-Philipp Wich 2015-11-20 23:34:11 +00:00
parent 923a59315c
commit 605621fc3f

View file

@ -37,8 +37,9 @@ wndr3700_board_detect() {
machine="NETGEAR WNDR3700" machine="NETGEAR WNDR3700"
;; ;;
"33373031") "33373031")
# Use awk to remove everything after the first zero byte model="$(ar71xx_get_mtd_offset_size_format art 41 32 %c)"
model="$(ar71xx_get_mtd_offset_size_format art 41 32 %c | LC_CTYPE=C awk -v 'FS=[^[:print:]]' '{print $1; exit}')" # Use awk to remove everything unprintable
model_stripped="$(echo -n "$model" | LC_CTYPE=C awk -v 'FS=[^[:print:]]' '{print $1; exit}')"
case $model in case $model in
$'\xff'*) $'\xff'*)
if [ "${model:24:1}" = 'N' ]; then if [ "${model:24:1}" = 'N' ]; then
@ -48,14 +49,14 @@ wndr3700_board_detect() {
fi fi
;; ;;
'29763654+16+64'*) '29763654+16+64'*)
machine="NETGEAR ${model:14}" machine="NETGEAR ${model_stripped:14}"
;; ;;
'29763654+16+128'*) '29763654+16+128'*)
machine="NETGEAR ${model:15}" machine="NETGEAR ${model_stripped:15}"
;; ;;
*) *)
# Unknown ID # Unknown ID
machine="NETGEAR $model" machine="NETGEAR ${model_stripped}"
esac esac
esac esac