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-WR710N"
92 model
="TP-Link TL-WR720N"
95 model
="TP-Link TL-WA701N/ND"
98 model
="TP-Link TL-WR740N/ND"
101 model
="TP-Link TL-WR741N/ND"
104 model
="TP-Link TL-WR743N/ND"
107 model
="TP-Link TL-WA750RE"
110 model
="TP-Link TL-WA801N/ND"
113 model
="TP-Link TL-WA830RE"
116 model
="TP-Link TL-WR841N/ND"
119 model
="TP-Link TL-WR842N/ND"
122 model
="TP-Link TL-WA850RE"
125 model
="TP-Link TL-WA901N/ND"
128 if [ "$hwid" == "09410002" -a "$mid" == "00420001" ]; then
129 model
="Rosewill RNX-N360RT"
132 model
="TP-Link TL-WR941N/ND"
136 model
="TP-Link TL-WR1041N/ND"
139 model
="TP-Link TL-WR1043N/ND"
142 model
="TP-Link TL-WR2543N/ND"
145 model
="TP-Link TL-MR10U"
148 model
="TP-Link TL-MR11U"
151 model
="TP-Link TL-MR13U"
154 model
="TP-Link TL-MR3020"
157 model
="TP-Link TL-MR3040"
160 model
="TP-Link TL-MR3220"
163 model
="TP-Link TL-MR3420"
166 model
="TP-Link TL-WDR3500"
169 model
="TP-Link TL-WDR3600"
172 model
="TP-Link TL-WDR4300"
175 model
="TP-Link TL-WDR4310"
178 model
="MERCURY MW4530R"
185 AR71XX_MODEL
="$model $hwver"
188 ar71xx_board_detect
() {
192 machine
=$
(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc
/cpuinfo
)
198 *"ALFA Network AP96")
201 *"ALFA Network N2/N5")
222 *"AP132 reference board")
225 *"AP136-010 reference board")
228 *"AP136-020 reference board")
231 *"AP135-020 reference board")
252 *"DB120 reference board")
293 size
=$
(awk '/firmware/ { print $2 }' /proc
/mtd
)
295 if [ "x$size" = "x00790000" ]; then
299 if [ "x$size" = "x00f90000" ]; then
315 *"WD My Net Wi-Fi Range Extender")
324 *"NBG460N/550N/550NH")
325 name
="nbg460n_550n_550nh"
339 *"PB44 reference board")
345 *"RouterBOARD 411/A/AH")
351 *"RouterBOARD 433/AH")
354 *"RouterBOARD 433UAH")
366 *"RouterBOARD 493/AH")
375 *"RouterBOARD 750GL")
384 *"RouterBOARD 951G-2HnD")
387 *"RouterBOARD 2011L")
390 *"RouterBOARD 2011UAS")
393 *"RouterBOARD 2011UAS-2HnD")
394 name
="rb-2011uas-2hnd"
402 *"RouterStation Pro")
403 name
="routerstation-pro"
471 *"TL-WDR3600/4300/4310")
537 *"WNDR3700/WNDR3800/WNDRMAC")
538 wndr3700_board_detect
"$machine"
561 *"WZR-HP-AG300H/WZR-600DHP")
571 name
="wzr-hp-g300nh2"
585 *EmbWir-Dorin-Router
)
586 name
="ew-dorin-router"
588 "8devices Carambola2"*)
594 *"BHU BXU2000n-2 rev. A1")
600 *TL-WR
* |
*TL-WA
* |
*TL-MR
* |
*TL-WD
*)
601 tplink_board_detect
"$machine"
605 [ -z "$name" ] && name
="unknown"
607 [ -z "$AR71XX_BOARD_NAME" ] && AR71XX_BOARD_NAME
="$name"
608 [ -z "$AR71XX_MODEL" ] && AR71XX_MODEL
="$machine"
610 [ -e "/tmp/sysinfo/" ] || mkdir
-p "/tmp/sysinfo/"
612 echo "$AR71XX_BOARD_NAME" > /tmp
/sysinfo
/board_name
613 echo "$AR71XX_MODEL" > /tmp
/sysinfo
/model
616 ar71xx_board_name
() {
619 [ -f /tmp
/sysinfo
/board_name
] && name
=$
(cat /tmp
/sysinfo
/board_name
)
620 [ -z "$name" ] && name
="unknown"