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