ramips: add DIR-615 D userspace support
[openwrt/svn-archive/archive.git] / target / linux / ramips / base-files / lib / ramips.sh
1 #!/bin/sh
2 #
3 # Copyright (C) 2010 OpenWrt.org
4 #
5
6 ramips_get_mac_binary()
7 {
8 local mtdname="$1"
9 local seek="$2"
10 local part
11
12 . /lib/functions.sh
13
14 part=$(find_mtd_part "$mtdname")
15 if [ -z "$part" ]; then
16 echo "ramips_get_mac_binary: partition $mtdname not found!" >&2
17 return
18 fi
19
20 dd bs=1 skip=$seek count=6 if=$part 2>/dev/null | /usr/sbin/maccalc bin2mac
21 }
22
23 ramips_get_mac_nvram()
24 {
25 local mtdname="$1"
26 local key="$2"
27 local part
28 local mac_dirty
29
30 . /lib/functions.sh
31
32 part=$(find_mtd_part "$mtdname")
33 if [ -z "$part" ]; then
34 echo "ramips_get_mac_nvram: partition $mtdname not found!" >&2
35 return
36 fi
37
38 mac_dirty=$(strings "$part" | sed -n 's/'"$key"'=//p')
39 # "canonicalize" mac
40 /usr/sbin/maccalc add "$mac_dirty" 0
41 }
42
43 ramips_board_name() {
44 local machine
45 local name
46
47 machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo)
48
49 case "$machine" in
50 *"8devices Carambola")
51 name="carambola"
52 ;;
53 *"Edimax 3g-6200n")
54 name="3g-6200n"
55 ;;
56 *"Allnet ALL0239-3G")
57 name="all0239-3g"
58 ;;
59 *"Allnet ALL0256N")
60 name="all0256n"
61 ;;
62 *"Allnet ALL5002")
63 name="all5002"
64 ;;
65 *"ARC FreeStation5")
66 name="freestation5"
67 ;;
68 *"Argus ATP-52B")
69 name="argus-atp52b"
70 ;;
71 *"Asus WL-330N")
72 name="wl-330n"
73 ;;
74 *"Asus WL-330N3G")
75 name="wl-330n3g"
76 ;;
77 *"Aztech HW550-3G")
78 name="hw550-3g"
79 ;;
80 *"DIR-300 B1")
81 name="dir-300-b1"
82 ;;
83 *"DIR-600 B1")
84 name="dir-600-b1"
85 ;;
86 *"DIR-600 B2")
87 name="dir-600-b2"
88 ;;
89 *"DIR-620 A1")
90 name="dir-620-a1"
91 ;;
92 *"DIR-615 H1")
93 name="dir-615-h1"
94 ;;
95 *"DIR-615 D")
96 name="dir-615-d"
97 ;;
98 *"DIR-645")
99 name="dir-645"
100 ;;
101 *"DAP-1350")
102 name="dap-1350"
103 ;;
104 *"ESR-9753")
105 name="esr-9753"
106 ;;
107 *"F5D8235 v1")
108 name="f5d8235-v1"
109 ;;
110 *"F5D8235 v2")
111 name="f5d8235-v2"
112 ;;
113 *"La Fonera 2.0N")
114 name="fonera20n"
115 ;;
116 *"MoFi Network MOFI3500-3GN")
117 name="mofi3500-3gn"
118 ;;
119 *"NBG-419N")
120 name="nbg-419n"
121 ;;
122 *"NexAira BC2")
123 name="bc2"
124 ;;
125 *"NW718")
126 name="nw718"
127 ;;
128 *"Omnima MiniEMBWiFi")
129 name="omni-emb"
130 ;;
131 *"Petatel PSR-680W"*)
132 name="psr-680w"
133 ;;
134 *"PWH2004")
135 name="pwh2004"
136 ;;
137 *"RT-G32 B1")
138 name="rt-g32-b1"
139 ;;
140 *"RT-N10+")
141 name="rt-n10-plus"
142 ;;
143 *"RT-N15")
144 name="rt-n15"
145 ;;
146 *"RT-N56U")
147 name="rt-n56u"
148 ;;
149 *"Skyline SL-R7205"*)
150 name="sl-r7205"
151 ;;
152 *"Sparklan WCR-150GN")
153 name="wcr-150gn"
154 ;;
155 *"V22RW-2X2")
156 name="v22rw-2x2"
157 ;;
158 *"W502U")
159 name="w502u"
160 ;;
161 *"WHR-G300N")
162 name="whr-g300n"
163 ;;
164 *"Sitecom WL-341 v3")
165 name="wl341v3"
166 ;;
167 *"Sitecom WL-351 v1 002")
168 name="wl-351"
169 ;;
170 *"Tenda W306R V2.0")
171 name="w306r-v20"
172 ;;
173 *"TEW-691GR")
174 name="tew-691gr"
175 ;;
176 *"TEW-692GR")
177 name="tew-692gr"
178 ;;
179 *"Ralink V11ST-FE")
180 name="v11st-fe"
181 ;;
182 *"WLI-TX4-AG300N")
183 name="wli-tx4-ag300n"
184 ;;
185 *"WZR-AGL300NH")
186 name="wzr-agl300nh"
187 ;;
188 *"WR512-3GN-like router")
189 name="wr512-3gn"
190 ;;
191 *"UR-336UN Wireless N router")
192 name="ur-336un"
193 ;;
194 *"AWB WR6202")
195 name="wr6202"
196 ;;
197 *"XDX RN502J")
198 name="xdxrn502j"
199 ;;
200 *)
201 name="generic"
202 ;;
203 esac
204
205 echo $name
206 }