Using the Nintendo Wiimote with Linux

Wii Fly


Nintendo's Wii game console includes the popular Wiimote control. Have you ever wondered whether the Wiimote works with Linux?

By Kristian Kißling

Christophe Schmid, Fotolia

Nintendo Wii users have become quite adept at slashing the wireless Wii remote (Wiimote) control through the air to score points with tennis players, golfers, space aliens, and other forms of virtual gladiators. If you like the Wiimote but you'd rather be on Linux, the transition is not as difficult as you might expect. A number of open source projects provide support for Wii with Linux. For instance, the CWiid toolset [1] includes:

The WiiLi project [2] offers a complete Linux port for the Wii itself, and the WiiBrew Wiki [3] provides resources for Wii-with-Linux users and developers.

From a technical point of view, the Wiimote is nothing more than a Bluetooth device. To let your system talk to the device, you'll need a Bluetooth adapter plus the necessary collection of components and drivers. Some Linux distros build in Wiimote support; others offer binary packages for download. If necessary, you can download and build the CWiid tools to integrate the Wiimote with your Linux environment. In this article, I show you how to get started with your Wiimote on Kubuntu and openSUSE systems. The details are similar for other distros.

Installation

First you'll need a Bluetooth adapter to communicate with the Wiimote device. In our lab, I used a tiny Bluetooth USB stick. Some Linux distros include the Wiimote tools in the default configuration; others provide binary packages for download. On Kubuntu 8.10 with KDE 4.1, start by installing a couple of packages at the console:

$ sudo apt-get install bluez lswm wmgui wminput autoconf build-essential libcwiid1-dev xpdf

Next, plug your Bluetooth stick into the USB slot, if you are using a stick, and scan for the Wiimote. To do this, type hcitool scan while pressing 1 and 2 at the same time on the remote. After a while, the console will display something like:

00:1F:32:A9:6B:4D Nintendo RVL-CNT-01

Although the numbers will be different, this is your Wiimote's Bluetooth address. Make a note of the address (only the numbers); you will need it later.

On openSUSE 11.0 with KDE 4.1, start by running YaST to install a couple of packages: Go to Software, click Software management, and install the following packages: bluez-libs, autoconf, xpdf, and python-devel. Then you need the developer tools. To install them, select Schemes as your Filter and check Basic developer environment (Figure 1).

Figure 1: On openSUSE 11.0, you can use YaST to install the developer tools before building a Wiimote-enabled application from the source code.

From the CWiid project website [1], obtain the cwiid-0.6.00 archive and place it in a folder below your home directory. At the console, type tar xvzf cwiid-0.6.00.tgz to unpack the archive, then change to the new directory and use the normal procedure (configure, make, make install) to build and install the software. (Make sure you are root for the last command.)

The rest of the installation steps are the same as for Kubuntu: Plug your Bluetooth stick into the USB slot, run hcitool scan to scan for the Wiimote, and make a note of the Bluetooth address. With openSUSE, enter su root and type the root password to become root instead of running sudo.

Wiimote in Action

After completing the installation, you need to enable the device. Giving the wmgui command launches a small graphical interface (Figure 2) that shows all of the Wiimote's buttons in the top left corner. First you must register the remote control with the GUI. To do so, press Ctrl+C. This pops up a window that prompts you to press 1 + 2 on the Wiimote. Then click OK with the mouse: It might take a while before the Wiimote is ready for action. Now press some of the Wimote's buttons - say, 1 and 2: The corresponding fields in the top left corner of the GUI should show green (see Figure 3).

Figure 2: Check the graphical interface to discover whether Linux has correctly identified the Wiimote buttons.

Figure 3: The Wiimote key presses show up in green in wmgui. Pressing Ctrl+A enables the Motion Sensors.

Pressing Ctrl+A enables the Motion Sensors, which register Wiimote movements and return them in the form of numeric output. Pressing this shortcut again disables the function. Pressing Ctrl+E displays the movement data for a Wiimote extension - such as a Nunchuk device (which is used for playing two-handed games like boxing). Pressing Ctrl+R twice enables and disables the internal vibration function, which uses up a fair amount of battery power.

One option is to use the Wiimote to replace the mouse. To do so, quit wmgui then type sudo modprobe uinput to load the kernel module that handles the alternative input device. Add a modprobe uinput line to your /etc/rc.local file to tell Linux to automatically load the module at startup time. Now type

$ sudo wminput 00:1F:32:A9:6B:4D

and press 1 and 2 at the same time on the Wiimote, before pressing Enter to send the command. If Ready is displayed at the prompt, the connection is working and you can now use the Wiimote to move the mouse pointer. A is the right mouse button, and B the left button. Moving the Wiimote up and down moves the cursor in the same directions; flipping your wrist left or right will move the mouse cursor left and right, too. Now you can control any program that you normally control with the mouse.

PDFs with Wiimote

WiiPDF[4] is a free PDF full-screen viewer designed to work with the Wiimote. For instance, you can press A and B on the Wiimote to go to the next or previous slides. First, download WiiPDF from the project website, then change to your home directory and give the tar -xvzf wiipdf-1.0.tar.gz command to unpack. Next, change to the new directory and type make to build the program from source code. After this, type sudo make install; you can then launch WiiPDF. To do so, you need your Wiimote's Bluetooth address. Once you have it, type the following:

$ wiipdf 00:1F:32:A9:6B:4D /path/to/PDF/file.pdf

The /path/to/PDF/ is replaced with the absolute path to the required document, and be sure to use the Bluetooth address for your own Wiimote. After a while, the PDF document should load, and you should be able to browse it by pressing A and B.

Other Ideas

Another option is to use your Wiimote to browse collections of pictures or control a multimedia center such as MythTV [5]. For the latter, you need to connect your computer to your TV set, launch the GUI, and use your Wiimote to zap through the channels. The Ardour audio editor, version 2.7 or newer, also supports Wiimote controls, although the feature is currently experimental.

Conclusions

These examples just scratch the surface of the possible uses for the Wiimote on Linux. Because the controls don't exactly lend themselves to fine motor skills, Wiimote is less than perfect for playing Neverball and other games that need highly precise movements. To find other programs you can control with your Wiimote, check out the CWiid site [6].

INFO
[1] CWiid: http://abstrakraft.org/cwiid/
[2] WiiLi: http://www.wiili.org/index.php/Main_Page
[3] WiiBrew: http://wiibrew.org/wiki/Main_Page
[4] WiiPDF: http://michael.stapelberg.de/wiipdf.en
[5] Controlling MythTV with a Wiimote: http://www.mythtv.org/wiki/index.php/Controlling_MythTV_using_a_Wii_remote
[6] More tools for Wiimote: http://abstrakraft.org/cwiid/wiki/ProgramsUsingCWiid