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