|
@@ -112,23 +112,32 @@ class simpleLCD():
|
|
return y
|
|
return y
|
|
|
|
|
|
def receiveIr(timeout=120*1000):
|
|
def receiveIr(timeout=120*1000):
|
|
- with subprocess.Popen(MODE2CMD, stdout=subprocess.PIPE) as proc:
|
|
|
|
|
|
+ codes = []
|
|
|
|
+
|
|
|
|
+ with subprocess.Popen(MODE2CMD, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) as proc:
|
|
p = select.poll()
|
|
p = select.poll()
|
|
p.register(proc.stdout)
|
|
p.register(proc.stdout)
|
|
- codes = []
|
|
|
|
i = 0
|
|
i = 0
|
|
|
|
+ fstart = False
|
|
while True:
|
|
while True:
|
|
ret = p.poll(timeout)
|
|
ret = p.poll(timeout)
|
|
if len(ret) == 0: # timeout
|
|
if len(ret) == 0: # timeout
|
|
proc.terminate()
|
|
proc.terminate()
|
|
return None
|
|
return None
|
|
line = proc.stdout.readline().strip().decode()
|
|
line = proc.stdout.readline().strip().decode()
|
|
- if i > 2:
|
|
|
|
- code = line.split(' ')[1]
|
|
|
|
|
|
+ type = line.split(' ')[0]
|
|
|
|
+ code = line.split(' ')[1]
|
|
|
|
+ if not fstart:
|
|
|
|
+ if type == 'pulse':
|
|
|
|
+ fstart = True
|
|
|
|
+
|
|
|
|
+ if fstart:
|
|
codes.append(code)
|
|
codes.append(code)
|
|
- i += 1
|
|
|
|
- if i > 69:
|
|
|
|
|
|
+ i += 1
|
|
|
|
+
|
|
|
|
+ if i >= 67:
|
|
break
|
|
break
|
|
|
|
+
|
|
proc.terminate()
|
|
proc.terminate()
|
|
return codes
|
|
return codes
|
|
|
|
|