back to lofibucket.com

A home made sensor bar

A home made sensor bar

Using a Wii remote controller as a mouse with Raspberry Pi is relatively painless. I used the default Raspbian Linux installation.

  1. Get a Bluetooth dongle since RPi doesn’t have it built-in.
  2. Get a sensor bar, or build one yourself. I had one made by my brother.
  3. Setup uinput, wminput and a Wiimote connection script. To enable the IR tracking, I had to add the following lines to ~/.cwiid/wminput/buttons-player1

    Plugin.ir_ptr.X = ABS_X
    Plugin.ir_ptr.Y = ABS_Y

    To map B button to left mouse click: Wiimote.B = BTN_LEFT

To test the setup I started the desktop environment with startx and then opened a terminal, launched the script made in step 3. Everything worked!

My Wiimote connection script is the one given on Kodi forums:

#!/bin/bash
sudo /usr/bin/wminput -w -c ~/.cwiid/wminput/buttons-player1 $(lswm) &

My ~/.cwiid/wminput/buttons-player1 config:

Plugin.led.Led1 = 1

Wiimote.A      = BTN_RIGHT
Wiimote.B      = BTN_LEFT
Wiimote.Up      = KEY_UP
Wiimote.Down    = KEY_DOWN
Wiimote.Left    = KEY_LEFT
Wiimote.Right   = KEY_RIGHT
Wiimote.Minus   = KEY_BACKSPACE
Wiimote.Plus    = KEY_ENTER
Wiimote.Home    = KEY_ESC
#Wiimote.1
#Wiimote.2

Plugin.ir_ptr.X = ABS_X
Plugin.ir_ptr.Y = ABS_Y

Full list of Wiimote buttons.

Problems

scummvm

The default version you get with apt-get install scummvm seems to work fine, but its full screen mode is busted. You don’t get real upscaling to higher resolutions (only 2x, 3x and other special modes), and cwiid’s mouse emulation goes crazy when going full screen.

Workaround

I set the HDMI mode to VGA and disabled overscan in /boot/config.txt.

disable_overscan=1
hdmi_group=1
hdmi_mode=1

Then booted up LXDE with startx, ran the connection script and launched scummvm with 2x scaling in windowed mode. I managed to inch out the window borders by moving it by dragging with a mouse when holding alt.

Very cumbersome to set up, but it does work.

Compiling your own

I tried to compile a RPi version of scummvm with Dispmanx scaling as told in Vanfanel’s instructions, but I just couldn’t get it to work.

I tried applying the following patch to fix SDL includes but it still wouldn’t link.

diff --git a/configure b/configure
index 2631a29..a4acc15 100755
--- a/configure
+++ b/configure
@@ -3072,7 +3072,7 @@ MODULES="$MODULES backends/platform/$_backend"
 # Setup SDL specifics for SDL based backends
 #
 case $_backend in
-       dingux | gph | linuxmoto | maemo | openpandora | samsungtv | sdl)
+       dingux | gph | linuxmoto | maemo | openpandora | raspberrypi | samsungtv | sdl)
                find_sdlconfig
                INCLUDES="$INCLUDES `$_sdlconfig --prefix="$_sdlpath" --cflags`"
                LIBS="$LIBS `$_sdlconfig --prefix="$_sdlpath" --libs`"
@@ -3095,7 +3095,7 @@ esac
 # Enable 16bit support only for backends which support it
 #
 case $_backend in
-       android | dingux | dc | gph | iphone | maemo | openpandora | psp | samsungtv | sdl | tizen |
+       android | dingux | dc | gph | iphone | maemo | openpandora | psp | raspberrypi | samsungtv |
                if test "$_16bit" = auto ; then
                        _16bit=yes
                else

Please let me know if you find a solution for this problem.

References


For feedback email to pekka.vaananen@iki.fi