From patchwork Tue Mar 12 22:46:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Young X-Patchwork-Id: 10850101 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 86D08139A for ; Tue, 12 Mar 2019 22:46:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72BCD296CF for ; Tue, 12 Mar 2019 22:46:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6590F29864; Tue, 12 Mar 2019 22:46:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 58EB1296CF for ; Tue, 12 Mar 2019 22:46:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726865AbfCLWqg (ORCPT ); Tue, 12 Mar 2019 18:46:36 -0400 Received: from gofer.mess.org ([88.97.38.141]:44153 "EHLO gofer.mess.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726008AbfCLWqg (ORCPT ); Tue, 12 Mar 2019 18:46:36 -0400 Received: by gofer.mess.org (Postfix, from userid 1000) id 3B61260664; Tue, 12 Mar 2019 22:46:35 +0000 (GMT) From: Sean Young To: linux-media@vger.kernel.org Subject: [PATCH v4l-utils] lircd2toml: toggle_bit is offset from bits including pre-data Date: Tue, 12 Mar 2019 22:46:35 +0000 Message-Id: <20190312224635.24037-1-sean@mess.org> X-Mailer: git-send-email 2.11.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This causes the following lircd.conf to be converted incorrectly. http://lirc.sourceforge.net/remotes/cambridge_audio/X40A Signed-off-by: Sean Young --- contrib/lircd2toml.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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]