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