mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-30 17:59:21 +02:00
ar71xx: fix WNDR3x00 model detection
Detect the model name for /tmp/sysinfo/model based on 10 bytes at offset 56 in the art (caldata) mtd partition. r29434 redid WNDR3x00 model detection, attempting to distinguish between WNDR3700v2 and WNDR3800 by checking MemTotal in /proc/meminfo. However, it contained a bug: it put the awk inside a $(...), with the result that all WNDR3700v2 and WNDR3800 models would be reported as WNDR3800. This patch checks the model name stored in the art partition, as is done by U-Boot shipping on the WNDR3800. It has the likely advantage of working with future models based on the WNDR3700 board. It also will not mis-detect units on which people install more memory. I have tested this patch on WNDR3700 (v1), WNDR3700v2, and WNDR3800. Signed-off-by: Mark Mentovai <mark@moxienet.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@29472 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
9de4cb5314
commit
e310d5b786
@ -6,18 +6,22 @@
|
||||
AR71XX_BOARD_NAME=
|
||||
AR71XX_MODEL=
|
||||
|
||||
ar71xx_get_mem_total() {
|
||||
$(awk '/MemTotal:/ {print($2)}' /proc/meminfo)
|
||||
ar71xx_get_mtd_offset_size_format() {
|
||||
local mtd="$1"
|
||||
local offset="$2"
|
||||
local size="$3"
|
||||
local format="$4"
|
||||
local dev
|
||||
|
||||
dev=$(find_mtd_part $mtd)
|
||||
[ -z "$dev" ] && return
|
||||
|
||||
dd if=$dev bs=1 skip=$offset count=$size 2>/dev/null | hexdump -v -e "1/1 \"$format\""
|
||||
}
|
||||
|
||||
ar71xx_get_mtd_part_magic() {
|
||||
local part="$1"
|
||||
local mtd
|
||||
|
||||
mtd=$(find_mtd_part $part)
|
||||
[ -z "$mtd" ] && return
|
||||
|
||||
dd if=$mtd bs=4 count=1 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
|
||||
local mtd="$1"
|
||||
ar71xx_get_mtd_offset_size_format "$mtd" 0 4 %02x
|
||||
}
|
||||
|
||||
wndr3700_board_detect() {
|
||||
@ -33,13 +37,12 @@ wndr3700_board_detect() {
|
||||
machine="NETGEAR WNDR3700"
|
||||
;;
|
||||
"33373031")
|
||||
local mt
|
||||
|
||||
mt=$(ar71xx_get_mem_total)
|
||||
if [ "$mt" -lt "65536" ]; then
|
||||
local model
|
||||
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
|
||||
machine="NETGEAR WNDR3700v2"
|
||||
else
|
||||
machine="NETGEAR WNDR3800"
|
||||
machine="NETGEAR $model"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
Loading…
Reference in New Issue
Block a user