Results 1 to 10 of 260

Thread: HOWTO: Wii remote in Ubuntu 8.04

Threaded View

  1. #1
    Join Date
    Aug 2006
    Location
    Australia
    Beans
    1,438

    Lightbulb HOWTO: Wii remote in Ubuntu 8.04

    HOWTO: Wii remote in Ubuntu 8.04


    Introduction:-

    This howto should help you get a Wii remote working as a mouse / keyboard / joystick in 32bit or 64bit Ubuntu Hardy Heron 8.04
    There is no compiling required, you only need to download a few packages, and configure a few text files.

    I'd like to thank leffect for posting http://ubuntuforums.org/showthread.php?t=535659 and all the contributors too.
    I'd also like to thank Cyborg_572 for clearing up a mouseemu related bug that used to effect this howto.
    Hopefully I'll update https://help.ubuntu.com/community/CWiiD to reflect this howto as well.

    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.

    For the Ubuntu Intrepid Ibex 8.10 Wii remote guide, follow the following link:
    http://ubuntuforums.org/showthread.php?t=993376


    Install Packages:-
    Bring up a terminal (Applications --> Accessories --> Terminal), and install these packages:
    Code:
    sudo aptitude install wminput wmgui lswm
    Now 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.
    Press buttons 1 + 2 on your Wii remote
    Then in a terminal, type in:
    Code:
    lswm
    If you don't see something that looks like 00:1F:32:95:EF: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:1F:32:95:EF:B0), this is your Wii remote bluetooth device address.


    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.


    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 recommend you make it automatically run upon Ubuntu start up.
    Code:
    gksudo gedit /etc/modules
    Add this line at the end of the file:
    Code:
    uinput
    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 may restart your computer for the settings to take effect, or if you're impatient and want to play with your Wii remote now (without having to restart your computer) you can run this:
    Code:
    sudo modprobe uinput

    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:
    wminput 00:1F:32:95:EF:B0
    Please use your bluetooth device address for your Wii remote.


    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 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:
    wminput -c ir_ptr 00:1F:32:95:EF:B0
    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:-

    If you wish to use your Wii remote and an IR LED pen to make up a cheap touch screen / interactive whiteboard, then download and install the appropriate package from here:
    http://code.google.com/p/linux-white...downloads/list
    Once installed, you can find the Wiimote Whiteboard application in Applications --> Accessories --> Wiimote Whiteboard.


    Using your Wii remote for watching DVDs, Elisa media center, 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:
    wminput -d -c ir_ptr 00:1F:32:95:EF:B0
    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:
    killall wminput
    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.
    I have attached two icons to this post that I have created myself that you may use for this.


    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...ction_enum.txt


    If I've left anything out let me know, I'll endeavor to keep this updated.

    *Updated 24-Jun-2008: Cyborg_572 has found that mouseemu isn't required which fixes up a bug that did affect this howto.
    *Updated 6-Aug-2008: leffect has kindly donated the icons attached for us all to use and share - under a "Creative Commons Attribution-Share Alike" license, which essentially means you can use them wherever you like, but if you do, or you change them, let other people have them too.
    *Updated 29-Nov-2008: Added link to Toshibawarrior's Ubuntu 8.10 Wii remote guide.
    *Updated 30-Nov-2008: Changed the auto startup line for the uinput module from /etc/rc.local to a much more appropriate place for modules in /etc/modules
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	wiimote.png 
Views:	599 
Size:	9.5 KB 
ID:	80305   Click image for larger version. 

Name:	wiimotedark.png 
Views:	534 
Size:	10.3 KB 
ID:	80306   Click image for larger version. 

Name:	wiimoteinv.png 
Views:	484 
Size:	9.5 KB 
ID:	80308   Click image for larger version. 

Name:	wiimotedkgrn.png 
Views:	442 
Size:	11.7 KB 
ID:	80309   Click image for larger version. 

Name:	wiimotered.png 
Views:	414 
Size:	11.0 KB 
ID:	80310  

    Last edited by Rhubarb; November 30th, 2008 at 08:03 AM.
    Work smart, not hard.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •