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)