Inhaltsverzeichnis

Quelle1)

Howto get Wii Remote working in Ubuntu 8.10 (Intrepid Ibex)

Posted by admin on February 4th, 2009

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting! This tutorial will explain howto get a Wii remote working as a mouse / keyboard / joystick in Ubuntu intrepid Ibex 8.10.

Requirements

Your computer must have a known working bluetooth adapter, a Wii remote.

An infra-red light source is required if you wish to use your Wii remote to behave like a mouse from an IR light source, such as the Wii sensor bar, some candles, an incandescent light, etc.

An IR LED pen is required if you wish to setup a whiteboard with your Wii remote.

Preparing your System

Open up a terminal (Applications –> Accessories –> Terminal) and enter the following command

sudo aptitude install wminput wmgui lswm

Next, we need to find the bluetooth device address of your Wii remote, this will allow you to connect to your Wii remote faster in future, and will let you know if your system can connect to your Wii remote via bluetooth.

In a terminal type the following command

lswm

And press buttons 1 & 2 on your wiimote to put it in discovery mode.

If you don’t see something that looks like 00:2A:34:95:FE:B0 then keep on running lswm / pressing buttons 1 + 2 on your Wii remote until you do.

Please note down the number that lswm returns (that looks similar to 00:2A:34:95:FE:B0), this is your Wii remote bluetooth address (Keep in mind that the number given here is an example).

Check to see if all the capabilities of your Wii Remote (and extra controllers) work

Start up wmgui (Applications –> Accessories –> Wmgui).

wmgui is an easy application that’s good to use for simple diagnostics on your wiimote, nunchuk and classic controller.

Allow your Wii remote to be a keyboard / mouse / joystick

Unless you want to run sudo modprobe uinput every time you start Ubuntu, it’s recommended that you make it automatically run upon Ubuntu start up.

Open a terminal and type

gksudo gedit /etc/modules

Insert this line at the end of the file

uinput

So the whole file should look exactly like this

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with “#” are ignored.
fuse
lp
sbp2
uinput

You have to restart your computer for the settings to take effect.

Using your Wii remote as a mouse using acceleration data

If you want to use your Wii remote as a mouse by tilting your Wii remote, then press buttons 1 + 2 on your Wii remote and from a terminal run this

gksudo wminput [your wiimote's bluetooth address]

Please use your bluetooth device address for your Wii remote (the one that lswm returned).

Using your Wii remote as a mouse using an Infra-Red light source

There’s a configuration file that you must first edit before this is possible.

From a terminal, type the following command

gksudo gedit /etc/cwiid/wminput/ir_ptr

Find these lines

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

and replace it with

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

To get your Wii remote to track IR light sources, press buttons 1 + 2 on your Wii remote and from a terminal run this

gksudo wminput -c ir_ptr [your wiimote's bluetooth address]

Please use your bluetooth device address for your Wii remote.

Swapping default left and right mouse buttons

If you prefer the left mouse button to be button B (the trigger) on your Wii remote, and the right mouse button to be button A on your Wii remote, then from a terminal run this

gksudo gedit /etc/cwiid/wminput/buttons

Find these lines

 Wiimote.A = BTN_LEFT
 Wiimote.B = BTN_RIGHT

and replace it with

 Wiimote.A = BTN_RIGHT
 Wiimote.B = BTN_LEFT

Using your Wii remote and IR LED pen as a whiteboard

First you need to download latest .deb from here or using the following command

wget http://linux-whiteboard.googlecode.com/files/whiteboard_0.3.4.2-0ubuntu1_i386.deb

install this .deb file using the following command

sudo dpkg -i whiteboard_0.3.4.2-0ubuntu1_i386.deb

Aufstellung der Wiimote

Using your Wii remote for watching DVDs, Elisa Media Center, Music players, etc

I’ve setup on my system 2 icons in my gnome panel that I can click on if I want to connect to my Wii Remote and use it’s IR light tracking ability as a mouse, and the other to turn off the wminput daemon that I started on the other icon.

Right click on an empty part of the Gnome panel and select “Add to Panel…”, then “Custom Application Launcher” then press the “+Add” button.

Type in a name for it, for the command, use this

gksudo wminput -d -c ir_ptr [your wiimote's bluetooth address here]

For IR mode. If you want to use ACC (accelerometer mode) the command should be:

gksudo wminput [your wiimote's bluetooth address here]

The gksudo is important because if you use sudo only you won’t see any prompt to type in your password, and in Intrepid it IS necessary to be root to activate wminput.

Select a nice icon for it if you wish, then press close.

To create another icon to kill all running wminput processes, do the same as above, but for the command use this

gksudo killall wminput

Use gksudo here too because you might need to type in your password again.

The advantage of using these two icons to run wminput, is that you can turn off your Wii remote (by pressing and holding the power button on your Wii remote) when you start watching a DVD / listening to music to save battery power, then if you wish to start using your Wii remote again, simply press buttons 1 + 2 on your Wii remote and Ubuntu will automatically connect to your Wii remote again as before without having to pick up a keyboard or mouse to do so.