Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2505767imm; Wed, 16 May 2018 14:05:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqEMyKNUJKd5OJ4YJcdrucS71H7UB9i6QgSfgUl0wBnaWDAsi6FkTqKR3RgZnbXVx3HLi1+ X-Received: by 2002:a63:7702:: with SMTP id s2-v6mr1984994pgc.313.1526504731853; Wed, 16 May 2018 14:05:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526504731; cv=none; d=google.com; s=arc-20160816; b=wrFVINOHLOczHtkG1WHoZdfoqh1hVfvtJ/QWJcaaFQpV4CiOQYXEkYVirdWfyQJycc SEdbDSjagL/y8qyYpByWat4NGiFXZpwHk5INbdQZxVDgh22pajLDSiYWHtUDAdLKnKTO z4Q4yXtjmyV+XK1ynMzuFeZro14e+GC54F21SprH17FF93WVJUoEr/ZxT1YqAktXnhOt bgzN0iNXsHdf1+nExi0OPQ8KWphbQHdAImf0hqVLBYyNTwEcRTpCUGnaXUd7Zd7IE/MA beb0JE2yz+ntg+xE1yQaUM2q2TLxU75dS6is9ngcsW2o9mWTJ0ri5MHrCF4iMv3jOMpm K2ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from :arc-authentication-results; bh=HHwIPUZq3uXpt2c3fFeY/WLsi9/GVDLTVE/jJDYZLXQ=; b=cIGr7nXdNY1NwFm9xAmRji92c/RbeNSugNmIMqwqkt7rzZh84+qnwHECcWnSg6JM19 iFvPjFhv0jf7VPPTNW3sasTiAaXa0yJrMdRXTFg3Y6OeJU5w3b9MCwr9oxxhVzhFGC+D Scbr8ujrMG1SwteMLBiy1pC2FVeh9opwA+MvIFZFchkxr0UdjpEse0mWZeeo4C3tpZ6S Fgjrtdni4vltrjLqlIDlU7nkvDYYfpLVrXdzJKC86kmoKhHO5E4mh/57a6vprILvi3hE LYiOdsof6fEiwCXdb7I1OSzfGRKIr5tpcQo+BZ9a1CL0jW/lGejA2b6kC6wQm1vEwPvL V4vg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33-v6si3360709plk.83.2018.05.16.14.05.16; Wed, 16 May 2018 14:05:31 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752121AbeEPVEq (ORCPT + 99 others); Wed, 16 May 2018 17:04:46 -0400 Received: from gofer.mess.org ([88.97.38.141]:42429 "EHLO gofer.mess.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751213AbeEPVEn (ORCPT ); Wed, 16 May 2018 17:04:43 -0400 Received: by gofer.mess.org (Postfix, from userid 1000) id 1FCE760667; Wed, 16 May 2018 22:04:41 +0100 (BST) From: Sean Young To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Alexei Starovoitov , Mauro Carvalho Chehab , Daniel Borkmann , netdev@vger.kernel.org, Matthias Reichl , Devin Heitmueller , Y Song Subject: [PATCH v3 0/2] IR decoding using BPF Date: Wed, 16 May 2018 22:04:39 +0100 Message-Id: X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, 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 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 (2): media: rc: introduce BPF_PROG_RAWIR_EVENT bpf: add selftest for rawir_event type program drivers/media/rc/Kconfig | 13 + drivers/media/rc/Makefile | 1 + drivers/media/rc/bpf-rawir-event.c | 363 ++++++++++++++++++ drivers/media/rc/lirc_dev.c | 24 ++ drivers/media/rc/rc-core-priv.h | 24 ++ drivers/media/rc/rc-ir-raw.c | 14 +- include/linux/bpf_rcdev.h | 30 ++ include/linux/bpf_types.h | 3 + include/uapi/linux/bpf.h | 55 ++- kernel/bpf/syscall.c | 7 + tools/bpf/bpftool/prog.c | 1 + tools/include/uapi/linux/bpf.h | 57 ++- tools/lib/bpf/libbpf.c | 1 + tools/testing/selftests/bpf/Makefile | 8 +- tools/testing/selftests/bpf/bpf_helpers.h | 6 + tools/testing/selftests/bpf/test_rawir.sh | 37 ++ .../selftests/bpf/test_rawir_event_kern.c | 26 ++ .../selftests/bpf/test_rawir_event_user.c | 130 +++++++ 18 files changed, 792 insertions(+), 8 deletions(-) create mode 100644 drivers/media/rc/bpf-rawir-event.c create mode 100644 include/linux/bpf_rcdev.h create mode 100755 tools/testing/selftests/bpf/test_rawir.sh create mode 100644 tools/testing/selftests/bpf/test_rawir_event_kern.c create mode 100644 tools/testing/selftests/bpf/test_rawir_event_user.c -- 2.17.0