diff mbox series

[v4l-utils] lircd2toml: toggle_bit is offset from bits including pre-data

Message ID 20190312224635.24037-1-sean@mess.org (mailing list archive)
State New, archived
Headers show
Series [v4l-utils] lircd2toml: toggle_bit is offset from bits including pre-data | expand

Commit Message

Sean Young March 12, 2019, 10:46 p.m. UTC
This causes the following lircd.conf to be converted incorrectly.

	http://lirc.sourceforge.net/remotes/cambridge_audio/X40A

Signed-off-by: Sean Young <sean@mess.org>
---
 contrib/lircd2toml.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/contrib/lircd2toml.py b/contrib/lircd2toml.py
index f9408ecc..72ee50e3 100755
--- a/contrib/lircd2toml.py
+++ b/contrib/lircd2toml.py
@@ -404,18 +404,18 @@  class Converter:
 
         bits = int(self.remote['bits'][0])
 
-        toggle_bit = 0
-        if 'toggle_bit_mask' in self.remote:
-            toggle_bit = ffs(int(self.remote['toggle_bit_mask'][0]))
-        if 'toggle_bit' in self.remote:
-            toggle_bit = bits - int(self.remote['toggle_bit'][0])
-
         pre_data = 0
         if 'pre_data_bits' in self.remote:
             pre_data_bits = int(self.remote['pre_data_bits'][0])
             pre_data = int(self.remote['pre_data'][0]) << bits
             bits += pre_data_bits
 
+        toggle_bit = 0
+        if 'toggle_bit_mask' in self.remote:
+            toggle_bit = ffs(int(self.remote['toggle_bit_mask'][0]))
+        if 'toggle_bit' in self.remote:
+            toggle_bit = bits - int(self.remote['toggle_bit'][0])
+
         if 'plead' in self.remote:
             plead = self.remote['plead'][0]
             one_pulse = self.remote['one'][0]