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"
56 cybertan_get_hw_magic
() {
59 part
=$
(find_mtd_part firmware
)
60 [ -z "$part" ] && return 1
62 dd bs
=8 count
=1 skip
=0 if=$part 2>/dev
/null |
hexdump -v -n 8 -e '1/1 "%02x"'
68 part
=$
(find_mtd_part firmware
)
69 [ -z "$part" ] && return 1
71 dd if=$part bs
=4 count
=1 skip
=16 2>/dev
/null |
hexdump -v -n 4 -e '1/1 "%02x"'
77 part
=$
(find_mtd_part firmware
)
78 [ -z "$part" ] && return 1
80 dd if=$part bs
=4 count
=1 skip
=17 2>/dev
/null |
hexdump -v -n 4 -e '1/1 "%02x"'
83 tplink_board_detect
() {
88 hwid
=$
(tplink_get_hwid
)
95 model
="TP-Link TL-WR703N"
98 model
="TP-Link TL-WR710N"
101 model
="TP-Link TL-WR720N"
104 model
="TP-Link TL-WA701N/ND"
107 model
="TP-Link TL-WR740N/ND"
110 model
="TP-Link TL-WR741N/ND"
113 model
="TP-Link TL-WR743N/ND"
116 model
="TP-Link TL-WA750RE"
119 model
="TP-Link TL-WA801N/ND"
122 model
="TP-Link TL-WA830RE"
125 model
="TP-Link TL-WR841N/ND"
128 model
="TP-Link TL-WR842N/ND"
131 model
="TP-Link TL-WA850RE"
134 model
="TP-Link TL-WA901N/ND"
137 if [ "$hwid" == "09410002" -a "$mid" == "00420001" ]; then
138 model
="Rosewill RNX-N360RT"
141 model
="TP-Link TL-WR941N/ND"
145 model
="TP-Link TL-WR1041N/ND"
148 model
="TP-Link TL-WR1043N/ND"
151 model
="TP-Link TL-WR2543N/ND"
154 model
="TP-Link TL-MR10U"
157 model
="TP-Link TL-MR11U"
160 model
="TP-Link TL-MR13U"
163 model
="TP-Link TL-MR3020"
166 model
="TP-Link TL-MR3040"
169 model
="TP-Link TL-MR3220"
172 model
="TP-Link TL-MR3420"
175 model
="TP-Link TL-WDR3500"
178 model
="TP-Link TL-WDR3600"
181 model
="TP-Link TL-WDR4300"
184 model
="TP-Link TL-WDR4310"
187 model
="MERCURY MW4530R"
194 AR71XX_MODEL
="$model $hwver"
197 ar71xx_board_detect
() {
201 machine
=$
(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc
/cpuinfo
)
207 *"ALFA Network AP96")
210 *"ALFA Network N2/N5")
231 *"AP132 reference board")
234 *"AP136-010 reference board")
237 *"AP136-020 reference board")
240 *"AP135-020 reference board")
261 *"DB120 reference board")
302 size
=$
(awk '/firmware/ { print $2 }' /proc
/mtd
)
304 if [ "x$size" = "x00790000" ]; then
308 if [ "x$size" = "x00f90000" ]; then
327 *"WD My Net Wi-Fi Range Extender")
336 *"NBG460N/550N/550NH")
337 name
="nbg460n_550n_550nh"
351 *"PB44 reference board")
357 *"RouterBOARD 411/A/AH")
363 *"RouterBOARD 433/AH")
366 *"RouterBOARD 433UAH")
378 *"RouterBOARD 493/AH")
387 *"RouterBOARD 750GL")
396 *"RouterBOARD 951G-2HnD")
399 *"RouterBOARD 2011L")
402 *"RouterBOARD 2011UAS")
405 *"RouterBOARD 2011UAS-2HnD")
406 name
="rb-2011uas-2hnd"
414 *"RouterStation Pro")
415 name
="routerstation-pro"
439 name
="tl-wr1043nd-v2"
492 *"TL-WDR3600/4300/4310")
561 *"WNDR3700/WNDR3800/WNDRMAC")
562 wndr3700_board_detect
"$machine"
585 *"WZR-HP-AG300H/WZR-600DHP")
595 name
="wzr-hp-g300nh2"
609 *EmbWir-Dorin-Router
)
610 name
="ew-dorin-router"
612 "8devices Carambola2"*)
618 *"BHU BXU2000n-2 rev. A1")
624 *TL-WR
* |
*TL-WA
* |
*TL-MR
* |
*TL-WD
*)
625 tplink_board_detect
"$machine"
629 [ -z "$name" ] && name
="unknown"
631 [ -z "$AR71XX_BOARD_NAME" ] && AR71XX_BOARD_NAME
="$name"
632 [ -z "$AR71XX_MODEL" ] && AR71XX_MODEL
="$machine"
634 [ -e "/tmp/sysinfo/" ] || mkdir
-p "/tmp/sysinfo/"
636 echo "$AR71XX_BOARD_NAME" > /tmp
/sysinfo
/board_name
637 echo "$AR71XX_MODEL" > /tmp
/sysinfo
/model
640 ar71xx_board_name
() {
643 [ -f /tmp
/sysinfo
/board_name
] && name
=$
(cat /tmp
/sysinfo
/board_name
)
644 [ -z "$name" ] && name
="unknown"