update madwifi to latest version (fixes #2403)
[openwrt/svn-archive/archive.git] / package / madwifi / patches / 102-multicall_binary.patch
1 Index: madwifi-ng-r2799-20071030/tools/80211debug.c
2 ===================================================================
3 --- madwifi-ng-r2799-20071030.orig/tools/80211debug.c 2007-10-31 14:04:46.925295598 +0100
4 +++ madwifi-ng-r2799-20071030/tools/80211debug.c 2007-10-31 14:04:47.537330476 +0100
5 @@ -49,6 +49,10 @@
6 #include <getopt.h>
7 #include <err.h>
8
9 +#ifdef DOMULTI
10 +#include "do_multi.h"
11 +#endif
12 +
13 #define N(a) (sizeof(a)/sizeof(a[0]))
14
15 static const char *progname;
16 @@ -180,9 +184,19 @@
17 }
18 #endif /* __linux__ */
19
20 +#ifdef DOMULTI
21 +
22 +int
23 +a80211debug_init(int argc, char *argv[])
24 +{
25 +
26 +#else
27 +
28 int
29 main(int argc, char *argv[])
30 {
31 +
32 +#endif
33 const char *ifname = "ath0";
34 const char *cp, *tp;
35 const char *sep;
36 Index: madwifi-ng-r2799-20071030/tools/80211stats.c
37 ===================================================================
38 --- madwifi-ng-r2799-20071030.orig/tools/80211stats.c 2007-10-31 14:04:46.929295827 +0100
39 +++ madwifi-ng-r2799-20071030/tools/80211stats.c 2007-10-31 14:04:47.537330476 +0100
40 @@ -60,6 +60,10 @@
41 #include "net80211/ieee80211_crypto.h"
42 #include "net80211/ieee80211_ioctl.h"
43
44 +#ifdef DOMULTI
45 +#include "do_multi.h"
46 +#endif
47 +
48 #ifndef SIOCG80211STATS
49 #define SIOCG80211STATS (SIOCDEVPRIVATE + 2)
50 #endif
51 @@ -241,9 +245,19 @@
52 #undef STAT
53 }
54
55 +#ifdef DOMULTI
56 +
57 +int
58 +a80211stats_init(int argc, char *argv[])
59 +{
60 +
61 +#else
62 +
63 int
64 main(int argc, char *argv[])
65 {
66 +
67 +#endif
68 int c, len;
69 struct ieee80211req_sta_info *si;
70 u_int8_t buf[24*1024], *cp;
71 Index: madwifi-ng-r2799-20071030/tools/athchans.c
72 ===================================================================
73 --- madwifi-ng-r2799-20071030.orig/tools/athchans.c 2007-10-31 14:04:46.937296283 +0100
74 +++ madwifi-ng-r2799-20071030/tools/athchans.c 2007-10-31 14:04:47.545330932 +0100
75 @@ -59,6 +59,10 @@
76 #include "net80211/ieee80211_crypto.h"
77 #include "net80211/ieee80211_ioctl.h"
78
79 +#ifdef DOMULTI
80 +#include "do_multi.h"
81 +#endif
82 +
83 static int s = -1;
84 static const char *progname;
85
86 @@ -139,9 +143,20 @@
87 }
88
89 #define MAXCHAN ((int)(sizeof(struct ieee80211req_chanlist) * NBBY))
90 +
91 +#ifdef DOMULTI
92 +
93 +int
94 +athchans_init(int argc, char *argv[])
95 +{
96 +
97 +#else
98 +
99 int
100 main(int argc, char *argv[])
101 {
102 +
103 +#endif
104 const char *ifname = "wifi0";
105 struct ieee80211req_chanlist chanlist;
106 int c;
107 Index: madwifi-ng-r2799-20071030/tools/athctrl.c
108 ===================================================================
109 --- madwifi-ng-r2799-20071030.orig/tools/athctrl.c 2007-10-31 14:04:46.945296738 +0100
110 +++ madwifi-ng-r2799-20071030/tools/athctrl.c 2007-10-31 14:04:47.549331161 +0100
111 @@ -53,6 +53,10 @@
112
113 #include <net/if.h>
114
115 +#ifdef DOMULTI
116 +#include "do_multi.h"
117 +#endif
118 +
119 static int
120 setsysctrl(const char *dev, const char *control , u_long value)
121 {
122 @@ -87,9 +91,19 @@
123 exit(1);
124 }
125
126 +#ifdef DOMULTI
127 +
128 +int
129 +athctrl_init(int argc, char *argv[])
130 +{
131 +
132 +#else
133 +
134 int
135 main(int argc, char *argv[])
136 {
137 +
138 +#endif
139 char device[IFNAMSIZ + 1];
140 int distance = -1;
141 int c;
142 Index: madwifi-ng-r2799-20071030/tools/athdebug.c
143 ===================================================================
144 --- madwifi-ng-r2799-20071030.orig/tools/athdebug.c 2007-10-31 14:04:46.953297193 +0100
145 +++ madwifi-ng-r2799-20071030/tools/athdebug.c 2007-10-31 14:04:47.557331616 +0100
146 @@ -52,6 +52,10 @@
147 #include <getopt.h>
148 #include <err.h>
149
150 +#ifdef DOMULTI
151 +#include "do_multi.h"
152 +#endif
153 +
154 #define N(a) (sizeof(a)/sizeof(a[0]))
155
156 static const char *progname;
157 @@ -187,9 +191,20 @@
158 }
159 #endif /* __linux__ */
160
161 +#ifdef DOMULTI
162 +
163 +int
164 +athdebug_init(int argc, char *argv[])
165 +{
166 +
167 +#else
168 +
169 int
170 main(int argc, char *argv[])
171 {
172 +
173 +#endif
174 +
175 #ifdef __linux__
176 const char *ifname = "wifi0";
177 #else
178 Index: madwifi-ng-r2799-20071030/tools/athkey.c
179 ===================================================================
180 --- madwifi-ng-r2799-20071030.orig/tools/athkey.c 2007-10-31 14:04:46.957297422 +0100
181 +++ madwifi-ng-r2799-20071030/tools/athkey.c 2007-10-31 14:04:47.557331616 +0100
182 @@ -59,6 +59,10 @@
183 #include "net80211/ieee80211_crypto.h"
184 #include "net80211/ieee80211_ioctl.h"
185
186 +#ifdef DOMULTI
187 +#include "do_multi.h"
188 +#endif
189 +
190 static int s = -1;
191 static const char *progname;
192
193 @@ -212,9 +216,19 @@
194 exit(-1);
195 }
196
197 +#ifdef DOMULTI
198 +
199 +int
200 +athkey_init(int argc, char *argv[])
201 +{
202 +
203 +#else
204 +
205 int
206 main(int argc, char *argv[])
207 {
208 +
209 +#endif
210 const char *ifname = "wifi0";
211 struct ieee80211req_key setkey;
212 struct ieee80211req_del_key delkey;
213 Index: madwifi-ng-r2799-20071030/tools/athstats.c
214 ===================================================================
215 --- madwifi-ng-r2799-20071030.orig/tools/athstats.c 2007-10-31 14:04:46.965297878 +0100
216 +++ madwifi-ng-r2799-20071030/tools/athstats.c 2007-10-31 14:04:47.557331616 +0100
217 @@ -63,6 +63,10 @@
218 #include "wireless_copy.h"
219 #include "if_athioctl.h"
220
221 +#ifdef DOMULTI
222 +#include "do_multi.h"
223 +#endif
224 +
225 static const struct {
226 u_int phyerr;
227 const char* desc;
228 @@ -226,9 +230,20 @@
229 signalled = 1;
230 }
231
232 +#ifdef DOMULTI
233 +
234 +int
235 +athstats_init(int argc, char *argv[])
236 +{
237 +
238 +#else
239 +
240 int
241 main(int argc, char *argv[])
242 {
243 +
244 +#endif
245 +
246 #ifdef __linux__
247 const char *ifname = "wifi0";
248 #else
249 Index: madwifi-ng-r2799-20071030/tools/do_multi.c
250 ===================================================================
251 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
252 +++ madwifi-ng-r2799-20071030/tools/do_multi.c 2007-10-31 14:04:47.557331616 +0100
253 @@ -0,0 +1,32 @@
254 +#include <string.h>
255 +#include "do_multi.h"
256 +
257 +int
258 +main(int argc, char *argv[])
259 +{
260 + char *progname;
261 + int ret = 0;
262 +
263 + progname = basename(argv[0]);
264 +
265 + if(strcmp(progname, "80211debug") == 0)
266 + ret = a80211debug_init(argc, argv);
267 + if(strcmp(progname, "80211stats") == 0)
268 + ret = a80211stats_init(argc, argv);
269 + if(strcmp(progname, "athchans") == 0)
270 + ret = athchans_init(argc, argv);
271 + if(strcmp(progname, "athctrl") == 0)
272 + ret = athctrl_init(argc, argv);
273 + if(strcmp(progname, "athdebug") == 0)
274 + ret = athdebug_init(argc, argv);
275 + if(strcmp(progname, "athkey") == 0)
276 + ret = athkey_init(argc, argv);
277 + if(strcmp(progname, "athstats") == 0)
278 + ret = athstats_init(argc, argv);
279 + if(strcmp(progname, "wlanconfig") == 0)
280 + ret = wlanconfig_init(argc, argv);
281 + if(strcmp(progname, "ath_info") == 0)
282 + ret = athinfo_init(argc, argv);
283 +
284 + return ret;
285 +}
286 Index: madwifi-ng-r2799-20071030/tools/do_multi.h
287 ===================================================================
288 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
289 +++ madwifi-ng-r2799-20071030/tools/do_multi.h 2007-10-31 14:04:47.557331616 +0100
290 @@ -0,0 +1,10 @@
291 +
292 +int a80211debug_init(int argc, char *argv[]);
293 +int a80211stats_init(int argc, char *argv[]);
294 +int athchans_init(int argc, char *argv[]);
295 +int athctrl_init(int argc, char *argv[]);
296 +int athdebug_init(int argc, char *argv[]);
297 +int athkey_init(int argc, char *argv[]);
298 +int athstats_init(int argc, char *argv[]);
299 +int wlanconfig_init(int argc, char *argv[]);
300 +int athinfo_init(int argc, char *argv[]);
301 Index: madwifi-ng-r2799-20071030/tools/Makefile
302 ===================================================================
303 --- madwifi-ng-r2799-20071030.orig/tools/Makefile 2007-10-31 14:04:46.981298791 +0100
304 +++ madwifi-ng-r2799-20071030/tools/Makefile 2007-10-31 14:04:47.561331846 +0100
305 @@ -47,9 +47,12 @@
306 endif
307
308
309 -ALL= athstats 80211stats athkey athchans athctrl \
310 +ALLPROGS= athstats 80211stats athkey athchans athctrl \
311 athdebug 80211debug wlanconfig ath_info
312
313 +OBJS= $(patsubst %,%.o,$(ALLPROGS) do_multi)
314 +ALL= ${OBJS} madwifi_multi
315 +
316 all: $(ALL)
317
318 INCS= -I. -I$(HAL) -I$(TOP) -I$(ATH_HAL)
319 @@ -59,25 +62,31 @@
320
321 all: $(ALL)
322
323 -athstats: athstats.c
324 - $(CC) -o athstats $(ALL_CFLAGS) -I$(TOP)/ath $(LDFLAGS) athstats.c
325 -80211stats: 80211stats.c
326 - $(CC) -o 80211stats $(ALL_CFLAGS) $(LDFLAGS) 80211stats.c
327 -athkey: athkey.c
328 - $(CC) -o athkey $(ALL_CFLAGS) $(LDFLAGS) athkey.c
329 -athchans: athchans.c
330 - $(CC) -o athchans $(ALL_CFLAGS) $(LDFLAGS) athchans.c
331 -athctrl: athctrl.c
332 - $(CC) -o athctrl $(ALL_CFLAGS) $(LDFLAGS) athctrl.c
333 -athdebug: athdebug.c
334 - $(CC) -o athdebug $(ALL_CFLAGS) $(LDFLAGS) athdebug.c
335 -wlanconfig: wlanconfig.c
336 - $(CC) -o wlanconfig $(ALL_CFLAGS) $(LDFLAGS) wlanconfig.c
337 -80211debug: 80211debug.c
338 - $(CC) -o 80211debug $(ALL_CFLAGS) $(LDFLAGS) 80211debug.c
339 -ath_info: ath_info.c
340 - $(CC) -o ath_info $(CFLAGS) ath_info.c
341 -
342 +athstats.o: athstats.c
343 + ${CC} -c -o athstats.o -DDOMULTI=1 ${ALL_CFLAGS} -I../ath athstats.c
344 +80211stats.o: 80211stats.c
345 + ${CC} -c -o 80211stats.o -DDOMULTI=1 ${ALL_CFLAGS} 80211stats.c
346 +ath_info.o: ath_info.c
347 + ${CC} -c -o ath_info.o -DDOMULTI=1 ${ALL_CFLAGS} ath_info.c
348 +athkey.o: athkey.c
349 + ${CC} -c -o athkey.o -DDOMULTI=1 ${ALL_CFLAGS} athkey.c
350 +athchans.o: athchans.c
351 + ${CC} -c -o athchans.o -DDOMULTI=1 ${ALL_CFLAGS} athchans.c
352 +athctrl.o: athctrl.c
353 + ${CC} -c -o athctrl.o -DDOMULTI=1 ${ALL_CFLAGS} athctrl.c
354 +athdebug.o: athdebug.c
355 + ${CC} -c -o athdebug.o -DDOMULTI=1 ${ALL_CFLAGS} athdebug.c
356 +wlanconfig.o: wlanconfig.c
357 + ${CC} -c -o wlanconfig.o -DDOMULTI=1 ${ALL_CFLAGS} wlanconfig.c
358 +80211debug.o: 80211debug.c
359 + ${CC} -c -o 80211debug.o -DDOMULTI=1 ${ALL_CFLAGS} 80211debug.c
360 +do_multi.o: do_multi.c
361 + ${CC} -c -o do_multi.o -DDOMULTI=1 ${ALL_CFLAGS} do_multi.c
362 +madwifi_multi: $(OBJS)
363 + ${CC} -o madwifi_multi ${LDFLAGS} ${OBJS}
364 + for i in athstats 80211stats athkey athchans athctrl athdebug wlanconfig 80211debug; do \
365 + ln -s -f madwifi_multi $$i; \
366 + done
367
368 install: $(ALL)
369 install -d $(DESTDIR)$(BINDIR)
370 Index: madwifi-ng-r2799-20071030/tools/wlanconfig.c
371 ===================================================================
372 --- madwifi-ng-r2799-20071030.orig/tools/wlanconfig.c 2007-10-31 14:04:46.989299247 +0100
373 +++ madwifi-ng-r2799-20071030/tools/wlanconfig.c 2007-10-31 14:04:47.561331846 +0100
374 @@ -62,6 +62,10 @@
375 #include "net80211/ieee80211_crypto.h"
376 #include "net80211/ieee80211_ioctl.h"
377
378 +#ifdef DOMULTI
379 +#include "do_multi.h"
380 +#endif
381 +
382 /*
383 * These are taken from ieee80211_node.h
384 */
385 @@ -96,9 +100,19 @@
386
387 static int verbose = 0;
388
389 +#ifdef DOMULTI
390 +
391 +int
392 +wlanconfig_init(int argc, char *argv[])
393 +{
394 +
395 +#else
396 +
397 int
398 main(int argc, char *argv[])
399 {
400 +
401 +#endif
402 const char *ifname, *cmd;
403 unsigned char bnounit = 0;
404 char *if_base = NULL;
405 Index: madwifi-ng-r2799-20071030/tools/ath_info.c
406 ===================================================================
407 --- madwifi-ng-r2799-20071030.orig/tools/ath_info.c 2007-10-31 14:04:46.997299702 +0100
408 +++ madwifi-ng-r2799-20071030/tools/ath_info.c 2007-10-31 14:04:47.561331846 +0100
409 @@ -722,8 +722,13 @@
410 "unlawful radio transmissions!\n\n");
411 }
412
413 +#ifdef DOMULTI
414 +int
415 +athinfo_init(int argc, char *argv[])
416 +#else
417 int
418 main(int argc, char *argv[])
419 +#endif
420 {
421 u_int32_t dev_addr;
422 u_int16_t eeprom_header, srev, phy_rev_5ghz, phy_rev_2ghz;