generic: ar8216: improve ar8xxx_is_possible check
[openwrt/openwrt.git] / target / linux / ar71xx / base-files / lib / ar71xx.sh
1 #!/bin/sh
2 #
3 # Copyright (C) 2009-2011 OpenWrt.org
4 #
5
6 AR71XX_BOARD_NAME=
7 AR71XX_MODEL=
8
9 ar71xx_get_mtd_offset_size_format() {
10 local mtd="$1"
11 local offset="$2"
12 local size="$3"
13 local format="$4"
14 local dev
15
16 dev=$(find_mtd_part $mtd)
17 [ -z "$dev" ] && return
18
19 dd if=$dev bs=1 skip=$offset count=$size 2>/dev/null | hexdump -v -e "1/1 \"$format\""
20 }
21
22 ar71xx_get_mtd_part_magic() {
23 local mtd="$1"
24 ar71xx_get_mtd_offset_size_format "$mtd" 0 4 %02x
25 }
26
27 wndr3700_board_detect() {
28 local machine="$1"
29 local magic
30 local name
31
32 name="wndr3700"
33
34 magic="$(ar71xx_get_mtd_part_magic firmware)"
35 case $magic in
36 "33373030")
37 machine="NETGEAR WNDR3700"
38 ;;
39 "33373031")
40 model="$(ar71xx_get_mtd_offset_size_format art 41 32 %c)"
41 # Use awk to remove everything unprintable
42 model_stripped="$(ar71xx_get_mtd_offset_size_format art 41 32 %c | LC_CTYPE=C awk -v 'FS=[^[:print:]]' '{print $1; exit}')"
43 case $model in
44 $'\xff'*)
45 if [ "${model:24:1}" = 'N' ]; then
46 machine="NETGEAR WNDRMAC"
47 else
48 machine="NETGEAR WNDR3700v2"
49 fi
50 ;;
51 '29763654+16+64'*)
52 machine="NETGEAR ${model_stripped:14}"
53 ;;
54 '29763654+16+128'*)
55 machine="NETGEAR ${model_stripped:15}"
56 ;;
57 *)
58 # Unknown ID
59 machine="NETGEAR ${model_stripped}"
60 esac
61 esac
62
63 AR71XX_BOARD_NAME="$name"
64 AR71XX_MODEL="$machine"
65 }
66
67 ubnt_get_mtd_part_magic() {
68 ar71xx_get_mtd_offset_size_format EEPROM 4118 2 %02x
69 }
70
71 ubnt_xm_board_detect() {
72 local model
73 local magic
74
75 magic="$(ubnt_get_mtd_part_magic)"
76 case ${magic:0:3} in
77 "e00"|\
78 "e01"|\
79 "e80") # Different revisions of the NanoStation?
80 model="Ubiquiti NanoStation M"
81 ;;
82 "e0a")
83 model="Ubiquiti NanoStation loco M"
84 ;;
85 "e1b") # Rocket M5 untested
86 model="Ubiquiti Rocket M"
87 ;;
88 "e20"|\
89 "e2d") # Bullet M Ti
90 model="Ubiquiti Bullet M"
91 ;;
92 "e30")
93 model="Ubiquiti PicoStation M"
94 ;;
95 esac
96
97 [ -z "$model" ] || AR71XX_MODEL="${model}${magic:3:1}"
98 }
99
100 cybertan_get_hw_magic() {
101 local part
102
103 part=$(find_mtd_part firmware)
104 [ -z "$part" ] && return 1
105
106 dd bs=8 count=1 skip=0 if=$part 2>/dev/null | hexdump -v -n 8 -e '1/1 "%02x"'
107 }
108
109 dir505_board_detect() {
110 local dev=$(find_mtd_part 'mac')
111 [ -z "$dev" ] && return
112
113 # The revision is stored at the beginning of the "mac" partition
114 local rev="$(LC_CTYPE=C awk -v 'FS=[^[:print:]]' '{print $1; exit}' $dev)"
115 AR71XX_MODEL="D-Link DIR-505 rev. $rev"
116 }
117
118 tplink_get_hwid() {
119 local part
120
121 part=$(find_mtd_part firmware)
122 [ -z "$part" ] && return 1
123
124 dd if=$part bs=4 count=1 skip=16 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
125 }
126
127 tplink_get_mid() {
128 local part
129
130 part=$(find_mtd_part firmware)
131 [ -z "$part" ] && return 1
132
133 dd if=$part bs=4 count=1 skip=17 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
134 }
135
136 tplink_board_detect() {
137 local model="$1"
138 local hwid
139 local hwver
140
141 hwid=$(tplink_get_hwid)
142 mid=$(tplink_get_mid)
143 hwver=${hwid:6:2}
144 hwver=" v${hwver#0}"
145
146 case "$hwid" in
147 "015000"*)
148 model="EasyLink EL-M150"
149 ;;
150 "015300"*)
151 model="EasyLink EL-MINI"
152 ;;
153 "044401"*)
154 model="ANTMINER-S1"
155 ;;
156 "044403"*)
157 model="ANTMINER-S3"
158 ;;
159 "44440101"*)
160 model="ANTROUTER-R1"
161 ;;
162 "120000"*)
163 model="MERCURY MAC1200R"
164 ;;
165 "007260"*)
166 model="TellStick ZNet Lite"
167 ;;
168 "066601"*)
169 model="OMYlink OMY-G1"
170 ;;
171 "066602"*)
172 model="OMYlink OMY-X1"
173 ;;
174 "3C0001"*)
175 model="OOLITE"
176 ;;
177 "3C0002"*)
178 model="MINIBOX_V1"
179 ;;
180 "070301"*)
181 model="TP-Link TL-WR703N"
182 ;;
183 "071000"*)
184 model="TP-Link TL-WR710N"
185
186 if [ "$hwid" = '07100002' -a "$mid" = '00000002' ]; then
187 hwver=' v2.1'
188 fi
189 ;;
190 "072001"*)
191 model="TP-Link TL-WR720N"
192 ;;
193 "070100"*)
194 model="TP-Link TL-WA701N/ND"
195 ;;
196 "073000"*)
197 model="TP-Link TL-WA730RE"
198 ;;
199 "074000"*)
200 model="TP-Link TL-WR740N/ND"
201 ;;
202 "074100"*)
203 model="TP-Link TL-WR741N/ND"
204 ;;
205 "074300"*)
206 model="TP-Link TL-WR743N/ND"
207 ;;
208 "075000"*)
209 model="TP-Link TL-WA750RE"
210 ;;
211 "721000"*)
212 model="TP-Link TL-WA7210N"
213 ;;
214 "751000"*)
215 model="TP-Link TL-WA7510N"
216 ;;
217 "080100"*)
218 model="TP-Link TL-WA801N/ND"
219 ;;
220 "083000"*)
221 model="TP-Link TL-WA830RE"
222
223 if [ "$hwver" = ' v10' ]; then
224 hwver=' v1'
225 fi
226 ;;
227 "084100"*)
228 model="TP-Link TL-WR841N/ND"
229
230 if [ "$hwid" = '08410002' -a "$mid" = '00000002' ]; then
231 hwver=' v1.5'
232 fi
233 ;;
234 "084200"*)
235 model="TP-Link TL-WR842N/ND"
236 ;;
237 "084300"*)
238 model="TP-Link TL-WR843N/ND"
239 ;;
240 "085000"*)
241 model="TP-Link TL-WA850RE"
242 ;;
243 "086000"*)
244 model="TP-Link TL-WA860RE"
245 ;;
246 "090100"*)
247 model="TP-Link TL-WA901N/ND"
248 ;;
249 "094100"*)
250 if [ "$hwid" = "09410002" -a "$mid" = "00420001" ]; then
251 model="Rosewill RNX-N360RT"
252 hwver=""
253 else
254 model="TP-Link TL-WR941N/ND"
255 fi
256 ;;
257 "104100"*)
258 model="TP-Link TL-WR1041N/ND"
259 ;;
260 "104300"*)
261 model="TP-Link TL-WR1043N/ND"
262 ;;
263 "254300"*)
264 model="TP-Link TL-WR2543N/ND"
265 ;;
266 "001001"*)
267 model="TP-Link TL-MR10U"
268 ;;
269 "001101"*)
270 model="TP-Link TL-MR11U"
271 ;;
272 "001201"*)
273 model="TP-Link TL-MR12U"
274 ;;
275 "001301"*)
276 model="TP-Link TL-MR13U"
277 ;;
278 "302000"*)
279 model="TP-Link TL-MR3020"
280 ;;
281 "304000"*)
282 model="TP-Link TL-MR3040"
283 ;;
284 "322000"*)
285 model="TP-Link TL-MR3220"
286 ;;
287 "342000"*)
288 model="TP-Link TL-MR3420"
289 ;;
290 "332000"*)
291 model="TP-Link TL-WDR3320"
292 ;;
293 "350000"*)
294 model="TP-Link TL-WDR3500"
295 ;;
296 "360000"*)
297 model="TP-Link TL-WDR3600"
298 ;;
299 "430000"*)
300 model="TP-Link TL-WDR4300"
301 ;;
302 "430080"*)
303 iw reg set IL
304 model="TP-Link TL-WDR4300 (IL)"
305 ;;
306 "431000"*)
307 model="TP-Link TL-WDR4310"
308 ;;
309 "49000002")
310 model="TP-Link TL-WDR4900"
311 ;;
312 "65000002")
313 model="TP-Link TL-WDR6500"
314 ;;
315 "453000"*)
316 model="Mercury MW4530R"
317 ;;
318 "934100"*)
319 model="NC-LINK SMART-300"
320 ;;
321 "c50000"*)
322 model="TP-Link Archer C5"
323 ;;
324 "750000"*|\
325 "c70000"*)
326 model="TP-Link Archer C7"
327 ;;
328 *)
329 hwver=""
330 ;;
331 esac
332
333 AR71XX_MODEL="$model$hwver"
334 }
335
336 tplink_pharos_get_model_string() {
337 local part
338 part=$(find_mtd_part 'product-info')
339 [ -z "$part" ] && return 1
340
341 # The returned string will end with \r\n, but we don't remove it here
342 # to simplify matching against it in the sysupgrade image check
343 dd if=$part bs=1 skip=4360 2>/dev/null | head -n 1
344 }
345
346 tplink_pharos_board_detect() {
347 local model_string="$(tplink_pharos_get_model_string | tr -d '\r')"
348 local oIFS="$IFS"; IFS=":"; set -- $model_string; IFS="$oIFS"
349 local model
350
351 case "$1" in
352 'CPE210(TP-LINK|UN|N300-2)')
353 model='TP-Link CPE210'
354 ;;
355 'CPE220(TP-LINK|UN|N300-2)')
356 model='TP-Link CPE220'
357 ;;
358 'CPE510(TP-LINK|UN|N300-5)')
359 model='TP-Link CPE510'
360 ;;
361 'CPE520(TP-LINK|UN|N300-5)')
362 model='TP-Link CPE520'
363 ;;
364 esac
365
366 [ -n "$model" ] && AR71XX_MODEL="$model v$2"
367 }
368
369 gl_inet_board_detect() {
370 local size="$(mtd_get_part_size 'firmware')"
371
372 case "$size" in
373 8192000)
374 AR71XX_MODEL='GL-iNet 6408A v1'
375 ;;
376 16580608)
377 AR71XX_MODEL='GL-iNet 6416A v1'
378 ;;
379 esac
380 }
381
382 ar71xx_board_detect() {
383 local machine
384 local name
385
386 machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo)
387
388 case "$machine" in
389 *"Oolite V1.0")
390 name="oolite"
391 ;;
392 *"AC1750DB")
393 name="f9k1115v2"
394 ;;
395 *"AirGateway")
396 name="airgateway"
397 ;;
398 *"AirGateway Pro")
399 name="airgatewaypro"
400 ;;
401 *"AirRouter")
402 name="airrouter"
403 ;;
404 *"ALFA Network AP120C")
405 name="alfa-ap120c"
406 ;;
407 *"ALFA Network AP96")
408 name="alfa-ap96"
409 ;;
410 *"ALFA Network N2/N5")
411 name="alfa-nx"
412 ;;
413 *ALL0258N)
414 name="all0258n"
415 ;;
416 *ALL0305)
417 name="all0305"
418 ;;
419 *ALL0315N)
420 name="all0315n"
421 ;;
422 *Antminer-S1)
423 name="antminer-s1"
424 ;;
425 *Antminer-S3)
426 name="antminer-s3"
427 ;;
428 *"Arduino Yun")
429 name="arduino-yun"
430 ;;
431 *AP113)
432 name="ap113"
433 ;;
434 *"AP121 reference board")
435 name="ap121"
436 ;;
437 *AP121-MINI)
438 name="ap121-mini"
439 ;;
440 *"AP132 reference board")
441 name="ap132"
442 ;;
443 *"AP136-010 reference board")
444 name="ap136-010"
445 ;;
446 *"AP136-020 reference board")
447 name="ap136-020"
448 ;;
449 *"AP135-020 reference board")
450 name="ap135-020"
451 ;;
452 *"AP143 reference board")
453 name="ap143"
454 ;;
455 *"AP147-010 reference board")
456 name="ap147-010"
457 ;;
458 *"AP152 reference board")
459 name="ap152"
460 ;;
461 *AP81)
462 name="ap81"
463 ;;
464 *AP83)
465 name="ap83"
466 ;;
467 *"Archer C5")
468 name="archer-c5"
469 ;;
470 *"Archer C7")
471 name="archer-c7"
472 ;;
473 *"Atheros AP96")
474 name="ap96"
475 ;;
476 *AW-NR580)
477 name="aw-nr580"
478 ;;
479 *CAP324)
480 name="cap324"
481 ;;
482 *C-55)
483 name="c-55"
484 ;;
485 *CAP4200AG)
486 name="cap4200ag"
487 ;;
488 *"COMFAST CF-E316N v2")
489 name="cf-e316n-v2"
490 ;;
491 *"CPE210/220")
492 name="cpe210"
493 tplink_pharos_board_detect
494 ;;
495 *"CPE510/520")
496 name="cpe510"
497 tplink_pharos_board_detect
498 ;;
499 *CR3000)
500 name="cr3000"
501 ;;
502 *CR5000)
503 name="cr5000"
504 ;;
505 *"DB120 reference board")
506 name="db120"
507 ;;
508 *"DGL-5500 rev. A1")
509 name="dgl-5500-a1"
510 ;;
511 *"DHP-1565 rev. A1")
512 name="dhp-1565-a1"
513 ;;
514 *"DIR-505 rev. A1")
515 name="dir-505-a1"
516 dir505_board_detect
517 ;;
518 *"DIR-600 rev. A1")
519 name="dir-600-a1"
520 ;;
521 *"DIR-615 rev. E1")
522 name="dir-615-e1"
523 ;;
524 *"DIR-615 rev. E4")
525 name="dir-615-e4"
526 ;;
527 *"DIR-615 rev. I1")
528 name="dir-615-i1"
529 ;;
530 *"DIR-825 rev. B1")
531 name="dir-825-b1"
532 ;;
533 *"DIR-825 rev. C1")
534 name="dir-825-c1"
535 ;;
536 *"DIR-835 rev. A1")
537 name="dir-835-a1"
538 ;;
539 *"DIR-869 rev. A1")
540 name="dir-869-a1"
541 ;;
542 *"dLAN Hotspot")
543 name="dlan-hotspot"
544 ;;
545 *"dLAN pro 500 Wireless+")
546 name="dlan-pro-500-wp"
547 ;;
548 *"dLAN pro 1200+ WiFi ac")
549 name="dlan-pro-1200-ac"
550 ;;
551 *DR344)
552 name="dr344"
553 ;;
554 *DR531)
555 name="dr531"
556 ;;
557 *"Dragino v2")
558 name="dragino2"
559 ;;
560 *"Domino Pi")
561 name="gl-domino"
562 ;;
563 *"EAP300 v2")
564 name="eap300v2"
565 ;;
566 *EAP7660D)
567 name="eap7660d"
568 ;;
569 *EL-M150)
570 name="el-m150"
571 ;;
572 *EL-MINI)
573 name="el-mini"
574 ;;
575 *"GL-CONNECT INET v1")
576 name="gl-inet"
577 gl_inet_board_detect
578 ;;
579 *"GL AR150")
580 name="gl-ar150"
581 ;;
582 *"GL AR300")
583 name="gl-ar300"
584 ;;
585 *"GL-AR300M")
586 name="gl-ar300m"
587 ;;
588 *"GL-MIFI")
589 name="gl-mifi"
590 ;;
591 *"EnGenius EPG5000")
592 name="epg5000"
593 ;;
594 *"EnGenius ESR1750")
595 name="esr1750"
596 ;;
597 *"EnGenius ESR900")
598 name="esr900"
599 ;;
600 *JA76PF)
601 name="ja76pf"
602 ;;
603 *JA76PF2)
604 name="ja76pf2"
605 ;;
606 *"Bullet M")
607 name="bullet-m"
608 ubnt_xm_board_detect
609 ;;
610 *"Loco M XW")
611 name="loco-m-xw"
612 ;;
613 *"Nanostation M")
614 name="nanostation-m"
615 ubnt_xm_board_detect
616 ;;
617 *"Nanostation M XW")
618 name="nanostation-m-xw"
619 ;;
620 *JWAP003)
621 name="jwap003"
622 ;;
623 *JWAP230)
624 name="jwap230"
625 ;;
626 *"Hornet-UB")
627 local size
628 size=$(awk '/firmware/ { print $2 }' /proc/mtd)
629
630 if [ "x$size" = "x00790000" ]; then
631 name="hornet-ub"
632 fi
633
634 if [ "x$size" = "x00f90000" ]; then
635 name="hornet-ub-x2"
636 fi
637 ;;
638 *LS-SR71)
639 name="ls-sr71"
640 ;;
641 *"MAC1200R")
642 name="mc-mac1200r"
643 ;;
644 *"MiniBox V1.0")
645 name="minibox-v1"
646 ;;
647 *MR12)
648 name="mr12"
649 ;;
650 *MR16)
651 name="mr16"
652 ;;
653 *MR18)
654 name="mr18"
655 ;;
656 *MR600v2)
657 name="mr600v2"
658 ;;
659 *MR1750)
660 name="mr1750"
661 ;;
662 *MR1750v2)
663 name="mr1750v2"
664 ;;
665 *MR600)
666 name="mr600"
667 ;;
668 *MR900)
669 name="mr900"
670 ;;
671 *MR900v2)
672 name="mr900v2"
673 ;;
674 *"My Net N600")
675 name="mynet-n600"
676 ;;
677 *"My Net N750")
678 name="mynet-n750"
679 ;;
680 *"WD My Net Wi-Fi Range Extender")
681 name="mynet-rext"
682 ;;
683 *MZK-W04NU)
684 name="mzk-w04nu"
685 ;;
686 *MZK-W300NH)
687 name="mzk-w300nh"
688 ;;
689 *"NBG460N/550N/550NH")
690 name="nbg460n_550n_550nh"
691 ;;
692 *"Zyxel NBG6616")
693 name="nbg6616"
694 ;;
695 *"Zyxel NBG6716")
696 name="nbg6716"
697 ;;
698 *OM2P)
699 name="om2p"
700 ;;
701 *OM2Pv2)
702 name="om2pv2"
703 ;;
704 *"OM2P HS")
705 name="om2p-hs"
706 ;;
707 *"OM2P HSv2")
708 name="om2p-hsv2"
709 ;;
710 *"OM2P HSv3")
711 name="om2p-hsv3"
712 ;;
713 *"OM2P LC")
714 name="om2p-lc"
715 ;;
716 *OM5P)
717 name="om5p"
718 ;;
719 *"OM5P AN")
720 name="om5p-an"
721 ;;
722 *"OM5P AC")
723 name="om5p-ac"
724 ;;
725 *"OM5P ACv2")
726 name="om5p-acv2"
727 ;;
728 *"OMY-X1")
729 name="omy-x1"
730 ;;
731 *"OMY-G1")
732 name="omy-g1"
733 ;;
734 *"Onion Omega")
735 name="onion-omega"
736 ;;
737 *PB42)
738 name="pb42"
739 ;;
740 *"PB44 reference board")
741 name="pb44"
742 ;;
743 *PB92)
744 name="pb92"
745 ;;
746 *"Qihoo 360 C301")
747 name="qihoo-c301"
748 ;;
749 *"RouterBOARD 411/A/AH")
750 name="rb-411"
751 ;;
752 *"RouterBOARD 411U")
753 name="rb-411u"
754 ;;
755 *"RouterBOARD 433/AH")
756 name="rb-433"
757 ;;
758 *"RouterBOARD 433UAH")
759 name="rb-433u"
760 ;;
761 *"RouterBOARD 435G")
762 name="rb-435g"
763 ;;
764 *"RouterBOARD 450")
765 name="rb-450"
766 ;;
767 *"RouterBOARD 450G")
768 name="rb-450g"
769 ;;
770 *"RouterBOARD 493/AH")
771 name="rb-493"
772 ;;
773 *"RouterBOARD 493G")
774 name="rb-493g"
775 ;;
776 *"RouterBOARD 750")
777 name="rb-750"
778 ;;
779 *"RouterBOARD 750GL")
780 name="rb-750gl"
781 ;;
782 *"RouterBOARD 751")
783 name="rb-751"
784 ;;
785 *"RouterBOARD 751G")
786 name="rb-751g"
787 ;;
788 *"RouterBOARD 911G-2HPnD")
789 name="rb-911g-2hpnd"
790 ;;
791 *"RouterBOARD 911G-5HPnD")
792 name="rb-911g-5hpnd"
793 ;;
794 *"RouterBOARD 911G-5HPacD")
795 name="rb-911g-5hpacd"
796 ;;
797 *"RouterBOARD 912UAG-2HPnD")
798 name="rb-912uag-2hpnd"
799 ;;
800 *"RouterBOARD 912UAG-5HPnD")
801 name="rb-912uag-5hpnd"
802 ;;
803 *"RouterBOARD 951G-2HnD")
804 name="rb-951g-2hnd"
805 ;;
806 *"RouterBOARD 951Ui-2HnD")
807 name="rb-951ui-2hnd"
808 ;;
809 *"RouterBOARD 2011L")
810 name="rb-2011l"
811 ;;
812 *"RouterBOARD 2011UAS")
813 name="rb-2011uas"
814 ;;
815 *"RouterBOARD 2011UiAS")
816 name="rb-2011uias"
817 ;;
818 *"RouterBOARD 2011UAS-2HnD")
819 name="rb-2011uas-2hnd"
820 ;;
821 *"RouterBOARD 2011UiAS-2HnD")
822 name="rb-2011uias-2hnd"
823 ;;
824 *"RouterBOARD SXT Lite2")
825 name="rb-sxt2n"
826 ;;
827 *"RouterBOARD SXT Lite5")
828 name="rb-sxt5n"
829 ;;
830 *"Rocket M")
831 name="rocket-m"
832 ubnt_xm_board_detect
833 ;;
834 *"Rocket M TI")
835 name="rocket-m-ti"
836 ;;
837 *"Rocket M XW")
838 name="rocket-m-xw"
839 ;;
840 *RouterStation)
841 name="routerstation"
842 ;;
843 *"RouterStation Pro")
844 name="routerstation-pro"
845 ;;
846 *RW2458N)
847 name="rw2458n"
848 ;;
849 *"SMART-300")
850 name="smart-300"
851 ;;
852 "Smart Electronics Black Swift board"*)
853 name="bsb"
854 ;;
855 *"Telldus TellStick ZNet Lite")
856 name="tellstick-znet-lite"
857 ;;
858 *SOM9331)
859 name="som9331"
860 ;;
861 *TEW-632BRP)
862 name="tew-632brp"
863 ;;
864 *TEW-673GRU)
865 name="tew-673gru"
866 ;;
867 *TEW-712BR)
868 name="tew-712br"
869 ;;
870 *TEW-732BR)
871 name="tew-732br"
872 ;;
873 *TEW-823DRU)
874 name="tew-823dru"
875 ;;
876 *"TL-WR1041N v2")
877 name="tl-wr1041n-v2"
878 ;;
879 *TL-WR1043ND)
880 name="tl-wr1043nd"
881 ;;
882 *"TL-WR1043ND v2")
883 name="tl-wr1043nd-v2"
884 ;;
885 *TL-WR2543N*)
886 name="tl-wr2543n"
887 ;;
888 *"DIR-615 rev. C1")
889 name="dir-615-c1"
890 ;;
891 *TL-MR3020)
892 name="tl-mr3020"
893 ;;
894 *TL-MR3040)
895 name="tl-mr3040"
896 ;;
897 *"TL-MR3040 v2")
898 name="tl-mr3040-v2"
899 ;;
900 *TL-MR3220)
901 name="tl-mr3220"
902 ;;
903 *"TL-MR3220 v2")
904 name="tl-mr3220-v2"
905 ;;
906 *TL-MR3420)
907 name="tl-mr3420"
908 ;;
909 *"TL-MR3420 v2")
910 name="tl-mr3420-v2"
911 ;;
912 *"TL-WA701ND v2")
913 name="tl-wa701nd-v2"
914 ;;
915 *"TL-WA7210N v2")
916 name="tl-wa7210n-v2"
917 ;;
918 *TL-WA750RE)
919 name="tl-wa750re"
920 ;;
921 *"TL-WA7510N v1")
922 name="tl-wa7510n"
923 ;;
924 *TL-WA850RE)
925 name="tl-wa850re"
926 ;;
927 *TL-WA860RE)
928 name="tl-wa860re"
929 ;;
930 *"TL-WA830RE v2")
931 name="tl-wa830re-v2"
932 ;;
933 *"TL-WA801ND v2")
934 name="tl-wa801nd-v2"
935 ;;
936 *"TL-WA801ND v3")
937 name="tl-wa801nd-v3"
938 ;;
939 *TL-WA901ND)
940 name="tl-wa901nd"
941 ;;
942 *"TL-WA901ND v2")
943 name="tl-wa901nd-v2"
944 ;;
945 *"TL-WA901ND v3")
946 name="tl-wa901nd-v3"
947 ;;
948 *"TL-WA901ND v4")
949 name="tl-wa901nd-v4"
950 ;;
951 *"TL-WDR3320 v2")
952 name="tl-wdr3320-v2"
953 ;;
954 *"TL-WDR3500")
955 name="tl-wdr3500"
956 ;;
957 *"TL-WDR3600/4300/4310")
958 name="tl-wdr4300"
959 ;;
960 *"TL-WDR4900 v2")
961 name="tl-wdr4900-v2"
962 ;;
963 *"TL-WDR6500 v2")
964 name="tl-wdr6500-v2"
965 ;;
966 *TL-WR741ND)
967 name="tl-wr741nd"
968 ;;
969 *"TL-WR741ND v4")
970 name="tl-wr741nd-v4"
971 ;;
972 *"TL-WR841N v1")
973 name="tl-wr841n-v1"
974 ;;
975 *"TL-WR841N/ND v7")
976 name="tl-wr841n-v7"
977 ;;
978 *"TL-WR841N/ND v8")
979 name="tl-wr841n-v8"
980 ;;
981 *"TL-WR841N/ND v9")
982 name="tl-wr841n-v9"
983 ;;
984 *"TL-WR841N/ND v11")
985 name="tl-wr841n-v11"
986 ;;
987 *"TL-WR842N/ND v2")
988 name="tl-wr842n-v2"
989 ;;
990 *"TL-WR842N/ND v3")
991 name="tl-wr842n-v3"
992 ;;
993 *TL-WR941ND)
994 name="tl-wr941nd"
995 ;;
996 *"TL-WR941N/ND v5")
997 name="tl-wr941nd-v5"
998 ;;
999 *"TL-WR941N/ND v6")
1000 name="tl-wr941nd-v6"
1001 ;;
1002 *"TL-WR703N v1")
1003 name="tl-wr703n"
1004 ;;
1005 *"TL-WR710N v1")
1006 name="tl-wr710n"
1007 ;;
1008 *"TL-WR720N"*)
1009 name="tl-wr720n-v3"
1010 ;;
1011 *"TL-WR810N")
1012 name="tl-wr810n"
1013 ;;
1014 *"TL-MR10U")
1015 name="tl-mr10u"
1016 ;;
1017 *"TL-MR11U")
1018 name="tl-mr11u"
1019 ;;
1020 *"TL-MR12U")
1021 name="tl-mr12u"
1022 ;;
1023 *"TL-MR13U v1")
1024 name="tl-mr13u"
1025 ;;
1026 *"Tube2H")
1027 name="tube2h"
1028 ;;
1029 *UniFi)
1030 name="unifi"
1031 ;;
1032 *"UniFi-AC-LITE")
1033 name="unifiac-lite"
1034 ;;
1035 *"UniFi-AC-PRO")
1036 name="unifiac-pro"
1037 ;;
1038 *"UniFi AP Pro")
1039 name="uap-pro"
1040 ;;
1041 "WeIO"*)
1042 name="weio"
1043 ;;
1044 *WHR-G301N)
1045 name="whr-g301n"
1046 ;;
1047 *WHR-HP-GN)
1048 name="whr-hp-gn"
1049 ;;
1050 *WLAE-AG300N)
1051 name="wlae-ag300n"
1052 ;;
1053 *"UniFiAP Outdoor")
1054 name="unifi-outdoor"
1055 ;;
1056 *"UniFiAP Outdoor+")
1057 name="unifi-outdoor-plus"
1058 ;;
1059 *WP543)
1060 name="wp543"
1061 ;;
1062 *WPE72)
1063 name="wpe72"
1064 ;;
1065 *WPJ342)
1066 name="wpj342"
1067 ;;
1068 *WPJ344)
1069 name="wpj344"
1070 ;;
1071 *WPJ531)
1072 name="wpj531"
1073 ;;
1074 *WPJ558)
1075 name="wpj558"
1076 ;;
1077 *WNDAP360)
1078 name="wndap360"
1079 ;;
1080 *"WNDR3700/WNDR3800/WNDRMAC")
1081 wndr3700_board_detect "$machine"
1082 ;;
1083 *"R6100")
1084 name="r6100"
1085 ;;
1086 *"WNDR3700v4")
1087 name="wndr3700v4"
1088 ;;
1089 *"WNDR4300")
1090 name="wndr4300"
1091 ;;
1092 *"WNR2000 V4")
1093 name="wnr2000-v4"
1094 ;;
1095 *"WNR2000 V3")
1096 name="wnr2000-v3"
1097 ;;
1098 *WNR2000)
1099 name="wnr2000"
1100 ;;
1101 *WNR2200)
1102 name="wnr2200"
1103 ;;
1104 *"WNR612 V2")
1105 name="wnr612-v2"
1106 ;;
1107 *"WNR1000 V2")
1108 name="wnr1000-v2"
1109 ;;
1110 *WPN824N)
1111 name="wpn824n"
1112 ;;
1113 *WRT160NL)
1114 name="wrt160nl"
1115 ;;
1116 *WRT400N)
1117 name="wrt400n"
1118 ;;
1119 *"WRTnode2Q board")
1120 name="wrtnode2q"
1121 ;;
1122 *"WZR-450HP2")
1123 name="wzr-450hp2"
1124 ;;
1125 *"WZR-HP-AG300H/WZR-600DHP")
1126 name="wzr-hp-ag300h"
1127 ;;
1128 *WZR-HP-G300NH)
1129 name="wzr-hp-g300nh"
1130 ;;
1131 *WZR-HP-G450H)
1132 name="wzr-hp-g450h"
1133 ;;
1134 *WZR-HP-G300NH2)
1135 name="wzr-hp-g300nh2"
1136 ;;
1137 *WHR-HP-G300N)
1138 name="whr-hp-g300n"
1139 ;;
1140 *Z1)
1141 name="z1"
1142 ;;
1143 *ZBT-WE1526)
1144 name="zbt-we1526"
1145 ;;
1146 *ZCN-1523H-2)
1147 name="zcn-1523h-2"
1148 ;;
1149 *ZCN-1523H-5)
1150 name="zcn-1523h-5"
1151 ;;
1152 *EmbWir-Dorin)
1153 name="ew-dorin"
1154 ;;
1155 *EmbWir-Dorin-Router)
1156 name="ew-dorin-router"
1157 ;;
1158 "8devices Carambola2"*)
1159 name="carambola2"
1160 ;;
1161 *"Sitecom WLR-8100")
1162 name="wlr8100"
1163 ;;
1164 *"BHU BXU2000n-2 rev. A1")
1165 name="bxu2000n-2-a1"
1166 ;;
1167 *"HiWiFi HC6361")
1168 name="hiwifi-hc6361"
1169 ;;
1170 esac
1171
1172 [ -z "$AR71XX_MODEL" ] && [ "${machine:0:8}" = 'TP-LINK ' ] && \
1173 tplink_board_detect "$machine"
1174
1175 [ -z "$name" ] && name="unknown"
1176
1177 [ -z "$AR71XX_BOARD_NAME" ] && AR71XX_BOARD_NAME="$name"
1178 [ -z "$AR71XX_MODEL" ] && AR71XX_MODEL="$machine"
1179
1180 [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
1181
1182 echo "$AR71XX_BOARD_NAME" > /tmp/sysinfo/board_name
1183 echo "$AR71XX_MODEL" > /tmp/sysinfo/model
1184 }
1185
1186 ar71xx_board_name() {
1187 local name
1188
1189 [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
1190 [ -z "$name" ] && name="unknown"
1191
1192 echo "$name"
1193 }