3 # Copyright (C) 2009-2011 OpenWrt.org
9 ar71xx_get_mtd_offset_size_format
() {
16 dev
=$
(find_mtd_part
$mtd)
17 [ -z "$dev" ] && return
19 dd if=$dev bs
=1 skip
=$offset count
=$size 2>/dev
/null |
hexdump -v -e "1/1 \"$format\""
22 ar71xx_get_mtd_part_magic
() {
24 ar71xx_get_mtd_offset_size_format
"$mtd" 0 4 %02x
27 wndr3700_board_detect
() {
34 magic
="$(ar71xx_get_mtd_part_magic firmware)"
37 machine
="NETGEAR WNDR3700"
41 model
=$
(ar71xx_get_mtd_offset_size_format art
56 10 %c
)
42 if [ -z "$model" ] ||
[ "$model" = $
'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' ]; then
43 machine
="NETGEAR WNDR3700v2"
45 machine
="NETGEAR $model"
50 AR71XX_BOARD_NAME
="$name"
51 AR71XX_MODEL
="$machine"
57 part
=$
(find_mtd_part firmware
)
58 [ -z "$part" ] && return 1
60 dd if=$part bs
=4 count
=1 skip
=16 2>/dev
/null |
hexdump -v -n 4 -e '1/1 "%02x"'
63 tplink_board_detect
() {
68 hwid
=$
(tplink_get_hwid
)
74 model
="TP-Link TL-WR703N"
77 model
="TP-Link TL-WA701N/ND"
80 model
="TP-Link TL-WR740N/ND"
83 model
="TP-Link TL-WR741N/ND"
86 model
="TP-Link TL-WR743N/ND"
89 model
="TP-Link TL-WR841N/ND"
92 model
="TP-Link TL-WA901N/ND"
95 model
="TP-Link TL-WR941N/ND"
98 model
="TP-Link TL-WR1043N/ND"
101 model
="TP-Link TL-WR2543N/ND"
104 model
="TP-Link TL-MR11U"
107 model
="TP-Link TL-MR3020"
110 model
="TP-Link TL-MR3220"
113 model
="TP-Link TL-MR3420"
120 AR71XX_MODEL
="$model $hwver"
123 ar71xx_board_detect
() {
127 machine
=$
(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc
/cpuinfo
)
133 *"ALFA Network AP96")
136 *"ALFA Network N2/N5")
163 *"DB120 reference board")
202 *"NBG460N/550N/550NH")
203 name
="nbg460n_550n_550nh"
217 *"RouterBOARD 411/A/AH")
223 *"RouterBOARD 433/AH")
226 *"RouterBOARD 433UAH")
235 *"RouterBOARD 493/AH")
250 *"RouterStation Pro")
251 name
="routerstation-pro"
322 *"WNDR3700/WNDR3800/WNDRMAC")
323 wndr3700_board_detect
"$machine"
344 name
="wzr-hp-g300nh2"
358 *TL-WR
* |
*TL-WA
* |
*TL-MR
*)
359 tplink_board_detect
"$machine"
363 [ -z "$name" ] && name
="unknown"
365 [ -z "$AR71XX_BOARD_NAME" ] && AR71XX_BOARD_NAME
="$name"
366 [ -z "$AR71XX_MODEL" ] && AR71XX_MODEL
="$machine"
368 [ -e "/tmp/sysinfo/" ] || mkdir
-p "/tmp/sysinfo/"
370 echo "$AR71XX_BOARD_NAME" > /tmp
/sysinfo
/board_name
371 echo "$AR71XX_MODEL" > /tmp
/sysinfo
/model
374 ar71xx_board_name
() {
377 [ -f /tmp
/sysinfo
/board_name
] && name
=$
(cat /tmp
/sysinfo
/board_name
)
378 [ -z "$name" ] && name
="unknown"