Page 1 of 1

Got xpad working in menus

Posted: Fri Apr 29, 2005 3:03 am
by antiflag1980
In my unsucessful quest to get mythgame to work I have gotten the xpad to work in the mythv menus, doesn't work in mythgame or watching a movie, just the menus and mythweather, mythnews, mythbrowser, I haven't tested it with mythmusic or mythgallery, but better than nothing, and it took me a hell of a lot of time to figure out how to map the right axes to the right things, I've pretty much mapped everything to the basic right, left, up, down, enter, escape, cause there aren't really any other things you can do in the menu, there are plenty of keymappings if only it worked in things other than the menu, but oh well. Also one small weird bug, if you startup with a single controller in the first port all is okay, but if you have a controller plugged into port 1 and port 2, port one becomes /dev/js1 and port2 becomes /dev/js0 so you would have to use controller # 2 instead of controller # 1 to navigate the menu. Here's what you have to do since joystick support is only available in mythtv 0.17 and higher.

Code: Select all

emerge sync
edit /etc/portage/package.keywords with nano or something, I didn't feel like typing out all the echo "foo-0.17 ~x86" >> /etc/portage/package.keywords commands here so I'm just cutting and pasting mine here.

Code: Select all

=media-tv/mythtv-0.17-r1 ~x86
=media-plugins/mythbrowser-0.17 ~x86
=media-plugins/mythdvd-0.17 ~x86
=media-plugins/mythgallery-0.17-r1 ~x86
=media-plugins/mythgame-0.17 ~x86
=media-plugins/mythmusic-0.17-r2 ~x86
=media-plugins/mythnews-0.17 ~x86
=media-plugins/mythvideo-0.17 ~x86
=media-plugins/mythweather-0.17 ~x86

Code: Select all

emerge mythtv && emerge mythbrowser mythdvd mythgallery mythgame mythmusic mythnews mythvideo mythweather
I know ther's that lirc dependency issue thing, but I don't remember having problems with it since I didn't use emerge -uD.

Code: Select all

nano -w /media/.mythtv/joystickmenurc
Paste mine into yours and save it. Heres mine:

Code: Select all

# ~/.mythtv/joystickmenurc
# Joystick menu config file
#  Place in /media/.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

#A button
button 0                    Space
#B button
button 1                    Escape
#Y button for ripping dvd
button 4                    0
#X button for cancelling rip
button 3                    9

#Didn't configure the rest of the buttons 2-9 I couldn't think of any use for them while in the menu

#chord  2    5               Escape

#Left Analog stick
axis   0    -32767  -15000  Left
axis   0     15000   32767  Right
axis   1    -32767  -15000  Down
axis   1     15000   32767  Up

#Right Analog stick
axis   3    -32767  -15000  Left
axis   3     15000   32767  Right
axis   4    -32767  -15000  Down
axis   4     15000   32767  Up

#Left trigger release
#axis   2    -32767  -15000  Up
#Left trigger pull
axis   2     15000   32767  Page Up
#Right trigger release
#axis   5    -32767  -15000  Down
#Right trigger pull
axis   5     15000   32767  Page Down

#Directional Pad
axis   6    -32767  -15000  Left
axis   6     15000   32767  Right
axis   7    -32767  -15000  Down
axis   7     15000   32767  Up
It still leaves MCE useless to anyone without either a keyboard or a remote control since one you start to watch a video you would lose control completely and have no way to exit or do anything until the movie is ends. If anyone knows how to configure it to work in mythgame and more importantly in mythvideo and mythdvd please post your config files and stuff. Ok while I'm writing this I just thought of how to fix that little xpad1 xpad2 switch duh, what was I thinking. I should just be able to create a sybolic link to /dev/input/js0 and /dev/input/js1 and change the config file to point to the sybolic link, like how /dev/input/mice points you to /dev/input/mouse0 and 1 and so on.

Code: Select all

ln -s "/dev/input/js0 /dev/input/js1" /dev/input/xpads
ok that didn't work. I checked and mice seems to be a device file not actually a symbolic link to the other mice. I don't know how to create a device file like mice so If anyone else knows post that too.

