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