[kismac] bug to squash

  • From: Robin L Darroch <robin@xxxxxxxxxxxxx>
  • To: kismac@xxxxxxxxxxxxx
  • Date: Mon, 17 Apr 2006 21:51:33 +0800

Hi everyone,

Found an annoying bug recently... and finally got the chance this evening to 
isolate it.  Will add to Trac as soon as I'm back in internet range.

Steps to reproduce:

1) Open KisMAC, select a USB Prism2 device as the one driver to use
2) Scan
3) Stop scanning
4) Close lid of iBook - allow to sleep
5) Open lid of iBook to wake
6) Start scanning again

Result -> CPU usage rises to 100% over about 5-10 seconds, and KisMAC either 
responds very slowly or not at all from then on.  The spinning channel 
indicator (for passive scanning) doesn't show channel numbers, and moves only 
stop-start.

* Same behaviour with either GPSd or no GPS integration selected.
* Does not affect Airport Extreme active OR passive scanning... so it must be 
an issue with the USB Prism2 device driver.  I have no other devices to test 
(12" iBook, so PCMCIA adapters aren't an option).

=================================
(later that night)
=================================

OK - I've created a fix that seems to work, although I'd appreciate input from 
someone who knows more about the handling of the drivers before I go committing 
it to the svn repository.  Here's the svn diff output:

Index: Sources/Driver/USBIntersilJack/USBIntersil.mm
===================================================================
--- Sources/Driver/USBIntersilJack/USBIntersil.mm       (revision 117)
+++ Sources/Driver/USBIntersilJack/USBIntersil.mm       (working copy)
@@ -89,8 +89,14 @@
     if (!_devicePresent) return false;
     if (!_deviceInit) return false;
     
+       // _doCommand(wlcInit,0) seems to be the key part of _reset() to make 
the USB driver work after sleeping
+    if (_doCommand(wlcInit, 0) != kIOReturnSuccess) {
+        NSLog(@"USBIntersilJack::::startCapture: _doCommand(wlcInit, 0) 
failed\n");
+        return false;
+    }
+
     if ((!_isEnabled) && (_disable() != kIOReturnSuccess)) {
-        NSLog(@"MACJackCard::startCapture: Couldn't disable card\n");
+        NSLog(@"USBIntersilJack::::startCapture: Couldn't disable card\n");
         return false;
     }


As far as I can tell, all that means is that KisMAC sends an initialisation 
command to the USB device every time you click the "start scan" button.  
Presumably when the computer goes to sleep and wakes up again, the USB device 
doesn't work properly without that initialisation, hence the problem reported 
above (and the fact that it only seems to affect my DWL-122).  For reference, 
the following is what would appear in the log when the failure was happening 
(i.e. when clicking Start Scan after waking from sleep, without the above 
patch):

2006-04-17 19:43:07.978 KisMAC[9034] USBIntersilJack::_setRecord: setRecord 
result 0x7f00
2006-04-17 19:43:07.991 KisMAC[9034] USBIntersilJack::_setRecord: setRecord 
result 0x7f00
2006-04-17 19:43:07.991 KisMAC[9034] USBIntersilJack::setChannel: setValue error
2006-04-17 19:43:07.991 KisMAC[9034] USBIntersilJack::::startCapture: 
setChannel(1) failed
2006-04-17 19:43:09.442 KisMAC[9034] USBIntersilJack::_setRecord: setRecord 
result 0x7f00
2006-04-17 19:43:09.456 KisMAC[9034] USBIntersilJack::_setRecord: setRecord 
result 0x7f00
2006-04-17 19:43:09.456 KisMAC[9034] USBIntersilJack::setChannel: setValue error
2006-04-17 19:43:09.458 KisMAC[9034] USBIntersilJack::getChannel: getValue error
(repeat the last four lines indefinitely)


As I say, I'll try to get around to raising a ticket for this, but if other 
folks with USB Prism2 adapters could test this in the mean time, I'd appreciate 
it... might be able to shortcut the Trac ticket straight to "resolved", 
accompanied by a commit of the above edit.

Cheers,
Robin
-- 

-------------------------------------------------------------------------
 Robin L. Darroch - PO Box 2715, South Hedland WA 6722 - +61 421 503 966
      robin@xxxxxxxxxxxxx - robin@xxxxxxxxxxx - robin@xxxxxxxxxxxxx
     

Other related posts: