-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can we have a script for LibreELEC? #137
Comments
Installation on LibreELEC is straightforward:
--- /home/mibergmann/Downloads/Mike/Retroflag/SafeShutdown.py
+++ /media/mibergmann/STORAGE/.config/RetroFlag/SafeShutdown.py
@@ -1,6 +1,8 @@
+import sys
+sys.path.append('/storage/.kodi/addons/virtual.rpi-tools/lib/')
import RPi.GPIO as GPIO
import os
import time
from multiprocessing import Process
#initialize pins
@@ -20,41 +22,32 @@
GPIO.output(powerenPin, GPIO.HIGH)
GPIO.setwarnings(False)
#waits for user to hold button up to 1 second before issuing poweroff command
def poweroff():
while True:
- #self.assertEqual(GPIO.input(powerPin), GPIO.LOW)
GPIO.wait_for_edge(powerPin, GPIO.FALLING)
- os.system("sudo killall emulationstation")
- os.system("sudo killall emulationstatio") #RetroPie 4.6
- os.system("sudo sleep 5s")
- os.system("sudo shutdown -r now")
+ os.system("shutdown -h now")
#blinks the LED to signal button being pushed
def ledBlink():
while True:
GPIO.output(ledPin, GPIO.HIGH)
- #self.assertEqual(GPIO.input(powerPin), GPIO.LOW)
GPIO.wait_for_edge(powerPin, GPIO.FALLING)
start = time.time()
while GPIO.input(powerPin) == GPIO.LOW:
GPIO.output(ledPin, GPIO.LOW)
time.sleep(0.2)
GPIO.output(ledPin, GPIO.HIGH)
time.sleep(0.2)
#resets the pi
def reset():
while True:
- #self.assertEqual(GPIO.input(resetPin), GPIO.LOW)
GPIO.wait_for_edge(resetPin, GPIO.FALLING)
- os.system("sudo killall emulationstation")
- os.system("sudo killall emulationstatio") #RetroPie 4.6
- os.system("sudo sleep 5s")
- os.system("sudo shutdown -r now")
+ os.system("shutdown -r now")
if __name__ == "__main__":
#initialize GPIO settings
init()
#create a multiprocessing.Process instance for each function to enable parallelism
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
LibreELEC is also a very popular OS to install on a Raspberry PI and it does not seem there is a simple way to set up safe shutdown on it with a RetroFlag case.
The text was updated successfully, but these errors were encountered: