0
0
mirror of https://github.com/libretro/Lakka-LibreELEC.git synced 2025-03-01 06:51:22 +00:00
Tomas Kelemen 95db0ec070 add GPi safe shutdown + dependencies
Co-authored-by: David Lawson <dmrlawson@gmail.com>
Co-authored-by: Albert Malina <albert.malina@gmail.com>
2021-10-06 21:36:55 +02:00

23 lines
453 B
Python
Executable File

#!/usr/bin/env python
# This script has been created using the following as a reference:
# https://github.com/RetroFlag/retroflag-picase
from gpiozero import Button, LED
import os
from signal import pause
powerPin = 26
powerenPin = 27
hold = 1
power = LED(powerenPin)
power.on()
#functions that handle button events
def when_pressed():
os.system("shutdown -P now &")
btn = Button(powerPin, hold_time=hold)
btn.when_pressed = when_pressed
pause()