LIRC libraries: irw.py

| LIRC libraries LinuxInfraredRemoteControl

irw.py
1 '''
2 Reference python implementation of irw(1)
3
4 Run using python3 irw.py [socket_path]
5
6 '''
7
8 import sys
9
10 import lirc
11
12 if len(sys.argv) >= 3:
13 sys.stderr.write("Usage: irw.py [socket path]")
14 sys.exit(1)
15 path = sys.argv[1] if len(sys.argv) == 2 else None
16 with lirc.RawConnection(path) as conn:
17 while True:
18 print(conn.readline())