Introduction
**UPDATE**: If you want an easier way to make you wiimote work with Ubuntu go read my newest tip on the "Tips and Advices" section.
Hello all! I know that many people liked Rhubarb's HOWTO about using the wiimote in Ubuntu but are confused on how to make it possible in other versions of K/Ubuntu. So, I decided to make this guide, to help out Rhubarb and everyone else here in the forums!
(To avoid common mistakes and extra work I'll use some snippets from Rhubarb's original guide.)
This HOWTO should help you get a Wii remote working as a mouse / keyboard / joystick in 32bit or 64bit (still untested in Intrepid) Ubuntu intrepid Ibex 8.10.
There is no compiling required, you only need to download a few packages, and configure a few text files.
Changelog
(Here I'll post minor and important updates made to the guide, make sure you read this first to know what's new on the guide.)
0 - November 25, 2008 = I started the guide.
1 - November 27, 2008 = Added the Special Thanks and Conclusion sections and fixed some text formatting.
2 - November 30, 2008 = Fixed some typos and changed the instructions for autostarting uinput on each boot for a much cleaner and nicer way (Thanks to Rhubarb for the tip!).
3 - December 11, 2008 = Added the Wiimote Whiteboard section (which is still on BETA state).
4 - December 14, 2008 = Added a few tips and advices.
5 - December 15, 2008 = Fixed the Wiimote Whiteboard section of the guide (thanks to Rhubarb for the detailed compiling process).
6 - January 1, 2009 = Added a link to download a .deb for installing the Whiteboard. (Thanks again to Rhubarb for this )
7 - February 10, 2009 = Added an "IMPORTANT NOTE" (which is just a little reminder) on the Infra Red section.
8 - February 14, 2009 = Added an alternative to restarting when installing wminput and the necessary packages.
9 - -July 5, 2009 = Fixed some boo-boos on the HOWTO's grammar and added a new tip [Check the Tips and Advices section to see it!]. I also fixed the command to execute wminput for IR Tracking while using gksudo[It needed to be wrapped in quotes for it to work. Thanks to everyone who noticed this, including zbeekman. I don't use IR tracking mode so to me it was irrelevant in some way].
10 - June 14, 2010 = Just a quick update: today (after almost a year of absence from this tutorial) I tried it with Ubuntu Lucid Lynx (10.04) and everything works. I still haven't tried the whiteboard part, but as far as I've tested, everything is working. So I'll be renaming this tutorial. I also added a new tip.
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.
Install the needed packages
Open up a terminal (Applications --> Accessories --> Terminal) and paste this in:
Code:
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 this in:
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:
Code:
gksudo gedit /etc/modules
Insert this line at the end of the file:
So the whole file should look exactly like this:
Code:
# /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.
Alternately, you can just open a terminal and type:
Code:
sudo modprobe uinput
(This method although accepted is not my favorite way of doing this.)
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:
Code:
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:
IMPORTANT NOTE: To use the wiimote in Infrea-Red mode you need an Infra-Red source, like: incandescent candles, flashlights or a Wireless Wii Sensor Bar. I personally use the Wireless Sensor Bar and it's pretty cool. You won't need to experiment making your own bars, if you don't want to. You can find "sensor bars" in lots of places, including online stores. Keep in mind that the sensor bar is nothing more than a few LED lights and some plastic to make it look pretty. Ask on this thread for suggestions about where to buy or how to make your own sensor bar.
There's a configuration file that you must first edit before this is possible.
From a terminal, type this in:
Code:
gksudo gedit /etc/cwiid/wminput/ir_ptr
Find these lines:
Code:
Plugin.ir_ptr.X = ~ABS_X
Plugin.ir_ptr.Y = ~ABS_Y
and replace it with:
Code:
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:
Code:
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:
Code:
gksudo gedit /etc/cwiid/wminput/buttons
Find these lines:
Code:
Wiimote.A = BTN_LEFT
Wiimote.B = BTN_RIGHT
and replace it with:
Code:
Wiimote.A = BTN_RIGHT
Wiimote.B = BTN_LEFT
Using your Wii remote and IR LED pen as a whiteboard:
This can be done by compiling in Intrepid...because the .deb package for Hardy doesn't work on Intrepid due to an incompatibility in some dependencies.
UPDATE: A .deb package was made! The link is below!
HARD WAY: (NOTE:Ubuntu 64-bit users have to compile the whiteboard thmselves because there's no .deb for 64-bit at the moment.)
Open up a terminal (Applications --> Accessories --> Terminal)
To install the needed packages type the following in:
Code:
sudo aptitude install libcwiid1-dev libsdl1.2-dev libxext-dev libbluetooth-dev libxtst-dev subversion lswm libcwiid1 libbluetooth3 libtool libcwiid1-dev libgtkmm-2.4-dev libglademm-2.4-dev libxtst-dev libcairomm-1.0-dev libsigc++-2.0-dev libgnome2-dev intltool libbluetooth-dev
You'll be prompted to enter in your password after entering the above command.
Now download the latest wii whiteboard from subversion:
Code:
svn checkout http://linux-whiteboard.googlecode.com/svn/branches/cpp/ linux-whiteboard-read-only
Change to the newly downloaded sources directory
Code:
cd ~/linux-whiteboard-read-only/
Configure it
Compile it
Install it
Then you can run it
This has been tested by Rhubarb in Intrepid and it works. If someone is not able to make it work, simply post your situation here.
EASY WAY:
There's a .deb package here - - > http://code.google.com/p/linux-white...downloads/list Enjoy!
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:
Code:
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:
Code:
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:
Code:
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.
Remapping the buttons / axis on your Wii remote / classic controller / nunchuck:
All the files you would want to change and experiment with are located in /etc/cwiid/wminput/
A list of all possible axis / keyboard / mouse / joystick / gamepad / steering wheel buttons you can bind your Wiimote to:
http://abstrakraft.org/cwiid/browser/trunk/wminput/action_enum.txt
If you don't understand something or have questions just ask! And I'll gladly try to help.
Tips and Advices:
- If you're not using your nunchuck or classic controller you must comment (add a # before each button entry on /etc/cwiid/wminput/buttons for the nunchuck and classic controller.
- Make sure you write down your Wiimote's bluetooth address and store it in a safe place to avoid having to use lswm each time you have to install wminput and cwiid (as in a fresh install of Ubuntu).
- Make sure you have all the latest updates for Intrepid to avoid corruption and/or bugs.
- Remember to use gksudo for wminput commands, since Intrepid asks for root privileges while using wminput.
- If your bluetooth adapter is not working unplug and re-plug it in different USB ports to see if Ubuntu recognizes it.
- In ACC (accelerometer mode) the wiimote's movement might be erratic. For moving the cursor up and down you tilt the wiimote up and down respectively. But for moving the cursor sideways you have to twist your wiimote left or right respectively. In IR (Infra-Red) mode you simply move your wiimote up, down, left , right, just like when playing Wii.
- Keep in mind that if you have a Wii and your Ubuntu computer in the same room and you use the wiimote's power button to turn it off, you'll end up turning on the Wii. And the Wii will automatically take over the wiimote.
- I tested XWii and it works flawlessly with Ubuntu 9.10 and 10.04. Here's a pre-made (completely safe) .deb package for the newest build of XWii. Just install it and run it on a terminal by typing: "xwii" without quotes and selecting a profile. I'll be adding a little more info on XWii's profiles soon. It's very useful and easy to setup, not to mention that the profiles are a breeze to make and it has some sweet capabilities that CWiiD/wminput doesn't have. Enjoy!
- If your bluetooth dongle doesn't work with your wiimote but does recognize the wiimote's bluetooth address fine, don't waste time reinstalling and fiddling with wminput or any other software. Simply try to find another dongle to test the wiimote. I have received multiple posts of people having non-working dongles and it turns out that there's no way to go around that, they just don't work! I have also received notice that Bluesoleil dongles don't work with wiimotes, go figure! They don't even work correctly in Windows, try to stay away from these dongles.
- If you have multiple Wiimotes and don't want to write down all of their addresses you can use this command:
Code:
gksudo "wminput -d -c ir_ptr $(lswm)"
This way lswm will search the Wiimote's bluetooth address at the same time as wminput connects to the Wiimote. Remember to press 1 + 2 on the Wiimote while executing this command!
Thanks to zbeekman for this!
Special Thanks
To Rhubarb for making the original guide for Hardy Heron and giving me advice for this guide.
Conclusion
Well, for now that's it. If I wasn't clear enough just let me know and I'll fix anything that needs fixing. And if you have suggestions for my guide simply post them here. Just like Rhubarb I'll do my best to keep this guide up to date with new updates in Ubuntu.
If you want to serve as a tester for using the wiimote in other Linux flavors (Kubuntu, Xubuntu, openSUSE, Fedora, etc) then we'll be very grateful if you post back your feedback on how it works.
That's All Folks! But stay tuned!
Bookmarks