I'm setting up a Freevo server for real usage and I want to use my wireless Saitek P3000 gamepad as remotecontrol. It has two analog axices (is that pluralis for axis?:)) and one digial.
This patch to src/plugins/joy.py makes it possible to use all axices in Freevo using this JOY_CMD syntax:
JOY_CMDS = {
'axis 2 up' : 'UP',
'axis 2 down' : 'DOWN',
'axis 0 left' : 'OTHER COMMAND'
}The patch is against Freevo 1.3.4 but I hope it will work with CVS!
I do have CVS write access but I haven't been active in Freevo development for quite a while (a year?) now so I send it to the list until I get updated on the sources. Then I will try to take up where I left, eg get Teletext support working. :)
BTW, is there a way to catch Freevo events while MPlayer is running now? I think it wasn't a year ago when I left off...
Regards, Per Wigren
--- /tmp/freevo-1.3.4/src/plugins/joy.py 2003-07-24 02:40:10.000000000 +0200
+++ /opt/freevo/src/plugins/joy.py 2003-09-30 22:22:50.655252944 +0200
@@ -118,6 +118,7 @@
def poll(self):
command = ''
+ button = FALSE
if DEBUG > 5: print 'self.joyfd = %s' % self.joyfd
(r, w, e) = select.select([self.joyfd], [], [], 0)
if DEBUG > 5: print 'r,w,e = %s,%s,%s' % (r,w,e)
@@ -133,22 +134,25 @@
command = config.JOY_CMDS.get(button, '')
sleep(0.3) # the direction pad can use lower debounce time
if data[2] == 2:
- 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']
+ if ((data[1] < -16384) & (data[3] % 2)) :
+ button = 'axis %d up' % (data[3]/2)
+ elif ((data[1] > 16384) & (data[3] % 2)):
+ button = 'axis %d down' % (data[3]/2)
+ elif ((data[1] < -16384) & (not data[3] % 2)):
+ button = 'axis %d left' % (data[3]/2)
+ elif ((data[1] > 16384) & (not data[3] % 2)):
+ button = 'axis %d right' % (data[3]/2)
+ try:
+ if button: command = config.JOY_CMDS[button]
+ except:
+ print 'Joystick event "%s" not defined!' % (button)
+
if command != '':
if DEBUG: print 'Translation: "%s" -> "%s"' % (button, command)
command = rc.key_event_mapper(command)
if command:
rc.post_event(command)
+ elif (button):
+ print 'Joystick event "%s" not defined!' % (button)
