Author: robin Date: 2006-04-28 12:54:05 +0200 (Fri, 28 Apr 2006) New Revision: 146 Modified: trunk/KisMAC.xcodeproj/project.pbxproj trunk/Sources/3rd Party/Apple80211.h trunk/Sources/WaveDrivers/WaveDriverAirportExtreme.h trunk/Sources/WaveDrivers/WaveDriverAirportExtreme.m Log: * themacuser's patch to remove the "airport" tool from Airport Extreme passive mode channel switching - large improvement in overall CPU load. Closes ticket #103. Modified: trunk/KisMAC.xcodeproj/project.pbxproj =================================================================== --- trunk/KisMAC.xcodeproj/project.pbxproj 2006-04-28 05:59:51 UTC (rev 145) +++ trunk/KisMAC.xcodeproj/project.pbxproj 2006-04-28 10:54:05 UTC (rev 146) @@ -857,7 +857,7 @@ 6CA3BCCA09B2A58F00DCB407 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = /System/Library/Frameworks/Accelerate.framework; sourceTree = "<absolute>"; }; 87CEBA8009AEF03700AEB0B8 /* GrowlController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = GrowlController.h; sourceTree = "<group>"; }; 87CEBA8109AEF03700AEB0B8 /* GrowlController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = GrowlController.m; sourceTree = "<group>"; }; - 8D1107320486CEB800E47090 /* KisMAC.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KisMAC.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 8D1107320486CEB800E47090 /* KisMAC.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = KisMAC.app; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ Modified: trunk/Sources/3rd Party/Apple80211.h =================================================================== --- trunk/Sources/3rd Party/Apple80211.h 2006-04-28 05:59:51 UTC (rev 145) +++ trunk/Sources/3rd Party/Apple80211.h 2006-04-28 10:54:05 UTC (rev 146) @@ -409,6 +409,13 @@ void *outBuf); +extern WIErr WirelessPrivate( + WirelessContextPtr inContext, + void* in_ptr, + int in_bytes, + void* out_ptr, + int out_bytes); + /* ***** MISSING FUNCTIONS ***** Modified: trunk/Sources/WaveDrivers/WaveDriverAirportExtreme.h =================================================================== --- trunk/Sources/WaveDrivers/WaveDriverAirportExtreme.h 2006-04-28 05:59:51 UTC (rev 145) +++ trunk/Sources/WaveDrivers/WaveDriverAirportExtreme.h 2006-04-28 10:54:05 UTC (rev 146) @@ -26,11 +26,13 @@ #import <Cocoa/Cocoa.h> #import <pcap.h> #import "WaveDriver.h" +#import "Apple80211.h" @interface WaveDriverAirportExtreme : WaveDriver { pcap_t *_device; } +WIErr wlc_ioctl(int command, int bufsize, void* buffer, int outsize, void* out); + (BOOL)monitorModeEnabled; + (void)setMonitorMode:(BOOL)enable; Modified: trunk/Sources/WaveDrivers/WaveDriverAirportExtreme.m =================================================================== --- trunk/Sources/WaveDrivers/WaveDriverAirportExtreme.m 2006-04-28 05:59:51 UTC (rev 145) +++ trunk/Sources/WaveDrivers/WaveDriverAirportExtreme.m 2006-04-28 10:54:05 UTC (rev 146) @@ -27,8 +27,10 @@ #import "ImportController.h" #import "WaveHelper.h" #import <BIGeneric/BIGeneric.h> +#import "Apple80211.h" static bool explicitlyLoadedAirportExtremeDriver = NO; +WirelessContextPtr gWCtxt = NULL; @implementation WaveDriverAirportExtreme @@ -274,9 +276,25 @@ return _currentChannel; } +WIErr +wlc_ioctl(int command, int bufsize, void* buffer, int outsize, void* out) { + if (!buffer) bufsize = 0; + int* buf = malloc(bufsize+8); + buf[0] = 3; + buf[1] = command; + if (bufsize && buffer) + memcpy(&buf[2], buffer, bufsize); + return WirelessPrivate(gWCtxt, buf, bufsize+8, out, outsize); +} + +int chanint; + - (bool) setChannel:(unsigned short)newChannel { - [[NSTask launchedTaskWithLaunchPath:@"/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport" - arguments:[NSArray arrayWithObjects:@"-z", [NSString stringWithFormat:@"--channel=%u", newChannel], nil]] waitUntilExit]; + chanint = newChannel; + WirelessAttach(&gWCtxt, 0); + wlc_ioctl(52, 0, NULL, 0, NULL); // disassociate + wlc_ioctl(30, 8, &chanint, 0, NULL); // set channel + WirelessDetach(gWCtxt); _currentChannel = newChannel; return YES; }