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