Notices


Reply
Thread Tools
Posts: 393 | Thanked: 112 times | Joined on Jul 2007
#1
Porting CWiid to OS2008 - See http://abstrakraft.org/cwiid/

CWiid is a library to access Wiimotes under Linux. Wiimotes are fantastic hardware devices that open up a wealth of interaction possibilities with linked hosts. They are relatively common and cheap thanks to the uptake of the Nintendo Wii.

The Wiimote provides triple gyroscopic tilt sensors, a 1024x768 infra-red camera with hardware optimized tracking facilities, a mono-speaker, a tiny amount of non-volatile memory, a digital joypad which includes 7 buttons, 4 LEDs, and the possibility for wired expansion with various hardware addons. Communication with the host is made wirelessly through bluetooth.

An initial cross-compile of CWiid revealed that the onboard bluetooth module on the N800 and N810 is very much compatible with the Wiimote.

At the very least this should provide a cheap bluetooth joypad. Because of the innovative nature of the Wiimote, MANY other additional applications have been created including sensitive motion sensing devices (time the acceleration of a car) to motion tracking applications (See: http://www.cs.cmu.edu/~johnny/projects/wii/ )

Possible extensions to CWiid include relative mouse movement (assuming we can hack into tslib say by creating a plugin), extensions to dbus, innovative application.

This needs a little tweaking to run.

Installation:
# 1) Extract the TARBALL straight to root.
cd /
tar xzvf cwiid-0.6.00.tar.gz

# 2) add usr/local/lib to library path
echo "/usr/local/lib" >> /etc/ld.so.conf

# 3) run LDConfig
ldconfig


Usage:
CWiiid automated detection fails for some reason (HCIread fails to return the wiimote name for some reason despite setting timeouts to ridiculous numbers!) I've used DBus methods to query wiimotes instead. Despite this; if you know your wiimote bluetooth address you can get cwiid to connect anyway.

1) Setup Wiimote for pairing by either pressing A+B together so the blue LEDs flash, or pressing the connect button under the battery cover.

2) Run lswm - this should eventually return the bluetooth address of your wiimote.

> lswm

3) Export the bluetooth address as an environment variable:

> export WIIMOTE_BDADDR=00:19:FD:YOURBLUETOOTHADDRESS

If you expect to use the same Wiimote here, you could export the above line to bashrc and skip steps 1-3 next time.

4) Insmod the kernel drivers
insmod /lib/modules/uinput.ko
insmod /lib/modules/joydev.ko

5) Run the driver:
wminput -d &

6) Setup Wiimote for pairing by either pressing A+B together so the blue LEDs flash, or pressing the connect button under the battery cover. (YES - do this again!)

Wiimote should pair at this stage. Bluetooth icon turns solid blue.

Now you will have the relevant udev devices in /dev/ including a joystick, keyboard and mouse. Setup your game/application/etc accordingly.



Troubleshooting:
Use WMGui to provide graphical feedback from the wiimote instead of running wminput above. The menu/button options here should be self-explanatory.

Configuration:
You can configure the relevant buttons by editing /usr/local/etc/cwiid/wminput/buttons (see other files here and refer to readme on what this all means.)

There are other "plugins" that extend or enhance the functionality of CWiid and I suggest you see the readme there for more info on what these do. Using other plugins requires changing a link to the relevant plugin (step 3 in installation above.)

HelperApps I've tried using to extend and query functionality include xsetpointer, mouse_poll, xev, evtest and xdotool. All are included here.

Problems:
Insmodding the kernel drivers results in maemo software keyboard not working. You will need to rmmod the modules after using the joypad if you use the onscreen keyboard. Hardware keyboard on N810 is not affected, neither are bluetooth attached keyboards.
rmmod uinput.ko
rmmod joydev.ko



