df8c6d728370c88f2efe62550ec39774d3731db1
[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 *"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 *"Archer C25 v1")
447 name="archer-c25-v1"
448 ;;
449 *"Archer C5")
450 name="archer-c5"
451 ;;
452 *"Archer C58 v1")
453 name="archer-c58-v1"
454 ;;
455 *"Archer C59 v1")
456 name="archer-c59-v1"
457 ;;
458 *"Archer C60 v1")
459 name="archer-c60-v1"
460 ;;
461 *"Archer C7")
462 name="archer-c7"
463 ;;
464 *"Arduino Yun")
465 name="arduino-yun"
466 ;;
467 *"Atheros AP96")
468 name="ap96"
469 ;;
470 *"AW-NR580")
471 name="aw-nr580"
472 ;;
473 *"BHR-4GRV2")
474 name="bhr-4grv2"
475 ;;
476 *"Black Swift board"*)
477 name="bsb"
478 ;;
479 *"Bullet M")
480 name="bullet-m"
481 ubnt_xm_board_detect
482 ;;
483 *"BXU2000n-2 rev. A1")
484 name="bxu2000n-2-a1"
485 ;;
486 *"C-55")
487 name="c-55"
488 ;;
489 *"C-60")
490 name="c-60"
491 ;;
492 *"CAP324")
493 name="cap324"
494 ;;
495 *"CAP4200AG")
496 name="cap4200ag"
497 ;;
498 *"Carambola2"*)
499 name="carambola2"
500 ;;
501 *"CF-E316N v2")
502 name="cf-e316n-v2"
503 ;;
504 *"CF-E320N v2")
505 name="cf-e320n-v2"
506 ;;
507 *"CF-E380AC v1")
508 name="cf-e380ac-v1"
509 ;;
510 *"CF-E380AC v2")
511 name="cf-e380ac-v2"
512 ;;
513 *"CF-E520N")
514 name="cf-e520n"
515 ;;
516 *"CF-E530N")
517 name="cf-e530n"
518 ;;
519 *"CPE210/220")
520 name="cpe210"
521 tplink_pharos_board_detect
522 ;;
523 *"CPE505N")
524 name="cpe505n"
525 ;;
526 *"CPE510/520")
527 name="cpe510"
528 tplink_pharos_board_detect
529 ;;
530 *"CPE830")
531 name="cpe830"
532 ;;
533 *"CPE870")
534 name="cpe870"
535 ;;
536 *"CR3000")
537 name="cr3000"
538 ;;
539 *"CR5000")
540 name="cr5000"
541 ;;
542 *"DAP-2695 rev. A1")
543 name="dap-2695-a1"
544 ;;
545 *"DB120 reference board")
546 name="db120"
547 ;;
548 *"DGL-5500 rev. A1")
549 name="dgl-5500-a1"
550 ;;
551 *"DHP-1565 rev. A1")
552 name="dhp-1565-a1"
553 ;;
554 *"DIR-505 rev. A1")
555 name="dir-505-a1"
556 dir505_board_detect
557 ;;
558 *"DIR-600 rev. A1")
559 name="dir-600-a1"
560 ;;
561 *"DIR-615 rev. C1")
562 name="dir-615-c1"
563 ;;
564 *"DIR-615 rev. E1")
565 name="dir-615-e1"
566 ;;
567 *"DIR-615 rev. E4")
568 name="dir-615-e4"
569 ;;
570 *"DIR-615 rev. I1")
571 name="dir-615-i1"
572 ;;
573 *"DIR-825 rev. B1")
574 name="dir-825-b1"
575 ;;
576 *"DIR-825 rev. C1")
577 name="dir-825-c1"
578 ;;
579 *"DIR-835 rev. A1")
580 name="dir-835-a1"
581 ;;
582 *"DIR-869 rev. A1")
583 name="dir-869-a1"
584 ;;
585 *"dLAN Hotspot")
586 name="dlan-hotspot"
587 ;;
588 *"dLAN pro 1200+ WiFi ac")
589 name="dlan-pro-1200-ac"
590 ;;
591 *"dLAN pro 500 Wireless+")
592 name="dlan-pro-500-wp"
593 ;;
594 *"Domino Pi")
595 name="gl-domino"
596 ;;
597 *"DR344")
598 name="dr344"
599 ;;
600 *"DR531")
601 name="dr531"
602 ;;
603 *"Dragino v2")
604 name="dragino2"
605 ;;
606 *"DW33D")
607 name="dw33d"
608 ;;
609 *"E2100L")
610 name="e2100l"
611 ;;
612 *"EAP120")
613 name="eap120"
614 tplink_pharos_board_detect
615 ;;
616 *"EAP300 v2")
617 name="eap300v2"
618 ;;
619 *"EAP7660D")
620 name="eap7660d"
621 ;;
622 *"EBR-2310 rev. C1")
623 name="ebr-2310-c1"
624 ;;
625 *"EL-M150")
626 name="el-m150"
627 ;;
628 *"EL-MINI")
629 name="el-mini"
630 ;;
631 *"EmbWir-Dorin")
632 name="ew-dorin"
633 ;;
634 *"EmbWir-Dorin-Router")
635 name="ew-dorin-router"
636 ;;
637 *"ENS202EXT")
638 name="ens202ext"
639 ;;
640 *"EPG5000")
641 name="epg5000"
642 ;;
643 *"ESR1750")
644 name="esr1750"
645 ;;
646 *"ESR900")
647 name="esr900"
648 ;;
649 *"FRITZ!WLAN Repeater 300E")
650 name="fritz300e"
651 ;;
652 *"GL AR150")
653 name="gl-ar150"
654 ;;
655 *"GL AR300")
656 name="gl-ar300"
657 ;;
658 *"GL-AR300M")
659 name="gl-ar300m"
660 ;;
661 *"GL-CONNECT INET v1")
662 name="gl-inet"
663
664 local size="$(mtd_get_part_size 'firmware')"
665
666 [ "$size" = "8192000" ] && AR71XX_MODEL="GL-iNet 6408A v1"
667 [ "$size" = "16580608" ] && AR71XX_MODEL="GL-iNet 6416A v1"
668 ;;
669 *"GL-MIFI")
670 name="gl-mifi"
671 ;;
672 *"HiveAP-121")
673 name="hiveap-121"
674 ;;
675 *"HiWiFi HC6361")
676 name="hiwifi-hc6361"
677 ;;
678 *"Hornet-UB")
679 local size="$(mtd_get_part_size 'firmware')"
680
681 [ "$size" = "7929856" ] && name="hornet-ub"
682 [ "$size" = "16318464" ] && name="hornet-ub-x2"
683 ;;
684 *"JA76PF")
685 name="ja76pf"
686 ;;
687 *"JA76PF2")
688 name="ja76pf2"
689 ;;
690 *"JWAP003")
691 name="jwap003"
692 ;;
693 *"JWAP230")
694 name="jwap230"
695 ;;
696 *"Lima"*)
697 name="lima"
698 ;;
699 *"Loco M XW")
700 name="loco-m-xw"
701 ;;
702 *"LS-SR71")
703 name="ls-sr71"
704 ;;
705 *"MAC1200R")
706 name="mc-mac1200r"
707 ;;
708 *"MiniBox V1.0")
709 name="minibox-v1"
710 ;;
711 *"MR12")
712 name="mr12"
713 ;;
714 *"MR16")
715 name="mr16"
716 ;;
717 *"MR1750")
718 name="mr1750"
719 ;;
720 *"MR1750v2")
721 name="mr1750v2"
722 ;;
723 *"MR18")
724 name="mr18"
725 ;;
726 *"MR600")
727 name="mr600"
728 ;;
729 *"MR600v2")
730 name="mr600v2"
731 ;;
732 *"MR900")
733 name="mr900"
734 ;;
735 *"MR900v2")
736 name="mr900v2"
737 ;;
738 *"My Net N600")
739 name="mynet-n600"
740 ;;
741 *"My Net N750")
742 name="mynet-n750"
743 ;;
744 *"My Net Wi-Fi Range Extender")
745 name="mynet-rext"
746 ;;
747 *"MZK-W04NU")
748 name="mzk-w04nu"
749 ;;
750 *"MZK-W300NH")
751 name="mzk-w300nh"
752 ;;
753 *"Nanostation M")
754 name="nanostation-m"
755 ubnt_xm_board_detect
756 ;;
757 *"Nanostation M XW")
758 name="nanostation-m-xw"
759 ;;
760 *"NBG460N/550N/550NH")
761 name="nbg460n_550n_550nh"
762 ;;
763 *"NBG6616")
764 name="nbg6616"
765 ;;
766 *"NBG6716")
767 name="nbg6716"
768 ;;
769 *"OM2P")
770 name="om2p"
771 ;;
772 *"OM2P HS")
773 name="om2p-hs"
774 ;;
775 *"OM2P HSv2")
776 name="om2p-hsv2"
777 ;;
778 *"OM2P HSv3")
779 name="om2p-hsv3"
780 ;;
781 *"OM2P HSv4")
782 name="om2p-hsv4"
783 ;;
784 *"OM2P LC")
785 name="om2p-lc"
786 ;;
787 *"OM2Pv2")
788 name="om2pv2"
789 ;;
790 *"OM2Pv4")
791 name="om2pv4"
792 ;;
793 *"OM5P")
794 name="om5p"
795 ;;
796 *"OM5P AC")
797 name="om5p-ac"
798 ;;
799 *"OM5P ACv2")
800 name="om5p-acv2"
801 ;;
802 *"OM5P AN")
803 name="om5p-an"
804 ;;
805 *"OMY-G1")
806 name="omy-g1"
807 ;;
808 *"OMY-X1")
809 name="omy-x1"
810 ;;
811 *"Onion Omega")
812 name="onion-omega"
813 ;;
814 *"Oolite V1.0")
815 name="oolite"
816 ;;
817 *"PB42")
818 name="pb42"
819 ;;
820 *"PB44 reference board")
821 name="pb44"
822 ;;
823 *"PQI Air Pen")
824 name="pqi-air-pen"
825 ;;
826 *"Qihoo 360 C301")
827 name="qihoo-c301"
828 ;;
829 *"R602N")
830 name="r602n"
831 ;;
832 *"R6100")
833 name="r6100"
834 ;;
835 *"Rambutan"*)
836 name="rambutan"
837 ;;
838 *"RE450")
839 name="re450"
840 ;;
841 *"Rocket M")
842 name="rocket-m"
843 ubnt_xm_board_detect
844 ;;
845 *"Rocket M TI")
846 name="rocket-m-ti"
847 ;;
848 *"Rocket M XW")
849 name="rocket-m-xw"
850 ;;
851 *"RouterBOARD 2011iL")
852 name="rb-2011il"
853 ;;
854 *"RouterBOARD 2011L")
855 name="rb-2011l"
856 ;;
857 *"RouterBOARD 2011UAS")
858 name="rb-2011uas"
859 ;;
860 *"RouterBOARD 2011UAS-2HnD")
861 name="rb-2011uas-2hnd"
862 ;;
863 *"RouterBOARD 2011UiAS")
864 name="rb-2011uias"
865 ;;
866 *"RouterBOARD 2011UiAS-2HnD")
867 name="rb-2011uias-2hnd"
868 ;;
869 *"RouterBOARD 411/A/AH")
870 name="rb-411"
871 ;;
872 *"RouterBOARD 411U")
873 name="rb-411u"
874 ;;
875 *"RouterBOARD 433/AH")
876 name="rb-433"
877 ;;
878 *"RouterBOARD 433UAH")
879 name="rb-433u"
880 ;;
881 *"RouterBOARD 435G")
882 name="rb-435g"
883 ;;
884 *"RouterBOARD 450")
885 name="rb-450"
886 ;;
887 *"RouterBOARD 450G")
888 name="rb-450g"
889 ;;
890 *"RouterBOARD 493/AH")
891 name="rb-493"
892 ;;
893 *"RouterBOARD 493G")
894 name="rb-493g"
895 ;;
896 *"RouterBOARD 750")
897 name="rb-750"
898 ;;
899 *"RouterBOARD 750 r2")
900 name="rb-750-r2"
901 ;;
902 *"RouterBOARD 750GL")
903 name="rb-750gl"
904 ;;
905 *"RouterBOARD 750UP r2")
906 name="rb-750up-r2"
907 ;;
908 *"RouterBOARD 751")
909 name="rb-751"
910 ;;
911 *"RouterBOARD 751G")
912 name="rb-751g"
913 ;;
914 *"RouterBOARD 911G-2HPnD")
915 name="rb-911g-2hpnd"
916 ;;
917 *"RouterBOARD 911G-5HPacD")
918 name="rb-911g-5hpacd"
919 ;;
920 *"RouterBOARD 911G-5HPnD")
921 name="rb-911g-5hpnd"
922 ;;
923 *"RouterBOARD 912UAG-2HPnD")
924 name="rb-912uag-2hpnd"
925 ;;
926 *"RouterBOARD 912UAG-5HPnD")
927 name="rb-912uag-5hpnd"
928 ;;
929 *"RouterBOARD 941-2nD")
930 name="rb-941-2nd"
931 ;;
932 *"RouterBOARD 951G-2HnD")
933 name="rb-951g-2hnd"
934 ;;
935 *"RouterBOARD 951Ui-2HnD")
936 name="rb-951ui-2hnd"
937 ;;
938 *"RouterBOARD 951Ui-2nD")
939 name="rb-951ui-2nd"
940 ;;
941 *"RouterBOARD 952Ui-5ac2nD")
942 name="rb-952ui-5ac2nd"
943 ;;
944 *"RouterBOARD 962UiGS-5HacT2HnT")
945 name="rb-962uigs-5hact2hnt"
946 ;;
947 *"RouterBOARD LHG 5nD")
948 name="rb-lhg-5nd"
949 ;;
950 *"RouterBOARD mAP L-2nD")
951 name="rb-mapl-2nd"
952 ;;
953 *"RouterBOARD SXT Lite2")
954 name="rb-sxt2n"
955 ;;
956 *"RouterBOARD SXT Lite5")
957 name="rb-sxt5n"
958 ;;
959 *"RouterStation")
960 name="routerstation"
961 ;;
962 *"RouterStation Pro")
963 name="routerstation-pro"
964 ;;
965 *"RW2458N")
966 name="rw2458n"
967 ;;
968 *"SC1750")
969 name="sc1750"
970 ;;
971 *"SC300M")
972 name="sc300m"
973 ;;
974 *"SC450")
975 name="sc450"
976 ;;
977 *"SMART-300")
978 name="smart-300"
979 ;;
980 *"SOM9331")
981 name="som9331"
982 ;;
983 *"SR3200")
984 name="sr3200"
985 ;;
986 *"TellStick ZNet Lite")
987 name="tellstick-znet-lite"
988 ;;
989 *"TEW-632BRP")
990 name="tew-632brp"
991 ;;
992 *"TEW-673GRU")
993 name="tew-673gru"
994 ;;
995 *"TEW-712BR")
996 name="tew-712br"
997 ;;
998 *"TEW-732BR")
999 name="tew-732br"
1000 ;;
1001 *"TEW-823DRU")
1002 name="tew-823dru"
1003 ;;
1004 *"TL-MR10U")
1005 name="tl-mr10u"
1006 ;;
1007 *"TL-MR11U")
1008 name="tl-mr11u"
1009 ;;
1010 *"TL-MR12U")
1011 name="tl-mr12u"
1012 ;;
1013 *"TL-MR13U v1")
1014 name="tl-mr13u"
1015 ;;
1016 *"TL-MR3020")
1017 name="tl-mr3020"
1018 ;;
1019 *"TL-MR3040")
1020 name="tl-mr3040"
1021 ;;
1022 *"TL-MR3040 v2")
1023 name="tl-mr3040-v2"
1024 ;;
1025 *"TL-MR3220")
1026 name="tl-mr3220"
1027 ;;
1028 *"TL-MR3220 v2")
1029 name="tl-mr3220-v2"
1030 ;;
1031 *"TL-MR3420")
1032 name="tl-mr3420"
1033 ;;
1034 *"TL-MR3420 v2")
1035 name="tl-mr3420-v2"
1036 ;;
1037 *TL-MR6400)
1038 name="tl-mr6400"
1039 ;;
1040 *"TL-WA701ND v2")
1041 name="tl-wa701nd-v2"
1042 ;;
1043 *"TL-WA7210N v2")
1044 name="tl-wa7210n-v2"
1045 ;;
1046 *"TL-WA750RE")
1047 name="tl-wa750re"
1048 ;;
1049 *"TL-WA7510N v1")
1050 name="tl-wa7510n"
1051 ;;
1052 *"TL-WA801ND v2")
1053 name="tl-wa801nd-v2"
1054 ;;
1055 *"TL-WA801ND v3")
1056 name="tl-wa801nd-v3"
1057 ;;
1058 *"TL-WA830RE v2")
1059 name="tl-wa830re-v2"
1060 ;;
1061 *"TL-WA850RE")
1062 name="tl-wa850re"
1063 ;;
1064 *"TL-WA850RE v2")
1065 name="tl-wa850re-v2"
1066 ;;
1067 *"TL-WA855RE v1")
1068 name="tl-wa855re-v1"
1069 ;;
1070 *"TL-WA860RE")
1071 name="tl-wa860re"
1072 ;;
1073 *"TL-WA901ND")
1074 name="tl-wa901nd"
1075 ;;
1076 *"TL-WA901ND v2")
1077 name="tl-wa901nd-v2"
1078 ;;
1079 *"TL-WA901ND v3")
1080 name="tl-wa901nd-v3"
1081 ;;
1082 *"TL-WA901ND v4")
1083 name="tl-wa901nd-v4"
1084 ;;
1085 *"TL-WDR3320 v2")
1086 name="tl-wdr3320-v2"
1087 ;;
1088 *"TL-WDR3500")
1089 name="tl-wdr3500"
1090 ;;
1091 *"TL-WDR3600/4300/4310")
1092 name="tl-wdr4300"
1093 ;;
1094 *"TL-WDR4900 v2")
1095 name="tl-wdr4900-v2"
1096 ;;
1097 *"TL-WDR6500 v2")
1098 name="tl-wdr6500-v2"
1099 ;;
1100 *"TL-WPA8630")
1101 name="tl-wpa8630"
1102 ;;
1103 *"TL-WR1041N v2")
1104 name="tl-wr1041n-v2"
1105 ;;
1106 *"TL-WR1043ND")
1107 name="tl-wr1043nd"
1108 ;;
1109 *"TL-WR1043ND v2")
1110 name="tl-wr1043nd-v2"
1111 ;;
1112 *"TL-WR1043ND v4")
1113 name="tl-wr1043nd-v4"
1114 ;;
1115 *"TL-WR2543N"*)
1116 name="tl-wr2543n"
1117 ;;
1118 *"TL-WR703N v1")
1119 name="tl-wr703n"
1120 ;;
1121 *"TL-WR710N v1")
1122 name="tl-wr710n"
1123 ;;
1124 *"TL-WR720N"*)
1125 name="tl-wr720n-v3"
1126 ;;
1127 *"TL-WR740N/ND v6")
1128 name="tl-wr740n-v6"
1129 ;;
1130 *"TL-WR741ND")
1131 name="tl-wr741nd"
1132 ;;
1133 *"TL-WR741ND v4")
1134 name="tl-wr741nd-v4"
1135 ;;
1136 *"TL-WR802N v1")
1137 name="tl-wr802n-v1"
1138 ;;
1139 *"TL-WR802N v2")
1140 name="tl-wr802n-v2"
1141 ;;
1142 *"TL-WR810N")
1143 name="tl-wr810n"
1144 ;;
1145 *"TL-WR840N v2")
1146 name="tl-wr840n-v2"
1147 ;;
1148 *"TL-WR840N v3")
1149 name="tl-wr840n-v3"
1150 ;;
1151 *"TL-WR841N v1")
1152 name="tl-wr841n-v1"
1153 ;;
1154 *"TL-WR841N/ND v11")
1155 name="tl-wr841n-v11"
1156 ;;
1157 *"TL-WR841N/ND v7")
1158 name="tl-wr841n-v7"
1159 ;;
1160 *"TL-WR841N/ND v8")
1161 name="tl-wr841n-v8"
1162 ;;
1163 *"TL-WR841N/ND v9")
1164 name="tl-wr841n-v9"
1165 ;;
1166 *"TL-WR842N/ND v2")
1167 name="tl-wr842n-v2"
1168 ;;
1169 *"TL-WR842N/ND v3")
1170 name="tl-wr842n-v3"
1171 ;;
1172 *"TL-WR940N v4")
1173 name="tl-wr940n-v4"
1174 ;;
1175 *"TL-WR941N/ND v5")
1176 name="tl-wr941nd-v5"
1177 ;;
1178 *"TL-WR941N/ND v6")
1179 name="tl-wr941nd-v6"
1180 ;;
1181 *"TL-WR941ND")
1182 name="tl-wr941nd"
1183 ;;
1184 *"TL-WR942N v1")
1185 name="tl-wr942n-v1"
1186 ;;
1187 *"Tube2H")
1188 name="tube2h"
1189 ;;
1190 *"UniFi")
1191 name="unifi"
1192 ;;
1193 *"UniFi AP Pro")
1194 name="uap-pro"
1195 ;;
1196 *"UniFi-AC-LITE/MESH")
1197 name="unifiac-lite"
1198 ;;
1199 *"UniFi-AC-PRO")
1200 name="unifiac-pro"
1201 ;;
1202 *"UniFiAP Outdoor")
1203 name="unifi-outdoor"
1204 ;;
1205 *"UniFiAP Outdoor+")
1206 name="unifi-outdoor-plus"
1207 ;;
1208 *"WBS210")
1209 name="wbs210"
1210 tplink_pharos_board_detect
1211 ;;
1212 *"WBS510")
1213 name="wbs510"
1214 tplink_pharos_board_detect
1215 ;;
1216 "WeIO"*)
1217 name="weio"
1218 ;;
1219 *"WHR-G301N")
1220 name="whr-g301n"
1221 ;;
1222 *"WHR-HP-G300N")
1223 name="whr-hp-g300n"
1224 ;;
1225 *"WHR-HP-GN")
1226 name="whr-hp-gn"
1227 ;;
1228 *"WLAE-AG300N")
1229 name="wlae-ag300n"
1230 ;;
1231 *"WLR-8100")
1232 name="wlr8100"
1233 ;;
1234 *"WNDAP360")
1235 name="wndap360"
1236 ;;
1237 *"WNDR3700/WNDR3800/WNDRMAC")
1238 wndr3700_board_detect "$machine"
1239 ;;
1240 *"WNDR3700v4")
1241 name="wndr3700v4"
1242 ;;
1243 *"WNDR4300")
1244 name="wndr4300"
1245 ;;
1246 *"WNR1000 V2")
1247 name="wnr1000-v2"
1248 ;;
1249 *"WNR2000")
1250 name="wnr2000"
1251 ;;
1252 *"WNR2000 V3")
1253 name="wnr2000-v3"
1254 ;;
1255 *"WNR2000 V4")
1256 name="wnr2000-v4"
1257 ;;
1258 *"WNR2200")
1259 name="wnr2200"
1260 ;;
1261 *"WNR612 V2")
1262 name="wnr612-v2"
1263 ;;
1264 *"WP543")
1265 name="wp543"
1266 ;;
1267 *"WPE72")
1268 name="wpe72"
1269 ;;
1270 *"WPJ342")
1271 name="wpj342"
1272 ;;
1273 *"WPJ344")
1274 name="wpj344"
1275 ;;
1276 *"WPJ531")
1277 name="wpj531"
1278 ;;
1279 *"WPJ558")
1280 name="wpj558"
1281 ;;
1282 *"WPJ563")
1283 name="wpj563"
1284 ;;
1285 *"WPN824N")
1286 name="wpn824n"
1287 ;;
1288 *"WRT160NL")
1289 name="wrt160nl"
1290 ;;
1291 *"WRT400N")
1292 name="wrt400n"
1293 ;;
1294 *"WRTnode2Q"*)
1295 name="wrtnode2q"
1296 ;;
1297 *"WZR-450HP2")
1298 name="wzr-450hp2"
1299 ;;
1300 *"WZR-HP-AG300H/WZR-600DHP")
1301 name="wzr-hp-ag300h"
1302 ;;
1303 *"WZR-HP-G300NH")
1304 name="wzr-hp-g300nh"
1305 ;;
1306 *"WZR-HP-G300NH2")
1307 name="wzr-hp-g300nh2"
1308 ;;
1309 *"WZR-HP-G450H")
1310 name="wzr-hp-g450h"
1311 ;;
1312 *"XD3200")
1313 name="xd3200"
1314 ;;
1315 *"Z1")
1316 name="z1"
1317 ;;
1318 *"ZBT-WE1526")
1319 name="zbt-we1526"
1320 ;;
1321 *"ZCN-1523H-2")
1322 name="zcn-1523h-2"
1323 ;;
1324 *"ZCN-1523H-5")
1325 name="zcn-1523h-5"
1326 ;;
1327 esac
1328
1329 [ -z "$AR71XX_MODEL" ] && [ "${machine:0:8}" = 'TP-LINK ' ] && \
1330 tplink_board_detect "$machine"
1331
1332 [ -z "$name" ] && name="unknown"
1333
1334 [ -z "$AR71XX_BOARD_NAME" ] && AR71XX_BOARD_NAME="$name"
1335 [ -z "$AR71XX_MODEL" ] && AR71XX_MODEL="$machine"
1336
1337 [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
1338
1339 echo "$AR71XX_BOARD_NAME" > /tmp/sysinfo/board_name
1340 echo "$AR71XX_MODEL" > /tmp/sysinfo/model
1341 }
1342
1343 ar71xx_board_name() {
1344 local name
1345
1346 [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
1347 [ -z "$name" ] && name="unknown"
1348
1349 echo "$name"
1350 }