ar71xx: add support for RB750UPr2
[openwrt/staging/yousong.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 "083000"*)
225 model="TP-Link TL-WA830RE"
226
227 if [ "$hwver" = ' v10' ]; then
228 hwver=' v1'
229 fi
230 ;;
231 "084100"*)
232 model="TP-Link TL-WR841N/ND"
233
234 if [ "$hwid" = '08410002' -a "$mid" = '00000002' ]; then
235 hwver=' v1.5'
236 fi
237 ;;
238 "084200"*)
239 model="TP-Link TL-WR842N/ND"
240 ;;
241 "084300"*)
242 model="TP-Link TL-WR843N/ND"
243 ;;
244 "085000"*)
245 model="TP-Link TL-WA850RE"
246 ;;
247 "086000"*)
248 model="TP-Link TL-WA860RE"
249 ;;
250 "090100"*)
251 model="TP-Link TL-WA901N/ND"
252 ;;
253 "094000"*)
254 model="TP-Link TL-WR940N"
255 ;;
256 "094100"*)
257 if [ "$hwid" = "09410002" -a "$mid" = "00420001" ]; then
258 model="Rosewill RNX-N360RT"
259 hwver=""
260 else
261 model="TP-Link TL-WR941N/ND"
262 fi
263 ;;
264 "104100"*)
265 model="TP-Link TL-WR1041N/ND"
266 ;;
267 "104300"*)
268 model="TP-Link TL-WR1043N/ND"
269 ;;
270 "254300"*)
271 model="TP-Link TL-WR2543N/ND"
272 ;;
273 "001001"*)
274 model="TP-Link TL-MR10U"
275 ;;
276 "001101"*)
277 model="TP-Link TL-MR11U"
278 ;;
279 "001201"*)
280 model="TP-Link TL-MR12U"
281 ;;
282 "001301"*)
283 model="TP-Link TL-MR13U"
284 ;;
285 "302000"*)
286 model="TP-Link TL-MR3020"
287 ;;
288 "304000"*)
289 model="TP-Link TL-MR3040"
290 ;;
291 "322000"*)
292 model="TP-Link TL-MR3220"
293 ;;
294 "342000"*)
295 model="TP-Link TL-MR3420"
296 ;;
297 "332000"*)
298 model="TP-Link TL-WDR3320"
299 ;;
300 "350000"*)
301 model="TP-Link TL-WDR3500"
302 ;;
303 "360000"*)
304 model="TP-Link TL-WDR3600"
305 ;;
306 "430000"*)
307 model="TP-Link TL-WDR4300"
308 ;;
309 "430080"*)
310 iw reg set IL
311 model="TP-Link TL-WDR4300 (IL)"
312 ;;
313 "431000"*)
314 model="TP-Link TL-WDR4310"
315 ;;
316 "49000002")
317 model="TP-Link TL-WDR4900"
318 ;;
319 "65000002")
320 model="TP-Link TL-WDR6500"
321 ;;
322 "453000"*)
323 model="Mercury MW4530R"
324 ;;
325 "934100"*)
326 model="NC-LINK SMART-300"
327 ;;
328 "c50000"*)
329 model="TP-Link Archer C5"
330 ;;
331 "750000"*|\
332 "c70000"*)
333 model="TP-Link Archer C7"
334 ;;
335 *)
336 hwver=""
337 ;;
338 esac
339
340 AR71XX_MODEL="$model$hwver"
341 }
342
343 tplink_pharos_get_model_string() {
344 local part
345 part=$(find_mtd_part 'product-info')
346 [ -z "$part" ] && return 1
347
348 # The returned string will end with \r\n, but we don't remove it here
349 # to simplify matching against it in the sysupgrade image check
350 dd if=$part bs=1 skip=4360 2>/dev/null | head -n 1
351 }
352
353 tplink_pharos_board_detect() {
354 local model_string="$(tplink_pharos_get_model_string | tr -d '\r')"
355 local oIFS="$IFS"; IFS=":"; set -- $model_string; IFS="$oIFS"
356
357 local model="${1%%\(*}"
358
359 AR71XX_MODEL="TP-Link $model v$2"
360 }
361
362 gl_inet_board_detect() {
363 local size="$(mtd_get_part_size 'firmware')"
364
365 case "$size" in
366 8192000)
367 AR71XX_MODEL='GL-iNet 6408A v1'
368 ;;
369 16580608)
370 AR71XX_MODEL='GL-iNet 6416A v1'
371 ;;
372 esac
373 }
374
375 ar71xx_board_detect() {
376 local machine
377 local name
378
379 machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo)
380
381 case "$machine" in
382 *"Oolite V1.0")
383 name="oolite"
384 ;;
385 *"A40")
386 name="a40"
387 ;;
388 *"A60")
389 name="a60"
390 ;;
391 *"AC1750DB")
392 name="f9k1115v2"
393 ;;
394 *"AirGateway")
395 name="airgateway"
396 ;;
397 *"AirGateway Pro")
398 name="airgatewaypro"
399 ;;
400 *"AirRouter")
401 name="airrouter"
402 ;;
403 *"ALFA Network AP120C")
404 name="alfa-ap120c"
405 ;;
406 *"ALFA Network AP96")
407 name="alfa-ap96"
408 ;;
409 *"ALFA Network N2/N5")
410 name="alfa-nx"
411 ;;
412 *ALL0258N)
413 name="all0258n"
414 ;;
415 *ALL0305)
416 name="all0305"
417 ;;
418 *ALL0315N)
419 name="all0315n"
420 ;;
421 *Antminer-S1)
422 name="antminer-s1"
423 ;;
424 *Antminer-S3)
425 name="antminer-s3"
426 ;;
427 *"Arduino Yun")
428 name="arduino-yun"
429 ;;
430 *"AP121 reference board")
431 name="ap121"
432 ;;
433 *AP121-MINI)
434 name="ap121-mini"
435 ;;
436 *"AP132 reference board")
437 name="ap132"
438 ;;
439 *"AP136-010 reference board")
440 name="ap136-010"
441 ;;
442 *"AP136-020 reference board")
443 name="ap136-020"
444 ;;
445 *"AP135-020 reference board")
446 name="ap135-020"
447 ;;
448 *"AP143 reference board")
449 name="ap143"
450 ;;
451 *"AP147-010 reference board")
452 name="ap147-010"
453 ;;
454 *"AP152 reference board")
455 name="ap152"
456 ;;
457 *AP90Q)
458 name="ap90q"
459 ;;
460 *"Archer C5")
461 name="archer-c5"
462 ;;
463 *"Archer C59 v1")
464 name="archer-c59-v1"
465 ;;
466 *"Archer C60 v1")
467 name="archer-c60-v1"
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 *"EBR-2310 rev. C1")
617 name="ebr-2310-c1"
618 ;;
619 *EL-M150)
620 name="el-m150"
621 ;;
622 *EL-MINI)
623 name="el-mini"
624 ;;
625 *"GL-CONNECT INET v1")
626 name="gl-inet"
627 gl_inet_board_detect
628 ;;
629 *"GL AR150")
630 name="gl-ar150"
631 ;;
632 *"GL AR300")
633 name="gl-ar300"
634 ;;
635 *"GL-AR300M")
636 name="gl-ar300m"
637 ;;
638 *"GL-MIFI")
639 name="gl-mifi"
640 ;;
641 *"EnGenius EPG5000")
642 name="epg5000"
643 ;;
644 *"EnGenius ESR1750")
645 name="esr1750"
646 ;;
647 *"EnGenius ESR900")
648 name="esr900"
649 ;;
650 *JA76PF)
651 name="ja76pf"
652 ;;
653 *JA76PF2)
654 name="ja76pf2"
655 ;;
656 *"Bullet M")
657 name="bullet-m"
658 ubnt_xm_board_detect
659 ;;
660 *"Loco M XW")
661 name="loco-m-xw"
662 ;;
663 *"Nanostation M")
664 name="nanostation-m"
665 ubnt_xm_board_detect
666 ;;
667 *"Nanostation M XW")
668 name="nanostation-m-xw"
669 ;;
670 *JWAP003)
671 name="jwap003"
672 ;;
673 *JWAP230)
674 name="jwap230"
675 ;;
676 *"Hornet-UB")
677 local size
678 size=$(awk '/firmware/ { print $2 }' /proc/mtd)
679
680 if [ "x$size" = "x00790000" ]; then
681 name="hornet-ub"
682 fi
683
684 if [ "x$size" = "x00f90000" ]; then
685 name="hornet-ub-x2"
686 fi
687 ;;
688 *LS-SR71)
689 name="ls-sr71"
690 ;;
691 *"MAC1200R")
692 name="mc-mac1200r"
693 ;;
694 *"MiniBox V1.0")
695 name="minibox-v1"
696 ;;
697 *MR12)
698 name="mr12"
699 ;;
700 *MR16)
701 name="mr16"
702 ;;
703 *MR18)
704 name="mr18"
705 ;;
706 *MR600v2)
707 name="mr600v2"
708 ;;
709 *MR1750)
710 name="mr1750"
711 ;;
712 *MR1750v2)
713 name="mr1750v2"
714 ;;
715 *MR600)
716 name="mr600"
717 ;;
718 *MR900)
719 name="mr900"
720 ;;
721 *MR900v2)
722 name="mr900v2"
723 ;;
724 *"My Net N600")
725 name="mynet-n600"
726 ;;
727 *"My Net N750")
728 name="mynet-n750"
729 ;;
730 *"WD My Net Wi-Fi Range Extender")
731 name="mynet-rext"
732 ;;
733 *MZK-W04NU)
734 name="mzk-w04nu"
735 ;;
736 *MZK-W300NH)
737 name="mzk-w300nh"
738 ;;
739 *"NBG460N/550N/550NH")
740 name="nbg460n_550n_550nh"
741 ;;
742 *"Zyxel NBG6616")
743 name="nbg6616"
744 ;;
745 *"Zyxel NBG6716")
746 name="nbg6716"
747 ;;
748 *OM2P)
749 name="om2p"
750 ;;
751 *OM2Pv2)
752 name="om2pv2"
753 ;;
754 *OM2Pv4)
755 name="om2pv4"
756 ;;
757 *"OM2P HS")
758 name="om2p-hs"
759 ;;
760 *"OM2P HSv2")
761 name="om2p-hsv2"
762 ;;
763 *"OM2P HSv3")
764 name="om2p-hsv3"
765 ;;
766 *"OM2P HSv4")
767 name="om2p-hsv4"
768 ;;
769 *"OM2P LC")
770 name="om2p-lc"
771 ;;
772 *OM5P)
773 name="om5p"
774 ;;
775 *"OM5P AN")
776 name="om5p-an"
777 ;;
778 *"OM5P AC")
779 name="om5p-ac"
780 ;;
781 *"OM5P ACv2")
782 name="om5p-acv2"
783 ;;
784 *"OMY-X1")
785 name="omy-x1"
786 ;;
787 *"OMY-G1")
788 name="omy-g1"
789 ;;
790 *"Onion Omega")
791 name="onion-omega"
792 ;;
793 *PB42)
794 name="pb42"
795 ;;
796 *"PB44 reference board")
797 name="pb44"
798 ;;
799 *"PQI Air Pen")
800 name="pqi-air-pen"
801 ;;
802 *"Qihoo 360 C301")
803 name="qihoo-c301"
804 ;;
805 *"RE450")
806 name="re450"
807 ;;
808 *"RouterBOARD 411/A/AH")
809 name="rb-411"
810 ;;
811 *"RouterBOARD 411U")
812 name="rb-411u"
813 ;;
814 *"RouterBOARD 433/AH")
815 name="rb-433"
816 ;;
817 *"RouterBOARD 433UAH")
818 name="rb-433u"
819 ;;
820 *"RouterBOARD 435G")
821 name="rb-435g"
822 ;;
823 *"RouterBOARD 450")
824 name="rb-450"
825 ;;
826 *"RouterBOARD 450G")
827 name="rb-450g"
828 ;;
829 *"RouterBOARD 493/AH")
830 name="rb-493"
831 ;;
832 *"RouterBOARD 493G")
833 name="rb-493g"
834 ;;
835 *"RouterBOARD 750")
836 name="rb-750"
837 ;;
838 *"RouterBOARD 750GL")
839 name="rb-750gl"
840 ;;
841 *"RouterBOARD 750UP r2")
842 name="rb-750up-r2"
843 ;;
844 *"RouterBOARD 751")
845 name="rb-751"
846 ;;
847 *"RouterBOARD 751G")
848 name="rb-751g"
849 ;;
850 *"RouterBOARD 911G-2HPnD")
851 name="rb-911g-2hpnd"
852 ;;
853 *"RouterBOARD 911G-5HPnD")
854 name="rb-911g-5hpnd"
855 ;;
856 *"RouterBOARD 911G-5HPacD")
857 name="rb-911g-5hpacd"
858 ;;
859 *"RouterBOARD 912UAG-2HPnD")
860 name="rb-912uag-2hpnd"
861 ;;
862 *"RouterBOARD 912UAG-5HPnD")
863 name="rb-912uag-5hpnd"
864 ;;
865 *"RouterBOARD 941-2nD")
866 name="rb-941-2nd"
867 ;;
868 *"RouterBOARD 951G-2HnD")
869 name="rb-951g-2hnd"
870 ;;
871 *"RouterBOARD 951Ui-2HnD")
872 name="rb-951ui-2hnd"
873 ;;
874 *"951Ui-2nD")
875 name="rb-951ui-2nd"
876 ;;
877 *"RouterBOARD 2011L")
878 name="rb-2011l"
879 ;;
880 *"RouterBOARD 2011UAS")
881 name="rb-2011uas"
882 ;;
883 *"RouterBOARD 2011UiAS")
884 name="rb-2011uias"
885 ;;
886 *"RouterBOARD 2011UAS-2HnD")
887 name="rb-2011uas-2hnd"
888 ;;
889 *"RouterBOARD 2011UiAS-2HnD")
890 name="rb-2011uias-2hnd"
891 ;;
892 *"RouterBOARD mAP L-2nD")
893 name="rb-mapl-2nd"
894 ;;
895 *"RouterBOARD SXT Lite2")
896 name="rb-sxt2n"
897 ;;
898 *"RouterBOARD SXT Lite5")
899 name="rb-sxt5n"
900 ;;
901 *"Rocket M")
902 name="rocket-m"
903 ubnt_xm_board_detect
904 ;;
905 *"Rocket M TI")
906 name="rocket-m-ti"
907 ;;
908 *"Rocket M XW")
909 name="rocket-m-xw"
910 ;;
911 *RouterStation)
912 name="routerstation"
913 ;;
914 *"RouterStation Pro")
915 name="routerstation-pro"
916 ;;
917 *RW2458N)
918 name="rw2458n"
919 ;;
920 *SC1750)
921 name="sc1750"
922 ;;
923 *SC300M)
924 name="sc300m"
925 ;;
926 *SC450)
927 name="sc450"
928 ;;
929 *"SMART-300")
930 name="smart-300"
931 ;;
932 "Smart Electronics Black Swift board"*)
933 name="bsb"
934 ;;
935 *"Telldus TellStick ZNet Lite")
936 name="tellstick-znet-lite"
937 ;;
938 *SOM9331)
939 name="som9331"
940 ;;
941 *SR3200)
942 name="sr3200"
943 ;;
944 *TEW-632BRP)
945 name="tew-632brp"
946 ;;
947 *TEW-673GRU)
948 name="tew-673gru"
949 ;;
950 *TEW-712BR)
951 name="tew-712br"
952 ;;
953 *TEW-732BR)
954 name="tew-732br"
955 ;;
956 *TEW-823DRU)
957 name="tew-823dru"
958 ;;
959 *"TL-WR1041N v2")
960 name="tl-wr1041n-v2"
961 ;;
962 *TL-WR1043ND)
963 name="tl-wr1043nd"
964 ;;
965 *"TL-WR1043ND v2")
966 name="tl-wr1043nd-v2"
967 ;;
968 *"TL-WR1043ND v4")
969 name="tl-wr1043nd-v4"
970 ;;
971 *TL-WR2543N*)
972 name="tl-wr2543n"
973 ;;
974 *"DIR-615 rev. C1")
975 name="dir-615-c1"
976 ;;
977 *TL-MR3020)
978 name="tl-mr3020"
979 ;;
980 *TL-MR3040)
981 name="tl-mr3040"
982 ;;
983 *"TL-MR3040 v2")
984 name="tl-mr3040-v2"
985 ;;
986 *TL-MR3220)
987 name="tl-mr3220"
988 ;;
989 *"TL-MR3220 v2")
990 name="tl-mr3220-v2"
991 ;;
992 *TL-MR3420)
993 name="tl-mr3420"
994 ;;
995 *"TL-MR3420 v2")
996 name="tl-mr3420-v2"
997 ;;
998 *"TL-WA701ND v2")
999 name="tl-wa701nd-v2"
1000 ;;
1001 *"TL-WA7210N v2")
1002 name="tl-wa7210n-v2"
1003 ;;
1004 *TL-WA750RE)
1005 name="tl-wa750re"
1006 ;;
1007 *"TL-WA7510N v1")
1008 name="tl-wa7510n"
1009 ;;
1010 *TL-WA850RE)
1011 name="tl-wa850re"
1012 ;;
1013 *"TL-WA850RE v2")
1014 name="tl-wa850re-v2"
1015 ;;
1016 *TL-WA860RE)
1017 name="tl-wa860re"
1018 ;;
1019 *"TL-WA830RE v2")
1020 name="tl-wa830re-v2"
1021 ;;
1022 *"TL-WA801ND v2")
1023 name="tl-wa801nd-v2"
1024 ;;
1025 *"TL-WA801ND v3")
1026 name="tl-wa801nd-v3"
1027 ;;
1028 *"TL-WR802N v1")
1029 name="tl-wr802n-v1"
1030 ;;
1031 *TL-WA901ND)
1032 name="tl-wa901nd"
1033 ;;
1034 *"TL-WA901ND v2")
1035 name="tl-wa901nd-v2"
1036 ;;
1037 *"TL-WA901ND v3")
1038 name="tl-wa901nd-v3"
1039 ;;
1040 *"TL-WA901ND v4")
1041 name="tl-wa901nd-v4"
1042 ;;
1043 *"TL-WDR3320 v2")
1044 name="tl-wdr3320-v2"
1045 ;;
1046 *"TL-WDR3500")
1047 name="tl-wdr3500"
1048 ;;
1049 *"TL-WDR3600/4300/4310")
1050 name="tl-wdr4300"
1051 ;;
1052 *"TL-WDR4900 v2")
1053 name="tl-wdr4900-v2"
1054 ;;
1055 *"TL-WDR6500 v2")
1056 name="tl-wdr6500-v2"
1057 ;;
1058 *TL-WPA8630)
1059 name="tl-wpa8630"
1060 ;;
1061 *TL-WR741ND)
1062 name="tl-wr741nd"
1063 ;;
1064 *"TL-WR741ND v4")
1065 name="tl-wr741nd-v4"
1066 ;;
1067 *"TL-WR841N v1")
1068 name="tl-wr841n-v1"
1069 ;;
1070 *"TL-WR841N/ND v7")
1071 name="tl-wr841n-v7"
1072 ;;
1073 *"TL-WR841N/ND v8")
1074 name="tl-wr841n-v8"
1075 ;;
1076 *"TL-WR841N/ND v9")
1077 name="tl-wr841n-v9"
1078 ;;
1079 *"TL-WR841N/ND v11")
1080 name="tl-wr841n-v11"
1081 ;;
1082 *"TL-WR842N/ND v2")
1083 name="tl-wr842n-v2"
1084 ;;
1085 *"TL-WR842N/ND v3")
1086 name="tl-wr842n-v3"
1087 ;;
1088 *TL-WR941ND)
1089 name="tl-wr941nd"
1090 ;;
1091 *"TL-WR941N/ND v5")
1092 name="tl-wr941nd-v5"
1093 ;;
1094 *"TL-WR941N/ND v6")
1095 name="tl-wr941nd-v6"
1096 ;;
1097 *"TL-WR940N v4")
1098 name="tl-wr940n-v4"
1099 ;;
1100 *"TL-WR703N v1")
1101 name="tl-wr703n"
1102 ;;
1103 *"TL-WR710N v1")
1104 name="tl-wr710n"
1105 ;;
1106 *"TL-WR720N"*)
1107 name="tl-wr720n-v3"
1108 ;;
1109 *"TL-WR810N")
1110 name="tl-wr810n"
1111 ;;
1112 *"TL-MR10U")
1113 name="tl-mr10u"
1114 ;;
1115 *"TL-MR11U")
1116 name="tl-mr11u"
1117 ;;
1118 *"TL-MR12U")
1119 name="tl-mr12u"
1120 ;;
1121 *"TL-MR13U v1")
1122 name="tl-mr13u"
1123 ;;
1124 *"Tube2H")
1125 name="tube2h"
1126 ;;
1127 *UniFi)
1128 name="unifi"
1129 ;;
1130 *"UniFi-AC-LITE")
1131 name="unifiac-lite"
1132 ;;
1133 *"UniFi-AC-PRO")
1134 name="unifiac-pro"
1135 ;;
1136 *"UniFi AP Pro")
1137 name="uap-pro"
1138 ;;
1139 "WeIO"*)
1140 name="weio"
1141 ;;
1142 *WHR-G301N)
1143 name="whr-g301n"
1144 ;;
1145 *WHR-HP-GN)
1146 name="whr-hp-gn"
1147 ;;
1148 *WLAE-AG300N)
1149 name="wlae-ag300n"
1150 ;;
1151 *"UniFiAP Outdoor")
1152 name="unifi-outdoor"
1153 ;;
1154 *"UniFiAP Outdoor+")
1155 name="unifi-outdoor-plus"
1156 ;;
1157 *WP543)
1158 name="wp543"
1159 ;;
1160 *WPE72)
1161 name="wpe72"
1162 ;;
1163 *WPJ342)
1164 name="wpj342"
1165 ;;
1166 *WPJ344)
1167 name="wpj344"
1168 ;;
1169 *WPJ531)
1170 name="wpj531"
1171 ;;
1172 *WPJ558)
1173 name="wpj558"
1174 ;;
1175 *WNDAP360)
1176 name="wndap360"
1177 ;;
1178 *"WNDR3700/WNDR3800/WNDRMAC")
1179 wndr3700_board_detect "$machine"
1180 ;;
1181 *"R6100")
1182 name="r6100"
1183 ;;
1184 *"WNDR3700v4")
1185 name="wndr3700v4"
1186 ;;
1187 *"WNDR4300")
1188 name="wndr4300"
1189 ;;
1190 *"WNR2000 V4")
1191 name="wnr2000-v4"
1192 ;;
1193 *"WNR2000 V3")
1194 name="wnr2000-v3"
1195 ;;
1196 *WNR2000)
1197 name="wnr2000"
1198 ;;
1199 *WNR2200)
1200 name="wnr2200"
1201 ;;
1202 *"WNR612 V2")
1203 name="wnr612-v2"
1204 ;;
1205 *"WNR1000 V2")
1206 name="wnr1000-v2"
1207 ;;
1208 *WPN824N)
1209 name="wpn824n"
1210 ;;
1211 *WRT160NL)
1212 name="wrt160nl"
1213 ;;
1214 *WRT400N)
1215 name="wrt400n"
1216 ;;
1217 *"WRTnode2Q board")
1218 name="wrtnode2q"
1219 ;;
1220 *"WZR-450HP2")
1221 name="wzr-450hp2"
1222 ;;
1223 *"WZR-HP-AG300H/WZR-600DHP")
1224 name="wzr-hp-ag300h"
1225 ;;
1226 *WZR-HP-G300NH)
1227 name="wzr-hp-g300nh"
1228 ;;
1229 *WZR-HP-G450H)
1230 name="wzr-hp-g450h"
1231 ;;
1232 *WZR-HP-G300NH2)
1233 name="wzr-hp-g300nh2"
1234 ;;
1235 *WHR-HP-G300N)
1236 name="whr-hp-g300n"
1237 ;;
1238 *XD3200)
1239 name="xd3200"
1240 ;;
1241 *Z1)
1242 name="z1"
1243 ;;
1244 *ZBT-WE1526)
1245 name="zbt-we1526"
1246 ;;
1247 *ZCN-1523H-2)
1248 name="zcn-1523h-2"
1249 ;;
1250 *ZCN-1523H-5)
1251 name="zcn-1523h-5"
1252 ;;
1253 *EmbWir-Dorin)
1254 name="ew-dorin"
1255 ;;
1256 *EmbWir-Dorin-Router)
1257 name="ew-dorin-router"
1258 ;;
1259 "8devices Carambola2"*)
1260 name="carambola2"
1261 ;;
1262 *"Sitecom WLR-8100")
1263 name="wlr8100"
1264 ;;
1265 *"BHU BXU2000n-2 rev. A1")
1266 name="bxu2000n-2-a1"
1267 ;;
1268 *"HiWiFi HC6361")
1269 name="hiwifi-hc6361"
1270 ;;
1271 esac
1272
1273 [ -z "$AR71XX_MODEL" ] && [ "${machine:0:8}" = 'TP-LINK ' ] && \
1274 tplink_board_detect "$machine"
1275
1276 [ -z "$name" ] && name="unknown"
1277
1278 [ -z "$AR71XX_BOARD_NAME" ] && AR71XX_BOARD_NAME="$name"
1279 [ -z "$AR71XX_MODEL" ] && AR71XX_MODEL="$machine"
1280
1281 [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
1282
1283 echo "$AR71XX_BOARD_NAME" > /tmp/sysinfo/board_name
1284 echo "$AR71XX_MODEL" > /tmp/sysinfo/model
1285 }
1286
1287 ar71xx_board_name() {
1288 local name
1289
1290 [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
1291 [ -z "$name" ] && name="unknown"
1292
1293 echo "$name"
1294 }