GPIO button to launch Kodi from EmulationStation?
-
I use Kodi often, and I control it with my phone. I don't always have a keyboard or gamepad handy to launch Kodi, though, so I would like to setup a GPIO button to launch Kodi from within EmulationStation.
I've modified my case to include a button. Currently it's used as an ON/OFF switch, but I'd eventually like to have it launch Kodi when the button is long-pressed. I've written a script to test this, but the trouble is I can't get it to launch Kodi when EmulationStation is running. If I run it from the commandline or desktop, it works fine. Is there a specific method to run Kodi that plays nice with EmulationStation? Something about
runcommand
, maybe? I'm a little out of my depth here..Here is the basic version of my script:
import gpiozero import subprocess def callback(*args): subprocess.call(["kodi"]) if __name__ == '__main__': btn = gpiozero.Button(3) btn.when_released = callback while True: pass
Currently it runs at boot from
/etc/rc.local
like so:sudo -u pi python3 /home/pi/kodi.py &
Not sure what else to include, but happy to provide any additional info.
-
Try creating a script that shuts down gracefully EmulationStation before launching Kodi and call that script in your GPIO input handler.
-
Thanks. As soon as I posted here, I found this topic and with a bit of modification I was able to get it working. :)
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.