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"'
65 tplink_board_detect
() {
70 hwid
=$
(tplink_get_hwid
)
76 model
="TP-Link TL-WR703N"
79 model
="TP-Link TL-WA701N/ND"
82 model
="TP-Link TL-WR740N/ND"
85 model
="TP-Link TL-WR741N/ND"
88 model
="TP-Link TL-WR743N/ND"
91 model
="TP-Link TL-WR841N/ND"
94 model
="TP-Link TL-WR842N/ND"
97 model
="TP-Link TL-WA901N/ND"
100 model
="TP-Link TL-WR941N/ND"
103 model
="TP-Link TL-WR1041N/ND"
106 model
="TP-Link TL-WR1043N/ND"
109 model
="TP-Link TL-WR2543N/ND"
112 model
="TP-Link TL-MR11U"
115 model
="TP-Link TL-MR3020"
118 model
="TP-Link TL-MR3040"
121 model
="TP-Link TL-MR3220"
124 model
="TP-Link TL-MR3420"
127 model
="TP-Link TL-WDR3600"
130 model
="TP-Link TL-WDR4300"
133 model
="TP-Link TL-WDR4310"
140 AR71XX_MODEL
="$model $hwver"
143 ar71xx_board_detect
() {
147 machine
=$
(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc
/cpuinfo
)
153 *"ALFA Network AP96")
156 *"ALFA Network N2/N5")
177 *"AP136 reference board")
192 *"DB120 reference board")
234 *"NBG460N/550N/550NH")
235 name
="nbg460n_550n_550nh"
246 *"PB44 reference board")
252 *"RouterBOARD 411/A/AH")
258 *"RouterBOARD 433/AH")
261 *"RouterBOARD 433UAH")
270 *"RouterBOARD 493/AH")
279 *"RouterBOARD 750GL")
288 *"RouterBOARD 2011L")
291 *"RouterBOARD 2011UAS-2HnD")
292 name
="rb-2011uas-2hnd"
300 *"RouterStation Pro")
301 name
="routerstation-pro"
345 *"TL-WDR3600/4300/4310")
387 *"WNDR3700/WNDR3800/WNDRMAC")
388 wndr3700_board_detect
"$machine"
409 name
="wzr-hp-g300nh2"
423 *EmbWir-Dorin-Router
)
424 name
="ew-dorin-router"
429 *TL-WR
* |
*TL-WA
* |
*TL-MR
*)
430 tplink_board_detect
"$machine"
434 [ -z "$name" ] && name
="unknown"
436 [ -z "$AR71XX_BOARD_NAME" ] && AR71XX_BOARD_NAME
="$name"
437 [ -z "$AR71XX_MODEL" ] && AR71XX_MODEL
="$machine"
439 [ -e "/tmp/sysinfo/" ] || mkdir
-p "/tmp/sysinfo/"
441 echo "$AR71XX_BOARD_NAME" > /tmp
/sysinfo
/board_name
442 echo "$AR71XX_MODEL" > /tmp
/sysinfo
/model
445 ar71xx_board_name
() {
448 [ -f /tmp
/sysinfo
/board_name
] && name
=$
(cat /tmp
/sysinfo
/board_name
)
449 [ -z "$name" ] && name
="unknown"