From patchwork Wed Mar 13 16:00:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Young X-Patchwork-Id: 10851427 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 E467417E6 for ; Wed, 13 Mar 2019 16:01:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFDB729E0A for ; Wed, 13 Mar 2019 16:01:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE60929319; Wed, 13 Mar 2019 16:01:00 +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 6B6DA2A050 for ; Wed, 13 Mar 2019 16:01:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726655AbfCMQA7 (ORCPT ); Wed, 13 Mar 2019 12:00:59 -0400 Received: from gofer.mess.org ([88.97.38.141]:60095 "EHLO gofer.mess.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726349AbfCMQA7 (ORCPT ); Wed, 13 Mar 2019 12:00:59 -0400 Received: by gofer.mess.org (Postfix, from userid 1000) id C55F36076A; Wed, 13 Mar 2019 16:00:57 +0000 (GMT) From: Sean Young To: linux-media@vger.kernel.org Subject: [PATCH v4l-utils 2/2] lircd2toml: detect NEC if bit 0 and 1 are inverted Date: Wed, 13 Mar 2019 16:00:57 +0000 Message-Id: <20190313160057.3470-2-sean@mess.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190313160057.3470-1-sean@mess.org> References: <20190313160057.3470-1-sean@mess.org> 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 fixes conversion of: http://lirc.sourceforge.net/remotes/goldstar/VCR Signed-off-by: Sean Young --- contrib/lircd2toml.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/contrib/lircd2toml.py b/contrib/lircd2toml.py index f2f7cdd3..b1aa2403 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<