ar71xx: add support for YunCore T830
[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")
80 model="Ubiquiti NanoStation M"
81 ;;
82 "e0a")
83 model="Ubiquiti NanoStation loco M"
84 ;;
85 "e1b"|\
86 "e1d")
87 model="Ubiquiti Rocket M"
88 ;;
89 "e20"|\
90 "e2d")
91 model="Ubiquiti Bullet M"
92 ;;
93 "e30")
94 model="Ubiquiti PicoStation M"
95 ;;
96 esac
97
98 [ -z "$model" ] || AR71XX_MODEL="${model}${magic:3:1}"
99 }
100
101 cybertan_get_hw_magic() {
102 local part
103
104 part=$(find_mtd_part firmware)
105 [ -z "$part" ] && return 1
106
107 dd bs=8 count=1 skip=0 if=$part 2>/dev/null | hexdump -v -n 8 -e '1/1 "%02x"'
108 }
109
110 dir505_board_detect() {
111 local dev=$(find_mtd_part 'mac')
112 [ -z "$dev" ] && return
113
114 # The revision is stored at the beginning of the "mac" partition
115 local rev="$(LC_CTYPE=C awk -v 'FS=[^[:print:]]' '{print $1; exit}' $dev)"
116 AR71XX_MODEL="D-Link DIR-505 rev. $rev"
117 }
118
119 tplink_get_hwid() {
120 local part
121
122 part=$(find_mtd_part firmware)
123 [ -z "$part" ] && return 1
124
125 dd if=$part bs=4 count=1 skip=16 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
126 }
127
128 tplink_get_mid() {
129 local part
130
131 part=$(find_mtd_part firmware)
132 [ -z "$part" ] && return 1
133
134 dd if=$part bs=4 count=1 skip=17 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
135 }
136
137 tplink_board_detect() {
138 local model="$1"
139 local hwid
140 local hwver
141
142 hwid=$(tplink_get_hwid)
143 mid=$(tplink_get_mid)
144 hwver=${hwid:6:2}
145 hwver=" v${hwver#0}"
146
147 case "$hwid" in
148 "001001"*)
149 model="TP-Link TL-MR10U"
150 ;;
151 "001101"*)
152 model="TP-Link TL-MR11U"
153 ;;
154 "001201"*)
155 model="TP-Link TL-MR12U"
156 ;;
157 "001301"*)
158 model="TP-Link TL-MR13U"
159 ;;
160 "007260"*)
161 model="TellStick ZNet Lite"
162 ;;
163 "015000"*)
164 model="EasyLink EL-M150"
165 ;;
166 "015300"*)
167 model="EasyLink EL-MINI"
168 ;;
169 "044401"*)
170 model="ANTMINER-S1"
171 ;;
172 "044403"*)
173 model="ANTMINER-S3"
174 ;;
175 "066601"*)
176 model="OMYlink OMY-G1"
177 ;;
178 "066602"*)
179 model="OMYlink OMY-X1"
180 ;;
181 "070100"*)
182 model="TP-Link TL-WA701N/ND"
183 ;;
184 "070301"*)
185 model="TP-Link TL-WR703N"
186 ;;
187 "071000"*)
188 model="TP-Link TL-WR710N"
189
190 [ "$hwid" = '07100002' -a "$mid" = '00000002' ] && hwver=' v2.1'
191 ;;
192 "072001"*)
193 model="TP-Link TL-WR720N"
194 ;;
195 "073000"*)
196 model="TP-Link TL-WA730RE"
197 ;;
198 "074000"*)
199 model="TP-Link TL-WR740N/ND"
200 ;;
201 "074100"*)
202 model="TP-Link TL-WR741N/ND"
203 ;;
204 "074300"*)
205 model="TP-Link TL-WR743N/ND"
206 ;;
207 "075000"*)
208 model="TP-Link TL-WA750RE"
209 ;;
210 "080100"*)
211 model="TP-Link TL-WA801N/ND"
212 ;;
213 "080200"*)
214 model="TP-Link TL-WR802N"
215
216 [ "$hwid" = '08020002' -a "$mid" = '00000002' ] && hwver=' v2'
217 ;;
218 "081000"*)
219 model="TP-Link TL-WR810N"
220 ;;
221 "083000"*)
222 model="TP-Link TL-WA830RE"
223
224 [ "$hwver" = ' v10' ] && hwver=' v1'
225 ;;
226 "084100"*)
227 model="TP-Link TL-WR841N/ND"
228
229 [ "$hwid" = '08410002' -a "$mid" = '00000002' ] && hwver=' v1.5'
230 ;;
231 "084200"*)
232 model="TP-Link TL-WR842N/ND"
233 ;;
234 "084300"*)
235 model="TP-Link TL-WR843N/ND"
236 ;;
237 "085000"*)
238 model="TP-Link TL-WA850RE"
239 ;;
240 "085500"*)
241 model="TP-Link TL-WA855RE"
242 ;;
243 "086000"*)
244 model="TP-Link TL-WA860RE"
245 ;;
246 "090100"*)
247 model="TP-Link TL-WA901N/ND"
248 ;;
249 "094000"*)
250 model="TP-Link TL-WR940N"
251 ;;
252 "094100"*)
253 model="TP-Link TL-WR941N/ND"
254
255 [ "$hwid" = "09410002" -a "$mid" = "00420001" ] && {
256 model="Rosewill RNX-N360RT"
257 hwver=""
258 }
259 ;;
260 "104100"*)
261 model="TP-Link TL-WR1041N/ND"
262 ;;
263 "104300"*)
264 model="TP-Link TL-WR1043N/ND"
265 ;;
266 "120000"*)
267 model="MERCURY MAC1200R"
268 ;;
269 "254300"*)
270 model="TP-Link TL-WR2543N/ND"
271 ;;
272 "302000"*)
273 model="TP-Link TL-MR3020"
274 ;;
275 "304000"*)
276 model="TP-Link TL-MR3040"
277 ;;
278 "322000"*)
279 model="TP-Link TL-MR3220"
280 ;;
281 "332000"*)
282 model="TP-Link TL-WDR3320"
283 ;;
284 "342000"*)
285 model="TP-Link TL-MR3420"
286 ;;
287 "350000"*)
288 model="TP-Link TL-WDR3500"
289 ;;
290 "360000"*)
291 model="TP-Link TL-WDR3600"
292 ;;
293 "3C0001"*)
294 model="OOLITE"
295 ;;
296 "3C0002"*)
297 model="MINIBOX_V1"
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 "44440101"*)
310 model="ANTROUTER-R1"
311 ;;
312 "453000"*)
313 model="Mercury MW4530R"
314 ;;
315 "49000002")
316 model="TP-Link TL-WDR4900"
317 ;;
318 "640000"*)
319 model="TP-Link TL-MR6400"
320 ;;
321 "65000002")
322 model="TP-Link TL-WDR6500"
323 ;;
324 "721000"*)
325 model="TP-Link TL-WA7210N"
326 ;;
327 "750000"*|\
328 "c70000"*)
329 model="TP-Link Archer C7"
330 ;;
331 "751000"*)
332 model="TP-Link TL-WA7510N"
333 ;;
334 "934100"*)
335 model="NC-LINK SMART-300"
336 ;;
337 "c50000"*)
338 model="TP-Link Archer C5"
339 ;;
340 *)
341 hwver=""
342 ;;
343 esac
344
345 AR71XX_MODEL="$model$hwver"
346 }
347
348 tplink_pharos_get_model_string() {
349 local part
350 part=$(find_mtd_part 'product-info')
351 [ -z "$part" ] && return 1
352
353 # The returned string will end with \r\n, but we don't remove it here
354 # to simplify matching against it in the sysupgrade image check
355 dd if=$part bs=1 skip=4360 2>/dev/null | head -n 1
356 }
357
358 tplink_pharos_board_detect() {
359 local model_string="$(tplink_pharos_get_model_string | tr -d '\r')"
360 local oIFS="$IFS"; IFS=":"; set -- $model_string; IFS="$oIFS"
361
362 local model="${1%%\(*}"
363
364 AR71XX_MODEL="TP-Link $model v$2"
365 }
366
367 ar71xx_board_detect() {
368 local machine
369 local name
370
371 machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo)
372
373 case "$machine" in
374 *"A40")
375 name="a40"
376 ;;
377 *"A60")
378 name="a60"
379 ;;
380 *"AC1750DB")
381 name="f9k1115v2"
382 ;;
383 *"AirGateway")
384 name="airgateway"
385 ;;
386 *"AirGateway Pro")
387 name="airgatewaypro"
388 ;;
389 *"AirRouter")
390 name="airrouter"
391 ;;
392 *"ALFA Network AP120C")
393 name="alfa-ap120c"
394 ;;
395 *"ALFA Network AP96")
396 name="alfa-ap96"
397 ;;
398 *"ALFA Network N2/N5")
399 name="alfa-nx"
400 ;;
401 *"ALL0258N")
402 name="all0258n"
403 ;;
404 *"ALL0305")
405 name="all0305"
406 ;;
407 *"ALL0315N")
408 name="all0315n"
409 ;;
410 *"Antminer-S1")
411 name="antminer-s1"
412 ;;
413 *"Antminer-S3")
414 name="antminer-s3"
415 ;;
416 *"AP121 reference board")
417 name="ap121"
418 ;;
419 *"AP121-MINI")
420 name="ap121-mini"
421 ;;
422 *"AP121F")
423 name="ap121f"
424 ;;
425 *"AP132 reference board")
426 name="ap132"
427 ;;
428 *"AP135-020 reference board")
429 name="ap135-020"
430 ;;
431 *"AP136-010 reference board")
432 name="ap136-010"
433 ;;
434 *"AP136-020 reference board")
435 name="ap136-020"
436 ;;
437 *"AP143 reference board")
438 name="ap143"
439 ;;
440 *"AP147-010 reference board")
441 name="ap147-010"
442 ;;
443 *"AP152 reference board")
444 name="ap152"
445 ;;
446 *"AP531B0")
447 name="ap531b0"
448 ;;
449 *"AP90Q")
450 name="ap90q"
451 ;;
452 *"AP91-5G")
453 name="ap91-5g"
454 ;;
455 *"Archer C25 v1")
456 name="archer-c25-v1"
457 ;;
458 *"Archer C5")
459 name="archer-c5"
460 ;;
461 *"Archer C7 v4")
462 name="archer-c7-v4"
463 ;;
464 *"Archer C58 v1")
465 name="archer-c58-v1"
466 ;;
467 *"Archer C59 v1")
468 name="archer-c59-v1"
469 ;;
470 *"Archer C60 v1")
471 name="archer-c60-v1"
472 ;;
473 *"Archer C7")
474 name="archer-c7"
475 ;;
476 *"Arduino Yun")
477 name="arduino-yun"
478 ;;
479 *"Atheros AP96")
480 name="ap96"
481 ;;
482 *"AW-NR580")
483 name="aw-nr580"
484 ;;
485 *"BHR-4GRV2")
486 name="bhr-4grv2"
487 ;;
488 *"Black Swift board"*)
489 name="bsb"
490 ;;
491 *"Bullet M")
492 name="bullet-m"
493 ubnt_xm_board_detect
494 ;;
495 *"BXU2000n-2 rev. A1")
496 name="bxu2000n-2-a1"
497 ;;
498 *"C-55")
499 name="c-55"
500 ;;
501 *"C-60")
502 name="c-60"
503 ;;
504 *"CAP324")
505 name="cap324"
506 ;;
507 *"CAP4200AG")
508 name="cap4200ag"
509 ;;
510 *"Carambola2"*)
511 name="carambola2"
512 ;;
513 *"CF-E316N v2")
514 name="cf-e316n-v2"
515 ;;
516 *"CF-E320N v2")
517 name="cf-e320n-v2"
518 ;;
519 *"CF-E355AC v1")
520 name="cf-e355ac-v1"
521 ;;
522 *"CF-E355AC v2")
523 name="cf-e355ac-v2"
524 ;;
525 *"CF-E375AC")
526 name="cf-e375ac"
527 ;;
528 *"CF-E380AC v1")
529 name="cf-e380ac-v1"
530 ;;
531 *"CF-E380AC v2")
532 name="cf-e380ac-v2"
533 ;;
534 *"CF-E385AC")
535 name="cf-e385ac"
536 ;;
537 *"CF-E520N")
538 name="cf-e520n"
539 ;;
540 *"CF-E530N")
541 name="cf-e530n"
542 ;;
543 *"CPE210/220")
544 name="cpe210"
545 tplink_pharos_board_detect
546 ;;
547 *"CPE505N")
548 name="cpe505n"
549 ;;
550 *"CPE510/520")
551 name="cpe510"
552 tplink_pharos_board_detect
553 ;;
554 *"CPE830")
555 name="cpe830"
556 ;;
557 *"CPE870")
558 name="cpe870"
559 ;;
560 *"CR3000")
561 name="cr3000"
562 ;;
563 *"CR5000")
564 name="cr5000"
565 ;;
566 *"DAP-2695 rev. A1")
567 name="dap-2695-a1"
568 ;;
569 *"DB120 reference board")
570 name="db120"
571 ;;
572 *"DGL-5500 rev. A1")
573 name="dgl-5500-a1"
574 ;;
575 *"DHP-1565 rev. A1")
576 name="dhp-1565-a1"
577 ;;
578 *"DIR-505 rev. A1")
579 name="dir-505-a1"
580 dir505_board_detect
581 ;;
582 *"DIR-600 rev. A1")
583 name="dir-600-a1"
584 ;;
585 *"DIR-615 rev. C1")
586 name="dir-615-c1"
587 ;;
588 *"DIR-615 rev. E1")
589 name="dir-615-e1"
590 ;;
591 *"DIR-615 rev. E4")
592 name="dir-615-e4"
593 ;;
594 *"DIR-615 rev. I1")
595 name="dir-615-i1"
596 ;;
597 *"DIR-825 rev. B1")
598 name="dir-825-b1"
599 ;;
600 *"DIR-825 rev. C1")
601 name="dir-825-c1"
602 ;;
603 *"DIR-835 rev. A1")
604 name="dir-835-a1"
605 ;;
606 *"DIR-869 rev. A1")
607 name="dir-869-a1"
608 ;;
609 *"dLAN Hotspot")
610 name="dlan-hotspot"
611 ;;
612 *"dLAN pro 1200+ WiFi ac")
613 name="dlan-pro-1200-ac"
614 ;;
615 *"dLAN pro 500 Wireless+")
616 name="dlan-pro-500-wp"
617 ;;
618 *"Domino Pi")
619 name="gl-domino"
620 ;;
621 *"DR342")
622 name="dr342"
623 ;;
624 *"DR344")
625 name="dr344"
626 ;;
627 *"DR531")
628 name="dr531"
629 ;;
630 *"Dragino v2")
631 name="dragino2"
632 ;;
633 *"DW33D")
634 name="dw33d"
635 ;;
636 *"E1700AC v2")
637 name="e1700ac-v2"
638 ;;
639 *"E2100L")
640 name="e2100l"
641 ;;
642 *"E600G v2")
643 name="e600g-v2"
644 ;;
645 *"E600GAC v2")
646 name="e600gac-v2"
647 ;;
648 *"EAP120")
649 name="eap120"
650 tplink_pharos_board_detect
651 ;;
652 *"EAP300 v2")
653 name="eap300v2"
654 ;;
655 *"EAP7660D")
656 name="eap7660d"
657 ;;
658 *"EBR-2310 rev. C1")
659 name="ebr-2310-c1"
660 ;;
661 *"EL-M150")
662 name="el-m150"
663 ;;
664 *"EL-MINI")
665 name="el-mini"
666 ;;
667 *"EmbWir-Balin")
668 name="ew-balin"
669 ;;
670 *"EmbWir-Dorin")
671 name="ew-dorin"
672 ;;
673 *"EmbWir-Dorin-Router")
674 name="ew-dorin-router"
675 ;;
676 *"ENS202EXT")
677 name="ens202ext"
678 ;;
679 *"EPG5000")
680 name="epg5000"
681 ;;
682 *"ESR1750")
683 name="esr1750"
684 ;;
685 *"ESR900")
686 name="esr900"
687 ;;
688 *"eTactica EG-200")
689 name="rme-eg200"
690 ;;
691 *"FRITZ!WLAN Repeater 300E")
692 name="fritz300e"
693 ;;
694 *"GL-AR150")
695 name="gl-ar150"
696 ;;
697 *"GL-AR300")
698 name="gl-ar300"
699 ;;
700 *"GL-AR300M")
701 name="gl-ar300m"
702 ;;
703 *"GL-AR750")
704 name="gl-ar750"
705 ;;
706 *"GL-CONNECT INET v1")
707 name="gl-inet"
708
709 local size="$(mtd_get_part_size 'firmware')"
710
711 [ "$size" = "8192000" ] && AR71XX_MODEL="GL-iNet 6408A v1"
712 [ "$size" = "16580608" ] && AR71XX_MODEL="GL-iNet 6416A v1"
713 ;;
714 *"GL-MIFI")
715 name="gl-mifi"
716 ;;
717 *"GL-USB150")
718 name="gl-usb150"
719 ;;
720 *"HiveAP-121")
721 name="hiveap-121"
722 ;;
723 *"HiWiFi HC6361")
724 name="hiwifi-hc6361"
725 ;;
726 *"Hornet-UB")
727 local size="$(mtd_get_part_size 'firmware')"
728
729 [ "$size" = "7929856" ] && name="hornet-ub"
730 [ "$size" = "16318464" ] && name="hornet-ub-x2"
731 ;;
732 *"JA76PF")
733 name="ja76pf"
734 ;;
735 *"JA76PF2")
736 name="ja76pf2"
737 ;;
738 *"JWAP003")
739 name="jwap003"
740 ;;
741 *"JWAP230")
742 name="jwap230"
743 ;;
744 *"Lima"*)
745 name="lima"
746 ;;
747 *"Loco M XW")
748 name="loco-m-xw"
749 ;;
750 *"LS-SR71")
751 name="ls-sr71"
752 ;;
753 *"MAC1200R")
754 name="mc-mac1200r"
755 ;;
756 *"MiniBox V1.0")
757 name="minibox-v1"
758 ;;
759 *"MR12")
760 name="mr12"
761 ;;
762 *"MR16")
763 name="mr16"
764 ;;
765 *"MR1750")
766 name="mr1750"
767 ;;
768 *"MR1750v2")
769 name="mr1750v2"
770 ;;
771 *"MR18")
772 name="mr18"
773 ;;
774 *"MR600")
775 name="mr600"
776 ;;
777 *"MR600v2")
778 name="mr600v2"
779 ;;
780 *"MR900")
781 name="mr900"
782 ;;
783 *"MR900v2")
784 name="mr900v2"
785 ;;
786 *"My Net N600")
787 name="mynet-n600"
788 ;;
789 *"My Net N750")
790 name="mynet-n750"
791 ;;
792 *"My Net Wi-Fi Range Extender")
793 name="mynet-rext"
794 ;;
795 *"MZK-W04NU")
796 name="mzk-w04nu"
797 ;;
798 *"MZK-W300NH")
799 name="mzk-w300nh"
800 ;;
801 *"N5Q")
802 name="n5q"
803 ;;
804 *"Nanostation M")
805 name="nanostation-m"
806 ubnt_xm_board_detect
807 ;;
808 *"Nanostation M XW")
809 name="nanostation-m-xw"
810 ;;
811 *"NBG460N/550N/550NH")
812 name="nbg460n_550n_550nh"
813 ;;
814 *"NBG6616")
815 name="nbg6616"
816 ;;
817 *"NBG6716")
818 name="nbg6716"
819 ;;
820 *"OM2P")
821 name="om2p"
822 ;;
823 *"OM2P HS")
824 name="om2p-hs"
825 ;;
826 *"OM2P HSv2")
827 name="om2p-hsv2"
828 ;;
829 *"OM2P HSv3")
830 name="om2p-hsv3"
831 ;;
832 *"OM2P HSv4")
833 name="om2p-hsv4"
834 ;;
835 *"OM2P LC")
836 name="om2p-lc"
837 ;;
838 *"OM2Pv2")
839 name="om2pv2"
840 ;;
841 *"OM2Pv4")
842 name="om2pv4"
843 ;;
844 *"OM5P")
845 name="om5p"
846 ;;
847 *"OM5P AC")
848 name="om5p-ac"
849 ;;
850 *"OM5P ACv2")
851 name="om5p-acv2"
852 ;;
853 *"OM5P AN")
854 name="om5p-an"
855 ;;
856 *"OMY-G1")
857 name="omy-g1"
858 ;;
859 *"OMY-X1")
860 name="omy-x1"
861 ;;
862 *"Onion Omega")
863 name="onion-omega"
864 ;;
865 *"Oolite V1.0")
866 name="oolite"
867 ;;
868 *"PB42")
869 name="pb42"
870 ;;
871 *"PB44 reference board")
872 name="pb44"
873 ;;
874 *"PQI Air Pen")
875 name="pqi-air-pen"
876 ;;
877 *"Qihoo 360 C301")
878 name="qihoo-c301"
879 ;;
880 *"R36A")
881 name="r36a"
882 ;;
883 *"R602N")
884 name="r602n"
885 ;;
886 *"R6100")
887 name="r6100"
888 ;;
889 *"Rambutan"*)
890 name="rambutan"
891 ;;
892 *"RE355")
893 name="re355"
894 ;;
895 *"RE450")
896 name="re450"
897 ;;
898 *"Rocket M")
899 name="rocket-m"
900 ubnt_xm_board_detect
901 ;;
902 *"Rocket M TI")
903 name="rocket-m-ti"
904 ;;
905 *"Rocket M XW")
906 name="rocket-m-xw"
907 ;;
908 *"RouterBOARD 2011iL")
909 name="rb-2011il"
910 ;;
911 *"RouterBOARD 2011L")
912 name="rb-2011l"
913 ;;
914 *"RouterBOARD 2011UAS")
915 name="rb-2011uas"
916 ;;
917 *"RouterBOARD 2011UAS-2HnD")
918 name="rb-2011uas-2hnd"
919 ;;
920 *"RouterBOARD 2011UiAS")
921 name="rb-2011uias"
922 ;;
923 *"RouterBOARD 2011UiAS-2HnD")
924 name="rb-2011uias-2hnd"
925 ;;
926 *"RouterBOARD 411/A/AH")
927 name="rb-411"
928 ;;
929 *"RouterBOARD 411U")
930 name="rb-411u"
931 ;;
932 *"RouterBOARD 433/AH")
933 name="rb-433"
934 ;;
935 *"RouterBOARD 433UAH")
936 name="rb-433u"
937 ;;
938 *"RouterBOARD 435G")
939 name="rb-435g"
940 ;;
941 *"RouterBOARD 450")
942 name="rb-450"
943 ;;
944 *"RouterBOARD 450G")
945 name="rb-450g"
946 ;;
947 *"RouterBOARD 493/AH")
948 name="rb-493"
949 ;;
950 *"RouterBOARD 493G")
951 name="rb-493g"
952 ;;
953 *"RouterBOARD 750")
954 name="rb-750"
955 ;;
956 *"RouterBOARD 750 r2")
957 name="rb-750-r2"
958 ;;
959 *"RouterBOARD 750GL")
960 name="rb-750gl"
961 ;;
962 *"RouterBOARD 750P r2")
963 name="rb-750p-pbr2"
964 ;;
965 *"RouterBOARD 750UP r2")
966 name="rb-750up-r2"
967 ;;
968 *"RouterBOARD 751")
969 name="rb-751"
970 ;;
971 *"RouterBOARD 751G")
972 name="rb-751g"
973 ;;
974 *"RouterBOARD 911-2Hn")
975 name="rb-911-2hn"
976 ;;
977 *"RouterBOARD 911-5Hn")
978 name="rb-911-5hn"
979 ;;
980 *"RouterBOARD 911G-2HPnD")
981 name="rb-911g-2hpnd"
982 ;;
983 *"RouterBOARD 911G-5HPacD")
984 name="rb-911g-5hpacd"
985 ;;
986 *"RouterBOARD 911G-5HPnD")
987 name="rb-911g-5hpnd"
988 ;;
989 *"RouterBOARD 912UAG-2HPnD")
990 name="rb-912uag-2hpnd"
991 ;;
992 *"RouterBOARD 912UAG-5HPnD")
993 name="rb-912uag-5hpnd"
994 ;;
995 *"RouterBOARD 921GS-5HPacD r2")
996 name="rb-921gs-5hpacd-r2"
997 ;;
998 *"RouterBOARD 941-2nD")
999 name="rb-941-2nd"
1000 ;;
1001 *"RouterBOARD 951G-2HnD")
1002 name="rb-951g-2hnd"
1003 ;;
1004 *"RouterBOARD 951Ui-2HnD")
1005 name="rb-951ui-2hnd"
1006 ;;
1007 *"RouterBOARD 951Ui-2nD")
1008 name="rb-951ui-2nd"
1009 ;;
1010 *"RouterBOARD 952Ui-5ac2nD")
1011 name="rb-952ui-5ac2nd"
1012 ;;
1013 *"RouterBOARD 962UiGS-5HacT2HnT")
1014 name="rb-962uigs-5hact2hnt"
1015 ;;
1016 *"RouterBOARD LHG 5nD")
1017 name="rb-lhg-5nd"
1018 ;;
1019 *"RouterBOARD mAP 2nD")
1020 name="rb-map-2nd"
1021 ;;
1022 *"RouterBOARD mAP L-2nD")
1023 name="rb-mapl-2nd"
1024 ;;
1025 *"RouterBOARD SXT Lite2")
1026 name="rb-sxt2n"
1027 ;;
1028 *"RouterBOARD SXT Lite5")
1029 name="rb-sxt5n"
1030 ;;
1031 *"RouterBOARD wAP 2nD r2")
1032 name="rb-wap-2nd"
1033 ;;
1034 *"RouterBOARD wAP G-5HacT2HnD")
1035 name="rb-wapg-5hact2hnd"
1036 ;;
1037 *"RouterStation")
1038 name="routerstation"
1039 ;;
1040 *"RouterStation Pro")
1041 name="routerstation-pro"
1042 ;;
1043 *"RUT900")
1044 name="rut900"
1045 ;;
1046 *"RW2458N")
1047 name="rw2458n"
1048 ;;
1049 *"SC1750")
1050 name="sc1750"
1051 ;;
1052 *"SC300M")
1053 name="sc300m"
1054 ;;
1055 *"SC450")
1056 name="sc450"
1057 ;;
1058 *"SMART-300")
1059 name="smart-300"
1060 ;;
1061 *"SOM9331")
1062 name="som9331"
1063 ;;
1064 *"SR3200")
1065 name="sr3200"
1066 ;;
1067 *"T830")
1068 name="t830"
1069 ;;
1070 *"TellStick ZNet Lite")
1071 name="tellstick-znet-lite"
1072 ;;
1073 *"TEW-632BRP")
1074 name="tew-632brp"
1075 ;;
1076 *"TEW-673GRU")
1077 name="tew-673gru"
1078 ;;
1079 *"TEW-712BR")
1080 name="tew-712br"
1081 ;;
1082 *"TEW-732BR")
1083 name="tew-732br"
1084 ;;
1085 *"TEW-823DRU")
1086 name="tew-823dru"
1087 ;;
1088 *"TL-MR10U")
1089 name="tl-mr10u"
1090 ;;
1091 *"TL-MR11U")
1092 name="tl-mr11u"
1093 ;;
1094 *"TL-MR12U")
1095 name="tl-mr12u"
1096 ;;
1097 *"TL-MR13U v1")
1098 name="tl-mr13u"
1099 ;;
1100 *"TL-MR3020")
1101 name="tl-mr3020"
1102 ;;
1103 *"TL-MR3040")
1104 name="tl-mr3040"
1105 ;;
1106 *"TL-MR3040 v2")
1107 name="tl-mr3040-v2"
1108 ;;
1109 *"TL-MR3220")
1110 name="tl-mr3220"
1111 ;;
1112 *"TL-MR3220 v2")
1113 name="tl-mr3220-v2"
1114 ;;
1115 *"TL-MR3420")
1116 name="tl-mr3420"
1117 ;;
1118 *"TL-MR3420 v2")
1119 name="tl-mr3420-v2"
1120 ;;
1121 *"TL-MR6400")
1122 name="tl-mr6400"
1123 ;;
1124 *"TL-WA701ND v2")
1125 name="tl-wa701nd-v2"
1126 ;;
1127 *"TL-WA7210N v2")
1128 name="tl-wa7210n-v2"
1129 ;;
1130 *"TL-WA750RE")
1131 name="tl-wa750re"
1132 ;;
1133 *"TL-WA7510N v1")
1134 name="tl-wa7510n"
1135 ;;
1136 *"TL-WA801ND v2")
1137 name="tl-wa801nd-v2"
1138 ;;
1139 *"TL-WA801ND v3")
1140 name="tl-wa801nd-v3"
1141 ;;
1142 *"TL-WA830RE v2")
1143 name="tl-wa830re-v2"
1144 ;;
1145 *"TL-WA850RE")
1146 name="tl-wa850re"
1147 ;;
1148 *"TL-WA850RE v2")
1149 name="tl-wa850re-v2"
1150 ;;
1151 *"TL-WA855RE v1")
1152 name="tl-wa855re-v1"
1153 ;;
1154 *"TL-WA860RE")
1155 name="tl-wa860re"
1156 ;;
1157 *"TL-WA901ND")
1158 name="tl-wa901nd"
1159 ;;
1160 *"TL-WA901ND v2")
1161 name="tl-wa901nd-v2"
1162 ;;
1163 *"TL-WA901ND v3")
1164 name="tl-wa901nd-v3"
1165 ;;
1166 *"TL-WA901ND v4")
1167 name="tl-wa901nd-v4"
1168 ;;
1169 *"TL-WA901ND v5")
1170 name="tl-wa901nd-v5"
1171 ;;
1172 *"TL-WDR3320 v2")
1173 name="tl-wdr3320-v2"
1174 ;;
1175 *"TL-WDR3500")
1176 name="tl-wdr3500"
1177 ;;
1178 *"TL-WDR3600/4300/4310")
1179 name="tl-wdr4300"
1180 ;;
1181 *"TL-WDR4900 v2")
1182 name="tl-wdr4900-v2"
1183 ;;
1184 *"TL-WDR6500 v2")
1185 name="tl-wdr6500-v2"
1186 ;;
1187 *"TL-WPA8630")
1188 name="tl-wpa8630"
1189 ;;
1190 *"TL-WR1041N v2")
1191 name="tl-wr1041n-v2"
1192 ;;
1193 *"TL-WR1043N v5")
1194 name="tl-wr1043n-v5"
1195 ;;
1196 *"TL-WR1043ND")
1197 name="tl-wr1043nd"
1198 ;;
1199 *"TL-WR1043ND v2")
1200 name="tl-wr1043nd-v2"
1201 ;;
1202 *"TL-WR1043ND v4")
1203 name="tl-wr1043nd-v4"
1204 ;;
1205 *"TL-WR2543N"*)
1206 name="tl-wr2543n"
1207 ;;
1208 *"TL-WR703N v1")
1209 name="tl-wr703n"
1210 ;;
1211 *"TL-WR710N v1")
1212 name="tl-wr710n"
1213 ;;
1214 *"TL-WR720N"*)
1215 name="tl-wr720n-v3"
1216 ;;
1217 *"TL-WR740N/ND v6")
1218 name="tl-wr740n-v6"
1219 ;;
1220 *"TL-WR741ND")
1221 name="tl-wr741nd"
1222 ;;
1223 *"TL-WR741ND v4")
1224 name="tl-wr741nd-v4"
1225 ;;
1226 *"TL-WR802N v1")
1227 name="tl-wr802n-v1"
1228 ;;
1229 *"TL-WR802N v2")
1230 name="tl-wr802n-v2"
1231 ;;
1232 *"TL-WR810N")
1233 name="tl-wr810n"
1234 ;;
1235 *"TL-WR810N v2")
1236 name="tl-wr810n-v2"
1237 ;;
1238 *"TL-WR840N v2")
1239 name="tl-wr840n-v2"
1240 ;;
1241 *"TL-WR840N v3")
1242 name="tl-wr840n-v3"
1243 ;;
1244 *"TL-WR841N v1")
1245 name="tl-wr841n-v1"
1246 ;;
1247 *"TL-WR841N/ND v11")
1248 name="tl-wr841n-v11"
1249 ;;
1250 *"TL-WR841N/ND v7")
1251 name="tl-wr841n-v7"
1252 ;;
1253 *"TL-WR841N/ND v8")
1254 name="tl-wr841n-v8"
1255 ;;
1256 *"TL-WR841N/ND v9")
1257 name="tl-wr841n-v9"
1258 ;;
1259 *"TL-WR842N/ND v2")
1260 name="tl-wr842n-v2"
1261 ;;
1262 *"TL-WR842N/ND v3")
1263 name="tl-wr842n-v3"
1264 ;;
1265 *"TL-WR902AC v1")
1266 name="tl-wr902ac-v1"
1267 ;;
1268 *"TL-WR940N v4")
1269 name="tl-wr940n-v4"
1270 ;;
1271 *"TL-WR941N/ND v5")
1272 name="tl-wr941nd-v5"
1273 ;;
1274 *"TL-WR941N/ND v6")
1275 name="tl-wr941nd-v6"
1276 ;;
1277 *"TL-WR941ND")
1278 name="tl-wr941nd"
1279 ;;
1280 *"TL-WR942N v1")
1281 name="tl-wr942n-v1"
1282 ;;
1283 *"Tube2H")
1284 name="tube2h"
1285 ;;
1286 *"UniFi")
1287 name="unifi"
1288 ;;
1289 *"UniFi AP Pro")
1290 name="uap-pro"
1291 ;;
1292 *"UniFi-AC-LITE/MESH")
1293 name="unifiac-lite"
1294 ;;
1295 *"UniFi-AC-PRO")
1296 name="unifiac-pro"
1297 ;;
1298 *"UniFiAP Outdoor")
1299 name="unifi-outdoor"
1300 ;;
1301 *"UniFiAP Outdoor+")
1302 name="unifi-outdoor-plus"
1303 ;;
1304 *"WAM250")
1305 name="wam250"
1306 ;;
1307 *"WBS210")
1308 name="wbs210"
1309 tplink_pharos_board_detect
1310 ;;
1311 *"WBS510")
1312 name="wbs510"
1313 tplink_pharos_board_detect
1314 ;;
1315 "WeIO"*)
1316 name="weio"
1317 ;;
1318 *"WI2A-AC200i")
1319 name="wi2a-ac200i"
1320 ;;
1321 *"WHR-G301N")
1322 name="whr-g301n"
1323 ;;
1324 *"WHR-HP-G300N")
1325 name="whr-hp-g300n"
1326 ;;
1327 *"WHR-HP-GN")
1328 name="whr-hp-gn"
1329 ;;
1330 *"WLAE-AG300N")
1331 name="wlae-ag300n"
1332 ;;
1333 *"WLR-8100")
1334 name="wlr8100"
1335 ;;
1336 *"WNDAP360")
1337 name="wndap360"
1338 ;;
1339 *"WNDR3700/WNDR3800/WNDRMAC")
1340 wndr3700_board_detect "$machine"
1341 ;;
1342 *"WNDR3700v4")
1343 name="wndr3700v4"
1344 ;;
1345 *"WNDR4300")
1346 name="wndr4300"
1347 ;;
1348 *"WNR1000 V2")
1349 name="wnr1000-v2"
1350 ;;
1351 *"WNR2000")
1352 name="wnr2000"
1353 ;;
1354 *"WNR2000 V3")
1355 name="wnr2000-v3"
1356 ;;
1357 *"WNR2000 V4")
1358 name="wnr2000-v4"
1359 ;;
1360 *"WNR2200")
1361 name="wnr2200"
1362 ;;
1363 *"WNR612 V2")
1364 name="wnr612-v2"
1365 ;;
1366 *"WP543")
1367 name="wp543"
1368 ;;
1369 *"WPE72")
1370 name="wpe72"
1371 ;;
1372 *"WPJ342")
1373 name="wpj342"
1374 ;;
1375 *"WPJ344")
1376 name="wpj344"
1377 ;;
1378 *"WPJ531")
1379 name="wpj531"
1380 ;;
1381 *"WPJ558")
1382 name="wpj558"
1383 ;;
1384 *"WPJ563")
1385 name="wpj563"
1386 ;;
1387 *"WPN824N")
1388 name="wpn824n"
1389 ;;
1390 *"WRT160NL")
1391 name="wrt160nl"
1392 ;;
1393 *"WRT400N")
1394 name="wrt400n"
1395 ;;
1396 *"WRTnode2Q"*)
1397 name="wrtnode2q"
1398 ;;
1399 *"WZR-450HP2")
1400 name="wzr-450hp2"
1401 ;;
1402 *"WZR-HP-AG300H/WZR-600DHP")
1403 name="wzr-hp-ag300h"
1404 ;;
1405 *"WZR-HP-G300NH")
1406 name="wzr-hp-g300nh"
1407 ;;
1408 *"WZR-HP-G300NH2")
1409 name="wzr-hp-g300nh2"
1410 ;;
1411 *"WZR-HP-G450H")
1412 name="wzr-hp-g450h"
1413 ;;
1414 *"XD3200")
1415 name="xd3200"
1416 ;;
1417 *"Z1")
1418 name="z1"
1419 ;;
1420 *"ZBT-WE1526")
1421 name="zbt-we1526"
1422 ;;
1423 *"ZCN-1523H-2")
1424 name="zcn-1523h-2"
1425 ;;
1426 *"ZCN-1523H-5")
1427 name="zcn-1523h-5"
1428 ;;
1429 esac
1430
1431 [ -z "$AR71XX_MODEL" ] && [ "${machine:0:8}" = 'TP-LINK ' ] && \
1432 tplink_board_detect "$machine"
1433
1434 [ -z "$name" ] && name="unknown"
1435
1436 [ -z "$AR71XX_BOARD_NAME" ] && AR71XX_BOARD_NAME="$name"
1437 [ -z "$AR71XX_MODEL" ] && AR71XX_MODEL="$machine"
1438
1439 [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
1440
1441 echo "$AR71XX_BOARD_NAME" > /tmp/sysinfo/board_name
1442 echo "$AR71XX_MODEL" > /tmp/sysinfo/model
1443 }