[mythtv-users] Logitech gamepad as controller -- working joystickmenurc

Dewey Smolka dsmolka at gmail.com
Fri Jan 2 15:13:46 UTC 2009


Happy New Year all,

I picked up a Logitech cordless gamepad not long ago and was hoping to
use it as a controller for Mythtv. It turns out that it's much, much
easier than I had imagined, and it really works quite well.

There are only a couple issues: The analog joysticks will go to sleep
after a time, but any button press will wake the device back up. Also,
I can't figure out how to set a repeat rate on the joysticks, meaning
that only a single command is sent when you move a stick. The only
other issue is that I couldn't find any preconfigured samples for this
particular controller, although Logitech pads seem pretty standard for
PC gaming.

The sleeping problem isn't really an issue. I solved the repeat
problem by making the left analog stick move up or down in single
steps, while the right analog stick has three degrees of up or down,
depending on how far you push the stick. It's not exact, but it does
mean much easier scrolling.

On the whole, it's an excellent controller, although one does need a
keyboard handy. But I've found that's true with every remote I've had.
It's certainly more comfortable and more responsive than any IR remote
I've used, and quite a bit cheaper than most.

Here's the mapping. I'd love to hear how folks have these mapped differently:

D-Pad:
Up, Right -- vol+
Down, Left -- vol-

Left stick:
Up -- up
Down -- down
Left -- left
Right -- right

Right stick
Up -- up (3 degrees)
Down -- down (3 degrees)
Left -- left
Right -- right

Buttons (as labeled on device)
1 -- M (Menu)
2 -- Enter
3 -- P (Pause/Play)
4 -- Esc

Upper triggers:
5 -- PageUp  (jump back in TV playback, PageUp in scheduling, skip
backwards within track in Music)
6 -- PageDown (jump forward in TV playback, PageDown in scheduling,
skip forward within track in Music)

Lower triggers:
7 -- Home (skip to previous marker in TV playback, skip to previous
track in Music)
8 -- End (skip to next marker in TV, skip to next track in Music

Buttons in center of device:
9 -- I (info screen. Doesn't serve much purpose, but I wanted to map
something there.)
10 -- 3 (this is purely to be able to access the playlist editor
inside MythMusic using only the gamepad)

Here's the config file -- save as ~/.mythtv/joystickmenurc and restart
X. It should work with any Logitech dual-analog gamepad. Note: my
gamepad showed up as js1. YMMV.

#
# Joystick menu config file
#  Place in ~/.mythtv/
#
#   Format:
#       devicename <devname>        Specify name of joystick device to use
#                                   (e.g. /dev/js0)
#       button num keystring        Send 'keystring' when button 'num'
is released
#       chord cnum bnum keystring   If button cnum is down, and button 'bnum'
#                                   is released, send keystring
#       axis num from to keystring  If axis num goes into the range of from-to
#                                   send keystring

#devicename /dev/input/js0
#
#button 0                    Enter
#button 1                    Escape
#
#axis   0    -32767  -15000  Left
#axis   0     15000   32767  Right
#axis   1    -32767  -15000  Up
#axis   1     15000   32767  Down

devicename /dev/input/js1

button 0                    M
button 1                    Enter
button 2                    P
button 3                    Escape
button 4		    PgUp
button 5		    PgDown
button 6		    Home
button 7		    End
button 8		    I
button 9		    3
#chord  2    5               Escape


axis   0    -32767  -15000  Left
axis   0     15000   32767  Right
axis   1    -32767  -15000  Up
axis   1     15000   32767  Down


#Up
#       axis   3    -32767  -15000  Up
        axis   3    -20000  -15000  Up
        axis   3    -25000  -20001  Up
        axis   3    -32767  -25001  Up

#Down
#       axis   3     15000   32767  Down
        axis   3     15000   20000  Down
        axis   3     20000   25000  Down
        axis   3     25001   32767  Down


axis   2    -32767  -15000  Left
axis   2     15000   32767  Right
#axis   3    -32767  -15000  Up
#axis   3     15000   32767  Down

axis   4    -32767  -15000  [
axis   4     15000   32767  ]
axis   5    -32767  -15000  ]
axis   5     15000   32767  [


More information about the mythtv-users mailing list