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