[kismac] [binaervarianz] r198 - in branches/usb-drivers/Sources: Driver/USBJack WaveDrivers

  • From: svn@xxxxxxxxxxxxxxxx
  • To: kismac@xxxxxxxxxxxxx
  • Date: Sat, 30 Sep 2006 18:54:58 +0200

Author: gkruse
Date: 2006-09-30 18:54:47 +0200 (Sat, 30 Sep 2006)
New Revision: 198

Modified:
   branches/usb-drivers/Sources/Driver/USBJack/IntersilJack.mm
   branches/usb-drivers/Sources/Driver/USBJack/RalinkJack.mm
   branches/usb-drivers/Sources/Driver/USBJack/USBJack.mm
   branches/usb-drivers/Sources/WaveDrivers/WaveDriverUSBIntersil.mm
Log:
Squash the cpu bug mostly, any one device will no longer hammer the cpu, but 
two at once seems to slap it sensless.  We probably only need one CFRunLoop for 
all devices.  Also, prism2 is somewhat mangling packets still.

Modified: branches/usb-drivers/Sources/Driver/USBJack/IntersilJack.mm
===================================================================
--- branches/usb-drivers/Sources/Driver/USBJack/IntersilJack.mm 2006-09-23 
16:48:32 UTC (rev 197)
+++ branches/usb-drivers/Sources/Driver/USBJack/IntersilJack.mm 2006-09-30 
16:54:47 UTC (rev 198)
@@ -187,7 +187,7 @@
 }
 
 IntersilJack::IntersilJack() {
-    _isEnabled = false;
+  /*  _isEnabled = false;
     _deviceInit = false;
     _devicePresent = false;
     deviceType = intersil;
@@ -205,10 +205,11 @@
     pthread_mutex_init(&_recv_mutex, NULL);
     pthread_cond_init (&_recv_cond, NULL);
     
-    run();
+ //   run();
     
     while (_runLoop==NULL || _intLoop==NULL)
         usleep(100);
+*/
 }
 
 IntersilJack::~IntersilJack() {

Modified: branches/usb-drivers/Sources/Driver/USBJack/RalinkJack.mm
===================================================================
--- branches/usb-drivers/Sources/Driver/USBJack/RalinkJack.mm   2006-09-23 
16:48:32 UTC (rev 197)
+++ branches/usb-drivers/Sources/Driver/USBJack/RalinkJack.mm   2006-09-30 
16:54:47 UTC (rev 198)
@@ -855,7 +855,7 @@
 bool RalinkJack::startCapture(UInt16 channel) {
     setChannel(channel);
     RTUSBWriteMACRegister(MAC_CSR20, 0x0002); //turn on led
-    RTUSBWriteMACRegister(TXRX_CSR2, 0x0046); //enable monitor mode?
+    RTUSBWriteMACRegister(TXRX_CSR2, 0x004e/*0x0046*/); //enable monitor mode?
     return true;   
 }
 
@@ -874,6 +874,11 @@
     bzero(frame,sizeof(_recieveBuffer));
     tempFrame = (WLFrame *)frame;
     
+    if (len < sizeof(RXD_STRUC)) {
+        NSLog(@"WTF, packet len %d shorter than footer %d!", len, 
sizeof(RXD_STRUC));
+        return false;
+    }
+    
     //flash the led for fun
     RTUSBWriteMACRegister(MAC_CSR20, 0x0007);        //put led under software 
control
 
@@ -902,9 +907,11 @@
         //if the packet is less than 46 bytes, we can't exactly copy any more
         if (len > 46) {
             memcpy(frame + sizeof(WLPrismHeader) + 32 + 14, pData + 
24,len-(32+sizeof(WLPrismHeader)));
+           // NSLog(@"Normal packet %d", len);
         }
         else {
-            NSLog(@"RalinkJack::Really short packet!");
+            NSLog(@"RalinkJack::Really short packet! %d", len);
+            return false;
         }
 
         memcpy(&_recieveBuffer, frame, sizeof(_recieveBuffer));
@@ -915,7 +922,8 @@
 }
 
 RalinkJack::RalinkJack() {
-    _isEnabled = false;
+    
+   /* _isEnabled = false;
     _deviceInit = false;
     _devicePresent = false;
     deviceType = ralink;
@@ -937,6 +945,7 @@
     
     while (_runLoop==NULL || _intLoop==NULL)
         usleep(100);
+    */
 }
 
 RalinkJack::~RalinkJack() {

Modified: branches/usb-drivers/Sources/Driver/USBJack/USBJack.mm
===================================================================
--- branches/usb-drivers/Sources/Driver/USBJack/USBJack.mm      2006-09-23 
16:48:32 UTC (rev 197)
+++ branches/usb-drivers/Sources/Driver/USBJack/USBJack.mm      2006-09-30 
16:54:47 UTC (rev 198)
@@ -551,15 +551,15 @@
             * than the monitor mode port, or is a message type other than
             * normal, we don't want it.
             */
-       /* if (frameDescriptor->status & 0x1 ||
+/*        if (frameDescriptor->status & 0x1 ||
             (frameDescriptor->status & 0x700) != 0x700 ||
             frameDescriptor->status & 0xe000) {
             goto readon;
         }
-        */
+  */      
         if (frameDescriptor->dataLen > 2304) {
-            NSLog(@"MACJackCard::_handleRx: Oversized packet (%d bytes)\n",
-                        frameDescriptor->dataLen);
+            NSLog(@"USBJackCard::_handleRx: Oversized packet (%d bytes) %d 
read size\n",
+                        frameDescriptor->dataLen, len);
             goto readon;
         }
         
@@ -761,7 +761,7 @@
             (void) (*intf)->Release(intf);
             break;
         }
