Viewing 1 post (of 1 total)
  • Author
    Posts
  • applepie
    Participant
    Post count: 1

    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)
  • You must be logged in to reply to this topic.