Wrapper for running emulationstation in a screen session when i turn on my BT controller(s)
I run the wrapper.py as a systemd on my raspberry pi os, which i also use for many other things. The use case for me is that I primarily run my pi headless, but it is connected to a hdmi tv screen so it can be used to play on retropie/emulationstation. Retropie is made for beings started from cli, and cannot easily be started without simple code snippets with no real CLI session behind it - UNLESS if you start it up inside a screen session.
I have tried to make it dead simple for my kids and family;
- It listens for BT connections from the mac addresses of my 8bitdo controllers
- upon connection it starts emulationstation within a screen session called TV (which is created at boot)
- It also starts the tv which switched to the correct channel
- Et voila
- To stop it, you exit emulationstation via the menu - and disconnect/turn off all controllers. This will (after a few seconds) also turn off the tv
For my controllers i also mapped one button as a "ctrl-c" button for the times one of the games get stuck. Holding the button for a few seconds sends 1 ctrl-c command to the screen session. Holding the button 1-2 times will typiucally be enough to resolve any trouble.