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