-        CFRunLoopAddSource(_intLoop, runLoopSource, kCFRunLoopDefaultMode);
+        CFRunLoopAddSource(_runLoop, runLoopSource, kCFRunLoopDefaultMode);
         
         _interface = intf;
         
@@ -793,9 +793,9 @@
 
 void USBJack::_attachDevice() {
     kern_return_t              kr;
-    IOUSBDeviceInterface    **dev=NULL;
+    IOUSBDeviceInterface    **dev;
     
-    if ((dev = _foundDevices[_numDevices])) {
+    if ((dev = _foundDevices[_numDevices--])) {
         
         // need to open the device in order to change its state
         kr = (*dev)->USBDeviceOpen(dev);
@@ -826,9 +826,9 @@
             return;
         }
         
-        _numDevices--;
         kr = (*dev)->USBDeviceClose(dev);
         kr = (*dev)->Release(dev);
+    
     }
 }
 
@@ -947,7 +947,7 @@
 } 
 
 void USBJack::_intCFRunLoop(USBJack* me) {
-    me->_intLoop = CFRunLoopGetCurrent();
+/*    me->_intLoop = CFRunLoopGetCurrent();
     while(me->_stayUp) {
         CFRunLoopRun();
     };
@@ -955,6 +955,7 @@
         CFRunLoopStop(me->_intLoop);
         me->_intLoop = NULL;
     }
+    */
 } 
 
 bool USBJack::run() {
@@ -964,10 +965,10 @@
     if (_runLoop==NULL) {
         pthread_create(&pt, NULL, (void*(*)(void*))_runCFRunLoop, this);
     }
-    if (_intLoop==NULL) {
+ /*   if (_intLoop==NULL) {
         pthread_create(&pt, NULL, (void*(*)(void*))_intCFRunLoop, this);
     }
-    
+   */ 
     return true;
 }
 
@@ -1052,7 +1053,7 @@
     
     run();
     
-    while (_runLoop==NULL || _intLoop==NULL)
+    while (_runLoop==NULL /* || _intLoop==NULL*/)
         usleep(100);
 }
 

Modified: branches/usb-drivers/Sources/WaveDrivers/WaveDriverUSBIntersil.mm
===================================================================
--- branches/usb-drivers/Sources/WaveDrivers/WaveDriverUSBIntersil.mm   
2006-09-23 16:48:32 UTC (rev 197)
+++ branches/usb-drivers/Sources/WaveDrivers/WaveDriverUSBIntersil.mm   
2006-09-30 16:54:47 UTC (rev 198)
@@ -52,7 +52,7 @@
             _driver = new IntersilJack;
             break;
         case ralink:
-         //   delete(_driver);
+        //    delete(_driver);
             _driver = new RalinkJack;
             break;
         case zydas:


Other related posts:

  • » [kismac] [binaervarianz] r198 - in branches/usb-drivers/Sources: Driver/USBJack WaveDrivers