Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

DarwiinRemote broken on OSX 10.8

EFroemling
2012-07-28
2013-06-22
  • EFroemling
    EFroemling
    2012-07-28

    Sadly it looks like DarwiinRemote is broken under Mountain Lion, (and from a quick scan of the internet, other wiimote-communication software is too).  Anyone have any idea what changed or if it'll be possible to get it working again?

     
  • John Lee
    John Lee
    2012-08-01

    I've been working on it, but I'm no expert.  From what I can tell, I can successfully open L2CAP channels for control and interrupt from the device, and when I try to send the status update command it returns successful (that it sent the command), but the Wii Remote is not behaving as expected.  Instead it continues in it's flashing mode.  Closing the L2Cap channels does not disconnect the wii remote.  So a connection is not being established with the wii remote, even though the channels are open.

    This may be because the way channels are opened are different from Lion to Mountain Lion?  I'm not sure.

     
  • John Lee
    John Lee
    2012-08-02

    I do not have developer access, but I figured it out!  The control and interrupt channels are not being properly retained as Objective-C requires.  So they invalidate as quickly.

    It will take some tracking to properly set all of the retain and releases all through-out the wii remote framework to prevent memory leaking, but you need to AT LEAST retain before returning from

    - (IOBluetoothL2CAPChannel *) openL2CAPChannelWithPSM:(BluetoothL2CAPPSM) psm delegate:(id) delegate

    and release during disconnect / dealloc.

     
  • EFroemling
    EFroemling
    2012-08-04

    The retain bit totally fixed it.. Thanks a ton good sir!  Hopefully someone with developer access can add that to the official version…

     

  • Anonymous
    2012-08-08

    I really need this software, but it seems it won't be updated :(

    Felmir posted a solution, but I don't know anything about coding. I've downloaded the source code, and I've opened it with XCode, but I don't know what's the next I have to do. I don't know where I have to place this:

    - (IOBluetoothL2CAPChannel *) openL2CAPChannelWithPSM:(BluetoothL2CAPPSM) psm delegate:(id) delegate

    If you explain me this, I could make it and have the app functional. Thanks!

     
  • John Lee
    John Lee
    2012-08-08

    I have to figure out how to re-configure the XCode project to build in Mountain Lion and then submit a patch to Darwiin, but I've been very busy.

    But here is an SVN diff that tells the places to change and what I changed.  I believe I got all of the cases to avoid a memory leak:

    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 = ;
    if (!_cchan)
    return kIOReturnNotOpen;

    usleep (20000);
    + if ( _ichan != nil )
    + ;
    _ichan = ;
    if (!_ichan)
    return kIOReturnNotOpen;
    @@ -506,15 +510,23 @@
    _delegate = nil;

    // cam: set delegate to nil
    - ;
    - ret = ;
    - _cchan = nil;
    - LogIOReturn (ret);
    + if ( _cchan != nil )
    + {
    + ;
    + ;
    + ret = ;
    + _cchan = nil;
    + LogIOReturn (ret);
    + }

    - ;
    - ret = ;
    - _ichan = nil;
    - LogIOReturn (ret);
    + if ( _ichan != nil )
    + {
    + ;
    + ;
    + ret = ;
    + _ichan = nil;
    + LogIOReturn (ret);
    + }

    ret = ;
    _wiiDevice = nil;
    @@ -1540,10 +1552,16 @@
    NSLogDebug (@"l2capChannelClosed (PSM:0x%x)", );

    if (l2capChannel == _cchan)
    + {
    + ;
    _cchan = nil;
    + }

    if (l2capChannel == _ichan)
    + {
    + ;
    _ichan = nil;
    + }

    ;
    }
    @@ -1624,6 +1642,7 @@
    ;
    }

    + ;
    return channel;
    }

     
    • Maxi
      Maxi
      2013-06-22

      Looks like the square brackets got omitted from felmir's diff. Anyone can fill in the blanks?

       
  • swenedo
    swenedo
    2012-10-02

    Excuse me for my ignorance, but could you give me some hint on how to build this in Xcode?

    I have checked out the code from svn, and made changes to trunk/WiiRemote.m (proposed by #7). How do I build this so I can run this locally on my computer (not in debug mode). I have never used Xcode before. If you know a good tutorial/guide I would be glad to know about it.

    I have just started a 1 month student project where I have decided to use a Wii mote (with motion+). If I can't get this to work it's kind of a showstopper.

    I'm OS X 10.8.2 and I use Xcode 4.5. The wiimote is the newest one (RVL-CN1-01-TR).

     

  • Anonymous
    2012-10-07

    I have the same issue as swenedo.  I have the local changes, but xcode refuses to compile.

     
  • felmir is right. I'm not a committer on the Darwiin project, but my EarthSurfer project http://code.google.com/p/earthsurfer/ compiles and runs without difficulty in iOS 10.8, Xcode 4.5. I've tried to keep the WiiRemote code as close as possible to the code in the svn repository here.

     
  • darkcooger
    darkcooger
    2012-11-26

    I took felmir's fix and went ahead and built a DMG.  For anyone having trouble building it yourself, this is working fine for me:  http://darkcooger.net/DarwiinRemote-OSX-10.8.dmg

     
    • Maxi
      Maxi
      2013-06-22

      Hi, that's awesome, but.. could you post the source? Looks like a lot of ppl would appreciate that.

      Thanks!

       
  • Zethyrius
    Zethyrius
    2012-11-30

    thanks loads darkcooger!  i was able to get the gf's MacBook Air up and able to play LIMBO again, no problems whatsoever!!

    and (sorry if this is the wrong place to post this, but) thanks to the community at large for efforts on this project.  it has helped make life on OS X so much more convenient and fun.

     
  • Oliver Jones
    Oliver Jones
    2013-01-13

    Hello,

    I am too, trying to get the DarwiinRemote working on 10.8. I downloaded the version 'darkcooger' supplied, but every time I try and run it, I get a message saying: "The managed object model version used to open the persistent store is incompatible with the one that was used to create the persistent store" …? Any ideas why this is coming up? When I hit 'OK', it just crashes straight away.

    Could someone please point me in the right direction - all I want to do I connect my WiiMote to my Mac :-/

    Thanks all!

     
  • Si Brindley
    Si Brindley
    2013-01-26

    Hey, thank you very much, David (Oster).  Extremely helpful and it worked for me.
    (And thanks to the detective work beforehand too.)