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="EasyLink EL-M150"
98 model="EasyLink EL-MINI"
104 model="TP-Link TL-WR703N"
107 model="TP-Link TL-WR710N"
110 model="TP-Link TL-WR720N"
113 model="TP-Link TL-WA701N/ND"
116 model="TP-Link TL-WA730RE"
119 model="TP-Link TL-WR740N/ND"
122 model="TP-Link TL-WR741N/ND"
125 model="TP-Link TL-WR743N/ND"
128 model="TP-Link TL-WA750RE"
131 model="TP-Link TL-WA7510N"
134 model="TP-Link TL-WA801N/ND"
137 model="TP-Link TL-WA830RE"
140 model="TP-Link TL-WR841N/ND"
143 model="TP-Link TL-WR842N/ND"
146 model="TP-Link TL-WA850RE"
149 model="TP-Link TL-WA860RE"
152 model="TP-Link TL-WA901N/ND"
155 if [ "$hwid" == "09410002" -a "$mid" == "00420001" ]; then
156 model="Rosewill RNX-N360RT"
159 model="TP-Link TL-WR941N/ND"
163 model="TP-Link TL-WR1041N/ND"
166 model="TP-Link TL-WR1043N/ND"
169 model="TP-Link TL-WR2543N/ND"
172 model="TP-Link TL-MR10U"
175 model="TP-Link TL-MR11U"
178 model="TP-Link TL-MR13U"
181 model="TP-Link TL-MR3020"
184 model="TP-Link TL-MR3040"
187 model="TP-Link TL-MR3220"
190 model="TP-Link TL-MR3420"
193 model="TP-Link TL-WDR3500"
196 model="TP-Link TL-WDR3600"
199 model="TP-Link TL-WDR4300"
203 model="TP-Link TL-WDR4300 (IL)"
206 model="TP-Link TL-WDR4310"
209 model="TP-Link TL-WDR4900"
212 model="MERCURY MW4530R"
215 model="NC-LINK SMART-300"
222 AR71XX_MODEL="$model $hwver"
225 ar71xx_board_detect() {
229 machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo)
241 *"ALFA Network AP96")
244 *"ALFA Network N2/N5")
265 *"AP132 reference board")
268 *"AP136-010 reference board")
271 *"AP136-020 reference board")
274 *"AP135-020 reference board")
298 *"DB120 reference board")
337 *"GL-CONNECT INET v1")
359 name="nanostation-m-xw"
366 size=$(awk '/firmware/ { print $2 }' /proc/mtd)
368 if [ "x$size" = "x00790000" ]; then
372 if [ "x$size" = "x00f90000" ]; then
391 *"WD My Net Wi-Fi Range Extender")
400 *"NBG460N/550N/550NH")
401 name="nbg460n_550n_550nh"
427 *"PB44 reference board")
433 *"RouterBOARD 411/A/AH")
439 *"RouterBOARD 433/AH")
442 *"RouterBOARD 433UAH")
454 *"RouterBOARD 493/AH")
463 *"RouterBOARD 750GL")
472 *"RouterBOARD 911G-2HPnD")
475 *"RouterBOARD 911G-5HPnD")
478 *"RouterBOARD 912UAG-2HPnD")
479 name="rb-912uag-2hpnd"
481 *"RouterBOARD 912UAG-5HPnD")
482 name="rb-912uag-5hpnd"
484 *"RouterBOARD 951G-2HnD")
487 *"RouterBOARD 951Ui-2HnD")
490 *"RouterBOARD 2011L")
493 *"RouterBOARD 2011UAS")
496 *"RouterBOARD 2011UiAS")
499 *"RouterBOARD 2011UAS-2HnD")
500 name="rb-2011uas-2hnd"
502 *"RouterBOARD 2011UiAS-2HnD")
503 name="rb-2011uias-2hnd"
505 *"RouterBOARD SXT Lite2")
508 *"RouterBOARD SXT Lite5")
517 *"RouterStation Pro")
518 name="routerstation-pro"
545 name="tl-wr1043nd-v2"
601 *"TL-WDR3600/4300/4310")
679 *"WNDR3700/WNDR3800/WNDRMAC")
680 wndr3700_board_detect "$machine"
706 *"WZR-HP-AG300H/WZR-600DHP")
716 name="wzr-hp-g300nh2"
730 *EmbWir-Dorin-Router)
731 name="ew-dorin-router"
733 "8devices Carambola2"*)
739 *"BHU BXU2000n-2 rev. A1")
748 *TL-WR* | *TL-WA* | *TL-MR* | *TL-WD*)
749 tplink_board_detect "$machine"
753 [ -z "$name" ] && name="unknown"
755 [ -z "$AR71XX_BOARD_NAME" ] && AR71XX_BOARD_NAME="$name"
756 [ -z "$AR71XX_MODEL" ] && AR71XX_MODEL="$machine"
758 [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
760 echo "$AR71XX_BOARD_NAME" > /tmp/sysinfo/board_name
761 echo "$AR71XX_MODEL" > /tmp/sysinfo/model
764 ar71xx_board_name() {
767 [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
768 [ -z "$name" ] && name="unknown"