{"id":162,"date":"2007-01-22T08:24:00","date_gmt":"2007-01-22T16:24:00","guid":{"rendered":"http:\/\/www.mccambridge.org\/blog\/2007\/01\/howto-mythtv-snes-joystick-control\/"},"modified":"2022-09-11T00:40:44","modified_gmt":"2022-09-11T00:40:44","slug":"howto-mythtv-snes-joystick-control","status":"publish","type":"post","link":"http:\/\/www.mccambridge.org\/blog\/2007\/01\/howto-mythtv-snes-joystick-control\/","title":{"rendered":"Howto: Mythtv SNES Joystick Control"},"content":{"rendered":"
Update:<\/strong> Why oh why can’t Blogger preview my post in the *actual* stylesheet of my blog? I seem to remember WordPress doing this… if so, I must switch. ASAP.<\/p>\n I’m back down in Madison, and in the midst of unpacking all my junk after moving down here from home. One thing that Nate & I set up right away is my HTPC, an Ubuntu<\/a>-based MythTV<\/a> box. Unfortunately, I noticed over winter break that my homemade serial-port IR receiver has given up the ghost, so I can no longer control MythTV from my universal remote. I’ve ordered the parts for a USB IR receiver<\/a>, but as I mentioned earlier, my soldering iron has also<\/em> given up the ghost…<\/p>\n So, what to do in the interim? Well, there is a keyboard attached to the Myth box, but it doesn’t reach the couch. Enter the SNES controller and MythTV joystick control. Here’s how I got it to work:<\/p>\n The first step in writing a MythTV joystick configuration is to determine the exact layout of your joystick, as Linux sees it. Specifically, we need to know what axes (and axis values) and buttons correspond to the controls on the joystick.<\/p>\n If you’re using an SNES controller with the To determine the layout of your own joystick, you can use the optional Run Joystick (SNES pad) has 2 axes (X, Y)<\/p>\n and 8 buttons (BtnX, BtnY, BtnTL, BtnTR, BtnTR2, BtnSelect, BtnThumbL, BtnThumbR).<\/p>\n Testing ... (interrupt to exit)<\/p>\n Axes: 0: 0 1: 0 Buttons: 0:off 1:off 2:off 3:off 4:off 5:off 6:off 7:off<\/code><\/p>\n This tells me that the joystick as seen by Linux has two axes and 7 buttons. Pressing them in sequence changes the output, such as this output when I hold the directional pad to the left and press the “A” button:<\/p>\n Axes: 0:-32767 1: 0 Buttons: 0:on 1:off 2:off 3:off 4:off 5:off 6:off 7:off<\/code><\/p>\n This tells you that the D-pad “left” direction corresponds to value -32767 on Axis 0, and that the “A” button corresponds to button 0.<\/p>\n Compiling a full list for your joystick would give you a mapping like this one for the SNES controllers & gamecon driver:<\/p>\nGoal<\/h3>\n
\n
Required Software \/ Hardware<\/h3>\n
\n
jstest<\/code> (Optional, available on Ubuntu in the “joystick” package)<\/em><\/li>\n<\/ul>\n
Determining joystick layout<\/h3>\n
gamecon<\/code> driver, I’ve done the legwork, and you can skip to the next section<\/a> below, using my example configuration. (Obviously you should test it and make sure it works.)<\/p>\n
jstest<\/code> program mentioned above. You can install it on Ubuntu from the
joystick<\/code> package (you will need the universe repository enabled):<\/p>\n
$ sudo apt-get install joystick<\/code><\/p>\n
jstest<\/code> and record the axis numbers and values, as well as button numbers, that correspond to all the controls you wish to use on your joystick.
jstest<\/code> requires a parameter of the joystick device to open. For example, I run
jstest<\/code> like this for my first SNES controller:<\/p>\n
$ jstest \/dev\/input\/js0<\/code><\/p>\n
jstest<\/code> produces output for my SNES controller like this:<\/p>\n
Driver version is 2.1.0.<\/p>\n
Testing ... (interrupt to exit)<\/p>\n