How to connect a Wiimote for remote controlling purposes under Fedora?
(actually, it is a 3rd party wiimote clone, like the ones sold on amazon for 15 $)
How to connect a Wiimote for remote controlling purposes under Fedora?
(actually, it is a 3rd party wiimote clone, like the ones sold on amazon for 15 $)
Fedora 19 is current enough such that the installed bluetooth stack comes with wiimote support by default. You can directly connect the wiimote like any other bluetooth device.
If everything works fine, no pin is needed. At the end of the pairing process one can select the wiimote as input device in the bluetooth applet.
Depending on the hardware, perhaps a few tries are necessary at first (use reset-button inside the battery compartment) - one method is: after the computer 'sees' the bluetooth hardware, click connect and immediately press 'reset' on the device.
The bluetooth symbol and/or the context menu show a successful pairing.
With that only a few buttons work (up/down/left/right keys, right-mouse-click and space - that's it).
Thus, we have to configure some kind of mapping.
# yum install \
git gcc strace strace autoconf automake libtool systemd-devel ncurses-devel
xorg-x11-util-macros xorg-x11-proto-devel xorg-x11-server-devel
(strace is not strictly necessary, but it is useful to check for permission denied issues when running xwiimote)
The xwiimote repository contains the basic userspace library that interfaces with the bluetooth-daemon-plugin and some related tools.
Unfortunately, this software is not packaged for Fedora, yet.
Thus, we have to compile it:
$ git clone https://github.com/dvdhrm/xwiimote.git
$ cd xwiimote
$ ./autogen.sh
$ ./configure --prefix=$HOME/local/xwiimote
$ make
$ make install
$ ./xwiishow list
Listing connected Wii Remote devices:
Found device #1: /sys/devices/pci0000:00/0000:00:1a.1/usb4/4-2/4-2:1.0/bluetooth/hci0/hci0:11/0001:0002:0023.0032
End of device list
=> pairing worked, we have to fix the permissions for further tests:
# chown root:juser /sys/devices/pci0000:00/0000:00:1a.1/usb4/4-2/4-2:1.0/bluetooth/hci0/hci0:11/0001:0002:0023.0032/leds/*/brightness
# chmod g+w /sys/devices/pci0000:00/0000:00:1a.1/usb4/4-2/4-2:1.0/bluetooth/hci0/hci0:11/0001:0002:0023.0032/leds/*/brightness
$ xinput --list
[..]
↳ Nintendo Wii Remote Accelerometer id=9 [slave keyboard (3)]
↳ Nintendo Wii Remote IR id=10 [slave keyboard (3)]
↳ Nintendo Wii Remote id=11 [slave keyboard (3)]
↳ Nintendo Wii Remote Extension id=12 [slave keyboard (3)]
↳ Nintendo Wii Remote Motion+ id=13 [slave keyboard (3)]
[..]
=> some more permission adjustments:
# chown root:juser /dev/input/event1[0123] /dev/input/event9
# chmod g+w /dev/input/event1[0123] /dev/input/event9
(the xiimote repository also contains a sample udev rule for permission setting on connect, but they are only necessary for direct access like with xwiishow)
Start a ncurses interface for testing buttons, sensors, calibrating etc.:
$ ./xwiishow 1
(where 1 is the first device)
There is an xinput2 module which is - again - not available from the Fedora/Fusion package repositories, yet.
$ cd ..
$ git clone https://github.com/dvdhrm/xf86-input-xwiimote.git
$ cd xf86-input-xwiimote
$ ./autogen.sh
$ PKG_CONFIG_PATH=$HOME/local/xwiimote/lib/pkgconfig ./configure --prefix=$HOME/local/xwiimote LDFLAGS="-L$HOME/local/xwiimote/lib -Wl,-R$HOME/local/xwiimote/lib"
$ make
$ make install
Verify the runtime-path setting:
$ ldd /home/gms/local/xwiimote/lib/xorg/modules/input/xwiimote_drv.so
(should not display 'not found' messages)
Change the system-wide Xorg configuration:
# cd /etc/X11/xorg.conf.d
# ln -s /home/juser/src/xf86-input-xwiimote/60-xorg-xwiimote.conf
# cd /usr/lib64/xorg/modules/input/
# ln -s /home/juser/local/xwiimote/lib/xorg/modules/input/xwiimote_drv.so
Logout and restart X.
Verify via the X command line tool xev: all buttons should now send real key codes.
For example with my hardware the defaults are: enter, left/right/up/down, space, 1, 2, esc, volume +/-
(which are pretty sane defaults)
The cheap wiimote clone also came with a 'nunchuck' extension, which does not work out of the box with xiishow - YMMV.