ath9k: fix switching channel bandwidth from 5/10 back to 20mhz
[openwrt.git] / package / madwifi / patches / 102-multicall_binary.patch
1 --- a/tools/80211debug.c
2 +++ b/tools/80211debug.c
3 @@ -48,6 +48,7 @@
4 #include <ctype.h>
5 #include <getopt.h>
6 #include <err.h>
7 +#include "do_multi.h"
8
9 #undef ARRAY_SIZE
10 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
11 @@ -185,7 +186,7 @@ sysctlbyname(const char *oid0, void *old
12 #endif /* __linux__ */
13
14 int
15 -main(int argc, char *argv[])
16 +CMD(a80211debug)(int argc, char *argv[])
17 {
18 const char *ifname = "ath0";
19 const char *cp, *tp;
20 --- a/tools/80211stats.c
21 +++ b/tools/80211stats.c
22 @@ -59,6 +59,7 @@
23 #include "net80211/ieee80211.h"
24 #include "net80211/ieee80211_crypto.h"
25 #include "net80211/ieee80211_ioctl.h"
26 +#include "do_multi.h"
27
28 #ifndef SIOCG80211STATS
29 #define SIOCG80211STATS (SIOCDEVPRIVATE + 2)
30 @@ -240,7 +241,7 @@ print_sta_stats(FILE *fd, const u_int8_t
31 }
32
33 int
34 -main(int argc, char *argv[])
35 +CMD(a80211stats)(int argc, char *argv[])
36 {
37 int c, len;
38 struct ieee80211req_sta_info *si;
39 --- a/tools/athchans.c
40 +++ b/tools/athchans.c
41 @@ -58,6 +58,7 @@
42 #include "net80211/ieee80211.h"
43 #include "net80211/ieee80211_crypto.h"
44 #include "net80211/ieee80211_ioctl.h"
45 +#include "do_multi.h"
46
47 static int s = -1;
48 static const char *progname;
49 @@ -140,8 +141,9 @@ usage(void)
50 }
51
52 #define MAXCHAN ((int)(sizeof(struct ieee80211req_chanlist) * NBBY))
53 +
54 int
55 -main(int argc, char *argv[])
56 +CMD(athchans)(int argc, char *argv[])
57 {
58 const char *ifname = "wifi0";
59 struct ieee80211req_chanlist chanlist;
60 --- a/tools/athctrl.c
61 +++ b/tools/athctrl.c
62 @@ -52,6 +52,7 @@
63 #include <err.h>
64
65 #include <net/if.h>
66 +#include "do_multi.h"
67
68 static int
69 setsysctrl(const char *dev, const char *control , u_long value)
70 @@ -88,7 +89,7 @@ static void usage(void)
71 }
72
73 int
74 -main(int argc, char *argv[])
75 +CMD(athctrl)(int argc, char *argv[])
76 {
77 char device[IFNAMSIZ + 1];
78 int distance = -1;
79 --- a/tools/athdebug.c
80 +++ b/tools/athdebug.c
81 @@ -51,6 +51,7 @@
82 #include <ctype.h>
83 #include <getopt.h>
84 #include <err.h>
85 +#include "do_multi.h"
86
87 #undef ARRAY_SIZE
88 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
89 @@ -194,7 +195,7 @@ sysctlbyname(const char *oid0, void *old
90 #endif /* __linux__ */
91
92 int
93 -main(int argc, char *argv[])
94 +CMD(athdebug)(int argc, char *argv[])
95 {
96 #ifdef __linux__
97 const char *ifname = "wifi0";
98 --- a/tools/athkey.c
99 +++ b/tools/athkey.c
100 @@ -58,6 +58,7 @@
101 #include "net80211/ieee80211.h"
102 #include "net80211/ieee80211_crypto.h"
103 #include "net80211/ieee80211_ioctl.h"
104 +#include "do_multi.h"
105
106 static int s = -1;
107 static const char *progname;
108 @@ -213,8 +214,7 @@ usage(void)
109 exit(-1);
110 }
111
112 -int
113 -main(int argc, char *argv[])
114 +int CMD(athkey)(int argc, char *argv[])
115 {
116 const char *ifname = "wifi0";
117 struct ieee80211req_key setkey;
118 --- a/tools/athstats.c
119 +++ b/tools/athstats.c
120 @@ -65,6 +65,7 @@
121
122 #undef ARRAY_SIZE
123 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
124 +#include "do_multi.h"
125
126 static const struct {
127 u_int phyerr;
128 @@ -228,7 +229,7 @@ catchalarm(int signo)
129 }
130
131 int
132 -main(int argc, char *argv[])
133 +CMD(athstats)(int argc, char *argv[])
134 {
135 #ifdef __linux__
136 const char *ifname = "wifi0";
137 --- /dev/null
138 +++ b/tools/do_multi.c
139 @@ -0,0 +1,33 @@
140 +#include <string.h>
141 +#include <libgen.h>
142 +#include "do_multi.h"
143 +
144 +int
145 +main(int argc, char *argv[])
146 +{
147 + char *progname;
148 + int ret = 0;
149 +
150 + progname = basename(argv[0]);
151 +
152 + if(strcmp(progname, "80211debug") == 0)
153 + ret = a80211debug_init(argc, argv);
154 + if(strcmp(progname, "80211stats") == 0)
155 + ret = a80211stats_init(argc, argv);
156 + if(strcmp(progname, "athchans") == 0)
157 + ret = athchans_init(argc, argv);
158 + if(strcmp(progname, "athctrl") == 0)
159 + ret = athctrl_init(argc, argv);
160 + if(strcmp(progname, "athdebug") == 0)
161 + ret = athdebug_init(argc, argv);
162 + if(strcmp(progname, "athkey") == 0)
163 + ret = athkey_init(argc, argv);
164 + if(strcmp(progname, "athstats") == 0)
165 + ret = athstats_init(argc, argv);
166 + if(strcmp(progname, "wlanconfig") == 0)
167 + ret = wlanconfig_init(argc, argv);
168 + if(strcmp(progname, "ath_info") == 0)
169 + ret = athinfo_init(argc, argv);
170 +
171 + return ret;
172 +}
173 --- /dev/null
174 +++ b/tools/do_multi.h
175 @@ -0,0 +1,15 @@
176 +#ifdef DO_MULTI
177 +int a80211debug_init(int argc, char *argv[]);
178 +int a80211stats_init(int argc, char *argv[]);
179 +int athchans_init(int argc, char *argv[]);
180 +int athctrl_init(int argc, char *argv[]);
181 +int athdebug_init(int argc, char *argv[]);
182 +int athkey_init(int argc, char *argv[]);
183 +int athstats_init(int argc, char *argv[]);
184 +int wlanconfig_init(int argc, char *argv[]);
185 +int athinfo_init(int argc, char *argv[]);
186 +
187 +#define CMD(name) name##_init
188 +#else
189 +#define CMD(name) main
190 +#endif
191 --- a/tools/Makefile
192 +++ b/tools/Makefile
193 @@ -46,56 +46,55 @@ ifeq ($(HAL),)
194 HAL= $(TOP)/hal
195 endif
196
197 +all: compile
198
199 -ALL= athstats 80211stats athkey athchans athctrl \
200 +ALLPROGS= athstats 80211stats athkey athchans athctrl \
201 athdebug 80211debug wlanconfig ath_info
202
203 -all: $(ALL)
204 +OBJS= $(patsubst %,%.o,$(ALLPROGS))
205
206 -INCS= -I. -I$(HAL) -I$(TOP) -I$(ATH_HAL)
207 +INCS= -I. -I../ath -I$(HAL) -I$(TOP) -I$(ATH_HAL)
208 CFLAGS= -g -O2 -Wall
209 ALL_CFLAGS= $(CFLAGS) $(INCS)
210 LDFLAGS=
211
212 -all: $(ALL)
213
214 -athstats: athstats.c
215 - $(CC) -o athstats $(ALL_CFLAGS) -I$(TOP)/ath $(LDFLAGS) athstats.c
216 -80211stats: 80211stats.c
217 - $(CC) -o 80211stats $(ALL_CFLAGS) $(LDFLAGS) 80211stats.c
218 -athkey: athkey.c
219 - $(CC) -o athkey $(ALL_CFLAGS) $(LDFLAGS) athkey.c
220 -athchans: athchans.c
221 - $(CC) -o athchans $(ALL_CFLAGS) $(LDFLAGS) athchans.c
222 -athctrl: athctrl.c
223 - $(CC) -o athctrl $(ALL_CFLAGS) $(LDFLAGS) athctrl.c
224 -athdebug: athdebug.c
225 - $(CC) -o athdebug $(ALL_CFLAGS) $(LDFLAGS) athdebug.c
226 -wlanconfig: wlanconfig.c
227 - $(CC) -o wlanconfig $(ALL_CFLAGS) $(LDFLAGS) wlanconfig.c
228 -80211debug: 80211debug.c
229 - $(CC) -o 80211debug $(ALL_CFLAGS) $(LDFLAGS) 80211debug.c
230 -ath_info: ath_info.c
231 - $(CC) -o ath_info $(CFLAGS) ath_info.c
232 +ifneq ($(DO_MULTI),)
233 +ALL_CFLAGS += -DDO_MULTI=1
234 +%.o: %.c
235 + ${CC} $(ALL_CFLAGS) -c -o $@ $<
236 +
237 +madwifi_multi: $(OBJS) do_multi.o
238 + $(CC) -o $@ $^
239 +
240 +compile: madwifi_multi
241 + for i in $(ALLPROGS); do \
242 + ln -s -f madwifi_multi $$i; \
243 + done
244 +else
245 +$(ALLPROGS):
246 + $(CC) $(ALL_CFLAGS) -o $@ $@.c
247 +
248 +compile: $(ALLPROGS)
249 +endif
250
251
252 install: $(ALL)
253 install -d $(DESTDIR)$(BINDIR)
254 - for i in $(ALL); do \
255 + for i in $(ALLPROGS) $(if $(DO_MULTI),madwifi_multi); do \
256 install $$i $(DESTDIR)$(BINDIR)/$$i; \
257 - $(STRIP) $(DESTDIR)$(BINDIR)/$$i; \
258 done
259 install -d $(DESTDIR)$(MANDIR)/man8
260 install -m 0644 man/*.8 $(DESTDIR)$(MANDIR)/man8
261 install $(TOP)/scripts/madwifi-unload $(DESTDIR)$(BINDIR)/madwifi-unload
262
263 uninstall:
264 - for i in $(ALL); do \
265 + for i in $(ALLPROGS) $(if $(DO_MULTI),madwifi_multi); do \
266 rm -f $(DESTDIR)$(BINDIR)/$$i; \
267 done
268 - for i in $(ALL:=.8); do \
269 - rm -f $(DESTDIR)$(MANDIR)/man8/$$i; \
270 + for i in $(ALLPROGS); do \
271 + rm -f $(DESTDIR)$(MANDIR)/man8/$$i.8; \
272 done
273
274 clean:
275 - rm -f $(ALL) core a.out
276 + rm -f $(ALLPROGS) madwifi_multi *.o core a.out
277 --- a/tools/wlanconfig.c
278 +++ b/tools/wlanconfig.c
279 @@ -61,6 +61,7 @@
280 #include "net80211/ieee80211.h"
281 #include "net80211/ieee80211_crypto.h"
282 #include "net80211/ieee80211_ioctl.h"
283 +#include "do_multi.h"
284
285 /*
286 * These are taken from ieee80211_node.h
287 @@ -100,7 +101,7 @@ size_t strlcat(char *, const char *, siz
288 static int verbose = 0;
289
290 int
291 -main(int argc, char *argv[])
292 +CMD(wlanconfig)(int argc, char *argv[])
293 {
294 const char *ifname, *cmd;
295 unsigned char bnounit = 0;
296 --- a/tools/ath_info.c
297 +++ b/tools/ath_info.c
298 @@ -98,6 +98,7 @@
299 #include <sys/mman.h>
300 #include <endian.h>
301 #include <byteswap.h>
302 +#include "do_multi.h"
303
304 #undef ARRAY_SIZE
305 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
306 @@ -738,7 +739,8 @@ static void usage(const char *n)
307 "unlawful radio transmissions!\n\n");
308 }
309
310 -int main(int argc, char *argv[])
311 +int
312 +CMD(athinfo)(int argc, char *argv[])
313 {
314 u_int32_t dev_addr;
315 u_int16_t eeprom_header, srev, phy_rev_5ghz, phy_rev_2ghz;
This page took 0.05683 seconds and 5 git commands to generate.