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