Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1622909imm; Tue, 22 May 2018 06:59:19 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrUyXYPvqwg1x3ti5jvsyz9UdvaVf8qiHbG2ohRn+QKTpKKWnkjSbPgJvLahqx/baNeleIH X-Received: by 2002:a62:d8c7:: with SMTP id e190-v6mr24307982pfg.161.1526997559126; Tue, 22 May 2018 06:59:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526997559; cv=none; d=google.com; s=arc-20160816; b=xSkXobXojo66DPCdGzcAD1IR0UzuDoP8Q52qmatgVwwJOB7kbGEC+PZ2Ctm8GnGkW8 AWFyGxYNnMddMVvM7GsErFdTFpLIkt2bT5oGPjwvaxnbdjzROORm47dmoVIFmr0FASiI VCMoCfmE5bYKki41et8VI+htT7LWijAhzwFiAEesAesSVCcA+xy4OGP2kRC1h6H8LHhS lA+kqqpiLIK5eTz2LHsCyyjndHH7ZOhqom6C5MjTVOxwZ+oGLhzG2BUFv7dWU/xhorkD PeqXCRYDMoUBHvQ9UyG8ysDWyS5oNSNreGc+ZbyvSvAuZRfAI94LVP4qY6Qrwzi0xK2E GspA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=zxfA1f0iO6Z0GnPIqRLqxXPenKGLWBFFQFxGDxKVoeM=; b=bmj6WIeLqjga0fKBmbqohMouzRWFa1HUKtqoiHc5ZcuoLydJFZHR/rD0Ru+K/9lgAe hVeLpp8uOgIMLftFfN1qMEQkEmiOz99KRbAcrIA1fC9I+wcWli8sXGq+kLIhfEYmgUz3 znR5pfRGsrmualYyyQnEcVa6Ilq7t6Cy4oBUOHynV+3a/9M+fNwLjYqE3aRc49x9ddp5 G2dKl1uTKpaR+w79zqwt1Z/a4i4pWXOK17FdWTQXVgRPCF+FmagImmC/5pK51Yg0lnZK SMq+V35CjBY9oiz7Hc65u7KlLLK3PGWxCKxg1zDuJXAmCszIP4e4Ek0fDIb7Mw15bShr EstQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@horus.com header.s=20180324 header.b=ZQcQQ1rx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=horus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e93-v6si6650006plk.386.2018.05.22.06.59.04; Tue, 22 May 2018 06:59:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@horus.com header.s=20180324 header.b=ZQcQQ1rx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=horus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751788AbeEVN6v (ORCPT + 99 others); Tue, 22 May 2018 09:58:51 -0400 Received: from mail.horus.com ([78.46.148.228]:47231 "EHLO mail.horus.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751480AbeEVN6r (ORCPT ); Tue, 22 May 2018 09:58:47 -0400 X-Greylist: delayed 504 seconds by postgrey-1.27 at vger.kernel.org; Tue, 22 May 2018 09:58:47 EDT Received: from [192.168.1.20] (194-96-47-49.adsl.highway.telekom.at [194.96.47.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "E-Mail Matthias Reichl", Issuer "HiassofT CA 2014" (verified OK)) by mail.horus.com (Postfix) with ESMTPSA id 4195E6408F; Tue, 22 May 2018 15:50:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=horus.com; s=20180324; t=1526997022; bh=zxfA1f0iO6Z0GnPIqRLqxXPenKGLWBFFQFxGDxKVoeM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZQcQQ1rx9DrukawflosxaOtPA+cMpFtN5JTfgxf1/7i5E4+fT9dL7ZYGaddqtDIsk SXpOZBN/3JDQ7vBXU4IikcgjrWYHlTioVOh2qwrFTU9yEUnXFx0x3FDZnOo/XpQN09 75FhixWwsyN22Fi6e1Vb47k+Tbw2stWoAYJGGQAc= Received: by camel2.lan (Postfix, from userid 1000) id 4988C1C7754; Tue, 22 May 2018 15:50:21 +0200 (CEST) Date: Tue, 22 May 2018 15:50:21 +0200 From: Matthias Reichl To: Sean Young Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Alexei Starovoitov , Mauro Carvalho Chehab , Daniel Borkmann , netdev@vger.kernel.org, Devin Heitmueller , Y Song , Quentin Monnet Subject: Re: [PATCH v4 0/3] IR decoding using BPF Message-ID: <20180522135020.y3xxmtvhdui2so3t@camel2.lan> Mail-Followup-To: Matthias Reichl , Sean Young , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Alexei Starovoitov , Mauro Carvalho Chehab , Daniel Borkmann , netdev@vger.kernel.org, Devin Heitmueller , Y Song , Quentin Monnet References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sean, On Fri, May 18, 2018 at 03:07:27PM +0100, Sean Young wrote: > The kernel IR decoders (drivers/media/rc/ir-*-decoder.c) support the most > widely used IR protocols, but there are many protocols which are not > supported[1]. For example, the lirc-remotes[2] repo has over 2700 remotes, > many of which are not supported by rc-core. There is a "long tail" of > unsupported IR protocols, for which lircd is need to decode the IR . > > IR encoding is done in such a way that some simple circuit can decode it; > therefore, bpf is ideal. > > In order to support all these protocols, here we have bpf based IR decoding. > The idea is that user-space can define a decoder in bpf, attach it to > the rc device through the lirc chardev. > > Separate work is underway to extend ir-keytable to have an extensive library > of bpf-based decoders, and a much expanded library of rc keymaps. > > Another future application would be to compile IRP[3] to a IR BPF program, and > so support virtually every remote without having to write a decoder for each. > It might also be possible to support non-button devices such as analog > directional pads or air conditioning remote controls and decode the target > temperature in bpf, and pass that to an input device. Thanks a lot, this looks like a very interesting feature to me! Unfortunately I don't have time to test it ATM, but please keep me posted - also on ir-keytable progress - I'm rather excited to give it a try. so long & thanks, Hias > > Thanks, > > Sean Young > > [1] http://www.hifi-remote.com/wiki/index.php?title=DecodeIR > [2] https://sourceforge.net/p/lirc-remotes/code/ci/master/tree/remotes/ > [3] http://www.hifi-remote.com/wiki/index.php?title=IRP_Notation > > Changes since v3: > - Implemented review comments from Quentin Monnet and Y Song (thanks!) > - More helpful and better formatted bpf helper documentation > - Changed back to bpf_prog_array rather than open-coded implementation > - scancodes can be 64 bit > - bpf gets passed values in microseconds, not nanoseconds. > microseconds is more than than enough (IR receivers support carriers upto > 70kHz, at which point a single period is already 14 microseconds). Also, > this makes it much more consistent with lirc mode2. > - Since it looks much more like lirc mode2, rename the program type to > BPF_PROG_TYPE_LIRC_MODE2. > - Rebased on bpf-next > > Changes since v2: > - Fixed locking issues > - Improved self-test to cover more cases > - Rebased on bpf-next again > > Changes since v1: > - Code review comments from Y Song and > Randy Dunlap > - Re-wrote sample bpf to be selftest > - Renamed RAWIR_DECODER -> RAWIR_EVENT (Kconfig, context, bpf prog type) > - Rebase on bpf-next > - Introduced bpf_rawir_event context structure with simpler access checking > > Sean Young (3): > bpf: bpf_prog_array_copy() should return -ENOENT if exclude_prog not > found > media: rc: introduce BPF_PROG_LIRC_MODE2 > bpf: add selftest for lirc_mode2 type program > > drivers/media/rc/Kconfig | 13 + > drivers/media/rc/Makefile | 1 + > drivers/media/rc/bpf-lirc.c | 308 ++++++++++++++++++ > drivers/media/rc/lirc_dev.c | 30 ++ > drivers/media/rc/rc-core-priv.h | 22 ++ > drivers/media/rc/rc-ir-raw.c | 12 +- > include/linux/bpf_rcdev.h | 30 ++ > include/linux/bpf_types.h | 3 + > include/uapi/linux/bpf.h | 53 ++- > kernel/bpf/core.c | 11 +- > kernel/bpf/syscall.c | 7 + > kernel/trace/bpf_trace.c | 2 + > tools/bpf/bpftool/prog.c | 1 + > tools/include/uapi/linux/bpf.h | 53 ++- > tools/include/uapi/linux/lirc.h | 217 ++++++++++++ > tools/lib/bpf/libbpf.c | 1 + > tools/testing/selftests/bpf/Makefile | 8 +- > tools/testing/selftests/bpf/bpf_helpers.h | 6 + > .../testing/selftests/bpf/test_lirc_mode2.sh | 28 ++ > .../selftests/bpf/test_lirc_mode2_kern.c | 23 ++ > .../selftests/bpf/test_lirc_mode2_user.c | 154 +++++++++ > 21 files changed, 974 insertions(+), 9 deletions(-) > create mode 100644 drivers/media/rc/bpf-lirc.c > create mode 100644 include/linux/bpf_rcdev.h > create mode 100644 tools/include/uapi/linux/lirc.h > create mode 100755 tools/testing/selftests/bpf/test_lirc_mode2.sh > create mode 100644 tools/testing/selftests/bpf/test_lirc_mode2_kern.c > create mode 100644 tools/testing/selftests/bpf/test_lirc_mode2_user.c > > -- > 2.17.0 >