Dies ist eine alte Version des Dokuments!


Quelle1)

Connect a Wii Remote to your PC Using Linux

Although linux is getting more and more user-friendly al lot of things cost most time and effort than you are used from Windows. But in return you will be able you modify all code and thus your Wii Remote behavior. So don't be scared, just follow the instructions and you will soon be making weird gestures in front of your linux pc.

Be sure to have BlueZ installed, this is the official linux bluetooth-stack. It's in installed by default on Ubuntu 7.0.4.

You can use the hcitool to scan for bluetooth devices in range and get their bluetooth address. Press button 1 and 2 on the Wii Remote simultaneously and type „hcitool scan“. This will give you something like:

jos@ubuntu:~$ sudo hcitool scan 
 Password: 
 Scanning ... 
         00:19:FD:C3:28:80       Nintendo RVL-CNT-01 
 jos@ubuntu:~$

To connect to your Wii Remote just type:

jos@ubuntu:~$ sudo hidd --search 
 Searching ... 
         Connecting to device 00:07:61:64:A2:98

Or use the bluetooth address you have obtained with hcitool:

sudo hidd –-connect 00:19:FD:C3:28:80

After being connected to the PC the Wii Remote LEDs will continuously flash.

Disconnect with:

sudo hidd --unplug 00:19:FD:C3:28:80

WMD

WMD stands for 'Wanna Mote Dammit' and provides functionality to use your Wii Remote as a mouse and generates keyboard events for buttons. WMD is written in python which is very easy to modify. You can get it at http://ForTheWiiN.org. ForTheWiiN.org seems to be down, you can download wmd-0.1.2.tar.gz here.

Assuming python is installed on your sytem you will need the following packages:

python-bluez 
python-xlib 
python-pygame

In Ubuntu you can simply install these using:

sudo apt-get install python-bluez python-xlib python-pygame

WiiLi states that pyOSD, OSD, py-numpy, py-numpy-ext and python-matplotlib are also required. But in the current version (0.1.2) of WMD the use is disabled or obsolete, see WMD_DESIGN.txt in wmd-0.1.2.tar.gz.

Then check if the uinpit kernel module is loaded. Just use lsmod to check wich modules are loaded. Ubuntu needed the module to be loaded manually, this done with the modprobe command.

Here is how to check if the module is loaded, then load the modules and check again:

jos@jos-ubuntu:~$ lsmod | grep input 
 jos@jos-ubuntu:~$ sudo modprobe uinput 
 jos@jos-ubuntu:~$ lsmod | grep input 
 uinput                 10240  0 
 jos@jos-ubuntu:~$

In Config.py edit the parameters UINPUT_DEV and MY_WIIMOTE_ADDR so that they match your system. Now we are ready to run WMD: sudo python WMD.py

When all is right you will be shown graph:

The console windows will show some logging and if the Wii Remote has the sensor bar (or any other infrared light source) in sight the mousepointer will be taken over.

The design of WMD is pretty clear and allow you to add your own module with some knowledge of Python.

CWiid

CWiid  is a collection of Linux tools written in C for interfacing to the Nintendo Wiimote. CWiid consists of three components:
- libcwiid - API to integrate the Wii Remote into your application 
- wmgui - a graphical representation of all the a data gathered by the Wii Remote 
- wminput - event/mouse/joystick driver that allows you to emulate mouse joystick and keyboard events

First get the packages required for CWiid:

sudo apt-get install libbluetooth2 bluez-utils original-awk bison flex libbluetooth2-dev autoconf mouseemu  libgtk2.0-dev python2.5-dev

Having done that it is time to donwload, compile and install CWiid: wget http://abstrakraft.org/cwiid/downloads/cwiid-0.6.00.tgz tar -zxvf cwiid-0.6.00.tgz cd cwiid-0.6.00/ ./configure make sudo make install sudo ldconfig /usr/local/lib/

Start wmgui by typing 'wmgui'. Connect the Wii Remote via 'File' → 'Connect', then set all mark under the 'Settings' menu.

To control the mouse close wmgui and start wminput. To do this you need root rights or allow acces to /dev/input/uinput:

jos@ubuntu:~$ sudo sh -c 'echo "KERNEL==\"uinput\", GROUP=\"admin\"" > /etc/udev/rules.d/50-cwiid-input.rules' 
 jos@ubuntu:~$ sudo /etc/init.d/udev restart

wminput takes control over the mouse and uses the tilting sensors in the Wii Remote to emulate the mouse which is not really comfortable.

To use the sensorbar (or any other infrared source) add somelines to xorg.conf. Somewhere near the other InputDevice sections add:

Section "InputDevice" 
         Identifier      "Wiimote" 
         Driver          "evdev" 
         Option          "Name"          "Nintendo Wiimote" 
EndSection

In the ServerLayout section add:

InputDevice     "Wiimote" "AlwaysCore"

Restart X (safest way is to reboot your system), log back in and type:

wminput -c ir_ptr

Now can use the use the Wii Remote the way you are used in the Wii menus!

 
Nach oben
wii/wii-remote_on_linux.1213871039.txt.gz · Zuletzt geändert: 2024/02/29 13:34 (Externe Bearbeitung)
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0
DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp   Dogecoin Donations Accepted Here    DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp  DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp