This weekend during my regular procrastination sessions I was able to plug in the PS2 controllers and let them go.
It took a wee bit of effort. Unlike on Windows, which sees the box as two different controllers, Linux has bung all the axis and buttons together into one input device. Yes, fun indeed. So, with that, no programs could just work out of the box.
Fortunately, I found QJoyPad. Instructions on installing that are on the Ubuntu forums. With no tray to put an icon in, it just pops up a floating window which doesn’t get in the way of MythTV.
One thing I learnt while using QJoyPad was that it has a horrible GUI. It is much easier to use xev to find the keycodes and modify the .lyt files in the ~/.qjoypad3 folder.
I first began with a control scheme for MythTV so I can just use the controller to select a game. Up, Down, Left, Right to move, X to Enter, Triangle to go Back. Simple. I saved that. I then made one for each emulator. I so far only have DGen and Mednafen (doesn’t that sound like a medicine?) installed.
I then created a wrapper script for each emulator, it goes in the form:
#!/bin/sh qjoypad "profilename"& emulator "$1" qjoypad "mythtv"
And in the MythGame player configuration, made it run the wrapper script instead. It works like a charm.
The next problem to solve was exiting. I wanted it so then the Exit button on my remote exits. Reading on the MythGame wiki page, the easiest way was to install xmacroplayand passing that. But then I’d have to make a new item for each program. The easy way would be to just kill all the emulators when I press the button, while not killing MythTV.
So I stole the script
#!/bin/bash
# This checks if an emulator is running
# Insert your emulator commands as well
if ps ax | egrep -q ' (dgen|mednafen)'; then
echo "KeyStr $1" | xmacroplay :0
fi
And made it run whenever Exit or OK was pressed. That works well too.
The most time consuming part is getting QJoyPad to work properly, other than that, it’s all sweet!


