Update NETGEAR WNDR3700/3800 model string detection patch
This commit is contained in:
parent
6bad3e385a
commit
9449f0f5d8
@ -1,51 +1,64 @@
|
|||||||
From: Matthias Schiffer <mschiffer@universe-factory.net>
|
From: Matthias Schiffer <mschiffer@universe-factory.net>
|
||||||
Date: Sun, 15 Mar 2015 19:51:15 +0100
|
Date: Sun, 29 Mar 2015 13:23:26 +0200
|
||||||
Subject: ar71xx: fix model string detection on NETGEAR WNDR3700/3800/WNDRMAC
|
Subject: ar71xx: fix model string detection on NETGEAR WNDR3700/3800/WNDRMAC
|
||||||
|
|
||||||
There were a few issues with the existing code to detect the model string:
|
There were a few issues with the existing code to detect the model string:
|
||||||
* Always using the string starting with byte 56 would cut off the W of WNDR when
|
* Always using the string starting with byte 56 would cut off the W of WNDR when
|
||||||
the ID starts with 29763654+16+128 instead of 29763654+16+64
|
the ID starts with 29763654+16+64 instead of 29763654+16+128
|
||||||
* The string contained garbage after the zero byte instead of cutting it off
|
* The string contained garbage after the zero byte instead of cutting it off
|
||||||
after the zero (which wasn't always visible using busybox tools, but could
|
after the zero (which wasn't always visible using busybox tools, but could
|
||||||
confuse other scripts)
|
confuse other scripts)
|
||||||
|
|
||||||
|
Tested on a WNDR3700v1 and a WNDR3700v2 using the new 29763654+16+64 ID in the
|
||||||
|
ART. Furthermore, tested against ART dumps of a WNDR3700v2 using the old
|
||||||
|
$'\xff...' value and a WNDR3800.
|
||||||
|
|
||||||
|
The [ -z "$model" ] check was dropped as there is no way to actually hit this
|
||||||
|
unless no ART partition is found at all.
|
||||||
|
|
||||||
|
The awk command was carefully crafted to work both with gawk and the (horribly
|
||||||
|
broken) busybox awk.
|
||||||
|
|
||||||
|
Fixes #18992.
|
||||||
|
|
||||||
|
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
|
||||||
|
|
||||||
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
|
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
|
||||||
index a698ce5..0f9be69 100755
|
index a698ce5..1838cb4 100755
|
||||||
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
|
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
|
||||||
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
|
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
|
||||||
@@ -37,16 +37,28 @@ wndr3700_board_detect() {
|
@@ -37,16 +37,26 @@ wndr3700_board_detect() {
|
||||||
machine="NETGEAR WNDR3700"
|
machine="NETGEAR WNDR3700"
|
||||||
;;
|
;;
|
||||||
"33373031")
|
"33373031")
|
||||||
- local model
|
- local model
|
||||||
- model=$(ar71xx_get_mtd_offset_size_format art 56 10 %c)
|
- model=$(ar71xx_get_mtd_offset_size_format art 56 10 %c)
|
||||||
- if [ -z "$model" ] || [ "$model" = $'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' ]; then
|
- if [ -z "$model" ] || [ "$model" = $'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' ]; then
|
||||||
+ case "$(ar71xx_get_mtd_offset_size_format art 56 10 %c)" in
|
- machine="NETGEAR WNDR3700v2"
|
||||||
+ $'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff')
|
|
||||||
machine="NETGEAR WNDR3700v2"
|
|
||||||
- elif [ -z "$model" ] || [ "$model" = $'\xff\xff\xff\xff\xff\xff\xff\xff\xffN' ]; then
|
- elif [ -z "$model" ] || [ "$model" = $'\xff\xff\xff\xff\xff\xff\xff\xff\xffN' ]; then
|
||||||
+ ;;
|
- machine="NETGEAR WNDRMAC"
|
||||||
+ $'\xff\xff\xff\xff\xff\xff\xff\xff\xffN')
|
|
||||||
machine="NETGEAR WNDRMAC"
|
|
||||||
- else
|
- else
|
||||||
- machine="NETGEAR $model"
|
+ # Use awk to remove everything after the first zero byte
|
||||||
- fi
|
+ model="$(ar71xx_get_mtd_offset_size_format art 41 32 %c | awk 'BEGIN{FS="[[:cntrl:]]"} {print $1; exit}')"
|
||||||
- ;;
|
+ case $model in
|
||||||
|
+ $'\xff'*)
|
||||||
|
+ if [ "${model:24:1}" = 'N' ]; then
|
||||||
|
+ machine="NETGEAR WNDRMAC"
|
||||||
|
+ else
|
||||||
|
+ machine="NETGEAR WNDR3700v2"
|
||||||
|
+ fi
|
||||||
|
+ ;;
|
||||||
|
+ '29763654+16+64'*)
|
||||||
|
+ machine="NETGEAR ${model:14}"
|
||||||
|
+ ;;
|
||||||
|
+ '29763654+16+128'*)
|
||||||
|
+ machine="NETGEAR ${model:15}"
|
||||||
+ ;;
|
+ ;;
|
||||||
+ *)
|
+ *)
|
||||||
+ # Use awk to remove everything after the first zero byte
|
+ # Unknown ID
|
||||||
+ model="$(ar71xx_get_mtd_offset_size_format art 41 32 %c | awk 'BEGIN{FS="[[:cntrl:]]"} {print $1; exit}')"
|
machine="NETGEAR $model"
|
||||||
+ case $model in
|
- fi
|
||||||
+ '29763654+16+64'*)
|
- ;;
|
||||||
+ machine="NETGEAR ${model:14}"
|
|
||||||
+ ;;
|
|
||||||
+ '29763654+16+128'*)
|
|
||||||
+ machine="NETGEAR ${model:15}"
|
|
||||||
+ ;;
|
|
||||||
+ *)
|
|
||||||
+ # Unknown ID
|
|
||||||
+ machine="NETGEAR $model"
|
|
||||||
+ esac
|
|
||||||
+ esac
|
+ esac
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user