ramips: raeth: indicate dropped packets in stats
[openwrt.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 *"Allnet ALL0256N")
51 name="all0256n"
52 ;;
53 *"Argus ATP-52B")
54 name="argus-atp52b"
55 ;;
56 *"Aztech HW550-3G")
57 name="hw550-3g"
58 ;;
59 *"DIR-300 B1")
60 name="dir-300-b1"
61 ;;
62 *"DIR-600 B1")
63 name="dir-600-b1"
64 ;;
65 *"DIR-600 B2")
66 name="dir-600-b2"
67 ;;
68 *"ESR-9753")
69 name="esr-9753"
70 ;;
71 *"F5D8235 v1")
72 name="f5d8235-v1"
73 ;;
74 *"F5D8235 v2")
75 name="f5d8235-v2"
76 ;;
77 *"La Fonera 2.0N")
78 name="fonera20n"
79 ;;
80 *"MoFi Network MOFI3500-3GN")
81 name="mofi3500-3gn"
82 ;;
83 *"NBG-419N")
84 name="nbg-419n"
85 ;;
86 *"NexAira BC2")
87 name="bc2"
88 ;;
89 *"NW718")
90 name="nw718"
91 ;;
92 *"Omnima MiniEMBWiFi")
93 name="omni-emb"
94 ;;
95 *"PWH2004")
96 name="pwh2004"
97 ;;
98 *"RT-G32 B1")
99 name="rt-g32-b1"
100 ;;
101 *"RT-N15")
102 name="rt-n15"
103 ;;
104 *"Sparklan WCR-150GN")
105 name="wcr-150gn"
106 ;;
107 *"V22RW-2X2")
108 name="v22rw-2x2"
109 ;;
110 *"W502U")
111 name="w502u"
112 ;;
113 *"WHR-G300N")
114 name="whr-g300n"
115 ;;
116 *"Sitecom WL-341 v3")
117 name="wl341v3"
118 ;;
119 *"Sitecom WL-351 v1 002")
120 name="wl-351"
121 ;;
122 *"WLI-TX4-AG300N")
123 name="wli-tx4-ag300n"
124 ;;
125 *"WZR-AGL300NH")
126 name="wzr-agl300nh"
127 ;;
128 *"WR512-3GN-like router")
129 name="wr512-3gn"
130 ;;
131 *"AWB WR6202")
132 name="wr6202"
133 ;;
134 *)
135 name="generic"
136 ;;
137 esac
138
139 echo $name
140 }
This page took 0.04857 seconds and 5 git commands to generate.