This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:

Subject: lircd2toml: detect NEC if bit 0 and 1 are inverted
Author:  Sean Young <s...@mess.org>
Date:    Wed Mar 13 13:35:09 2019 +0000

This fixes conversion of:

        http://lirc.sourceforge.net/remotes/goldstar/VCR

Signed-off-by: Sean Young <s...@mess.org>

 contrib/lircd2toml.py | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=f85040e18e937a12367d80c3895216e3cf8d4a7d
diff --git a/contrib/lircd2toml.py b/contrib/lircd2toml.py
index f2f7cdd39ac4..b1aa24030362 100755
--- a/contrib/lircd2toml.py
+++ b/contrib/lircd2toml.py
@@ -340,6 +340,42 @@ class Converter:
 
             if variant:
                 res['params']['variant'] = "'" + variant + "'"
+        elif ('header_pulse' in res['params'] and
+            'header_space' in res['params'] and
+            'reverse' not in res['params'] and
+            'trailer_pulse' in res['params'] and
+            'header_optional' not in res['params'] and
+            'pulse_distance' == res['protocol'] and
+            eq_margin(res['params']['header_pulse'], 9000, 1000) and
+            eq_margin(res['params']['header_space'], 4500, 1000) and
+            eq_margin(res['params']['bit_pulse'], 560, 300) and
+            eq_margin(res['params']['bit_1_space'], 560, 300) and
+            eq_margin(res['params']['bit_0_space'], 1680, 300) and
+            eq_margin(res['params']['trailer_pulse'], 560, 300) and
+            res['params']['bits'] == 32 and
+            ('repeat_pulse' not in res['params'] or
+             (eq_margin(res['params']['repeat_pulse'], 9000, 1000) and
+              eq_margin(res['params']['repeat_space'], 2250, 1000)))):
+            self.warning('remote looks exactly like NEC, converting')
+            res['protocol'] = 'nec'
+            res['params'] = {}
+            # bit_0_space and bit_1_space have been swapped, scancode
+            # will need to be inverted
+
+            variant = None
+
+            for s in self.remote['codes']:
+                p = (s<<post_data_bits)|pre_data
+                v, n = decode_nec_scancode(~p)
+                if variant == None:
+                    variant = v
+                elif v != variant:
+                    variant = ""
+
+                res['map'][n] = self.remote['codes'][s]
+
+            if variant:
+                res['params']['variant'] = "'" + variant + "'"
         else:
             for s in self.remote['codes']:
                 p = (s<<post_data_bits)|pre_data

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to