Wiimote

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.

Prerequisites

  • Bluetooth
  • 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 the bluez package in Arch Linux includes the required wiimote plugin.

Connect the Wiimote

See XWiimote#Connect the Wii Remote.

Infrared sources

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 ()

Input device

MoltenGamepad

moltengamepadAUR 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 the uinput kernel module to emulate keyboard key presses. You can use this to make your Wiimote control videos and music.

First, install MoltenGamepad.

Create the system-wide configuration 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.

/etc/xdg/moltengamepad/profiles/wiimote_mediacontrol
[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 configuration file:

/etc/xdg/moltengamepad/moltengamepad.cfg
load profiles from "wiimote_mediacontrol"

Finally, start/enable the moltengamepad.service unit.

X11

XWiimote provides an X11 input driver for using a Wiimote as a desktop input device. See XWiimote for details.

cwiid

Note: This approach is based on software which is no longer developed upstream. You should use the Linux kernel driver and uinput or XWiimote instead.

The Wiimote can act as a regular input device like a mouse using wminput(1) from the cwiidAUR 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 uinput module:

# modprobe uinput

You should have a device in /dev/uinput now. For permanent use, add uinput to MODULES in mkinitcpio.conf.

cwiid should allow you to scan for your Wiimote now. Run the following command and press the 1 and buttons on your Wiimote:

Once your Wiimote has been detected you can test if it is working by running 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

Configuration

The default configuration files are in . They are a good starting point for your customized settings in ~/.cwiid/wminput or /usr/local/etc/cwiid/wminput. The general syntax is:

Wiimote_button = keyboard_key

All possible values for can be found in cwiid/wminput.list. The possible values for are keycodes in /usr/include/linux/input-event-codes.h.

Unable to open uinput

If wminput gives this error, leaving you unable to use the Wiimote, create a udev rule with the following contents :

KERNEL=="uinput", GROUP="wheel", MODE="0660"

Reboot the system afterwards. See also regarding udev rules for uinput.

Alternatively, add uinput to the MODULES array in mkinitcpio.conf:

MODULES=(uinput ...)

Regenerate the initramfs and reboot the system afterwards.

gollark: Solution: don't vote, but then whenever anyone brings up the subject, just change the subject and distract them.
gollark: > Why is the IQ of everyone using Twitter, Facebook, etc all like 40? It’s amazing just how dumb people on social media areThey have incentives to show you stuff which will make you very outraged, to boost engagement.
gollark: I have, mercifully, been able to avoid it so far.
gollark: Probably not the same people, but likely the same *kind*.
gollark: Yes, it seems very reasonable from that.

See also

This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.