aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2019-03-13 12:58:08 (GMT)
committerSean Young <sean@mess.org>2019-03-13 17:26:29 (GMT)
commitd9646b9eaaf97502cfa51f6241a843668b22018b (patch)
tree6d6c53f3421d8389dc5dfe603e2508dfe1f8c9f7
parent30c095bbcc4037c40f4bd6848c4c3b17ccb004fb (diff)
lircd2toml: honour pre_data for rc-mm remote definitions
Signed-off-by: Sean Young <sean@mess.org>
-rwxr-xr-xcontrib/lircd2toml.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/contrib/lircd2toml.py b/contrib/lircd2toml.py
index 72ee50e..f2f7cdd 100755
--- a/contrib/lircd2toml.py
+++ b/contrib/lircd2toml.py
@@ -349,7 +349,7 @@ class Converter:
def convert_rcmm(self):
res = {
- 'protocol': 'rc_mm',
+ 'protocol': 'rc-mm',
'params': {},
'map': {}
}
@@ -368,16 +368,24 @@ class Converter:
if 'toggle_bit' in self.remote:
toggle_bit = bits - int(self.remote['toggle_bit'][0])
- if toggle_bit > 0 and toggle_bit < bits:
- res['params']['toggle_bit'] = toggle_bit
-
- res['params']['bits'] = bits
-
if 'codes' not in self.remote or len(self.remote['codes']) == 0:
self.error("missing codes section")
return None
- res['map'] = self.remote['codes']
+ 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
+ for s in self.remote['codes']:
+ res['map'][s|pre_data] = self.remote['codes'][s]
+ else:
+ res['map'] = self.remote['codes']
+
+ res['params']['bits'] = bits
+ res['params']['variant'] = "'rc-mm-" + str(bits) + "'"
+
+ if toggle_bit > 0 and toggle_bit < bits:
+ res['params']['toggle_bit'] = toggle_bit
return res

Privacy Policy