-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Hi,
I have a nespi+ case and I use safe shutdown and reset buttons from here:
https://github.com/edus44/lakka-gpio-control
It works perfectly, but I wanted a little update like here:
https://github.com/crcerror/retroflag-picase/blob/master/SafeShutdown.py
what I want is when reset button is pressed, check if we are running any emulator or kodi is open, for this we can inspire in this piece of code:
def reboot():
output = int(subprocess.check_output(['/opt/RetroFlag/multi_switch.sh', '--es-pid']))
output_rc = int(subprocess.check_output(['/opt/RetroFlag/multi_switch.sh', '--rc-pid']))
if output_rc:
os.system("/opt/RetroFlag/multi_switch.sh --closeemu")
elif output:
os.system("/opt/RetroFlag/multi_switch.sh --es-restart")
else:
os.system("sudo reboot")
I know that we don't have ES but I hope that check for some process can be possible
this is the code/pseudocode that I should develop:
def reset():
oldState = True
while True:
GPIO.wait_for_edge(resetPin, GPIO.FALLING)
state = GPIO.input(resetPin)
if state != oldState and state == False:
## state_kodi = funtionToCheckIfKodiIsRunning()
## state_cores = funtionToCheckIfAnyCoreIsRunning()
## if state_kodi:
## os.system("kodi-send --action="Quit"")
## elif state_cores:
## FuntionLikeXMBCloseContent
## else:
## os.system("pkill retroarch")
## time.sleep(1)
I hope that it isn't very confused, there is no problem if I have to develop a multi_switch.sh to handle better the events, but first I have to know if its possible and how to find references.
What I really need are two functions:
- one to close core like "retroarch -L" but reverse, I have been looking for docs but I only found this: https://docs.libretro.com/guides/cli-intro/ and says nothing about that.
- one to check runnig process.
Can anyone show me the way or a doc page to find info related with this commands?
is it related to #4235
Thanks