Having trouble with Darwiin Remote on Mac OS X 10.8 Mountain Lion? So was I. The Remote would be picked up by Mac OS’s Bluetooth rather than Darwiin Remote. That was disappointing.
But, thanks to a user at Sourceforge, there’s a fix. I’ve rebuilt the framework and created a quick zip file with the updated bundle, including the fixed Framework with the last released version of the app.
Read on for the raw source of the patch:
Index: trunk/WiiRemote.m
===================================================================
--- trunk/WiiRemote.m (revision 240)
+++ trunk/WiiRemote.m (working copy)
@@ -143,11 +143,15 @@
IOReturn ret = kIOReturnSuccess;
// it seems like it is not needed to call openConnection in order to open L2CAP channels ...
+ if ( _cchan != nil )
+ [_cchan release];
_cchan = [self openL2CAPChannelWithPSM:kBluetoothL2CAPPSMHIDControl delegate:self];
if (!_cchan)
return kIOReturnNotOpen;
usleep (20000);
+ if ( _ichan != nil )
+ [_ichan release];
_ichan = [self openL2CAPChannelWithPSM:kBluetoothL2CAPPSMHIDInterrupt delegate:self];
if (!_ichan)
return kIOReturnNotOpen;
@@ -506,15 +510,23 @@
_delegate = nil;
// cam: set delegate to nil
- [_cchan setDelegate:nil];
- ret = [_cchan closeChannel];
- _cchan = nil;
- LogIOReturn (ret);
+ if ( _cchan != nil )
+ {
+ [_cchan release];
+ [_cchan setDelegate:nil];
+ ret = [_cchan closeChannel];
+ _cchan = nil;
+ LogIOReturn (ret);
+ }
- [_ichan setDelegate:nil];
- ret = [_ichan closeChannel];
- _ichan = nil;
- LogIOReturn (ret);
+ if ( _ichan != nil )
+ {
+ [_ichan release];
+ [_ichan setDelegate:nil];
+ ret = [_ichan closeChannel];
+ _ichan = nil;
+ LogIOReturn (ret);
+ }
ret = [_wiiDevice closeConnection];
_wiiDevice = nil;
@@ -1540,10 +1552,16 @@
NSLogDebug (@"l2capChannelClosed (PSM:0x%x)", [l2capChannel getPSM]);
if (l2capChannel == _cchan)
+ {
+ [_cchan release];
_cchan = nil;
+ }
if (l2capChannel == _ichan)
+ {
+ [_ichan release];
_ichan = nil;
+ }
[self closeConnection];
}
@@ -1624,6 +1642,7 @@
[self closeConnection];
}
+ [channel retain];
return channel;
}