maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Using the wiimote to control the n810 (https://talk.maemo.org/showthread.php?t=18984)

jldiaz 2008-04-11 08:09

Using the wiimote to control the n810
 
Hello,

I've developed a small python script which, when run in an xterm in my n810, connects to my Wiimote, read the events it sends, and maps the wiimote buttons to X-window events, such as keypresses or touchscreen taps. This way, I can control any application from my wiimote.

The mapping "wiimote buttons"->"X-window events" is configurable. My default setup allows for a wide range of applications:

Code:

Wiimote  | Action on N810
----------+---------------------------------------
  Up      |  Up
  Down    |  Down
  Right  |  Right
  Left    |  Left
  A      |  Return
  +      |  Zoom/volume +
  -      |  Zoom/volume -
  1      |  Opens application specific menu
  2      |  Opens desktop "Applications" menu
  B      |  "Mode shift" (see below)
----------+----------------------------------------
 B+Up    |  Fullscreen
 B+Down  |  Close window
 B+Right  |  Open window-list menu
 B+Left  |  Escape
 B+A      |  (not used)
 B++      |  (not used)
 B+-      |  (not used)
 B+1      |  (not used)
 B+2      |  (not used)

I think this opens interesting posibiltiies for audio players. You can connect your nokia to your stereo, and control the playlist, volume, etc. from your wiimote. Although it is also possible to control any other application (mplayer, browser, email, etc.) I cannot see any advantage of using a remote for this (except for the coolness factor), because you need to be anyway close to the n810 in order to read the screen.

At the moment, only the Wiimote buttons are read, the accelerometers information is discarded. It is theoretically possible to use it also, but I cannot think any useful application for it (except, perhaps, shaking the wiimote in order to skip a song, but this, although cool, it is not very comfortable).

Currently, the python script is only a quick&dirty hack, kinda "proof of concept", and it only works with my own Wiimote (because the MAC is hardcoded in the script, but it is easy to change it if you know the MAC of your wiimote). However, I plan to make it evolve into a more friendly application.

I would like to publish the script, for feedback. Which would you consider the more convenient way of publishing it? Should I open a new project in the garage?

Ah, I forgot to mention that you can see a demo of this thing in action in Youtube (click on the image):

http://i.ytimg.com/vi/jKx5tNrsiE8/default.jpg

yabbas 2008-04-11 10:32

Re: Using the wiimote to control the n810
 
Open a new project in garage :)

Benson 2008-04-11 11:43

Re: Using the wiimote to control the n810
 
I think cwiid already does that, but multiple projects isn't necessarily bad.

jldiaz 2008-04-11 22:48

Re: Using the wiimote to control the n810
 
Quote:

Originally Posted by yabbas (Post 168349)
Open a new project in garage :)

I'll do that. Thanks

jldiaz 2008-04-11 23:17

Re: Using the wiimote to control the n810
 
Quote:

Originally Posted by Benson (Post 168366)
I think cwiid already does that, but multiple projects isn't necessarily bad.

It is not exactly the same goal. As far as I know, cwiid is aimed to provide an interface between wiimote and applications, by creating gamepad and mouse devices which can be read from applications. It requires to install some device controllers through kernel modules. Therefore, the use of the wiimote is restricted to applications which are able to get the input from these device drivers (mostly games and console emulators, I assume).

My goal, instead, is to provide a simple and configurable mean for assigning "macros" to wiimote buttons, without installing any driver or kernel module. Only pure python. These macros can be any sequence of X-window events (keypresses, key releases, mouse movements, stylus taps...). This allows us to control any arbitrary application through the wiimote, even if the app is not joypad-capable.

For example, I want to use the wiimote to control vagalume, using the UP key to mark a track as loved, and the DOWN key to mark a track as banned. Marking a song as loved in vagalume requires, first to tap on the "heart" button (or to press the Ctrl-L accelerator), and then tap on the "OK" button in the confirm dialog (or hit Return). With my script I can assign this sequence of user inputs to the Wiimote UP button, by assigning it the sequence of strings: "k C-L", "k Return" ("k" stands for "keystroke"), or, alternatively, the sequence of strings "t 330 390", "k Return" ("t" stands for "tap with stylus at coordinates...").

Benson 2008-04-11 23:55

Re: Using the wiimote to control the n810
 
I thought cwiid did keys and stuff, too; either way, this is a lighter solution, so where it works, it may well be the best choice.

Underscore 2008-04-12 00:22

Re: Using the wiimote to control the n810
 
Ummm, awesome. Do you realize how awesome this will be when they release noBounds? Portable media player controlled by Wiimote. Yes please. :)

El Amir 2008-04-12 00:51

Re: Using the wiimote to control the n810
 
Cant wait for this to get released!!

http://www.engadget.com/2008/02/13/e...bile-joystick/

Now were talking "mobile solutions" :)

jldiaz 2008-04-16 23:52

Re: Using the wiimote to control the n810
 
Ok. My project was approved for inclusion in the garage, and I have uploaded the pre-alpha version.

There are no releases yet, but you can get the relevant files from the SVN repository, in case you feel like playing with it. Despite the pre-alpha stage, it is fully functional (at least for me!) If it does not work for you, please report.

I've written a bare documentation, enough to get the demo running, and even to customize the button-action mapping. Python knowledge is not required :-)

konttori 2008-04-21 17:28

Re: Using the wiimote to control the n810
 
Man, this seems like the very best project for a long long time. I am so sorry now that I left my n810 at work.

The download link is in here:
https://garage.maemo.org/frs/?group_...elease_id=1735

Now, It would really rock if you could have a UI for making the pairing between the wiimote and the device.

Anyway, I'll definitely try out this thing tomorrow. Kudos jldiaz!


All times are GMT. The time now is 22:20.

vBulletin® Version 3.8.8