Sunday, January 28, 2007

Wiimote and Java

These few days I was trying to hack an Wiimote, the cool remote controller for Wii. If you're not familiar with this, here is a nice passionate community about it: Wiili

Anyway, my development environment consists of:

  • one wiimote
  • one bluetooth dongle (intuix) supported by BlueSoleil
  • WindowsXP SP2 (mainly) / Debian Linux (nothing done here yet)
Since I wanted to use 'processing' to play with the Wiimote, I've worked for a Java-related platform. The starting point was to find a good and preferably free implementation of Java Bluetooth stack. And I had to face the following problems
  • BlueCove: This cannot get a proper local device address of my dongle. It just says 000000000000. According to several articles,
  • avetana: This says "No supported stack installed or no dongle available". I guess it's because I couldn't put the address of my dongle correctly when I've got the free demo of avetana. The address of my dongle is 10:11:11:11:11:11(or 11:11:11:11:11:11), and with this address I cannot download avetana.
In sum, I couldn't manage to get any JSR-82 implementation working with my dongle. I was about to give up my dongle and order another dongle which supports MS Bluetooth drivers. But I couldn't. Because it still works in other programming languages!
  • I took a look at other programs at Wiili, such as DarwiinRemote(for OS X) and Wiinmote(for XP). Afterwards I found that Wiinmote, in Delphi(precisely in Pascal), uses a library named HID controller. This HID controller basically uses PnP devices. That means, this Wiinmote just considers my Wiimote as a general PnP device. And it works perfectly!
What I'm wondering now is if I can get around seeking for any JSR-82 implementation by using PnP communication, for example. Probably the easiest way is just buying a new Bluetooth dongle from a well-known brand, in the list above. But... I don't like it. :( I mean, my dongle is still working very well in other languages. Why not Java? Should I really compile the HID controller into DLL and connect it with Java by JNI?