diff options
Diffstat (limited to 'demo_scripts/receiver-test.py')
-rw-r--r-- | demo_scripts/receiver-test.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/demo_scripts/receiver-test.py b/demo_scripts/receiver-test.py new file mode 100644 index 0000000..3057717 --- /dev/null +++ b/demo_scripts/receiver-test.py @@ -0,0 +1,27 @@ +#!/usr/bin/python3 + +from necrc import * +from rc6 import * + +DEVICE = "/dev/rc" + +with open(DEVICE, "r") as f: + while True: + raw = f.readline().strip() + # Try to decode button data using different encoding methods + try: + decoded = nec_decode(raw) + print("Decoded as NEC:", " ".join(f"{b:02x}" for b in decoded)) + continue + except: + pass + if is_nec_repeat(raw): + print("Decoded as NEC repeat code") + continue + try: + decoded = rc6_decode(raw) + print("Decoded as RC6:", decoded) + continue + except: + pass + print("Can't decode, raw data:", raw) |