Exit emulator with one button press vía gpio
- 
					
					
					
					
Page restored: https://github.com/recalbox/recalbox-os/wiki/Enable-Gpio-button-to-close-emulator-with-only-one-button-press
But scripts are always missing...
 - 
					
					
					
					
So....now we cant use that script?
Gosh thats terrible....
 - 
					
					
					
					
@8bit_astronaut The terrible thing is that " @Bug " @Phantiss has closed his account and delete everything without any reason! ><
 - 
					
					
					
					
Thats even worst....
 - 
					
					
					
					
Any alternative to that script....?
 - 
					
					
					
					
@DjLeChuck maybe @substring has still the scripts somewhere because I kinda remember to have read in a thread he tested it
 - 
					
					
					
					
I would rather ask @supernature2k, as he told me he was creating his own script to do that.
 - 
					
					
					
					
Thank you! A lot of people would use it
 - 
					
					
					
					
@supernature2k I SUMMON YOU !!!
 - 
					
					
					
					
@Substring Yep, how can I help?
 - 
					
					
					
					
@supernature2k where is your fringing script to kill emulators via GPIO ?
 - 
					
					
					
					
@Substring try this:
import RPi.GPIO as GPIO import time import os import thread import datetime import socket import sys from datetime import datetime from configgen import recalboxFiles # this last one retrieves emulators bin names IPADDR = "127.0.0.1" PORTNUM = 55355 # IP and port for retroarch network commands QUIT = 3 GPIO.setwarnings(False) # no warnings GPIO.setmode(GPIO.BCM) # set up BCM GPIO numbering GPIO.setup(QUIT, GPIO.IN, pull_up_down=GPIO.PUD_UP) # GPIO on pin 3 is the GPIO 2 in BCM mode #to Reset+ # Define a threaded callback function to run in another thread when events are detected def button_pressed(channel): nwcommand="QUIT" retroarch(nwcommand) killthats**t(channel) # on quit press, trying to kill all listed emus def killthats**t(channel): if channel == QUIT: for bin in recalboxFiles.recalboxBins: print bin proc = os.path.basename(bin) print proc os.system("killall -9 "+proc) # sending network command to retroarch (only exit and reset atm) def retroarch(nwcommand): try: s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) except socket.error: print 'Failed to create socket' sys.exit() s.sendto(nwcommand, (IPADDR, PORTNUM)) GPIO.add_event_detect(QUIT, GPIO.BOTH, callback=button_pressed, bouncetime=2) while True: time.sleep(0.2) - 
					
					
					
					
@supernature2k
Does this automaticly start ES again after killing the Emulator? - 
					
					
					
					
@sevenx no as ES is not killed when you launch an emu
 - 
					
					
					
					
@supernature2k
Do you have some time, to talk about a new project from me? Over PM? - 
					
					
					
					
@sevenx ok
 - 
					
					
					
					
@8bit_astronaut maybe this article I wrote some time ago can help. I use the script to reset the emulator. But with replacing the RESET with QUIT you should be able to quit it and return to ES.
https://github.com/recalbox/recalbox-os/wiki/Emulator-interactions-via-GPIO-mapping-(EN)
 - 
					
					
					
					
@lackyluuk that looks great! Ill check it in a moment, thank you so much!
 - 
					
					
					
					
@lackyluuk its necesary to have an internet conection for recalbox???
 - 
					
					
					
					
@8bit_astronaut No, I think it should also work without. But it is highly recommended
