804f622983793adc0f84b09b7f0460a0ba6e0e88
[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 cybertan_get_hw_magic() {
68 local part
69
70 part=$(find_mtd_part firmware)
71 [ -z "$part" ] && return 1
72
73 dd bs=8 count=1 skip=0 if=$part 2>/dev/null | hexdump -v -n 8 -e '1/1 "%02x"'
74 }
75
76 tplink_get_hwid() {
77 local part
78
79 part=$(find_mtd_part firmware)
80 [ -z "$part" ] && return 1
81
82 dd if=$part bs=4 count=1 skip=16 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
83 }
84
85 tplink_get_mid() {
86 local part
87
88 part=$(find_mtd_part firmware)
89 [ -z "$part" ] && return 1
90
91 dd if=$part bs=4 count=1 skip=17 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
92 }
93
94 tplink_board_detect() {
95 local model="$1"
96 local hwid
97 local hwver
98
99 hwid=$(tplink_get_hwid)
100 mid=$(tplink_get_mid)
101 hwver=${hwid:6:2}
102 hwver="v${hwver#0}"
103
104 case "$hwid" in
105 "015000"*)
106 model="EasyLink EL-M150"
107 ;;
108 "015300"*)
109 model="EasyLink EL-MINI"
110 ;;
111 "044401"*)
112 model="ANTMINER-S1"
113 ;;
114 "044403"*)
115 model="ANTMINER-S3"
116 ;;
117 "44440101"*)
118 model="ANTROUTER-R1"
119 ;;
120 "120000"*)
121 model="MERCURY MAC1200R"
122 ;;
123 "3C0001"*)
124 model="OOLITE"
125 ;;
126 "3C0002"*)
127 model="MINIBOX_V1"
128 ;;
129 "070301"*)
130 model="TP-Link TL-WR703N"
131 ;;
132 "071000"*)
133 model="TP-Link TL-WR710N"
134 ;;
135 "072001"*)
136 model="TP-Link TL-WR720N"
137 ;;
138 "070100"*)
139 model="TP-Link TL-WA701N/ND"
140 ;;
141 "073000"*)
142 model="TP-Link TL-WA730RE"
143 ;;
144 "074000"*)
145 model="TP-Link TL-WR740N/ND"
146 ;;
147 "074100"*)
148 model="TP-Link TL-WR741N/ND"
149 ;;
150 "074300"*)
151 model="TP-Link TL-WR743N/ND"
152 ;;
153 "075000"*)
154 model="TP-Link TL-WA750RE"
155 ;;
156 "721000"*)
157 model="TP-Link TL-WA7210N"
158 ;;
159 "751000"*)
160 model="TP-Link TL-WA7510N"
161 ;;
162 "080100"*)
163 model="TP-Link TL-WA801N/ND"
164 ;;
165 "083000"*)
166 model="TP-Link TL-WA830RE"
167
168 if [ "$hwver" = 'v10' ]; then
169 hwver='v1'
170 fi
171 ;;
172 "084100"*)
173 model="TP-Link TL-WR841N/ND"
174 ;;
175 "084200"*)
176 model="TP-Link TL-WR842N/ND"
177 ;;
178 "084300"*)
179 model="TP-Link TL-WR843N/ND"
180 ;;
181 "085000"*)
182 model="TP-Link TL-WA850RE"
183 ;;
184 "086000"*)
185 model="TP-Link TL-WA860RE"
186 ;;
187 "090100"*)
188 model="TP-Link TL-WA901N/ND"
189 ;;
190 "094100"*)
191 if [ "$hwid" = "09410002" -a "$mid" = "00420001" ]; then
192 model="Rosewill RNX-N360RT"
193 hwver=""
194 else
195 model="TP-Link TL-WR941N/ND"
196 fi
197 ;;
198 "104100"*)
199 model="TP-Link TL-WR1041N/ND"
200 ;;
201 "104300"*)
202 model="TP-Link TL-WR1043N/ND"
203 ;;
204 "254300"*)
205 model="TP-Link TL-WR2543N/ND"
206 ;;
207 "001001"*)
208 model="TP-Link TL-MR10U"
209 ;;
210 "001101"*)
211 model="TP-Link TL-MR11U"
212 ;;
213 "001201"*)
214 model="TP-Link TL-MR12U"
215 ;;
216 "001301"*)
217 model="TP-Link TL-MR13U"
218 ;;
219 "302000"*)
220 model="TP-Link TL-MR3020"
221 ;;
222 "304000"*)
223 model="TP-Link TL-MR3040"
224 ;;
225 "322000"*)
226 model="TP-Link TL-MR3220"
227 ;;
228 "342000"*)
229 model="TP-Link TL-MR3420"
230 ;;
231 "332000"*)
232 model="TP-Link TL-WDR3320"
233 ;;
234 "350000"*)
235 model="TP-Link TL-WDR3500"
236 ;;
237 "360000"*)
238 model="TP-Link TL-WDR3600"
239 ;;
240 "430000"*)
241 model="TP-Link TL-WDR4300"
242 ;;
243 "430080"*)
244 iw reg set IL
245 model="TP-Link TL-WDR4300 (IL)"
246 ;;
247 "431000"*)
248 model="TP-Link TL-WDR4310"
249 ;;
250 "49000002")
251 model="TP-Link TL-WDR4900"
252 ;;
253 "65000002")
254 model="TP-Link TL-WDR6500"
255 ;;
256 "453000"*)
257 model="MERCURY MW4530R"
258 ;;
259 "934100"*)
260 model="NC-LINK SMART-300"
261 ;;
262 "c50000"*)
263 model="TP-Link Archer C5"
264 ;;
265 "750000"*|\
266 "c70000"*)
267 model="TP-Link Archer C7"
268 ;;
269 *)
270 hwver=""
271 ;;
272 esac
273
274 AR71XX_MODEL="$model $hwver"
275 }
276
277 tplink_pharos_get_model_string() {
278 local part
279 part=$(find_mtd_part 'product-info')
280 [ -z "$part" ] && return 1
281
282 # The returned string will end with \r\n, but we don't remove it here
283 # to simplify matching against it in the sysupgrade image check
284 dd if=$part bs=1 skip=4360 2>/dev/null | head -n 1
285 }
286
287 tplink_pharos_board_detect() {
288 local model_string="$(tplink_pharos_get_model_string | tr -d '\r')"
289 local oIFS="$IFS"; IFS=":"; set -- $model_string; IFS="$oIFS"
290 local model
291
292 case "$1" in
293 'CPE210(TP-LINK|UN|N300-2)')
294 model='TP-Link CPE210'
295 ;;
296 'CPE220(TP-LINK|UN|N300-2)')
297 model='TP-Link CPE220'
298 ;;
299 'CPE510(TP-LINK|UN|N300-5)')
300 model='TP-Link CPE510'
301 ;;
302 'CPE520(TP-LINK|UN|N300-5)')
303 model='TP-Link CPE520'
304 ;;
305 esac
306
307 [ -n "$model" ] && AR71XX_MODEL="$model v$2"
308 }
309
310 gl_inet_board_detect() {
311 local size="$(mtd_get_part_size 'firmware')"
312
313 case "$size" in
314 8192000)
315 AR71XX_MODEL='GL-iNet 6408A v1'
316 ;;
317 16580608)
318 AR71XX_MODEL='GL-iNet 6416A v1'
319 ;;
320 esac
321 }
322
323 ar71xx_board_detect() {
324 local machine
325 local name
326
327 machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo)
328
329 case "$machine" in
330 *"Oolite V1.0")
331 name="oolite"
332 ;;
333 *"AC1750DB")
334 name="f9k1115v2"
335 ;;
336 *"AirGateway")
337 name="airgateway"
338 ;;
339 *"AirGateway Pro")
340 name="airgatewaypro"
341 ;;
342 *"AirRouter")
343 name="airrouter"
344 ;;
345 *"ALFA Network AP96")
346 name="alfa-ap96"
347 ;;
348 *"ALFA Network N2/N5")
349 name="alfa-nx"
350 ;;
351 *ALL0258N)
352 name="all0258n"
353 ;;
354 *ALL0305)
355 name="all0305"
356 ;;
357 *ALL0315N)
358 name="all0315n"
359 ;;
360 *Antminer-S1)
361 name="antminer-s1"
362 ;;
363 *Antminer-S3)
364 name="antminer-s3"
365 ;;
366 *"Arduino Yun")
367 name="arduino-yun"
368 ;;
369 *AP113)
370 name="ap113"
371 ;;
372 *"AP121 reference board")
373 name="ap121"
374 ;;
375 *AP121-MINI)
376 name="ap121-mini"
377 ;;
378 *"AP132 reference board")
379 name="ap132"
380 ;;
381 *"AP136-010 reference board")
382 name="ap136-010"
383 ;;
384 *"AP136-020 reference board")
385 name="ap136-020"
386 ;;
387 *"AP135-020 reference board")
388 name="ap135-020"
389 ;;
390 *"AP143 reference board")
391 name="ap143"
392 ;;
393 *"AP147-010 reference board")
394 name="ap147-010"
395 ;;
396 *"AP152 reference board")
397 name="ap152"
398 ;;
399 *AP81)
400 name="ap81"
401 ;;
402 *AP83)
403 name="ap83"
404 ;;
405 *"Archer C5")
406 name="archer-c5"
407 ;;
408 *"Archer C7")
409 name="archer-c7"
410 ;;
411 *"Atheros AP96")
412 name="ap96"
413 ;;
414 *AW-NR580)
415 name="aw-nr580"
416 ;;
417 *CAP324)
418 name="cap324"
419 ;;
420 *C-55)
421 name="c-55"
422 ;;
423 *CAP4200AG)
424 name="cap4200ag"
425 ;;
426 *"COMFAST CF-E316N v2")
427 name="cf-e316n-v2"
428 ;;
429 *"CPE210/220/510/520")
430 name="cpe510"
431 tplink_pharos_board_detect
432 ;;
433 *CR3000)
434 name="cr3000"
435 ;;
436 *CR5000)
437 name="cr5000"
438 ;;
439 *"DB120 reference board")
440 name="db120"
441 ;;
442 *"DGL-5500 rev. A1")
443 name="dgl-5500-a1"
444 ;;
445 *"DHP-1565 rev. A1")
446 name="dhp-1565-a1"
447 ;;
448 *"DIR-505 rev. A1")
449 name="dir-505-a1"
450 ;;
451 *"DIR-600 rev. A1")
452 name="dir-600-a1"
453 ;;
454 *"DIR-615 rev. E1")
455 name="dir-615-e1"
456 ;;
457 *"DIR-615 rev. E4")
458 name="dir-615-e4"
459 ;;
460 *"DIR-615 rev. I1")
461 name="dir-615-i1"
462 ;;
463 *"DIR-825 rev. B1")
464 name="dir-825-b1"
465 ;;
466 *"DIR-825 rev. C1")
467 name="dir-825-c1"
468 ;;
469 *"DIR-835 rev. A1")
470 name="dir-835-a1"
471 ;;
472 *"dLAN Hotspot")
473 name="dlan-hotspot"
474 ;;
475 *"dLAN pro 500 Wireless+")
476 name="dlan-pro-500-wp"
477 ;;
478 *"dLAN pro 1200+ WiFi ac")
479 name="dlan-pro-1200-ac"
480 ;;
481 *DR344)
482 name="dr344"
483 ;;
484 *"Dragino v2")
485 name="dragino2"
486 ;;
487 *"Domino Pi")
488 name="gl-domino"
489 ;;
490 *"EAP300 v2")
491 name="eap300v2"
492 ;;
493 *EAP7660D)
494 name="eap7660d"
495 ;;
496 *EL-M150)
497 name="el-m150"
498 ;;
499 *EL-MINI)
500 name="el-mini"
501 ;;
502 *"GL-CONNECT INET v1")
503 name="gl-inet"
504 gl_inet_board_detect
505 ;;
506 *"GL AR150")
507 name="gl-ar150"
508 ;;
509 *"GL AR300")
510 name="gl-ar300"
511 ;;
512 *"EnGenius EPG5000")
513 name="epg5000"
514 ;;
515 *"EnGenius ESR1750")
516 name="esr1750"
517 ;;
518 *"EnGenius ESR900")
519 name="esr900"
520 ;;
521 *JA76PF)
522 name="ja76pf"
523 ;;
524 *JA76PF2)
525 name="ja76pf2"
526 ;;
527 *"Bullet M")
528 name="bullet-m"
529 ;;
530 *"Loco M XW")
531 name="loco-m-xw"
532 ;;
533 *"Nanostation M")
534 name="nanostation-m"
535 ;;
536 *"Nanostation M XW")
537 name="nanostation-m-xw"
538 ;;
539 *JWAP003)
540 name="jwap003"
541 ;;
542 *"Hornet-UB")
543 local size
544 size=$(awk '/firmware/ { print $2 }' /proc/mtd)
545
546 if [ "x$size" = "x00790000" ]; then
547 name="hornet-ub"
548 fi
549
550 if [ "x$size" = "x00f90000" ]; then
551 name="hornet-ub-x2"
552 fi
553 ;;
554 *LS-SR71)
555 name="ls-sr71"
556 ;;
557 *"MAC1200R")
558 name="mc-mac1200r"
559 ;;
560 *"MiniBox V1.0")
561 name="minibox-v1"
562 ;;
563 *MR12)
564 name="mr12"
565 ;;
566 *MR16)
567 name="mr16"
568 ;;
569 *MR18)
570 name="mr18"
571 ;;
572 *MR600v2)
573 name="mr600v2"
574 ;;
575 *MR1750)
576 name="mr1750"
577 ;;
578 *MR600)
579 name="mr600"
580 ;;
581 *MR900)
582 name="mr900"
583 ;;
584 *MR900v2)
585 name="mr900v2"
586 ;;
587 *"My Net N600")
588 name="mynet-n600"
589 ;;
590 *"My Net N750")
591 name="mynet-n750"
592 ;;
593 *"WD My Net Wi-Fi Range Extender")
594 name="mynet-rext"
595 ;;
596 *MZK-W04NU)
597 name="mzk-w04nu"
598 ;;
599 *MZK-W300NH)
600 name="mzk-w300nh"
601 ;;
602 *"NBG460N/550N/550NH")
603 name="nbg460n_550n_550nh"
604 ;;
605 *"Zyxel NBG6616")
606 name="nbg6616"
607 ;;
608 *"Zyxel NBG6716")
609 name="nbg6716"
610 ;;
611 *OM2P)
612 name="om2p"
613 ;;
614 *OM2Pv2)
615 name="om2pv2"
616 ;;
617 *"OM2P HS")
618 name="om2p-hs"
619 ;;
620 *"OM2P HSv2")
621 name="om2p-hsv2"
622 ;;
623 *"OM2P LC")
624 name="om2p-lc"
625 ;;
626 *OM5P)
627 name="om5p"
628 ;;
629 *"OM5P AN")
630 name="om5p-an"
631 ;;
632 *"Onion Omega")
633 name="onion-omega"
634 ;;
635 *PB42)
636 name="pb42"
637 ;;
638 *"PB44 reference board")
639 name="pb44"
640 ;;
641 *PB92)
642 name="pb92"
643 ;;
644 *"Qihoo 360 C301")
645 name="qihoo-c301"
646 ;;
647 *"RouterBOARD 411/A/AH")
648 name="rb-411"
649 ;;
650 *"RouterBOARD 411U")
651 name="rb-411u"
652 ;;
653 *"RouterBOARD 433/AH")
654 name="rb-433"
655 ;;
656 *"RouterBOARD 433UAH")
657 name="rb-433u"
658 ;;
659 *"RouterBOARD 435G")
660 name="rb-435g"
661 ;;
662 *"RouterBOARD 450")
663 name="rb-450"
664 ;;
665 *"RouterBOARD 450G")
666 name="rb-450g"
667 ;;
668 *"RouterBOARD 493/AH")
669 name="rb-493"
670 ;;
671 *"RouterBOARD 493G")
672 name="rb-493g"
673 ;;
674 *"RouterBOARD 750")
675 name="rb-750"
676 ;;
677 *"RouterBOARD 750GL")
678 name="rb-750gl"
679 ;;
680 *"RouterBOARD 751")
681 name="rb-751"
682 ;;
683 *"RouterBOARD 751G")
684 name="rb-751g"
685 ;;
686 *"RouterBOARD 911G-2HPnD")
687 name="rb-911g-2hpnd"
688 ;;
689 *"RouterBOARD 911G-5HPnD")
690 name="rb-911g-5hpnd"
691 ;;
692 *"RouterBOARD 911G-5HPacD")
693 name="rb-911g-5hpacd"
694 ;;
695 *"RouterBOARD 912UAG-2HPnD")
696 name="rb-912uag-2hpnd"
697 ;;
698 *"RouterBOARD 912UAG-5HPnD")
699 name="rb-912uag-5hpnd"
700 ;;
701 *"RouterBOARD 951G-2HnD")
702 name="rb-951g-2hnd"
703 ;;
704 *"RouterBOARD 951Ui-2HnD")
705 name="rb-951ui-2hnd"
706 ;;
707 *"RouterBOARD 2011L")
708 name="rb-2011l"
709 ;;
710 *"RouterBOARD 2011UAS")
711 name="rb-2011uas"
712 ;;
713 *"RouterBOARD 2011UiAS")
714 name="rb-2011uias"
715 ;;
716 *"RouterBOARD 2011UAS-2HnD")
717 name="rb-2011uas-2hnd"
718 ;;
719 *"RouterBOARD 2011UiAS-2HnD")
720 name="rb-2011uias-2hnd"
721 ;;
722 *"RouterBOARD SXT Lite2")
723 name="rb-sxt2n"
724 ;;
725 *"RouterBOARD SXT Lite5")
726 name="rb-sxt5n"
727 ;;
728 *"Rocket M")
729 name="rocket-m"
730 ;;
731 *"Rocket M TI")
732 name="rocket-m-ti"
733 ;;
734 *"Rocket M XW")
735 name="rocket-m-xw"
736 ;;
737 *RouterStation)
738 name="routerstation"
739 ;;
740 *"RouterStation Pro")
741 name="routerstation-pro"
742 ;;
743 *RW2458N)
744 name="rw2458n"
745 ;;
746 *"SMART-300")
747 name="smart-300"
748 ;;
749 "Smart Electronics Black Swift board"*)
750 name="bsb"
751 ;;
752 *TEW-632BRP)
753 name="tew-632brp"
754 ;;
755 *TEW-673GRU)
756 name="tew-673gru"
757 ;;
758 *TEW-712BR)
759 name="tew-712br"
760 ;;
761 *TEW-732BR)
762 name="tew-732br"
763 ;;
764 *TEW-823DRU)
765 name="tew-823dru"
766 ;;
767 *"TL-WR1041N v2")
768 name="tl-wr1041n-v2"
769 ;;
770 *TL-WR1043ND)
771 name="tl-wr1043nd"
772 ;;
773 *"TL-WR1043ND v2")
774 name="tl-wr1043nd-v2"
775 ;;
776 *TL-WR2543N*)
777 name="tl-wr2543n"
778 ;;
779 *"DIR-615 rev. C1")
780 name="dir-615-c1"
781 ;;
782 *TL-MR3020)
783 name="tl-mr3020"
784 ;;
785 *TL-MR3040)
786 name="tl-mr3040"
787 ;;
788 *"TL-MR3040 v2")
789 name="tl-mr3040-v2"
790 ;;
791 *TL-MR3220)
792 name="tl-mr3220"
793 ;;
794 *"TL-MR3220 v2")
795 name="tl-mr3220-v2"
796 ;;
797 *TL-MR3420)
798 name="tl-mr3420"
799 ;;
800 *"TL-MR3420 v2")
801 name="tl-mr3420-v2"
802 ;;
803 *"TL-WA701ND v2")
804 name="tl-wa701nd-v2"
805 ;;
806 *"TL-WA7210N v2")
807 name="tl-wa7210n-v2"
808 ;;
809 *TL-WA750RE)
810 name="tl-wa750re"
811 ;;
812 *"TL-WA7510N v1")
813 name="tl-wa7510n"
814 ;;
815 *TL-WA850RE)
816 name="tl-wa850re"
817 ;;
818 *TL-WA860RE)
819 name="tl-wa860re"
820 ;;
821 *"TL-WA830RE v2")
822 name="tl-wa830re-v2"
823 ;;
824 *"TL-WA801ND v2")
825 name="tl-wa801nd-v2"
826 ;;
827 *"TL-WA801ND v3")
828 name="tl-wa801nd-v3"
829 ;;
830 *TL-WA901ND)
831 name="tl-wa901nd"
832 ;;
833 *"TL-WA901ND v2")
834 name="tl-wa901nd-v2"
835 ;;
836 *"TL-WA901ND v3")
837 name="tl-wa901nd-v3"
838 ;;
839 *"TL-WDR3320 v2")
840 name="tl-wdr3320-v2"
841 ;;
842 *"TL-WDR3500")
843 name="tl-wdr3500"
844 ;;
845 *"TL-WDR3600/4300/4310")
846 name="tl-wdr4300"
847 ;;
848 *"TL-WDR4900 v2")
849 name="tl-wdr4900-v2"
850 ;;
851 *"TL-WDR6500 v2")
852 name="tl-wdr6500-v2"
853 ;;
854 *TL-WR741ND)
855 name="tl-wr741nd"
856 ;;
857 *"TL-WR741ND v4")
858 name="tl-wr741nd-v4"
859 ;;
860 *"TL-WR841N v1")
861 name="tl-wr841n-v1"
862 ;;
863 *"TL-WR841N/ND v7")
864 name="tl-wr841n-v7"
865 ;;
866 *"TL-WR841N/ND v8")
867 name="tl-wr841n-v8"
868 ;;
869 *"TL-WR841N/ND v9")
870 name="tl-wr841n-v9"
871 ;;
872 *"TL-WR842N/ND v2")
873 name="tl-wr842n-v2"
874 ;;
875 *TL-WR941ND)
876 name="tl-wr941nd"
877 ;;
878 *"TL-WR941N/ND v5")
879 name="tl-wr941nd-v5"
880 ;;
881 *"TL-WR941N/ND v6")
882 name="tl-wr941nd-v6"
883 ;;
884 *"TL-WR703N v1")
885 name="tl-wr703n"
886 ;;
887 *"TL-WR710N v1")
888 name="tl-wr710n"
889 ;;
890 *"TL-WR720N"*)
891 name="tl-wr720n-v3"
892 ;;
893 *"TL-MR10U")
894 name="tl-mr10u"
895 ;;
896 *"TL-MR11U")
897 name="tl-mr11u"
898 ;;
899 *"TL-MR12U")
900 name="tl-mr12u"
901 ;;
902 *"TL-MR13U v1")
903 name="tl-mr13u"
904 ;;
905 *"Tube2H")
906 name="tube2h"
907 ;;
908 *UniFi)
909 name="unifi"
910 ;;
911 *"UniFi-AC")
912 name="unifiac"
913 ;;
914 *"UniFi AP Pro")
915 name="uap-pro"
916 ;;
917 "WeIO"*)
918 name="weio"
919 ;;
920 *WHR-G301N)
921 name="whr-g301n"
922 ;;
923 *WHR-HP-GN)
924 name="whr-hp-gn"
925 ;;
926 *WLAE-AG300N)
927 name="wlae-ag300n"
928 ;;
929 *"UniFiAP Outdoor")
930 name="unifi-outdoor"
931 ;;
932 *"UniFiAP Outdoor+")
933 name="unifi-outdoor-plus"
934 ;;
935 *WP543)
936 name="wp543"
937 ;;
938 *WPE72)
939 name="wpe72"
940 ;;
941 *WPJ344)
942 name="wpj344"
943 ;;
944 *WPJ531)
945 name="wpj531"
946 ;;
947 *WPJ558)
948 name="wpj558"
949 ;;
950 *WNDAP360)
951 name="wndap360"
952 ;;
953 *"WNDR3700/WNDR3800/WNDRMAC")
954 wndr3700_board_detect "$machine"
955 ;;
956 *"R6100")
957 name="r6100"
958 ;;
959 *"WNDR3700v4")
960 name="wndr3700v4"
961 ;;
962 *"WNDR4300")
963 name="wndr4300"
964 ;;
965 *"WNR2000 V4")
966 name="wnr2000-v4"
967 ;;
968 *"WNR2000 V3")
969 name="wnr2000-v3"
970 ;;
971 *WNR2000)
972 name="wnr2000"
973 ;;
974 *WNR2200)
975 name="wnr2200"
976 ;;
977 *"WNR612 V2")
978 name="wnr612-v2"
979 ;;
980 *"WNR1000 V2")
981 name="wnr1000-v2"
982 ;;
983 *WPN824N)
984 name="wpn824n"
985 ;;
986 *WRT160NL)
987 name="wrt160nl"
988 ;;
989 *WRT400N)
990 name="wrt400n"
991 ;;
992 *"WZR-450HP2")
993 name="wzr-450hp2"
994 ;;
995 *"WZR-HP-AG300H/WZR-600DHP")
996 name="wzr-hp-ag300h"
997 ;;
998 *WZR-HP-G300NH)
999 name="wzr-hp-g300nh"
1000 ;;
1001 *WZR-HP-G450H)
1002 name="wzr-hp-g450h"
1003 ;;
1004 *WZR-HP-G300NH2)
1005 name="wzr-hp-g300nh2"
1006 ;;
1007 *WHR-HP-G300N)
1008 name="whr-hp-g300n"
1009 ;;
1010 *ZCN-1523H-2)
1011 name="zcn-1523h-2"
1012 ;;
1013 *ZCN-1523H-5)
1014 name="zcn-1523h-5"
1015 ;;
1016 *EmbWir-Dorin)
1017 name="ew-dorin"
1018 ;;
1019 *EmbWir-Dorin-Router)
1020 name="ew-dorin-router"
1021 ;;
1022 "8devices Carambola2"*)
1023 name="carambola2"
1024 ;;
1025 *"Sitecom WLR-8100")
1026 name="wlr8100"
1027 ;;
1028 *"BHU BXU2000n-2 rev. A1")
1029 name="bxu2000n-2-a1"
1030 ;;
1031 *"HiWiFi HC6361")
1032 name="hiwifi-hc6361"
1033 ;;
1034 esac
1035
1036 [ -z "$AR71XX_MODEL" ] && [ "${machine:0:8}" = 'TP-LINK ' ] && \
1037 tplink_board_detect "$machine"
1038
1039 [ -z "$name" ] && name="unknown"
1040
1041 [ -z "$AR71XX_BOARD_NAME" ] && AR71XX_BOARD_NAME="$name"
1042 [ -z "$AR71XX_MODEL" ] && AR71XX_MODEL="$machine"
1043
1044 [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
1045
1046 echo "$AR71XX_BOARD_NAME" > /tmp/sysinfo/board_name
1047 echo "$AR71XX_MODEL" > /tmp/sysinfo/model
1048 }
1049
1050 ar71xx_board_name() {
1051 local name
1052
1053 [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
1054 [ -z "$name" ] && name="unknown"
1055
1056 echo "$name"
1057 }