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-WA801N/ND"
110 model
="TP-Link TL-WA830RE"
113 model
="TP-Link TL-WR841N/ND"
116 model
="TP-Link TL-WR842N/ND"
119 model
="TP-Link TL-WA901N/ND"
122 if [ "$hwid" == "09410002" -a "$mid" == "00420001" ]; then
123 model
="Rosewill RNX-N360RT"
126 model
="TP-Link TL-WR941N/ND"
130 model
="TP-Link TL-WR1041N/ND"
133 model
="TP-Link TL-WR1043N/ND"
136 model
="TP-Link TL-WR2543N/ND"
139 model
="TP-Link TL-MR10U"
142 model
="TP-Link TL-MR11U"
145 model
="TP-Link TL-MR13U"
148 model
="TP-Link TL-MR3020"
151 model
="TP-Link TL-MR3040"
154 model
="TP-Link TL-MR3220"
157 model
="TP-Link TL-MR3420"
160 model
="TP-Link TL-WDR3500"
163 model
="TP-Link TL-WDR3600"
166 model
="TP-Link TL-WDR4300"
169 model
="TP-Link TL-WDR4310"
172 model
="MERCURY MW4530R"
179 AR71XX_MODEL
="$model $hwver"
182 ar71xx_board_detect
() {
186 machine
=$
(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc
/cpuinfo
)
192 *"ALFA Network AP96")
195 *"ALFA Network N2/N5")
216 *"AP132 reference board")
219 *"AP136-010 reference board")
222 *"AP136-020 reference board")
225 *"AP135-020 reference board")
246 *"DB120 reference board")
287 size
=$
(awk '/firmware/ { print $2 }' /proc
/mtd
)
289 if [ "x$size" = "x00790000" ]; then
293 if [ "x$size" = "x00f90000" ]; then
315 *"NBG460N/550N/550NH")
316 name
="nbg460n_550n_550nh"
330 *"PB44 reference board")
336 *"RouterBOARD 411/A/AH")
342 *"RouterBOARD 433/AH")
345 *"RouterBOARD 433UAH")
357 *"RouterBOARD 493/AH")
366 *"RouterBOARD 750GL")
375 *"RouterBOARD 951G-2HnD")
378 *"RouterBOARD 2011L")
381 *"RouterBOARD 2011UAS")
384 *"RouterBOARD 2011UAS-2HnD")
385 name
="rb-2011uas-2hnd"
393 *"RouterStation Pro")
394 name
="routerstation-pro"
456 *"TL-WDR3600/4300/4310")
522 *"WNDR3700/WNDR3800/WNDRMAC")
523 wndr3700_board_detect
"$machine"
546 *"WZR-HP-AG300H/WZR-600DHP")
556 name
="wzr-hp-g300nh2"
570 *EmbWir-Dorin-Router
)
571 name
="ew-dorin-router"
573 "8devices Carambola2"*)
582 *TL-WR
* |
*TL-WA
* |
*TL-MR
* |
*TL-WD
*)
583 tplink_board_detect
"$machine"
587 [ -z "$name" ] && name
="unknown"
589 [ -z "$AR71XX_BOARD_NAME" ] && AR71XX_BOARD_NAME
="$name"
590 [ -z "$AR71XX_MODEL" ] && AR71XX_MODEL
="$machine"
592 [ -e "/tmp/sysinfo/" ] || mkdir
-p "/tmp/sysinfo/"
594 echo "$AR71XX_BOARD_NAME" > /tmp
/sysinfo
/board_name
595 echo "$AR71XX_MODEL" > /tmp
/sysinfo
/model
598 ar71xx_board_name
() {
601 [ -f /tmp
/sysinfo
/board_name
] && name
=$
(cat /tmp
/sysinfo
/board_name
)
602 [ -z "$name" ] && name
="unknown"