To-do:
1) Fix CWiid automated Wiimote detection by using DBus methods.
2) Create debian installation package.
3) Find a means to hook the mouse driver to the tablet.
4) Hildonize WMGui
5) Find means to fix maemo software keyboard not working on insmod.
6) Create menus for:
* Starting and stopping (insmod/rmmod) kernel modules.
* Starting/Stopping wminput with autoconfigure.
* WMGui

Last edited by yabbas; 2008-03-06 at 02:29. Reason: Simplify install,and screenshot.
 

The Following 21 Users Say Thank You to yabbas For This Useful Post:
Posts: 330 | Thanked: 57 times | Joined on May 2007 @ BKNYC
#2
Really nice project.
manage to play some gngeo today.
 
Underscore's Avatar
Posts: 276 | Thanked: 74 times | Joined on Feb 2008 @ Missouri, USA
#3
Oh wow...D: This looks really complicated. I'll go for it when there's a one-click install and setup for newbies like myself.

Maybe I should get me a bluetooth adapter for my computer and test this out...hmmm.
 
Posts: 330 | Thanked: 57 times | Joined on May 2007 @ BKNYC
#4
the install was pretty simple
download the tar
and untar it in /
painless
and it works
play some gngeo with the wimmote classic and a little bit of VGBA.
 
b-man's Avatar
Posts: 549 | Thanked: 502 times | Joined on Feb 2008 @ Bowling Green Ohio (united states)
#5
I can't extract tne tarball. when i try it said that there's no such file or directory. i can't seem to find what i did incorectly. did i do this right? i'm using easyroot.
here's what i did-

~ $ sudio gainroot
root shell enabled

/home/user # cd/
/bin/sh: cd/: not found
/home/user # cd/tar xzvf cwiid-0.6.00.tar.gz
/bin/sh: cd/tar: not found
/home/user # cd
/home/user # tar xzvf cwiid-o.6.00.tar.gz
tar: can't open 'cwiid-0.6.00.tar.gz : no such file or directory
/home/user cd/ tar xzvf cwiid-0.6.00.tar.gz
/bin/hs: cd: can't cd to tar

Just to let you know, i'm new at using the root shell.

Last edited by b-man; 2008-03-15 at 20:37.
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,356 times | Joined on Sep 2007 @ Looking at y'all and sighing
#6
I can see you are new...

1stly, it's not cd/ it's
cd /

And try tar xzvf cwiid-0.6.00.tar.gz

and the tar file wont appear by magic there, too . You move it manually into /
 

The Following User Says Thank You to qwerty12 For This Useful Post:
Underscore's Avatar
Posts: 276 | Thanked: 74 times | Joined on Feb 2008 @ Missouri, USA
#7
Hmm. It can't be too difficult if I just follow directions. I'll try it some other time when I'm not being lazy. Also, I'm trying out the screen rotation right now.
 
Posts: 393 | Thanked: 112 times | Joined on Jul 2007
#8
b-man, try googling some introductory linux command line lessons; this one's ok: http://librenix.com/?inode=4052 One of my posts some time ago linked to a few linux newbie articles.

download the tar to your removable disk
move the tar to the root directory, if you store the tar on your removable disk for example it'll be something like:
mv /media/mmc1/NAMEOFTAR /
(be aware there is a space after mv and after NAMEOFTAR)
then
cd /
(space after cd)
then untar as I have described


When I have time I'll aim to upload this to garage and start on the todos.


Persevere, you can only learn by doing and making mistakes
 

The Following User Says Thank You to yabbas For This Useful Post:
Posts: 10 | Thanked: 14 times | Joined on Mar 2008 @ USA
#9
Worked great! Tested in LXDoom with no problems. Resolution isnt that great, I suspect the classic controller might work better in that regard. This opens up a lot of possibilities as far as input methods on the N800.

Thanks for your work on this!
 
Posts: 75 | Thanked: 11 times | Joined on Feb 2008 @ Bay area, CA // Kampala, Uganda
#10
If I had a Wii, I would be extremely excited about this...as it is, it almost makes me want to get a Wiimote just for my N800.

Well done!
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 11:15.