banner

The Nintendo Wiimotes are really a nice way to interact with the desktop: you can use it as wireless mouse for presentations, as a classic old videogame gamepad or even as lightgun (aka zapper) for 8-bits emulators (like retroarch).

So, let’s install the required libraries and add some additional configurations to get it working as a wireless mouse.

Install from System Repository (Ubuntu 16.04, Retropie, Debian)

If you’re on Retropie, Debian or Ubuntu 16.04 (first release, i.e., no HWE), just install the standard xserver-xorg-input-xwiimote package:

sudo apt install xserver-xorg-input-xwiimote

Install from PPA (Ubuntu 16.04.1 or above)

If you’re in Ubuntu 16.04.1 or above (i.e., you’re using HWE), the default system package will not work with the following errors:

The following packages have unmet dependencies:
 xserver-xorg-input-xwiimote : Depends: xorg-input-abi-22
                               Depends: xserver-xorg-core (>= 2:1.17.99.902)

I’ve reported an issue and in this meanwhile built the updated package.

You can install it with:

sudo apt-add-repository -y ppa:rael-gc/utils
sudo apt update
sudo apt install xserver-xorg-input-xwiimote

Alternative: Manual build

This is not required if you got the package installed from system repository or from the PPA. Skip to Additional configurations in this case.

Build requirements

Install required packages on Retropie, Debian or Ubuntu 16.04:

sudo apt install xutils-dev xserver-xorg-dev libxwiimote-dev

If you’re under Ubuntu 16.04.1 or higher, install with:

sudo apt install xutils-dev xserver-xorg-dev-hwe-16.0 libxwiimote-dev

Then open a new terminal or do a logout/login.

Download sources

Git clone or manual download (and extract) from https://github.com/dvdhrm/xf86-input-xwiimote

Build

cd xf86-input-xwiimote
./autogen.sh
./configure
make

Install

sudo make install
sudo cp 60-xorg-xwiimote.conf /usr/share/X11/xorg.conf.d/

Additional configurations

The default config file for xf86-input-xwiimote is /usr/share/X11/xorg.conf.d/60-xorg-xwiimote.conf.

If you’re using the system package or the PPA install, this file will be overwritten every time the package is updated. A better idea should create a copy named /usr/share/X11/xorg.conf.d/61-xorg-xwiimote.conf and use it to avoid package overwrite.

Enable IR

Of course, enable IR if you’re using a USB Wii sensor bar.

Edit the config file and add under “Nintendo Wii Remote” section:

	Option "MotionSource" "ir"

Enable mouse clicks

By default, if you press wiimote button A, it’ll produce a Enter key press.

To change this, edit the config file and add under “Nintendo Wii Remote” section:

	Option "MapIRA" "left-button"
	Option "MapIRB" "right-button"

Mimic 8bitdo Zero gamepad in keyboard mode

Edit the config file and add under “Nintendo Wii Remote” section:

	Option "MapOne" "KEY_G"
	Option "MapRight" "KEY_J"
	Option "MapLeft" "KEY_D"
	Option "MapRight" "KEY_C"
	Option "MapUp" "KEY_E"
	Option "MapDown" "KEY_F"
	Option "MapPlus" "KEY_O"
	Option "MapMinus" "KEY_N"
	Option "MapHome" "KEY_ESC"

Restart X.org

You’ll need to restart your X.org to get all changes working. Usually in Ubuntu, a logout/login is enough.

Pair the wiimote

Of course, if you didn’t pair your wiimote, pair it using the red sync button (the one in the batteries slot).

Read the manual

Seriously, the xf86-input-xwiimote manual is really nice. Give a try if you want different options:

man xf86-input-xwiimote