ronanParticipant10/07/2014 at 11:22Post count: 3
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.ronanParticipant10/09/2014 at 09:44Post count: 3
So I tried to simulate an ESC key press with python-uinput, and while it works the emulators doesn’t react.
So I found a simpler way: I look at all the running processes, and if I find one with a command path starting with “/opt/retropie/emulators/” I send it a “kill -INT [pid]”.
Not really future-proof if the emulators path change, but good enough.ronanParticipant10/23/2014 at 16:51Post count: 3
My script is on github, feel free to use it or suggest improvements: https://github.com/RonanL/retropie-mausberry-switch/blob/master/python/nespi.pyimnewParticipant10/23/2014 at 17:04Post count: 13
I’m yet to receive a response on this site – can someone reply to this please as I’m not sure whether theres some bat shit invisible mode on or something.
thankstool212Participant12/11/2014 at 08:13Post count: 1
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.
ThanksbruncheroParticipant04/11/2015 at 20:09Post count: 20
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.
- The forum ‘Everything else related to the RetroPie Project’ is closed to new topics and replies.