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