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 for the new site. The new forum is located at 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
  • #5093
    Profile photo of applepie

    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?


    import RPi.GPIO as GPIO
    import time
    import os
    pin = 26
    prev_input = 0;
    while True:
    	input = GPIO.input(pin);
    	if ((not prev_input) and input):
    		print("Button pressed")
    		os.system("killall emulationstation")
    		os.system("echo 'Restarting emulationstation'")
    		os.system("su -c 'emulationstation &' -s /bin/sh pi")
    	prev_input = input

Viewing 1 post (of 1 total)

Forums are currently read only - please visit the new RetroPie forums at

Skip to toolbar