[Index] [TitleIndex] [WordIndex


This is a plugin to control freevo with a joystick. Make sure that your joystick is working. (driver compiled in kernel or as module and module loaded).

Freevo needs to know which joystick device to use. /dev/input/js0 or /dev/js0 = device 1, add the following in your local_conf.py :


You can link different events to the joystick actions example, also to add in local_conf.py :

   'up' : 'UP',
   'down' : 'DOWN',
   'left' : 'LEFT',
   'right': 'RIGHT',
   'button 1': 'PLAY',
   'button 2': 'STOP',
   'button 3': 'PAUSE',
   'button 4': 'ENTER'

For a listing of all available commands and how they are mapped within the different events (Playing Audio, Video, TV, etc...) look at freevo/src/event.py .

When using Mplayer, you might want to disable Mplayer using the joystick, to prevent Freevo and Mplayer to get in each others way:

MPLAYER_ARGS_DEF = '-nojoystick'

To activate the plugin, add this in your local_conf.py :


If you want to use some other axis, or change the default one (for example, when your controller has a POV and a D-PAD), you can add them for freevo to use. You will have to modify the joy.py file (normally at /usr/lib/python2.3/site-packages/freevo/plugins/joy.py ). Don't forget to do a backup first! Look at the bottom of the joy.py file, you will find something like this:

            if ((data[3] == 1) & (data[1] < -16384)):
                button = 'up'
                command = config.JOY_CMDS['up']
            if ((data[3] == 1) & (data[1] > 16384)):
                button = 'down'
                command = config.JOY_CMDS['down']
            if ((data[3] == 0) & (data[1] < -16384)):
                button = 'left'
                command = config.JOY_CMDS['left']
            if ((data[3] == 0) & (data[1] > 16384)):
                button = 'right'
                command = config.JOY_CMDS['right']

The lines "button =" and "command = config.JOY_CMDS[..." indicates the function assigned to the axis. You can put whatever word you want there, instead of left/right/up/down (be sure to put the same thing on the "button" and "command" lines), then use them in the JOY_CMDS section of your local_conf.py to assign functions (see above). On the example above, the axis used are 0 and 1. If you want to use another axis, just change those numbers. If you want to use axis X, then modify accordingly:

            if ((data[3] == X) & (data[1] < -16384)):
                button = 'name1'
                command = config.JOY_CMDS['name1']
            if ((data[3] == X) & (data[1] > 16384)):
                button = 'name2'
                command = config.JOY_CMDS['name2']
            and so on...

You might want to try and find out which axis is the one you want, as it isn't always obvious.

So new lines can be added or modified to your suiting. If you have 4 axis you want to use for different functions, add some new "if ((data[3] == X)..." subsections as above, and change the names and axis' accordingly.

You might not get this right the first time, so it's all about trial and error. Modify the file, save it, then launch freevo and see what happens.

Another important part are the "offsets". As you can see above, by default it is 16384 or -16384. This tells freevo when to acknowledge a command. If you have analog controllers, 16384 is the mid-position (when you push it half up or down). You might want to fiddle with those values until you find the ones which are comfortable.

On the other hand, with digital controlers, it usually is 1. So you will want to replace 16384 and -16348 with 1 and -1.

To know what the good values are, you can use the linux jstest or jscal tools.

2014-02-15 05:35