Page 1 of 26 12311 ... LastLast
Results 1 to 10 of 260

Thread: HOWTO: Wii remote in Ubuntu 8.04

  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:	495 
Size:	9.5 KB 
ID:	80305   Click image for larger version. 

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

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

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

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

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

  2. #2
    Join Date
    Apr 2008
    Location
    In front of my iMac...
    Beans
    364
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOWTO: Wii remote in Ubuntu 8.04

    Rhubarb you are my hero! Thanks so much for this How-To...I read it and it seems to be easy enough...I just have two little questions before tampering with my Wiimote and my "current flawlessly working keyboard+mouse configuration"...

    If I download all these packages and make these configurations...will my Wiimote still work on my Wii?...I know the configs are on Ubuntu, and the Wiimote is not supposed to be changed in any way, but I want to make 100% sure...

    And, if I follow this How-To, will my keyboard+mouse combo will suffer any changes, other than the specified on your How-To (the one about the mouse dying when you type on the keyboard)? (BTW I have an integrated touchpad on my laptop (as all of them do, and an external USB wireless mouse...will they be changed?...or it's configs?)

    Thank you so much for this!

    I also posted this message on the old Wiimote thread...

    BTW this How-To is great, very complete and easy-to-follow...Keep up the good work!
    Last edited by Toshibawarrior; June 22nd, 2008 at 09:02 PM.
    7$]-[!8@\|//\Rr!0|2!!!
    =D>
    My Little Ubuntu Blog!

  3. #3
    Join Date
    May 2008
    Beans
    28

    Re: HOWTO: Wii remote in Ubuntu 8.04

    you, good sir, are phenomenal. thank you. ill be doing this tonight after work!

  4. #4
    Join Date
    Aug 2007
    Beans
    86
    Distro
    Kubuntu 8.04 Hardy Heron

    Re: HOWTO: Wii remote in Ubuntu 8.04

    Quote Originally Posted by Rhubarb View Post
    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
    I followed the steps and got my Wii remote working. I tested it with WMgui and all buttons worked fine. However, when I edit /etc/cwiid/wminput/buttons and I used the list from the URL above to try an remap the buttons, nothing worked! It seems only BTN_RIGHT, BTN_LEFT and REL_X and REL_Y work. I can map any Wii button to BTN_RIGHT or BTN_LEFT, but nothing else works (Including the the keys that are in the default buttons file). What could be wrong?

  5. #5
    Join Date
    Aug 2007
    Beans
    86
    Distro
    Kubuntu 8.04 Hardy Heron

    Re: HOWTO: Wii remote in Ubuntu 8.04

    Quote Originally Posted by Rhubarb View Post

    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.

    OK, I made the two icons and put them on the panel. I can click on the green icon and my remote connects, then click on the red and it disconnects.

    The way you worded this part makes it seem like this will magically make Ubuntu automatically connect if I press 1+2 and disconnect if I press the power button. I didn't think this would happen, and it didn't. Is there a way (i.e. something else I have to do) to get Ubuntu to automatically recognize these button presses?

  6. #6
    Join Date
    Aug 2007
    Beans
    86
    Distro
    Kubuntu 8.04 Hardy Heron

    Re: HOWTO: Wii remote in Ubuntu 8.04

    Answered my own questions on automatically disconnect/reconnect. The -d option makes it stay in memory so you can connect/disconnect. Aha!

    I still can't get all the button maps to work, though.

  7. #7
    Join Date
    Aug 2007
    Beans
    86
    Distro
    Kubuntu 8.04 Hardy Heron

    Re: HOWTO: Wii remote in Ubuntu 8.04

    Sorry for so many posts... I'm having fun with this tonight. I just found out, it's not necessary to specify your bluetooth address. wminput will use hci_inquiry to find an active bluetooth device and pick the first one. My panel button is now simply wminput -d and it works fine.

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

    Re: HOWTO: Wii remote in Ubuntu 8.04

    Toshibawarrior: Your Wiimote should still work on your Wii just fine.
    While I don't own a Wii myself, I could possibly be wrong here - but I have not heard of anyone having problems with using their wiimote on Ubuntu and their Wii.
    Your keyboard+mouse combo will not suffer any changes (you must fix up the bug I described in my howto). I have tested this on 3 different Ubuntu 8.04 computers - 2 64bit Desktops and 1 32bit Laptop. Everything works fine.

    TrashmanL: True it's not necessary to specify your bluetooth address, but it does allow Ubuntu to connect to your wiimote a lot faster.
    Thanks for pointing out the problem with binding buttons using wminput / wminput -c acc_ptr. I didn't realise that there's a bug with this.
    Binding different buttons does work fine when you use: wminput -c ir_ptr or wminput -c buttons
    I will experiment a bit and update my howto accordingly.


    *Updated 6-Aug-2008: Attached are my original icons you may all use, they are 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.
    Attached Images Attached Images   
    Last edited by Rhubarb; August 5th, 2008 at 04:48 PM. Reason: Please ignore my text in Red, this is no longer a problem and has been updated in my howto.
    Work smart, not hard.

  9. #9
    Join Date
    Aug 2007
    Beans
    86
    Distro
    Kubuntu 8.04 Hardy Heron

    Re: HOWTO: Wii remote in Ubuntu 8.04

    My last post of the night, I swear...

    Confirmed. Just some more info to narrow down. The buttons did map correctly with ir_ptr and buttons used directly. Not only did acc_ptr not work, but nunchuk_acc_ptr did not work, either. As a test, I tried to put

    Plugin.acc.X = REL_X
    Plugin.acc.Y = REL_Y

    in buttons directly. wminput -c buttons no longer worked to remap the buttons. This tells me the bug happens whenever REL_X and/or REL_Y are called (as opposed to being in the include statement - but I suppose that was obvious in that ir_ptr worked).

    You probably already though of this, but just in case you didn't, I figured I'd share my observations.

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

    Re: HOWTO: Wii remote in Ubuntu 8.04

    I've come to a similar conclusion TrashmanL.
    It seems to me whenever REL_X or REL_Y is called it becomes impossible to map keyboard buttons to other wiimote buttons.

    Interestingly this functions exactly like a joystick (it appears as a joystick and works in google earth), and the buttons work fine:
    Code:
    Plugin.acc.X	= ABS_X
    Plugin.acc.Y	= ABS_Y
    When you include mouse buttons, rather than just behaving as a joystick, it actually behaves as a joystick and a mouse simultaneously (the buttons work fine here too):
    Code:
    Plugin.acc.X	= ABS_X
    Plugin.acc.Y	= ABS_Y
    Wiimote.B	= BTN_LEFT
    But when ever you call REL_X or REL_Y, only mouse buttons can be bound, no extra keyboard bindings can be made:
    Code:
    Plugin.acc.X	= REL_X
    Plugin.acc.Y	= REL_Y
    A little clue of why this happens is found here:
    http://abstrakraft.org/cwiid/wiki/wminput
    An event device is always created. A mouse device is created if REL_X, REL_Y, and BTN_LEFT symbols are mapped (~ABS_X and ~ABS_Y effectively map REL_X and REL_Y, respectively). A joystick device is created if ABS_X is mapped.
    So it seems when a mouse device is created the buttons don't work, and when a joystick device is created (even though it can control the mouse cursor - I'm a bit confused here) the buttons do work.

    This possibly can be proven by (I'm a bit confused here)
    Code:
    Plugin.acc.X	= ~ABS_X
    Plugin.acc.Y	= ~ABS_Y
    Using the above configuration, I was unable to move the mouse pointer (it doesn't fuction as a joystick either), none of the buttons worked except for the buttons I bound to left and right mouse click.


    I haven't compiled the latest development version CWiid to test any further.

    If anyone here knows how to fix this bug please let me know.
    Last edited by Rhubarb; June 29th, 2008 at 04:43 PM. Reason: Please ignore this post, as it is no longer a problem and has been updated in my howto.
    Work smart, not hard.

Page 1 of 26 12311 ... LastLast

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
  •