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