Docs/Hardware/Wiimote
From Mandriva Community Wiki
This article describes how to use a Wiimote remote controller with games in Mandriva Linux.
Contents |
[edit] Bluetooth configuration
The Wiimote controller requires a Bluetooth adapter (it can be builtin, PCI or USB). The lspcidrake | grep Bluetooth command can be used to find if such an adapter is available on the system. To use this adapter, the bluez-utils package needs to be installed (run urpmi bluez-utils as root). Then, the bluetooth and hidd services have to be running: run service bluetooth restart; service hidd restart as root.
To check that the Wiimote controller is correctly detected, press simultaneously the 1 and 2 buttons of the controller (to put it in discover mode), and run the hcitool scan command. It should detect a Nintendo device:
$ hcitool scan
Scanning ...
00:19:1D:82:B8:FD Nintendo RVL-CNT-01
The address on the left of the Nintendo label is the Bluetooth address of the Wiimote controller, and could be useful later.
[edit] Wiimote configuration
The Wiimote controller can be configured using the WMD tool, from the python-wmd package. After the package installation, load the uinput module by running the modprobe uinput command as root (this does not need to be run after a reboot).
Then, press again the 1 and 2 buttons on your controller, and start the WMD tool as root, by running WMD.py. It should display a graphical windows with curves, representing the acceleration forces detected by the Wiimote accelerometers. These curves are actually a straight line when the controller lays, and show the strength when the controller is being moved.
To be able to modify the WMD configuration, a private copy can be done as user, for example
mkdir wiimote-js cd wiimote-js cp /usr/bin/WMD.py . cp -a /usr/lib/python2.5/site-packages/wmd/ .
To make WMD discover the device faster, the bluetooth address of the Wiimote can be set in the wmd/Config.py file:
'MY_WIIMOTE_ADDR': "00:19:1D:82:B8:FD",
Then, WMD can be started (as root) from the wiimote-js directory to use local changes:
./WMD.py
[edit] Joystick emulation
After some modifications, the WMD tool provides joystick emulation support, and this allows the Wiimote to be used in most Linux games (if they already have generic joystick support).
[edit] Patching WMD
WMD has to be modified to get joystick support, with a patch inspired from pigeon's work.
curl http://people.mandriva.com/~blino/wmd-0.1.2-acc_wheel.patch | patch -p0
[edit] Calibrating the joystick
With this patch, after WMD is started, a /dev/js0 device should have been created. This allows to use the Wiimote as a joystick device. To calibrate this new virtual joystick, the input-utils package has to be installed. Then, the jscal -c /dev/js0 command will calibrate the joystick (this has to be done everytime WMD is restarted).
[edit] Using the Wiimote as a wheel
The Wiimote controller can be used as a wheel in racing games, such as Torcs (use urpmi torcs as root to install it).
During calibration with jscal, the Wiimote should lay horizontally, the arrow keys on the left, and the 1/2 buttons on the right. Then, torcs can be started, and the "joystick" has to be calibrated again in the torcs settings menu.
[edit] Using the Wiimote as a joystick
(using the Wiimote in the FlightGear simulator)
[edit] More
The cwiid package also allows the Wiimote to be used as a controller. It comes with the wmgui graphical frontend and the wminput tool.
The transfermii package can be used to manipulate Mii data on the Wiimote.

