Using the Nintendo Wiimote with Linux
Nintendo's Wii game console includes the popular Wiimote control. Have you ever wondered whether the Wiimote works with Linux?
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  includes:
- libcwiid – an API for supporting the Wiid environment
- wmgui – a GUI control panel app
- wminput – an event/mouse/joystick driver
- wmdemo – a demo and testing application
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.
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).
From the CWiid project website , 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).
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 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.
Another option is to use your Wiimote to browse collections of pictures or control a multimedia center such as MythTV . 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.
Buy this article as PDF
The Internet community officially banishes the notoriously unsafe Secure Sockets Layer protocol.
Popular desktop environment continues the Gnome 2 legacy – with new support for the Gnome 3 toolkit.
New program will dial up security for the Firefox browser.
Red Hat's community distro embraces the cloud.
New partnership will bring more and better CS training to US schools
Criminals offer online help over Tor network
Sophisticated malware is still present on Joomla and WordPress sites around the world.
New release marks the arrival of AMD’s unified driver strategy.