Software Bakery

Specialty: Delicious software

 

Wii Device Library v1.2 released

 

Here is another release of Wii Device Library. This version fixes even more bugs and adds some more stablity. The major changes:

  • Balanceboards are now also supported under Windows.
  • All stacks are more stable (*).
  • Fixed support for Bluez v3.2.1 on x64 machines.
  • Fixed some issues for the Windows and Linux GUIs.

(*) You can now (un)plug your bluetooth dongle when running without problems.

You can get the full changelog at Google Code.

The download is available at the project page.

 

11 Responses to “Wii Device Library v1.2 released”

  1.  

    So I was using the library and I was happy with it, when out of the blue it starts throwing exceptions after it pairs with a Wiimote. I think maybe it’s my code, so I try the example app and it still happens. I didn’t even reboot between when it was working perfectly fine and when not, and I didn’t do anything bluetooth or wiimote related to affected it, so I’m stumped.

    The IDeviceProvider is discovering…
    A device has been found.
    Connecting to the device…

    Unhandled Exception: System.InvalidOperationException: Received an output report
    !
    at WiiDeviceLibrary.ReportWiimote.ParseReport(Byte[] report)
    at WiiDeviceLibrary.ReportDevice.OnReportReceived(Byte[] report)
    at WiiDeviceLibrary.ReportDevice.OnReadReport(IAsyncResult result)
    at System.Runtime.Remoting.Messaging.AsyncResult.SyncProcessMessage(IMessage
    msg)
    at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMe
    ssage msg, IMessageSink replySink)
    at System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.DoAsyncCall()
    at System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.ThreadPoolCallBack(Ob
    ject o)
    at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state
    )
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, C
    ontextCallback callback, Object state)
    at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_Thre
    adPoolWaitCallback tpWaitCallBack)
    at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)

    In my own code the exception is thrown right after I call IDeviceProvider.Connect with the Wiimote’s IDeviceInfo.

    Tried pairing the Wiimote with a Wii and then back to the PC, tried popping the Wiimote batteries, tried unplugging and replugging my bluetooth dongle, tried restarting the Windows Bluetooth helper service… nothing.

    Any help would be appreciated. This is a great library you guys have made here.

  2.  

    Today I wake up and it’s working again after a sleep and wake. This is weird.

    I recommend you put a more friendly error message there like: “There may be a problem with the MS Bluetooth stack, reboot to fix.”

  3.  

    I’ve solved the mystery. Apparently if I have one of my USB hubs connected… it doesn’t matter if the bluetooth dongle is plugged into it or elsewhere… the exception occurs. Unplug it and everything works.

  4.  

    Another problem. This website seems dead but I might as well try.

    Apparently if I set the ReportingMode to turn off the Ir camera, and then wait a bit and set a ReportingMode to turn the camera back on, WiiDeviceLibrary throws a TimeoutException every time. ReportDevice.cs line 395

  5.  

    Actually it seems to be happening randomly now whenever I SetReportingMode… maybe it’ll crash, maybe not! Who knows!

  6.  

    I think my problem is due to multiple reports being sent to the Wiimote across multiple threads.

    My Updated event for a device invoked itself on the GUI thread to manipulate the GUI, and read from the wiimote at the same time (the rumble, battery, and led states). This reading could have been happening at the same time a ReportingMode was being set, which could have caused a problem.

    I also had the same exception if I tried to enable the speaker while my same update code was running.

    I noticed both use WriteMemory to poke at a number of addresses on the Wiimote, and it was WriteMemory that was failing to receive a return report.

    I worked around both problems by unhooking my device’s Updated event handler while changing ReportingMode or IsSpeakerEnabled, and rehooking it after.

  7.  

    Hi Dan,

    First: sorry for the wait, we should really have some sort of notification when people comment on this site.

    It really surprised me that you ran across the ‘Received an output report!’. When I added that exception I presumed no one was ever going to see that, because it would be almost impossible. I think one of the usb-devices (or hub) was registered as HID-device with the same Id’s as the Wii-devices have. WiiDeviceLibrary thought one of those devices was a Wii-device and tried to connect. The Wiimote normally sends and receives ‘reports’ and identifies the report-type with a single byte. This byte is checked by WiiDeviceLibrary. If it receives a byte that corresponds with a report-type that would normally be SENT to the Wiimote instead of RECEIVED it raises the exception you described.
    I might just remove the exception and just try to disconnect the device, since raising an exception on a thread that is not managed by the user could cause great annoyances.

    The TimeoutException is raised for WriteMemory and ReadMemory when there is no resulting-report sent back to confirm the operation succeeded (or failed) within 5 seconds.
    We tested and covered calling Wiimote-methods directly from the Update-eventhandler. This should be no problem.
    Though, invoking a call on the GUI-thread and at the same time blocking the Update-thread (which is what the ‘Invoke’ method does) -could- result in problems.

    I can’t really clearly state where the problem lies without some more information. It would be great if you could send us a portion of your code so we can analyse, test and debug using that.
    You can email me or Maato at info@softwarebakery.com.

  8.  

    This is the only .Net bluetooth library I’ve found that works on nokia’s n810 with mono.
    You need to convert the library to .Net 2.0 and replace libbluetooth.so.3 with libbluetooth.so.2 in the bluez native methods class.
    Don’t yet own a Wiimote so maybe there will be problems but it looks good so far.

  9.  

    That is an interesting usecase. You might be able to redirect references from libbluetooth.so.3 to libbluetooth.so.2 by using Mono’s configuration in your app.exe.config. If you try this, be sure to use WiiDeviceLibrary.Bluetooth.Bluez.BluezDeviceProvider directly instead of DeviceProviderRegistry.
    We’ll try it here later this week if mono’s redirection will work.

  10.  

    Hello FrozenCow

    Great job and thank you very much for the hard work !

    Any chance to get Motion Plus support with pass thru mode for Nunchuck ?
    Please see http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1248889032/45 for some hints about pass thru mode.

    Regards….

  11.  

    Don’t forget to also thank Maato ;) , he doesn’t comment much but did a lot of work and testing too, especially BlueZ support.

    I’ve been looking at Motion Plus support, though I can’t say it’s implemented in a few minutes in the current framework. At the moment school takes a lot of time, which doesn’t give me enough to setup the test-environment and implement the support. It would be a great addition though!

    To not forget the feature I’ve added it to the issue-tracker: http://code.google.com/p/wiidevicelibrary/issues/detail?id=13 . If there are any other requests (or issues) please also add it to the issue-tracker.

Leave a Reply