Thanks, I'll try it in a bit.
Posts made by crispycritter911
-
RE: Emulator Exit button GPIO
My knowledge of Python is pretty much nil. I haven't had any real coding background whatsoever. I've tinkered and modified some stuff ini files for the original xbox to help automate flashing bios and setting up hard drives the way I like it. But that's really it. I usually take other peoples code and modify it to suit my needs. I would like to go back to college someday to learn about coding. Thanks for the input.
-
RE: Emulator Exit button GPIO
Yeah, I've copied and pasted it from a Reddit thread. Here is where I got it from.
https://www.reddit.com/r/raspberry_pi/comments/2yw4fn/finally_set_up_retropie_complete_with_a_gpio/I really like the look and feel of RecalBox and wanted to use it in my other pi but had a few hiccups a long the way. One of them being this emulator exit button that I cannot get working on RecalBox. I think the other was the SNES GPIO adapter which I have kind of figured out.
-
Emulator Exit button GPIO
I was curious as to modify an existing script to work from retropie to RecalBox. I've got a button wired up to a GPIO pin to exit out of all the emulators on RetroPie 3.8 and on 4.0 Beta. However when I try to use the same script in RecalBox I can see the button output on the terminal screen when pressed. I've used this in the event the emulator freezes up and hotkeys don't work, I can still get back to emulation station.
from time import sleepimport os import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) def exitEmulator(channel): print('exitEmulator') pids = [pid for pid in os.listdir('/proc') if pid.isdigit()] for pid in pids: try: commandpath = open(os.path.join('/proc', pid, 'cmdline'), 'rb').read() if commandpath[0:24] == '/opt/retropie/emulators/': os.system('kill -QUIT %s' % pid) print('kill -QUIT %s' % pid) except IOError: continue GPIO.add_event_detect(17, GPIO.RISING, callback=exitEmulator, bouncetime=500) while True: sleep(10)
Thanks
Here