Homepage Forums RetroPie Project Everything else related to the RetroPie Project Start emulationstation on button press

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #5093
    Anonymous
    Inactive

    Hi folks!

    I tried to add a button for restarting emulationstation.
    It should kill the actual running emustation, and the restart it (as user).

    The line marked with #Restart isnt woking like i expect, any ideas how to implement that?

    Thanks

    import RPi.GPIO as GPIO
    import time
    import os
    
    pin = 26
    prev_input = 0;
    
    GPIO.setmode(GPIO.BOARD);
    GPIO.setup(pin,GPIO.IN);
    
    while True:
    	input = GPIO.input(pin);
    	if ((not prev_input) and input):
    		print("Button pressed")
    		os.system("killall emulationstation")
    		os.system("echo 'Restarting emulationstation'")
    		time.sleep(2.0)
    
                    #Restart
    		os.system("su -c 'emulationstation &' -s /bin/sh pi")
    
    	prev_input = input
    	time.sleep(0.05)
    
Viewing 1 post (of 1 total)
  • The forum ‘Everything else related to the RetroPie Project’ is closed to new topics and replies.