[kismac] [binaervarianz] r212 - in branches/usb-drivers/Sources: Driver/USBJack WaveDrivers
- From: svn@xxxxxxxxxxxxxxxx
- To: kismac@xxxxxxxxxxxxx
- Date: Wed, 18 Oct 2006 19:44:05 +0200
Author: gkruse
Date: 2006-10-18 19:43:58 +0200 (Wed, 18 Oct 2006)
New Revision: 212
Modified:
branches/usb-drivers/Sources/Driver/USBJack/IntersilJack.mm
branches/usb-drivers/Sources/Driver/USBJack/RT73Jack.mm
branches/usb-drivers/Sources/Driver/USBJack/RalinkJack.mm
branches/usb-drivers/Sources/Driver/USBJack/USBJack.h
branches/usb-drivers/Sources/Driver/USBJack/USBJack.mm
branches/usb-drivers/Sources/WaveDrivers/WaveDriverUSBIntersil.mm
Log:
Some small cleanup to not hang if the usb device is in use or can't be opened
Modified: branches/usb-drivers/Sources/Driver/USBJack/IntersilJack.mm
===================================================================
--- branches/usb-drivers/Sources/Driver/USBJack/IntersilJack.mm 2006-10-17
06:32:44 UTC (rev 211)
+++ branches/usb-drivers/Sources/Driver/USBJack/IntersilJack.mm 2006-10-18
17:43:58 UTC (rev 212)
@@ -109,8 +109,11 @@
WLHardwareAddress macAddr;
int i;
+ if(!_attachDevice()){
+ NSLog(@"Device could not be opened");
+ return kIOReturnNoDevice;
+ }
- _attachDevice();
_firmwareType = -1;
for (i = 0; i< wlResetTries; i++) {
Modified: branches/usb-drivers/Sources/Driver/USBJack/RT73Jack.mm
===================================================================
--- branches/usb-drivers/Sources/Driver/USBJack/RT73Jack.mm 2006-10-17
06:32:44 UTC (rev 211)
+++ branches/usb-drivers/Sources/Driver/USBJack/RT73Jack.mm 2006-10-18
17:43:58 UTC (rev 212)
@@ -10,15 +10,16 @@
#include "RT73.h"
IOReturn RT73Jack::_init() {
- unsigned long Index;
unsigned long temp;
unsigned int i;
- unsigned char Value = 0xff;
IOReturn ret;
NICInitialized = false;
- _attachDevice();
+ if(!_attachDevice()){
+ NSLog(@"Device could not be opened");
+ return kIOReturnNoDevice;
+ }
// Wait for hardware stable
@@ -82,7 +83,7 @@
}
*/
- return kIOReturnSuccess;
+ return ret;
}
IOReturn RT73Jack::RTUSB_VendorRequest(UInt8 direction,
Modified: branches/usb-drivers/Sources/Driver/USBJack/RalinkJack.mm
===================================================================
--- branches/usb-drivers/Sources/Driver/USBJack/RalinkJack.mm 2006-10-17
06:32:44 UTC (rev 211)
+++ branches/usb-drivers/Sources/Driver/USBJack/RalinkJack.mm 2006-10-18
17:43:58 UTC (rev 212)
@@ -17,7 +17,10 @@
unsigned int i;
IOReturn ret;
- _attachDevice();
+ if(!_attachDevice()){
+ NSLog(@"Device could not be opened");
+ return kIOReturnNoDevice;
+ }
NSLog(@"--> NICInitializeAsic");
Modified: branches/usb-drivers/Sources/Driver/USBJack/USBJack.h
===================================================================
--- branches/usb-drivers/Sources/Driver/USBJack/USBJack.h 2006-10-17
06:32:44 UTC (rev 211)
+++ branches/usb-drivers/Sources/Driver/USBJack/USBJack.h 2006-10-18
17:43:58 UTC (rev 212)
@@ -93,7 +93,7 @@
IOReturn _configureAnchorDevice(IOUSBDeviceInterface **dev);
IOReturn _findInterfaces(IOUSBDeviceInterface **dev);
- void _attachDevice();
+ bool _attachDevice();
static void _addDevice(void *refCon, io_iterator_t iterator);
static void _handleDeviceRemoval(void *refCon, io_iterator_t
iterator);
static void _interruptRecieved(void *refCon, IOReturn result, int
len);
Modified: branches/usb-drivers/Sources/Driver/USBJack/USBJack.mm
===================================================================
--- branches/usb-drivers/Sources/Driver/USBJack/USBJack.mm 2006-10-17
06:32:44 UTC (rev 211)
+++ branches/usb-drivers/Sources/Driver/USBJack/USBJack.mm 2006-10-18
17:43:58 UTC (rev 212)
@@ -796,7 +796,7 @@
return kr;
}
-void USBJack::_attachDevice() {
+bool USBJack::_attachDevice() {
kern_return_t kr;
IOUSBDeviceInterface **dev;
@@ -812,7 +812,7 @@
NSLog(@"unable to open device: %08x\n", kr);
}
(*dev)->Release(dev);
- return;
+ return false;
}
kr = _configureAnchorDevice(dev);
@@ -820,7 +820,7 @@
NSLog(@"unable to configure device: %08x\n", kr);
(*dev)->USBDeviceClose(dev);
(*dev)->Release(dev);
- return;
+ return false;
}
kr = _findInterfaces(dev);
@@ -828,13 +828,14 @@
NSLog(@"unable to find interfaces on device: %08x\n", kr);
(*dev)->USBDeviceClose(dev);
(*dev)->Release(dev);
- return;
+ return false;
}
kr = (*dev)->USBDeviceClose(dev);
kr = (*dev)->Release(dev);
}
+ return true;
}
void USBJack::_addDevice(void *refCon, io_iterator_t iterator) {
Modified: branches/usb-drivers/Sources/WaveDrivers/WaveDriverUSBIntersil.mm
===================================================================
--- branches/usb-drivers/Sources/WaveDrivers/WaveDriverUSBIntersil.mm
2006-10-17 06:32:44 UTC (rev 211)
+++ branches/usb-drivers/Sources/WaveDrivers/WaveDriverUSBIntersil.mm
2006-10-18 17:43:58 UTC (rev 212)
@@ -69,7 +69,9 @@
return Nil;
}
- _driver->_init();
+ if(_driver->_init() != kIOReturnSuccess)
+ return Nil;
+
_errors = 0;
return self;
Other related posts: