Start emulationstation on button press

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

RetroPie has a new website and forum. Please visit https://retropie.org.uk/ for the new site. The new forum is located at https://retropie.org.uk/forum/. This forum is left here as a read-only archive.

This topic contains 0 replies, has 1 voice, and was last updated by Profile photo of applepie applepie 3 years, 2 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #5093
    Profile photo of applepie
    applepie
    Participant

    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)

Forums are currently read only - please visit the new RetroPie forums at https://retropie.org.uk/forums/

Skip to toolbar