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