Game Controller inputs running in the backgroud of Kodi after launching retrorch

Just copy the executable to your home folder (the “username” folder) with smartftp first, then use ssh to copy it to your /etc folder with super user privileges:

$ sudo cp kodifocus /etc

I am not sure if you have to chmod it, but it doesn’t hurt either, so just do it

$ sudo chmod +x /etc/kodifocus

to be on the safe side. The extensions of files in are usually of no importance in Linux, it’s for the human. You can uninstall xdotool like this

$ sudo apt-get remove xdotool

And you can delete them old script with

$ sudo rm /etc/kodi_focus.sh

As I said, you might want to try if it really runs, since it might be that I have a different glibc version or something.If it doesn’t work I check if I can recompile it for Kodibuntu.

And yea, I noticed the same problem with the gamepad on my system, must be a Kodi thing, I will investigate further, since now I want to use my gamepad as well :smiley: The executable should work for your remote and keyboard, etc. though.

Excellent! So close! When I exit a Game everything works except the game controller! :slight_smile: You might have a different glibc. Not sure what that means. But when I install Kodibuntu I update the core right away. I believe it is on Ubuntu 14.04. Not sure what version glibc I have. Do you think it is possible to get this working? Other than the game controller it works flawless. A very smooth transition into the game and very smooth out. I am going to try some mame games now. Excellent job! cant wait to hear back. Where do you get all the information to write this stuff so quickly?

I am glad I could help. If it works it works, the glibc version doesn’t matter then.

Maybe I can find something out about the gamepad, but I think that’s how Kodi works, and I might not be able to fix this (any time soon). In case you simply disable your gamepad in Kodi settings, the script to start retroarch can be reduced to

#!/bin/bash
/usr/bin/retroarch "$@"
/etc/kodifocus

Years of sweat and tears :smiley:

Haha! Thanks! I will continue to look for something also. I could not have gotten this close with out your help. I will let you know if I find something. Thanks so much.

Hey I did run into a glitch. I don’t know if it is my fault. I went to set up my mame games using the same procedure. Without thinking, Instead of pointing to the Kodi_input.sh I pointed it to kodifocus. When I went to launch the game the screen just flashed and did nothing. My bad! But after I changed it to kodi_input.sh, it still would not launch. So I exited kodi and tested retroarch in Ubuntu. Worked fine when picking the core manualy. So I went back into kodi and noticed that after launching one platform, ex. (SNES), and then going to a MAME game the Core stays set to SNES. If I manually load the core for MAME it stays set to that. I don’t know if it has anything to do with the mistake I made. retroarch is not auto loading the corresponding cores anymore. I am going to try another fresh install.

I start retroarch by specifically naming the core to load, so I am not familiar with the reliability of core auto loading. I suggest you do the same. Just add the core to the launch options in your rom collection browser, e.g.

-L /usr/lib/libretro/snes9x_libretro.so

for snes9x. You can check what names the cores have with

$ ls /usr/lib/libretro/*.so

Sure, makes sense, I will try that when I get home. I did set it up on another machine and tested retroarch in Ubuntu successfully. Then when I launched through Kodi it would not load the core at all from the script… So retroarch can not recognize the source game through the program you wrote. I am sure it will work with -L option. :slight_smile:

As I said, I don’t know how the auto detecting of cores works, I find it highly unlikely that it has anything to do with my script, but it surely is possible.

Ohh wow! Kodi is very sensitive. So I applied the launch options as described.

 -F -L /usr/lib/libretro/snes9x_libretro.so %ROM% 

and it did absolutely nothing!. What? So I checked all the settings. Settings where good. So I deleted the entire rom collection to start from scratch. I used retroarch first to make sure it was running. Then I set it up to point to the script with the launch options. It worked perfectly. Great. So I went to install everything on my other zotac box. I tried pointing directly to retroarch first to make sure it was running ok. Then after following the same procedure and pointing to the script. I get nothing. I tried everything and checked my procedure over and over. I hope I am missing something, I can not get it to work. I checked all kodi web server setting, port is 8090, I checked and even copied the script files from the other machine. I made sure they were executable. Allow remote control is enabled. I even re-installed curl. I am thinking of trying another fresh install. I even disabled the sound. sometimes it can get caught up on sound. Is it the hardware? A fresh install might help me figure it out maybe I missed something. Ill get back.

Well I just did a fresh install for nothing. It still did not work. I went back and started over step by step. I finally got the script to work again by installing xdotool and running the original kodi_focus.sh script then switching over to kodifocus. But now I am where I was yesterday on the other machine. I can only manually change over the cores. Once I introduce

-F -L /usr/lib/libretro/snes9x_libretro.so %ROM%

It does not work for either rom collection. ???

After banging my head around for a while, I checked the first machine launch settings. Compared it to the new install and low and behold!! It was a dumb ass syntax error! I was typing

 -l /usr/lib/libretro/snes9x_libretro.so %ROM%

when I should have typed

 -L /usr/lib/libretro/snes9x_libretro.so %ROM% 

. Syntax error. The ( -L ) has to be capital! Now I will do one more fresh install to see if I had to install xdotool and run kodi_focus.sh first in order to get the kodifocus to work. I believe once I run a bad command Kodi caches it. So when I correct the bad command it still wont work. I am hoping that I do not have to install xdotool and run kodi_focus.sh first. If that’s the case, all is well and I have a sure fire procedure for any machine. I wont know until I try on a clean install. I’ll get back

[QUOTE=ufopaper;31419]I am glad I could help. If it works it works, the glibc version doesn’t matter then.

Maybe I can find something out about the gamepad, but I think that’s how Kodi works, and I might not be able to fix this (any time soon). In case you simply disable your gamepad in Kodi settings, the script to start retroarch can be reduced to

#!/bin/bash
/usr/bin/retroarch "$@"
/etc/kodifocus

Years of sweat and tears :D[/QUOTE]

Hey what can you make of this? http://forum.kodi.tv/showthread.php?tid=213040 Says its a patch?