From patchwork Wed Apr 18 11:24:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Young X-Patchwork-Id: 10347907 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 251F36031B for ; Wed, 18 Apr 2018 11:26:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19F9F28599 for ; Wed, 18 Apr 2018 11:26:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E54E285D8; Wed, 18 Apr 2018 11:26:46 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DA4BF28620 for ; Wed, 18 Apr 2018 11:24:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qWxK1VwqlkB687h1lAZRScYxwYHQo2PQc42kGO/2SoA=; b=cunNRAdPKEulu2 lK4uzo78mZWc4l8M3nPHA1A/aPaF5URdaB3uRQa6Fqi7RzGglRT2UMU5Gxve5hJlZlRUf1Qxoe6A9 2jR97NSfwhYMicfef1w+2DJjadR/m0DSWWgrvS1KkQaSvqT7LswpLmLBFfAyAzTeyWk5PyluCVk5I hf5WS7F2CErz3xoo19hze/ZjDVWZTXTsVkYzB0+9XWXg2ZJeTCGi22HQ9VCrisaHb2W/XoJOrh+5N WRUCV1a1yVftGhSJcGtwLd5CUebVOoekwec0vQM3odTpl5Ywxl0C+pzptMqj82eWtsht3N13pXirb ahcGCXzRwvvAybc4e9Mw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f8lCi-0003tV-E5; Wed, 18 Apr 2018 11:24:48 +0000 Received: from gofer.mess.org ([2a02:8011:d000:212::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f8lCf-0003s5-4U for linux-amlogic@lists.infradead.org; Wed, 18 Apr 2018 11:24:47 +0000 Received: by gofer.mess.org (Postfix, from userid 1000) id 4F7F4609BB; Wed, 18 Apr 2018 12:24:29 +0100 (BST) Date: Wed, 18 Apr 2018 12:24:29 +0100 From: Sean Young To: Matthias Reichl Subject: Re: [PATCH v2 7/7] media: rc: mceusb: allow the timeout to be configurable Message-ID: <20180418112428.zk3lmdxoqv46weph@gofer.mess.org> References: <02b5dac3b27169c6e6a4a070a2569b33fef47bbe.1523221902.git.sean@mess.org> <20180417191457.fhgsdega2kjqw3t2@camel2.lan> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180417191457.fhgsdega2kjqw3t2@camel2.lan> User-Agent: NeoMutt/20170113 (1.7.2) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180418_042445_454908_67183399 X-CRM114-Status: GOOD ( 25.36 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Neil Armstrong , Kevin Hilman , Jonas Karlman , Carlo Caione , linux-amlogic@lists.infradead.org, linux-media@vger.kernel.org, Alex Deryskyba , Heiner Kallweit Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hello Hias, On Tue, Apr 17, 2018 at 09:14:57PM +0200, Matthias Reichl wrote: > On Sun, Apr 08, 2018 at 10:19:42PM +0100, Sean Young wrote: > > mceusb devices have a default timeout of 100ms, but this can be changed. > > We finally added a backport of the v2 series (and also the mce_kbd > series) to LibreELEC yesterday and ratcher quickly received 2 bugreports > from users using mceusb receivers. > > Local testing on RPi/gpio-ir and Intel NUC/ite-cir was fine, I've > been using the v2 series for over a week without issues on > LibreELEC (RPi with kernel 4.14). > > Here are the links to the bugreports and logs: > https://forum.kodi.tv/showthread.php?tid=298461&pid=2726684#pid2726684 > https://forum.kodi.tv/showthread.php?tid=298462&pid=2726690#pid2726690 > > Both users are using similar mceusb receivers: > > Log 1: > [ 6.418218] rc rc0: Media Center Ed. eHome Infrared Remote Transceiver (147a:e017) as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.0/rc/rc0 > [ 6.418358] input: Media Center Ed. eHome Infrared Remote Transceiver (147a:e017) as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.0/rc/rc0/input0 > [ 6.419443] rc rc0: lirc_dev: driver ir-lirc-codec (mceusb) registered at minor = 0 > [ 6.608114] mceusb 1-1.3:1.0: Registered Formosa21 SnowflakeEmulation with mce emulator interface version 1 > [ 6.608125] mceusb 1-1.3:1.0: 0 tx ports (0x0 cabled) and 1 rx sensors (0x1 active) > > Log 2: > [ 3.023361] rc rc0: Media Center Ed. eHome Infrared Remote Transceiver (147a:e03e) as /devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.0/rc/rc0 > [ 3.023393] input: Media Center Ed. eHome Infrared Remote Transceiver (147a:e03e) as /devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.0/rc/rc0/input11 > [ 3.023868] rc rc0: lirc_dev: driver ir-lirc-codec (mceusb) registered at minor = 0 > [ 3.119384] input: eventlircd as /devices/virtual/input/input21 > [ 3.138625] ip6_tables: (C) 2000-2006 Netfilter Core Team > [ 3.196830] mceusb 1-10:1.0: Registered Formosa21 eHome Infrared Transceiver with mce emulator interface version 2 > [ 3.196836] mceusb 1-10:1.0: 0 tx ports (0x0 cabled) and 1 rx sensors (0x1 active) > > In both cases ir-keytable doesn't report any scancodes and the > ir-ctl -r output contains very odd long space values where I'd expect > a short timeout instead: > > gap between messages: > space 800 > pulse 450 > space 16777215 > space 25400 > pulse 2650 > space 800 > > end of last message: > space 800 > pulse 450 > space 16777215 > timeout 31750 > > This patch applied cleanly on 4.14 and the mceusb history from > 4.14 to media/master looked rather unsuspicious. I'm not 100% sure > if I might have missed a dependency when backporting the patch > or if this is indeed an issue of this patch on these particular > (or maybe some more) mceusb receivers. Thanks again for a great bug report and analysis! So, it seems with the shorter timeout, some mceusb devices add a specific "timeout" code to the IR data stream (0x80) rather than a space. The current mceusb code resets the decoders in this case, causing the IR decoders to reset and lirc to report a space of 0xffffff. Turns out that one of my mceusb devices also suffers from this, I don't know how I missed this. Anyway hopefully this will solve the problem. Thanks Sean From 92d27b206e51993e927dc0b3aba210a621eef3d0 Mon Sep 17 00:00:00 2001 From: Sean Young Date: Wed, 18 Apr 2018 10:36:25 +0100 Subject: [PATCH] media: rc: mceusb: IR of length 0 means IR timeout, not reset The last usb packet with IR data will end with 0x80 (MCE_IRDATA_TRAILER). If we reset the decoder state at this point, IR decoding can fail. Signed-off-by: Sean Young --- drivers/media/rc/mceusb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c index c97cb2eb1c5f..5c0bf61fae26 100644 --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c @@ -1201,7 +1201,12 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) if (ir->rem) { ir->parser_state = PARSE_IRDATA; } else { - ir_raw_event_reset(ir->rc); + init_ir_raw_event(&rawir); + rawir.timeout = 1; + rawir.duration = ir->rc->timeout; + if (ir_raw_event_store_with_filter(ir->rc, + &rawir)) + event = true; ir->pulse_tunit = 0; ir->pulse_count = 0; }