From 6aa6929574ee173e3bde95fc1aa74828694a0149 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sun, 12 Nov 2023 14:46:51 -0700 Subject: [PATCH] Add homemonitor script --- homemonitor.py | 20 ++++++++++++++++++++ requirements.txt | 10 ++++++++++ 2 files changed, 30 insertions(+) create mode 100644 homemonitor.py diff --git a/homemonitor.py b/homemonitor.py new file mode 100644 index 0000000..2d6c94e --- /dev/null +++ b/homemonitor.py @@ -0,0 +1,20 @@ +# This script monitors Protovac's HOME key to kick the user +# back to the home screen +# +# Runs as root + +import os +import serial + +ser = serial.Serial('/dev/ttyAMA1', baudrate=9600) + + +try: + while True: + if ser.read() == b'\x01' and ser.read() == b'N' and ser.read() == b'\r': + print('Home key pressed, killing login process...') + os.system('killall -9 login') +finally: + print('Closing serial port...') + ser.close() + diff --git a/requirements.txt b/requirements.txt index d2b6157..632e35e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,19 @@ +annotated-types==0.5.0 certifi==2022.6.15 charset-normalizer==2.1.1 idna==3.3 +inflect==7.0.0 +jaraco.itertools==6.4.1 +more-itertools==9.1.0 Pillow==9.2.0 +pydantic==2.0.3 +pydantic_core==2.3.0 +pyserial==3.5 pytz==2022.2.1 requests==2.28.1 +six==1.16.0 +typing_extensions==4.7.1 urllib3==1.26.12 git+https://git.tannercollin.com/tanner/wolframalpha.git x256==0.0.3 +xmltodict==0.13.0