blino's website

Free software developer and more

I finally bought my own Wiimote (and a cheap bluetooth adapter), I am thus ready for more fun ;-) For example, I can now play TORCS using the Wiimote as a wheel!


Wiimote-torcs
Uploaded by blino

By patching latest WMD with the patch pigeon made for Fligthgear, the Wiimote can be used as a classical joystick in Linux (using a /dev/js0 device).

Only a minor modification was required to pick other axis as events sources, since the Wiimote is not handled the same way as a wheel as it was when used as a joystick (with Fligthgear).

Then, the joystick needs to be calibrated using jscal -s /dev/js0. I have also packaged the jscalibrator joystick calibration utility, but it does not seem to handle the "joystick" center correctly.

The WMD patch send events through the uinput interface (user input), and just specifying in uinput that we support EV_ABS and ABS_X makes the joydev module automatically use the uinput device as a joystick, thanks to this code in drivers/input/joydev.c:

static struct input_device_id joydev_ids[]= {
        {
                .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
                .evbit = { BIT(EV_ABS) },
                .absbit = { BIT(ABS_X) },
        },
...
MODULE_DEVICE_TABLE(input, joydev_ids);

In cooker, I have also updated CWiid to version 0.3.00 (with IR support). The next Mandriva release will probably be Wiimote-ready for real \o/



Today, David has brought his Wiimote at Mandriva office so that we make some experiments with the Wiimote linux drivers. I've started with WMD, which is a python program that can generate input events based on the info sent by the Wiimote (on Bluetooth). It just required python-xlib and pybluez to run (I've uploaded packages in Cooker), to load the uinput kernel module, and to configure it in WMD config.

Since I don't have a sensor bar here (and haven't found time to build one), I can only use the accelerometer info. I've wrote a quick patch for WMD to send button events when a reasonnable acceleration is detected on the Wiimote X axis (see the motion analysis).

By mapping the relevant buttons on Ctrl+Alt+Left on Ctrl+Alt+Right, it gives a nice result in compiz: the Wiimote makes the 3D cube rotate \o/


Wii-compiz
Uploaded by blino

Well, there are some caveats though: when David takes back his Wiimote and moves away, it makes my desktop rotate /o\

More info about Wii and Linux can be found on the Wiili project homepage. The relevant packages will appear in Mandriva Cooker soon, stay tunned :-)



blosxom Optimised for standards.
Olivier Blin (2005)