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"
44 elif [ -z "$model" ] ||
[ "$model" = $
'\xff\xff\xff\xff\xff\xff\xff\xff\xffN' ]; then
45 machine
="NETGEAR WNDRMAC"
47 machine
="NETGEAR $model"
52 AR71XX_BOARD_NAME
="$name"
53 AR71XX_MODEL
="$machine"
59 part
=$
(find_mtd_part firmware
)
60 [ -z "$part" ] && return 1
62 dd if=$part bs
=4 count
=1 skip
=16 2>/dev
/null |
hexdump -v -n 4 -e '1/1 "%02x"'
68 part
=$
(find_mtd_part firmware
)
69 [ -z "$part" ] && return 1
71 dd if=$part bs
=4 count
=1 skip
=17 2>/dev
/null |
hexdump -v -n 4 -e '1/1 "%02x"'
74 tplink_board_detect
() {
79 hwid
=$
(tplink_get_hwid
)
86 model
="TP-Link TL-WR703N"
89 model
="TP-Link TL-WR720N"
92 model
="TP-Link TL-WA701N/ND"
95 model
="TP-Link TL-WR740N/ND"
98 model
="TP-Link TL-WR741N/ND"
101 model
="TP-Link TL-WR743N/ND"
104 model
="TP-Link TL-WA801N/ND"
107 model
="TP-Link TL-WA830RE"
110 model
="TP-Link TL-WR841N/ND"
113 model
="TP-Link TL-WR842N/ND"
116 model
="TP-Link TL-WA901N/ND"
119 if [ "$hwid" == "09410002" -a "$mid" == "00420001" ]; then
120 model
="Rosewill RNX-N360RT"
123 model
="TP-Link TL-WR941N/ND"
127 model
="TP-Link TL-WR1041N/ND"
130 model
="TP-Link TL-WR1043N/ND"
133 model
="TP-Link TL-WR2543N/ND"
136 model
="TP-Link TL-MR10U"
139 model
="TP-Link TL-MR11U"
142 model
="TP-Link TL-MR3020"
145 model
="TP-Link TL-MR3040"
148 model
="TP-Link TL-MR3220"
151 model
="TP-Link TL-MR3420"
154 model
="TP-Link TL-WDR3500"
157 model
="TP-Link TL-WDR3600"
160 model
="TP-Link TL-WDR4300"
163 model
="TP-Link TL-WDR4310"
170 AR71XX_MODEL
="$model $hwver"
173 ar71xx_board_detect
() {
177 machine
=$
(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc
/cpuinfo
)
183 *"ALFA Network AP96")
186 *"ALFA Network N2/N5")
207 *"AP132 reference board")
210 *"AP136-010 reference board")
213 *"AP136-020 reference board")
216 *"AP135-020 reference board")
234 *"DB120 reference board")
288 *"NBG460N/550N/550NH")
289 name
="nbg460n_550n_550nh"
303 *"PB44 reference board")
309 *"RouterBOARD 411/A/AH")
315 *"RouterBOARD 433/AH")
318 *"RouterBOARD 433UAH")
330 *"RouterBOARD 493/AH")
339 *"RouterBOARD 750GL")
348 *"RouterBOARD 951G-2HnD")
351 *"RouterBOARD 2011L")
354 *"RouterBOARD 2011UAS-2HnD")
355 name
="rb-2011uas-2hnd"
363 *"RouterStation Pro")
364 name
="routerstation-pro"
420 *"TL-WDR3600/4300/4310")
477 *"WNDR3700/WNDR3800/WNDRMAC")
478 wndr3700_board_detect
"$machine"
495 *"WZR-HP-AG300H/WZR-600DHP")
505 name
="wzr-hp-g300nh2"
519 *EmbWir-Dorin-Router
)
520 name
="ew-dorin-router"
525 *TL-WR
* |
*TL-WA
* |
*TL-MR
* |
*TL-WD
*)
526 tplink_board_detect
"$machine"
530 [ -z "$name" ] && name
="unknown"
532 [ -z "$AR71XX_BOARD_NAME" ] && AR71XX_BOARD_NAME
="$name"
533 [ -z "$AR71XX_MODEL" ] && AR71XX_MODEL
="$machine"
535 [ -e "/tmp/sysinfo/" ] || mkdir
-p "/tmp/sysinfo/"
537 echo "$AR71XX_BOARD_NAME" > /tmp
/sysinfo
/board_name
538 echo "$AR71XX_MODEL" > /tmp
/sysinfo
/model
541 ar71xx_board_name
() {
544 [ -f /tmp
/sysinfo
/board_name
] && name
=$
(cat /tmp
/sysinfo
/board_name
)
545 [ -z "$name" ] && name
="unknown"