I’m mounting a retropie based game station in an old NES case, and I’d like to use the nes reset switch to exit the current game and return to emulationstation.
Is there any way to send this kind signal to emulationstation via a python script? I already have a script running for the mausberry shutdown circuit, if possible it would be great to have this on the same script.
I use usb controllers, so I don’t need a full gpio/controller mapping; I just need to simulate an escape key press, or send directly a signal to emulationstation or the current running emulator to exit.
This is what I want mine to do. I am Working on one for a Xmas gift and I am 99% complete. Everything works including the power button on the NES. I am stuck on the shutdown I have everything soldered to the mausberry switch and I am using gpio 23 and gpio 24. on boot up i can see error erc/switch.sh line9, line 11 echo write error device not responding or busy.
In your code it appears you are using 23 24 and 25. could you send me a pic or diagram on how you have it wired.
Thanks Ronan, your script was the code I needed for my Retro RPi2!
I adjusted it to fit my GPIO stuff with some LEDs added, and attached my version in case anyone is interested. (I use the retropi 2.6 image.)
– made it a very basic python daemon, so I could add it to init-scripts
– use BCM GPIO 3 for shutdown, since it also can startup the rpi when pulled low
– for that reason, use FALLING interrupts
– use SIG TERM for emulator, to allow clean exit (save srm?), wait 5 seconds and then send SIG KILL to the process in case TERM did not help
– added LED when nespi.py daemon is running
– added LED when emulator is running, check every second
To simplify the emulator LED, I hacked runcommand.sh to write its own PID into a temp file on start, and remove it on script end.
I also wanted my own ACT LED for sd card activity, which, as turned out, is super easy using the device tree overlay in config.txt. dtoverlay=act_led_gpio=22
Retro gaming, rpg and adventure fan. arduino and raspberry tinkerer.