Add homemonitor script
This commit is contained in:
20
homemonitor.py
Normal file
20
homemonitor.py
Normal file
@@ -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()
|
||||
|
Reference in New Issue
Block a user