You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
452 B
21 lines
452 B
6 months ago
|
# 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()
|
||
|
|