Files
Argon-One-Daemon/root/lib/systemd/system-shutdown/argon-one_poweroff.py
Cantibra e189b376f3
All checks were successful
Argon One Daemon / Argon One Daemon (Bookworm) [arm64] (push) Successful in 11s
Inital Commit
2025-10-26 08:05:50 +01:00

19 lines
343 B
Python

#!/usr/bin/python3
import sys
import smbus
import RPi.GPIO as GPIO
rev = GPIO.RPI_REVISION
if rev == 2 or rev == 3:
bus = smbus.SMBus(1)
else:
bus = smbus.SMBus(0)
if len(sys.argv) > 1:
bus.write_byte(0x1A, 0)
if sys.argv[1] == "poweroff" or sys.argv[1] == "halt":
try:
bus.write_byte(0x1A, 0xFF)
except:
rev = 0