44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Monitor IR listener output
|
|
"""
|
|
|
|
import subprocess
|
|
import sys
|
|
import time
|
|
|
|
def monitor_ir_listener():
|
|
"""Monitor the IR listener process"""
|
|
try:
|
|
# Connect to the remote system and monitor the IR listener
|
|
cmd = [
|
|
"ssh", "tulivision@192.168.1.137",
|
|
"cd /home/tulivision/rpi-tulivision && python3 simple_ir_listener_polling.py"
|
|
]
|
|
|
|
print("Starting IR listener monitoring...")
|
|
print("The IR listener is now running on the Raspberry Pi.")
|
|
print("Point your IR remote at the IR receiver and press buttons.")
|
|
print("Press Ctrl+C to stop monitoring.")
|
|
print("=" * 60)
|
|
|
|
# Start the process
|
|
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
|
universal_newlines=True, bufsize=1)
|
|
|
|
# Monitor output
|
|
for line in iter(process.stdout.readline, ''):
|
|
print(line.rstrip())
|
|
sys.stdout.flush()
|
|
|
|
except KeyboardInterrupt:
|
|
print("\nStopping IR listener...")
|
|
process.terminate()
|
|
process.wait()
|
|
except Exception as e:
|
|
print(f"Error: {e}")
|
|
|
|
if __name__ == "__main__":
|
|
monitor_ir_listener()
|
|
|