Posted: Fri Apr 29, 2005 3:25 am
by antiflag1980
I edited above because I didn't realize it worked in mythbrowser and mythnews and stuff so someone could probably edit the config file for a better button mapping for useful shortcuts in the browser and the other modules that it works in. Also I forgot to mention above about the xpad1 & 2 problem that you can't simply put more than one device in the file and have them both work, that was the first thing I tried, also you can't use /dev/input/mice as the device either. I figured that might work since /dev/input/mice gets it's input from the xpad, but no, that doesn't work either. As far as getting the xpad to work in mythvideo I'm not sure which way to go here the mouse cursor shows up over the video when you move the stick but you can't right click or anything and I know it's because myth disables the mouse events from working in myth but does the mouse simply not work because it doesn't have focus or what. I don't know if getting it working would be acomplished by editing /media/.mythtv/mplayerlaunch or would it be able to be done by using imwheel and xmodmap and simply binding the mouse(xpad) buttons to key events. If you bind the mouse buttons to the correct keys would mplayer recieve the events or not? If this could be done easily than using MCE without the remote kit would be perfectly fine. Also how can these changes be saved if I ever have to do a rescuse besides using rsync to backup to another computer, is MCE.TGZ simply a tgz of the entire root directory or what and if so can I simply delete it and replace it with a current tgz of my root directory and if I have to rescue it won't complain?

Posted: Fri Apr 29, 2005 4:51 am
by antiflag1980
Ok, I keep correcting myself here, the xpad works perfectly in mythdvd to watch a dvd, and rip a dvd I've updated my above post with the config file to map buttons for rip (0) and cancel rip (9). I just figured mythdvd didn't work because mythvideo didn't, I didn't realize that mythdvd was set to use xine and mythvideo was set to use mplayer, I will try switching mythvideo to use xine and see if it works, if so then everything is fine that I know of besides mythgame, and I haven't tried mythmusic or mythgallery because I haven't transferred any pictures or music onto the installation. I'm not really familliar at all with mythtv and haven't ever used most of the features, so If someone would post some necessary keys that should be mapped that I have missed that would be great too. Awsome this is great I hate the stupid remote, well I guess I just hate mine, I use a universal with mine and I always have to reprogram it, and with key search on it you have to use the power key and hit enter on the remote after it works, well say I'm in MCE, the power key isn't assigned to do anything so I never know when I've got the right code, so I would have to ssh into the xbox and restart in that case, this solves that problem.

Posted: Fri Apr 29, 2005 5:26 am
by antiflag1980
Ok, there isn't an option anymore for using xine in video, only for dvd so it looks like I have to edit /media/.mythtv/mplayerlaunch.

find this section

Code: Select all

        sudo /bin/nice -n -20 mplayer -fs -quiet -lircconf /media/.mythtv/lircrc -vo xv "$2" $3 $4 $5 $6 $7 $8 $9 $10 $11 $11 $12 $13 $14 $15 $16 $17 $18 $19 $20 $21 $22 $23 $24 $25 $26 $27 $28 $29 $30 $31 $32 $33 $34 $35 $36 $37 $38 $39 $40
and change it to this

Code: Select all

        sudo /bin/nice -n -20 xine -V xv -f -g --no-logo --no-splash -E "$2" $3 $4 $5 $6 $7 $8 $9 $10 $11 $11 $12 $13 $14 $15 $16 $17 $18 $19 $20 $21 $22 $23 $24 $25 $26 $27 $28 $29 $30 $31 $32 $33 $34 $35 $36 $37 $38 $39 $40
Your just changing this part:

Code: Select all

mplayer -fs -quiet -lircconf /media/.mythtv/lircrc -vo xv
to this:

Code: Select all

xine -V xv -f -g --no-logo --no-splash -E
you should be able to do something similar with the vcd section of the file which I'm not gonna mess with right now.
My key mappings aren't so good though I should probably map the back button to escape and having the left analog stick mapped to up down left right causes problems in mythbrowser because it sends the key events as well as the mouse events, same thing for the dpad, so if you wanted to use the browser with this config you should only map the dpad to up, down , right, left so you can use the L_analog as the mouse and b button cant be mapped as esc b/c it's also right click in the browser.