This article will go through the basic steps required to have a working Wiimote in Linux for general use. It will not go into much detail for some steps as there are many guides already written for some parts already.
- A Wii Remote
Wiimotes connect via Bluetooth. This must already be configured and running without the help of this guide. You will need a Wiimote, this can include (although are not required) the Nunchuk and Classic Control attachments.
Once a Wiimote is connected via Bluetooth, the device should start working, as the kernel driver for the Wiimote is in Linux since version 3.1 and thepackage in Arch Linux includes the required wiimote plugin.
Connect the Wiimote
Possible infrared sources are
- Nintendo Wii Sensor Bar
- Wireless sensor bar - check eBay!
- Normal light bulbs
- Small candles (should have about 30cm distance)
- Home made sensor bar ()
AUR provides a display server-neutral way to configure Wiimotes and other game controllers. It will work in X11, Wayland, or even the Linux console.
Using a Wiimote as a media device
MoltenGamepad can use uinput to emulate keyboard key presses. You can use this to make your Wiimote control videos and music.
First, install MoltenGamepad.
Create the system-wide config directories:
# mkdir -p /etc/xdg/moltengamepad/profiles
Add a profile for setting up a Wiimote as a media controller (see the upstream example). You can set the key bindings to whatever you like.
[wiimote] wiimote.wm_2 = key(key_nextsong) wiimote.wm_down = key(key_down) wiimote.wm_up = key(key_up) wiimote.wm_right = key(key_right) wiimote.wm_plus = key(key_volumeup) wiimote.wm_1 = key(key_previoussong) wiimote.wm_left = key(key_left) wiimote.wm_a = key(key_playpause) wiimote.wm_minus = key(key_volumedown) wiimote.wm_b = key(key_mute)
Load this profile when MoltenGamepad starts by adding it to the root config file:
load profiles from "wiimote_mediacontrol"
Finally, start and enable the
moltengamepad.service systemd unit.
XWiimote provides an X11 input driver for using a Wiimote as a desktop input device. See XWiimote for details.
The Wiimote can act as a regular input device like a mouse using
wminput from the AUR package. This package contains a userspace driver, libraries, and programs required for basic use of the Wiimote.
First you need to make sure to load the
# modprobe uinput
You should have a device in
/dev/uinput now. For permanent use you can add it to the modules section in your mkinitcpio.conf.
Thanks to cwiid you can scan for your Wiimote now:
(press the 1 and 2 buttons on your Wiimote) $ bluetoothctl scan on Scanning ... <MAC address> Nintendo RVL-CNT-01
Once your Wiimote has been detected you can test if it is working by running the command
wmgui and testing out various buttons and sensors through that interface.
If you have no infrared source simply run:
$ wminput -w
You can control your pointer now by tilting your Wiimote forward, backward or to the sides.
If you have an infrared source run:
$ wminput -c ir_ptr -w
The default configuration files are in
/etc/cwiid/wminput/. They are a good starting point for your customized settings in
/usr/local/etc/cwiid/wminput. The general syntax is:
Wiimote.Button = KEY_ON_KEYBOARD
All possible values for Wiimote.Buttons can be found here: , the possible values for KEY_ON_KEYBOARD in
Unable to open uinput
If wminput gives this error, leaving you unable to use the wiimote, try the following:
- Create a new file in
/etc/udev/rules.d/(It does not matter what the name of the file is, so long as the extension is .rules)
- Add the following to the file:
KERNEL=="uinput", GROUP="wheel", MODE="0660"
This should solve the problem. Solution was found in the forums here.
- Edit the
/etc/mkinitcpio.confadd "uinput" in MODULES:
MODULES="uinput ...."as needed.
- Re-generate the initramfs image with:
# mkinitcpio -p linux