ar71xx: Add support for PISEN TS-D084
[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 ubnt_ac_lite_get_mtd_part_magic() {
102 ar71xx_get_mtd_offset_size_format EEPROM 12 2 %02x
103 }
104
105 ubnt_ac_lite_board_detect() {
106 local model
107 local magic
108
109 magic="$(ubnt_ac_lite_get_mtd_part_magic)"
110 case ${magic:0:4} in
111 "e517")
112 model="Ubiquiti UniFi-AC-LITE"
113 ;;
114 "e557")
115 model="Ubiquiti UniFi-AC-MESH"
116 ;;
117 esac
118
119 [ -z "$model" ] || AR71XX_MODEL="${model}"
120 }
121
122 cybertan_get_hw_magic() {
123 local part
124
125 part=$(find_mtd_part firmware)
126 [ -z "$part" ] && return 1
127
128 dd bs=8 count=1 skip=0 if=$part 2>/dev/null | hexdump -v -n 8 -e '1/1 "%02x"'
129 }
130
131 dir505_board_detect() {
132 local dev=$(find_mtd_part 'mac')
133 [ -z "$dev" ] && return
134
135 # The revision is stored at the beginning of the "mac" partition
136 local rev="$(LC_CTYPE=C awk -v 'FS=[^[:print:]]' '{print $1; exit}' $dev)"
137 AR71XX_MODEL="D-Link DIR-505 rev. $rev"
138 }
139
140 tplink_get_hwid() {
141 local part
142
143 part=$(find_mtd_part firmware)
144 [ -z "$part" ] && return 1
145
146 dd if=$part bs=4 count=1 skip=16 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
147 }
148
149 tplink_get_mid() {
150 local part
151
152 part=$(find_mtd_part firmware)
153 [ -z "$part" ] && return 1
154
155 dd if=$part bs=4 count=1 skip=17 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
156 }
157
158 tplink_board_detect() {
159 local model="$1"
160 local hwid
161 local hwver
162
163 hwid=$(tplink_get_hwid)
164 mid=$(tplink_get_mid)
165 hwver=${hwid:6:2}
166 hwver=" v${hwver#0}"
167
168 case "$hwid" in
169 "001001"*)
170 model="TP-Link TL-MR10U"
171 ;;
172 "001101"*)
173 model="TP-Link TL-MR11U"
174 ;;
175 "001201"*)
176 model="TP-Link TL-MR12U"
177 ;;
178 "001301"*)
179 model="TP-Link TL-MR13U"
180 ;;
181 "007260"*)
182 model="TellStick ZNet Lite"
183 ;;
184 "015000"*)
185 model="EasyLink EL-M150"
186 ;;
187 "015300"*)
188 model="EasyLink EL-MINI"
189 ;;
190 "044401"*)
191 model="ANTMINER-S1"
192 ;;
193 "044403"*)
194 model="ANTMINER-S3"
195 ;;
196 "066601"*)
197 model="OMYlink OMY-G1"
198 ;;
199 "066602"*)
200 model="OMYlink OMY-X1"
201 ;;
202 "070100"*)
203 model="TP-Link TL-WA701N/ND"
204 ;;
205 "070301"*)
206 model="TP-Link TL-WR703N"
207 ;;
208 "071000"*)
209 model="TP-Link TL-WR710N"
210
211 [ "$hwid" = '07100002' -a "$mid" = '00000002' ] && hwver=' v2.1'
212 ;;
213 "072001"*)
214 model="TP-Link TL-WR720N"
215 ;;
216 "073000"*)
217 model="TP-Link TL-WA730RE"
218 ;;
219 "074000"*)
220 model="TP-Link TL-WR740N/ND"
221 ;;
222 "074100"*)
223 model="TP-Link TL-WR741N/ND"
224 ;;
225 "074300"*)
226 model="TP-Link TL-WR743N/ND"
227 ;;
228 "075000"*)
229 model="TP-Link TL-WA750RE"
230 ;;
231 "080100"*)
232 model="TP-Link TL-WA801N/ND"
233 ;;
234 "080200"*)
235 model="TP-Link TL-WR802N"
236
237 [ "$hwid" = '08020002' -a "$mid" = '00000002' ] && hwver=' v2'
238 ;;
239 "081000"*)
240 model="TP-Link TL-WR810N"
241 ;;
242 "083000"*)
243 model="TP-Link TL-WA830RE"
244
245 [ "$hwver" = ' v10' ] && hwver=' v1'
246 ;;
247 "084100"*)
248 model="TP-Link TL-WR841N/ND"
249
250 [ "$hwid" = '08410002' -a "$mid" = '00000002' ] && hwver=' v1.5'
251 ;;
252 "084200"*)
253 model="TP-Link TL-WR842N/ND"
254 ;;
255 "084300"*)
256 model="TP-Link TL-WR843N/ND"
257 ;;
258 "085000"*)
259 model="TP-Link TL-WA850RE"
260 ;;
261 "085500"*)
262 model="TP-Link TL-WA855RE"
263 ;;
264 "086000"*)
265 model="TP-Link TL-WA860RE"
266 ;;
267 "090100"*)
268 model="TP-Link TL-WA901N/ND"
269 ;;
270 "094000"*)
271 model="TP-Link TL-WR940N"
272 ;;
273 "094100"*)
274 model="TP-Link TL-WR941N/ND"
275
276 [ "$hwid" = "09410002" -a "$mid" = "00420001" ] && {
277 model="Rosewill RNX-N360RT"
278 hwver=""
279 }
280 ;;
281 "104100"*)
282 model="TP-Link TL-WR1041N/ND"
283 ;;
284 "104300"*)
285 model="TP-Link TL-WR1043N/ND"
286 ;;
287 "120000"*)
288 model="MERCURY MAC1200R"
289 ;;
290 "254300"*)
291 model="TP-Link TL-WR2543N/ND"
292 ;;
293 "302000"*)
294 model="TP-Link TL-MR3020"
295 ;;
296 "304000"*)
297 model="TP-Link TL-MR3040"
298 ;;
299 "322000"*)
300 model="TP-Link TL-MR3220"
301 ;;
302 "332000"*)
303 model="TP-Link TL-WDR3320"
304 ;;
305 "342000"*)
306 model="TP-Link TL-MR3420"
307 ;;
308 "350000"*)
309 model="TP-Link TL-WDR3500"
310 ;;
311 "360000"*)
312 model="TP-Link TL-WDR3600"
313 ;;
314 "430000"*)
315 model="TP-Link TL-WDR4300"
316 ;;
317 "430080"*)
318 iw reg set IL
319 model="TP-Link TL-WDR4300 (IL)"
320 ;;
321 "431000"*)
322 model="TP-Link TL-WDR4310"
323 ;;
324 "44440101"*)
325 model="ANTROUTER-R1"
326 ;;
327 "453000"*)
328 model="Mercury MW4530R"
329 ;;
330 "49000002")
331 model="TP-Link TL-WDR4900"
332 ;;
333 "640000"*)
334 model="TP-Link TL-MR6400"
335 ;;
336 "65000002")
337 model="TP-Link TL-WDR6500"
338 ;;
339 "721000"*)
340 model="TP-Link TL-WA7210N"
341 ;;
342 "750000"*|\
343 "c70000"*)
344 model="TP-Link Archer C7"
345 ;;
346 "751000"*)
347 model="TP-Link TL-WA7510N"
348 ;;
349 "934100"*)
350 model="NC-LINK SMART-300"
351 ;;
352 "c50000"*)
353 model="TP-Link Archer C5"
354 ;;
355 *)
356 hwver=""
357 ;;
358 esac
359
360 AR71XX_MODEL="$model$hwver"
361 }
362
363 tplink_pharos_get_model_string() {
364 local part
365 part=$(find_mtd_part 'product-info')
366 [ -z "$part" ] && return 1
367
368 # The returned string will end with \r\n, but we don't remove it here
369 # to simplify matching against it in the sysupgrade image check
370 dd if=$part bs=1 skip=4360 2>/dev/null | head -n 1
371 }
372
373 tplink_pharos_board_detect() {
374 local model_string="$(tplink_pharos_get_model_string | tr -d '\r')"
375 local oIFS="$IFS"; IFS=":"; set -- $model_string; IFS="$oIFS"
376
377 local model="${1%%\(*}"
378
379 AR71XX_MODEL="TP-Link $model v$2"
380 }
381
382 ar71xx_board_detect() {
383 local machine
384 local name
385
386 machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo)
387
388 case "$machine" in
389 *"A40")
390 name="a40"
391 ;;
392 *"A60")
393 name="a60"
394 ;;
395 *"AC1750DB")
396 name="f9k1115v2"
397 ;;
398 *"AirGateway")
399 name="airgateway"
400 ;;
401 *"AirGateway Pro")
402 name="airgatewaypro"
403 ;;
404 *"AirRouter")
405 name="airrouter"
406 ;;
407 *"ALFA Network AP120C")
408 name="alfa-ap120c"
409 ;;
410 *"ALFA Network AP96")
411 name="alfa-ap96"
412 ;;
413 *"ALFA Network N2/N5")
414 name="alfa-nx"
415 ;;
416 *"ALL0258N")
417 name="all0258n"
418 ;;
419 *"ALL0305")
420 name="all0305"
421 ;;
422 *"ALL0315N")
423 name="all0315n"
424 ;;
425 *"Antminer-S1")
426 name="antminer-s1"
427 ;;
428 *"Antminer-S3")
429 name="antminer-s3"
430 ;;
431 *"AP121 reference board")
432 name="ap121"
433 ;;
434 *"AP121-MINI")
435 name="ap121-mini"
436 ;;
437 *"AP121F")
438 name="ap121f"
439 ;;
440 *"AP132 reference board")
441 name="ap132"
442 ;;
443 *"AP135-020 reference board")
444 name="ap135-020"
445 ;;
446 *"AP136-010 reference board")
447 name="ap136-010"
448 ;;
449 *"AP136-020 reference board")
450 name="ap136-020"
451 ;;
452 *"AP143 reference board")
453 name="ap143"
454 ;;
455 *"AP147-010 reference board")
456 name="ap147-010"
457 ;;
458 *"AP152 reference board")
459 name="ap152"
460 ;;
461 *"AP531B0")
462 name="ap531b0"
463 ;;
464 *"AP90Q")
465 name="ap90q"
466 ;;
467 *"AP91-5G")
468 name="ap91-5g"
469 ;;
470 *"Archer C25 v1")
471 name="archer-c25-v1"
472 ;;
473 *"Archer C5")
474 name="archer-c5"
475 ;;
476 *"Archer C7 v4")
477 name="archer-c7-v4"
478 ;;
479 *"Archer C58 v1")
480 name="archer-c58-v1"
481 ;;
482 *"Archer C59 v1")
483 name="archer-c59-v1"
484 ;;
485 *"Archer C60 v1")
486 name="archer-c60-v1"
487 ;;
488 *"Archer C60 v2")
489 name="archer-c60-v2"
490 ;;
491 *"Archer C7")
492 name="archer-c7"
493 ;;
494 *"Arduino Yun")
495 name="arduino-yun"
496 ;;
497 *"Atheros AP96")
498 name="ap96"
499 ;;
500 *"AW-NR580")
501 name="aw-nr580"
502 ;;
503 *"BHR-4GRV2")
504 name="bhr-4grv2"
505 ;;
506 *"Black Swift board"*)
507 name="bsb"
508 ;;
509 *"Bullet M")
510 name="bullet-m"
511 ubnt_xm_board_detect
512 ;;
513 *"BXU2000n-2 rev. A1")
514 name="bxu2000n-2-a1"
515 ;;
516 *"C-55")
517 name="c-55"
518 ;;
519 *"C-60")
520 name="c-60"
521 ;;
522 *"CAP324")
523 name="cap324"
524 ;;
525 *"CAP4200AG")
526 name="cap4200ag"
527 ;;
528 *"Carambola2"*)
529 name="carambola2"
530 ;;
531 *"CF-E316N v2")
532 name="cf-e316n-v2"
533 ;;
534 *"CF-E320N v2")
535 name="cf-e320n-v2"
536 ;;
537 *"CF-E355AC v1")
538 name="cf-e355ac-v1"
539 ;;
540 *"CF-E355AC v2")
541 name="cf-e355ac-v2"
542 ;;
543 *"CF-E375AC")
544 name="cf-e375ac"
545 ;;
546 *"CF-E380AC v1")
547 name="cf-e380ac-v1"
548 ;;
549 *"CF-E380AC v2")
550 name="cf-e380ac-v2"
551 ;;
552 *"CF-E385AC")
553 name="cf-e385ac"
554 ;;
555 *"CF-E520N")
556 name="cf-e520n"
557 ;;
558 *"CF-E530N")
559 name="cf-e530n"
560 ;;
561 *"CPE210/220")
562 name="cpe210"
563 tplink_pharos_board_detect
564 ;;
565 *"CPE505N")
566 name="cpe505n"
567 ;;
568 *"CPE510/520")
569 name="cpe510"
570 tplink_pharos_board_detect
571 ;;
572 *"CPE830")
573 name="cpe830"
574 ;;
575 *"CPE870")
576 name="cpe870"
577 ;;
578 *"CR3000")
579 name="cr3000"
580 ;;
581 *"CR5000")
582 name="cr5000"
583 ;;
584 *"DAP-1330 Rev. A1")
585 name="dap-1330-a1"
586 ;;
587 *"DAP-2695 rev. A1")
588 name="dap-2695-a1"
589 ;;
590 *"DB120 reference board")
591 name="db120"
592 ;;
593 *"DGL-5500 rev. A1")
594 name="dgl-5500-a1"
595 ;;
596 *"DHP-1565 rev. A1")
597 name="dhp-1565-a1"
598 ;;
599 *"DIR-505 rev. A1")
600 name="dir-505-a1"
601 dir505_board_detect
602 ;;
603 *"DIR-600 rev. A1")
604 name="dir-600-a1"
605 ;;
606 *"DIR-615 rev. C1")
607 name="dir-615-c1"
608 ;;
609 *"DIR-615 rev. E1")
610 name="dir-615-e1"
611 ;;
612 *"DIR-615 rev. E4")
613 name="dir-615-e4"
614 ;;
615 *"DIR-615 rev. I1")
616 name="dir-615-i1"
617 ;;
618 *"DIR-825 rev. B1")
619 name="dir-825-b1"
620 ;;
621 *"DIR-825 rev. C1")
622 name="dir-825-c1"
623 ;;
624 *"DIR-835 rev. A1")
625 name="dir-835-a1"
626 ;;
627 *"DIR-869 rev. A1")
628 name="dir-869-a1"
629 ;;
630 *"dLAN Hotspot")
631 name="dlan-hotspot"
632 ;;
633 *"dLAN pro 1200+ WiFi ac")
634 name="dlan-pro-1200-ac"
635 ;;
636 *"dLAN pro 500 Wireless+")
637 name="dlan-pro-500-wp"
638 ;;
639 *"Domino Pi")
640 name="gl-domino"
641 ;;
642 *"DR342")
643 name="dr342"
644 ;;
645 *"DR344")
646 name="dr344"
647 ;;
648 *"DR531")
649 name="dr531"
650 ;;
651 *"Dragino v2")
652 name="dragino2"
653 ;;
654 *"DW33D")
655 name="dw33d"
656 ;;
657 *"E1700AC v2")
658 name="e1700ac-v2"
659 ;;
660 *"E2100L")
661 name="e2100l"
662 ;;
663 *"E600G v2")
664 name="e600g-v2"
665 ;;
666 *"E600GAC v2")
667 name="e600gac-v2"
668 ;;
669 *"EAP120")
670 name="eap120"
671 tplink_pharos_board_detect
672 ;;
673 *"EAP300 v2")
674 name="eap300v2"
675 ;;
676 *"EAP7660D")
677 name="eap7660d"
678 ;;
679 *"EBR-2310 rev. C1")
680 name="ebr-2310-c1"
681 ;;
682 *"EL-M150")
683 name="el-m150"
684 ;;
685 *"EL-MINI")
686 name="el-mini"
687 ;;
688 *"EmbWir-Balin")
689 name="ew-balin"
690 ;;
691 *"EmbWir-Dorin")
692 name="ew-dorin"
693 ;;
694 *"EmbWir-Dorin-Router")
695 name="ew-dorin-router"
696 ;;
697 *"ENS202EXT")
698 name="ens202ext"
699 ;;
700 *"EPG5000")
701 name="epg5000"
702 ;;
703 *"ESR1750")
704 name="esr1750"
705 ;;
706 *"ESR900")
707 name="esr900"
708 ;;
709 *"eTactica EG-200")
710 name="rme-eg200"
711 ;;
712 *"FRITZ!Box 4020")
713 name="fritz4020"
714 ;;
715 *"FRITZ!WLAN Repeater 300E")
716 name="fritz300e"
717 ;;
718 *"GL-AR150")
719 name="gl-ar150"
720 ;;
721 *"GL-AR300")
722 name="gl-ar300"
723 ;;
724 *"GL-AR300M")
725 name="gl-ar300m"
726 ;;
727 *"GL-AR750")
728 name="gl-ar750"
729 ;;
730 *"GL-CONNECT INET v1")
731 name="gl-inet"
732
733 local size="$(mtd_get_part_size 'firmware')"
734
735 [ "$size" = "8192000" ] && AR71XX_MODEL="GL-iNet 6408A v1"
736 [ "$size" = "16580608" ] && AR71XX_MODEL="GL-iNet 6416A v1"
737 ;;
738 *"GL-MIFI")
739 name="gl-mifi"
740 ;;
741 *"GL-USB150")
742 name="gl-usb150"
743 ;;
744 *"HiveAP-121")
745 name="hiveap-121"
746 ;;
747 *"HiWiFi HC6361")
748 name="hiwifi-hc6361"
749 ;;
750 *"Hornet-UB")
751 local size="$(mtd_get_part_size 'firmware')"
752
753 [ "$size" = "7929856" ] && name="hornet-ub"
754 [ "$size" = "16318464" ] && name="hornet-ub-x2"
755 ;;
756 *"JA76PF")
757 name="ja76pf"
758 ;;
759 *"JA76PF2")
760 name="ja76pf2"
761 ;;
762 *"JWAP003")
763 name="jwap003"
764 ;;
765 *"JWAP230")
766 name="jwap230"
767 ;;
768 *"LAN Turtle")
769 name="lan-turtle"
770 ;;
771 *"Lima"*)
772 name="lima"
773 ;;
774 *"Litebeam M5"*)
775 name="lbe-m5"
776 ;;
777 *"Loco M XW")
778 name="loco-m-xw"
779 ;;
780 *"LS-SR71")
781 name="ls-sr71"
782 ;;
783 *"MAC1200R")
784 name="mc-mac1200r"
785 ;;
786 *"MiniBox V1.0")
787 name="minibox-v1"
788 ;;
789 *"MR12")
790 name="mr12"
791 ;;
792 *"MR16")
793 name="mr16"
794 ;;
795 *"MR1750")
796 name="mr1750"
797 ;;
798 *"MR1750v2")
799 name="mr1750v2"
800 ;;
801 *"MR18")
802 name="mr18"
803 ;;
804 *"MR600")
805 name="mr600"
806 ;;
807 *"MR600v2")
808 name="mr600v2"
809 ;;
810 *"MR900")
811 name="mr900"
812 ;;
813 *"MR900v2")
814 name="mr900v2"
815 ;;
816 *"My Net N600")
817 name="mynet-n600"
818 ;;
819 *"My Net N750")
820 name="mynet-n750"
821 ;;
822 *"My Net Wi-Fi Range Extender")
823 name="mynet-rext"
824 ;;
825 *"MZK-W04NU")
826 name="mzk-w04nu"
827 ;;
828 *"MZK-W300NH")
829 name="mzk-w300nh"
830 ;;
831 *"N5Q")
832 name="n5q"
833 ;;
834 *"Nanostation M")
835 name="nanostation-m"
836 ubnt_xm_board_detect
837 ;;
838 *"Nanostation M XW")
839 name="nanostation-m-xw"
840 ;;
841 *"NBG460N/550N/550NH")
842 name="nbg460n_550n_550nh"
843 ;;
844 *"NBG6616")
845 name="nbg6616"
846 ;;
847 *"NBG6716")
848 name="nbg6716"
849 ;;
850 *"OM2P")
851 name="om2p"
852 ;;
853 *"OM2P HS")
854 name="om2p-hs"
855 ;;
856 *"OM2P HSv2")
857 name="om2p-hsv2"
858 ;;
859 *"OM2P HSv3")
860 name="om2p-hsv3"
861 ;;
862 *"OM2P HSv4")
863 name="om2p-hsv4"
864 ;;
865 *"OM2P LC")
866 name="om2p-lc"
867 ;;
868 *"OM2Pv2")
869 name="om2pv2"
870 ;;
871 *"OM2Pv4")
872 name="om2pv4"
873 ;;
874 *"OM5P")
875 name="om5p"
876 ;;
877 *"OM5P AC")
878 name="om5p-ac"
879 ;;
880 *"OM5P ACv2")
881 name="om5p-acv2"
882 ;;
883 *"OM5P AN")
884 name="om5p-an"
885 ;;
886 *"OMY-G1")
887 name="omy-g1"
888 ;;
889 *"OMY-X1")
890 name="omy-x1"
891 ;;
892 *"Onion Omega")
893 name="onion-omega"
894 ;;
895 *"Oolite V1.0")
896 name="oolite-v1"
897 ;;
898 *"Packet Squirrel")
899 name="packet-squirrel"
900 ;;
901 *"Oolite V5.2")
902 name="oolite-v5.2"
903 ;;
904 *"Oolite V5.2-Dev")
905 name="oolite-v5.2-dev"
906 ;;
907 *"PB42")
908 name="pb42"
909 ;;
910 *"PB44 reference board")
911 name="pb44"
912 ;;
913 *"PQI Air Pen")
914 name="pqi-air-pen"
915 ;;
916 *"Qihoo 360 C301")
917 name="qihoo-c301"
918 ;;
919 *"R36A")
920 name="r36a"
921 ;;
922 *"R602N")
923 name="r602n"
924 ;;
925 *"R6100")
926 name="r6100"
927 ;;
928 *"Rambutan"*)
929 name="rambutan"
930 ;;
931 *"RE355")
932 name="re355"
933 ;;
934 *"RE450")
935 name="re450"
936 ;;
937 *"Rocket M")
938 name="rocket-m"
939 ubnt_xm_board_detect
940 ;;
941 *"Rocket M TI")
942 name="rocket-m-ti"
943 ;;
944 *"Rocket M XW")
945 name="rocket-m-xw"
946 ;;
947 *"RouterBOARD 2011iL")
948 name="rb-2011il"
949 ;;
950 *"RouterBOARD 2011iLS")
951 name="rb-2011ils"
952 ;;
953 *"RouterBOARD 2011L")
954 name="rb-2011l"
955 ;;
956 *"RouterBOARD 2011UAS")
957 name="rb-2011uas"
958 ;;
959 *"RouterBOARD 2011UAS-2HnD")
960 name="rb-2011uas-2hnd"
961 ;;
962 *"RouterBOARD 2011UiAS")
963 name="rb-2011uias"
964 ;;
965 *"RouterBOARD 2011UiAS-2HnD")
966 name="rb-2011uias-2hnd"
967 ;;
968 *"RouterBOARD 411/A/AH")
969 name="rb-411"
970 ;;
971 *"RouterBOARD 411U")
972 name="rb-411u"
973 ;;
974 *"RouterBOARD 433/AH")
975 name="rb-433"
976 ;;
977 *"RouterBOARD 433UAH")
978 name="rb-433u"
979 ;;
980 *"RouterBOARD 435G")
981 name="rb-435g"
982 ;;
983 *"RouterBOARD 450")
984 name="rb-450"
985 ;;
986 *"RouterBOARD 450G")
987 name="rb-450g"
988 ;;
989 *"RouterBOARD 493/AH")
990 name="rb-493"
991 ;;
992 *"RouterBOARD 493G")
993 name="rb-493g"
994 ;;
995 *"RouterBOARD 750")
996 name="rb-750"
997 ;;
998 *"RouterBOARD 750 r2")
999 name="rb-750-r2"
1000 ;;
1001 *"RouterBOARD 750GL")
1002 name="rb-750gl"
1003 ;;
1004 *"RouterBOARD 750P r2")
1005 name="rb-750p-pbr2"
1006 ;;
1007 *"RouterBOARD 750UP r2")
1008 name="rb-750up-r2"
1009 ;;
1010 *"RouterBOARD 751")
1011 name="rb-751"
1012 ;;
1013 *"RouterBOARD 751G")
1014 name="rb-751g"
1015 ;;
1016 *"RouterBOARD 911-2Hn")
1017 name="rb-911-2hn"
1018 ;;
1019 *"RouterBOARD 911-5Hn")
1020 name="rb-911-5hn"
1021 ;;
1022 *"RouterBOARD 911G-2HPnD")
1023 name="rb-911g-2hpnd"
1024 ;;
1025 *"RouterBOARD 911G-5HPacD")
1026 name="rb-911g-5hpacd"
1027 ;;
1028 *"RouterBOARD 911G-5HPnD")
1029 name="rb-911g-5hpnd"
1030 ;;
1031 *"RouterBOARD 912UAG-2HPnD")
1032 name="rb-912uag-2hpnd"
1033 ;;
1034 *"RouterBOARD 912UAG-5HPnD")
1035 name="rb-912uag-5hpnd"
1036 ;;
1037 *"RouterBOARD 921GS-5HPacD r2")
1038 name="rb-921gs-5hpacd-r2"
1039 ;;
1040 *"RouterBOARD 941-2nD")
1041 name="rb-941-2nd"
1042 ;;
1043 *"RouterBOARD 951G-2HnD")
1044 name="rb-951g-2hnd"
1045 ;;
1046 *"RouterBOARD 951Ui-2HnD")
1047 name="rb-951ui-2hnd"
1048 ;;
1049 *"RouterBOARD 951Ui-2nD")
1050 name="rb-951ui-2nd"
1051 ;;
1052 *"RouterBOARD 952Ui-5ac2nD")
1053 name="rb-952ui-5ac2nd"
1054 ;;
1055 *"RouterBOARD 962UiGS-5HacT2HnT")
1056 name="rb-962uigs-5hact2hnt"
1057 ;;
1058 *"RouterBOARD LHG 5nD")
1059 name="rb-lhg-5nd"
1060 ;;
1061 *"RouterBOARD mAP 2nD")
1062 name="rb-map-2nd"
1063 ;;
1064 *"RouterBOARD mAP L-2nD")
1065 name="rb-mapl-2nd"
1066 ;;
1067 *"RouterBOARD SXT Lite2")
1068 name="rb-sxt2n"
1069 ;;
1070 *"RouterBOARD SXT Lite5")
1071 name="rb-sxt5n"
1072 ;;
1073 *"RouterBOARD wAP 2nD r2")
1074 name="rb-wap-2nd"
1075 ;;
1076 *"RouterBOARD wAP G-5HacT2HnD")
1077 name="rb-wapg-5hact2hnd"
1078 ;;
1079 *"RouterStation")
1080 name="routerstation"
1081 ;;
1082 *"RouterStation Pro")
1083 name="routerstation-pro"
1084 ;;
1085 *"RUT900")
1086 name="rut900"
1087 ;;
1088 *"RW2458N")
1089 name="rw2458n"
1090 ;;
1091 *"SC1750")
1092 name="sc1750"
1093 ;;
1094 *"SC300M")
1095 name="sc300m"
1096 ;;
1097 *"SC450")
1098 name="sc450"
1099 ;;
1100 *"SMART-300")
1101 name="smart-300"
1102 ;;
1103 *"SOM9331")
1104 name="som9331"
1105 ;;
1106 *"SR3200")
1107 name="sr3200"
1108 ;;
1109 *"T830")
1110 name="t830"
1111 ;;
1112 *"TellStick ZNet Lite")
1113 name="tellstick-znet-lite"
1114 ;;
1115 *"TEW-632BRP")
1116 name="tew-632brp"
1117 ;;
1118 *"TEW-673GRU")
1119 name="tew-673gru"
1120 ;;
1121 *"TEW-712BR")
1122 name="tew-712br"
1123 ;;
1124 *"TEW-732BR")
1125 name="tew-732br"
1126 ;;
1127 *"TEW-823DRU")
1128 name="tew-823dru"
1129 ;;
1130 *"TL-MR10U")
1131 name="tl-mr10u"
1132 ;;
1133 *"TL-MR11U")
1134 name="tl-mr11u"
1135 ;;
1136 *"TL-MR12U")
1137 name="tl-mr12u"
1138 ;;
1139 *"TL-MR13U v1")
1140 name="tl-mr13u"
1141 ;;
1142 *"TL-MR3020")
1143 name="tl-mr3020"
1144 ;;
1145 *"TL-MR3040")
1146 name="tl-mr3040"
1147 ;;
1148 *"TL-MR3040 v2")
1149 name="tl-mr3040-v2"
1150 ;;
1151 *"TL-MR3220")
1152 name="tl-mr3220"
1153 ;;
1154 *"TL-MR3220 v2")
1155 name="tl-mr3220-v2"
1156 ;;
1157 *"TL-MR3420")
1158 name="tl-mr3420"
1159 ;;
1160 *"TL-MR3420 v2")
1161 name="tl-mr3420-v2"
1162 ;;
1163 *"TL-MR6400")
1164 name="tl-mr6400"
1165 ;;
1166 *"TL-WA701ND v2")
1167 name="tl-wa701nd-v2"
1168 ;;
1169 *"TL-WA7210N v2")
1170 name="tl-wa7210n-v2"
1171 ;;
1172 *"TL-WA750RE")
1173 name="tl-wa750re"
1174 ;;
1175 *"TL-WA7510N v1")
1176 name="tl-wa7510n"
1177 ;;
1178 *"TL-WA801ND v2")
1179 name="tl-wa801nd-v2"
1180 ;;
1181 *"TL-WA801ND v3")
1182 name="tl-wa801nd-v3"
1183 ;;
1184 *"TL-WA830RE v2")
1185 name="tl-wa830re-v2"
1186 ;;
1187 *"TL-WA850RE")
1188 name="tl-wa850re"
1189 ;;
1190 *"TL-WA850RE v2")
1191 name="tl-wa850re-v2"
1192 ;;
1193 *"TL-WA855RE v1")
1194 name="tl-wa855re-v1"
1195 ;;
1196 *"TL-WA860RE")
1197 name="tl-wa860re"
1198 ;;
1199 *"TL-WA901ND")
1200 name="tl-wa901nd"
1201 ;;
1202 *"TL-WA901ND v2")
1203 name="tl-wa901nd-v2"
1204 ;;
1205 *"TL-WA901ND v3")
1206 name="tl-wa901nd-v3"
1207 ;;
1208 *"TL-WA901ND v4")
1209 name="tl-wa901nd-v4"
1210 ;;
1211 *"TL-WA901ND v5")
1212 name="tl-wa901nd-v5"
1213 ;;
1214 *"TL-WDR3320 v2")
1215 name="tl-wdr3320-v2"
1216 ;;
1217 *"TL-WDR3500")
1218 name="tl-wdr3500"
1219 ;;
1220 *"TL-WDR3600/4300/4310")
1221 name="tl-wdr4300"
1222 ;;
1223 *"TL-WDR4900 v2")
1224 name="tl-wdr4900-v2"
1225 ;;
1226 *"TL-WDR6500 v2")
1227 name="tl-wdr6500-v2"
1228 ;;
1229 *"TL-WPA8630")
1230 name="tl-wpa8630"
1231 ;;
1232 *"TL-WR1041N v2")
1233 name="tl-wr1041n-v2"
1234 ;;
1235 *"TL-WR1043N v5")
1236 name="tl-wr1043n-v5"
1237 ;;
1238 *"TL-WR1043ND")
1239 name="tl-wr1043nd"
1240 ;;
1241 *"TL-WR1043ND v2")
1242 name="tl-wr1043nd-v2"
1243 ;;
1244 *"TL-WR1043ND v4")
1245 name="tl-wr1043nd-v4"
1246 ;;
1247 *"TL-WR2543N"*)
1248 name="tl-wr2543n"
1249 ;;
1250 *"TL-WR703N v1")
1251 name="tl-wr703n"
1252 ;;
1253 *"TL-WR710N v1")
1254 name="tl-wr710n"
1255 ;;
1256 *"TL-WR720N"*)
1257 name="tl-wr720n-v3"
1258 ;;
1259 *"TL-WR740N/ND v6")
1260 name="tl-wr740n-v6"
1261 ;;
1262 *"TL-WR741ND")
1263 name="tl-wr741nd"
1264 ;;
1265 *"TL-WR741ND v4")
1266 name="tl-wr741nd-v4"
1267 ;;
1268 *"TL-WR802N v1")
1269 name="tl-wr802n-v1"
1270 ;;
1271 *"TL-WR802N v2")
1272 name="tl-wr802n-v2"
1273 ;;
1274 *"TL-WR810N")
1275 name="tl-wr810n"
1276 ;;
1277 *"TL-WR810N v2")
1278 name="tl-wr810n-v2"
1279 ;;
1280 *"TL-WR840N v2")
1281 name="tl-wr840n-v2"
1282 ;;
1283 *"TL-WR840N v3")
1284 name="tl-wr840n-v3"
1285 ;;
1286 *"TL-WR841N v1")
1287 name="tl-wr841n-v1"
1288 ;;
1289 *"TL-WR841N/ND v11")
1290 name="tl-wr841n-v11"
1291 ;;
1292 *"TL-WR841N/ND v7")
1293 name="tl-wr841n-v7"
1294 ;;
1295 *"TL-WR841N/ND v8")
1296 name="tl-wr841n-v8"
1297 ;;
1298 *"TL-WR841N/ND v9")
1299 name="tl-wr841n-v9"
1300 ;;
1301 *"TL-WR842N/ND v2")
1302 name="tl-wr842n-v2"
1303 ;;
1304 *"TL-WR842N/ND v3")
1305 name="tl-wr842n-v3"
1306 ;;
1307 *"TL-WR902AC v1")
1308 name="tl-wr902ac-v1"
1309 ;;
1310 *"TL-WR940N v4")
1311 name="tl-wr940n-v4"
1312 ;;
1313 *"TL-WR940N v6")
1314 name="tl-wr940n-v6"
1315 ;;
1316 *"TL-WR941N/ND v5")
1317 name="tl-wr941nd-v5"
1318 ;;
1319 *"TL-WR941N/ND v6")
1320 name="tl-wr941nd-v6"
1321 ;;
1322 *"TL-WR941ND")
1323 name="tl-wr941nd"
1324 ;;
1325 *"TL-WR942N v1")
1326 name="tl-wr942n-v1"
1327 ;;
1328 *"TS-D084")
1329 name="ts-d084"
1330 ;;
1331 *"Tube2H")
1332 name="tube2h"
1333 ;;
1334 *"UniFi")
1335 name="unifi"
1336 ;;
1337 *"UniFi AP Pro")
1338 name="uap-pro"
1339 ;;
1340 *"UniFi-AC-LITE/MESH")
1341 name="unifiac-lite"
1342 ubnt_ac_lite_board_detect
1343 ;;
1344 *"UniFi-AC-PRO")
1345 name="unifiac-pro"
1346 ;;
1347 *"UniFiAP Outdoor")
1348 name="unifi-outdoor"
1349 ;;
1350 *"UniFiAP Outdoor+")
1351 name="unifi-outdoor-plus"
1352 ;;
1353 *"WAM250")
1354 name="wam250"
1355 ;;
1356 *"WBS210")
1357 name="wbs210"
1358 tplink_pharos_board_detect
1359 ;;
1360 *"WBS510")
1361 name="wbs510"
1362 tplink_pharos_board_detect
1363 ;;
1364 "WeIO"*)
1365 name="weio"
1366 ;;
1367 *"WI2A-AC200i")
1368 name="wi2a-ac200i"
1369 ;;
1370 *"WHR-G301N")
1371 name="whr-g301n"
1372 ;;
1373 *"WHR-HP-G300N")
1374 name="whr-hp-g300n"
1375 ;;
1376 *"WHR-HP-GN")
1377 name="whr-hp-gn"
1378 ;;
1379 *"WiFi Pineapple NANO")
1380 name="wifi-pineapple-nano"
1381 ;;
1382 *"WLAE-AG300N")
1383 name="wlae-ag300n"
1384 ;;
1385 *"WLR-8100")
1386 name="wlr8100"
1387 ;;
1388 *"WNDAP360")
1389 name="wndap360"
1390 ;;
1391 *"WNDR3700/WNDR3800/WNDRMAC")
1392 wndr3700_board_detect "$machine"
1393 ;;
1394 *"WNDR3700v4")
1395 name="wndr3700v4"
1396 ;;
1397 *"WNDR4300")
1398 name="wndr4300"
1399 ;;
1400 *"WNR1000 V2")
1401 name="wnr1000-v2"
1402 ;;
1403 *"WNR2000")
1404 name="wnr2000"
1405 ;;
1406 *"WNR2000 V3")
1407 name="wnr2000-v3"
1408 ;;
1409 *"WNR2000 V4")
1410 name="wnr2000-v4"
1411 ;;
1412 *"WNR2200")
1413 name="wnr2200"
1414 ;;
1415 *"WNR612 V2")
1416 name="wnr612-v2"
1417 ;;
1418 *"WP543")
1419 name="wp543"
1420 ;;
1421 *"WPE72")
1422 name="wpe72"
1423 ;;
1424 *"WPJ342")
1425 name="wpj342"
1426 ;;
1427 *"WPJ344")
1428 name="wpj344"
1429 ;;
1430 *"WPJ531")
1431 name="wpj531"
1432 ;;
1433 *"WPJ558")
1434 name="wpj558"
1435 ;;
1436 *"WPJ563")
1437 name="wpj563"
1438 ;;
1439 *"WPN824N")
1440 name="wpn824n"
1441 ;;
1442 *"WRT160NL")
1443 name="wrt160nl"
1444 ;;
1445 *"WRT400N")
1446 name="wrt400n"
1447 ;;
1448 *"WRTnode2Q"*)
1449 name="wrtnode2q"
1450 ;;
1451 *"WZR-450HP2")
1452 name="wzr-450hp2"
1453 ;;
1454 *"WZR-HP-AG300H/WZR-600DHP")
1455 name="wzr-hp-ag300h"
1456 ;;
1457 *"WZR-HP-G300NH")
1458 name="wzr-hp-g300nh"
1459 ;;
1460 *"WZR-HP-G300NH2")
1461 name="wzr-hp-g300nh2"
1462 ;;
1463 *"WZR-HP-G450H")
1464 name="wzr-hp-g450h"
1465 ;;
1466 *"XD3200")
1467 name="xd3200"
1468 ;;
1469 *"Z1")
1470 name="z1"
1471 ;;
1472 *"ZBT-WE1526")
1473 name="zbt-we1526"
1474 ;;
1475 *"ZCN-1523H-2")
1476 name="zcn-1523h-2"
1477 ;;
1478 *"ZCN-1523H-5")
1479 name="zcn-1523h-5"
1480 ;;
1481 esac
1482
1483 [ -z "$AR71XX_MODEL" ] && [ "${machine:0:8}" = 'TP-LINK ' ] && \
1484 tplink_board_detect "$machine"
1485
1486 [ -z "$name" ] && name="unknown"
1487
1488 [ -z "$AR71XX_BOARD_NAME" ] && AR71XX_BOARD_NAME="$name"
1489 [ -z "$AR71XX_MODEL" ] && AR71XX_MODEL="$machine"
1490
1491 [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
1492
1493 echo "$AR71XX_BOARD_NAME" > /tmp/sysinfo/board_name
1494 echo "$AR71XX_MODEL" > /tmp/sysinfo/model
1495 }