Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2274038pxm; Fri, 4 Mar 2022 12:52:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJwySVsQ8wMw95PyszpftP6jP4ZFGobDe5WWN91FPdgAA6QbQX14WA/AInPoH9mbZH6YoC/v X-Received: by 2002:a63:2a45:0:b0:373:1850:d5b with SMTP id q66-20020a632a45000000b0037318500d5bmr169299pgq.563.1646427145807; Fri, 04 Mar 2022 12:52:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646427145; cv=none; d=google.com; s=arc-20160816; b=CgABkCmerL4bTsFDZH30bUNI8oguespGCmGc86LSxUoP7i53MU5y5/qZHwbugvanMp EAF8Yh3fmgSO/hRl4aTk024TXpPWMUsCOZOfLhSlSVqfbud+OJdw7y9rh4J4QoSxA4Gr 9x6iXinp4XkI+zPqtPwVH45LKOUaNVpih5ej/LFOGUb5kFX3icmAcwKx4zX6afeqYOXe cX90EkNS+aHqyiB+SPTpFJKS+0DGV1TthSUGq/bx/4MNWNH7JFnlnrD83VCwIAZPEC+e cDveWUb14sfO7fKvHgnMncdCd2o4gfTLNKx4T3HYPgvKRNVdzSpoXMIQ3qWVhL6RSi9U WxAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jXjAemh+tgaeshWdU0Zw5DqV+Jw6OpdtZV+yJ3YWHiI=; b=mYtz9aqNVMyCEl2Nx9RNDKKl9FqFJ+iy8bgd2dfkfE3AGEcvgn+Y4zgHpvn5E7KIv6 Os5JDYm0ibpEG7AS0FfpU0xs2X5qeL9Tax+hEwQ3pUhIL1cElprIbNA6DSh9+bTe9Y6z 3GZaJATb9uB62LQwEDAsZOoXCgKR/SVeLayxaAX8/Uj316IxejTFH9jQ49ZYPB9V40Od ywLsRfQnjCOAefs/aRuT97VsttlwB/K6O1EU17Ur+L55DE4vGjPSQuCDMzvh7nCyWdZa aVMtcre7poGND5ttIc/O4WPaFvwsMFc3SSgSrL88U/pjwIeVn0pFK6q81SUXzbFPVPR/ dSWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="C1Fa/jY7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id cl10-20020a17090af68a00b001bd14e01f74si435657pjb.98.2022.03.04.12.52.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 12:52:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="C1Fa/jY7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D8CE0314F18; Fri, 4 Mar 2022 11:46:05 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238412AbiCDRdU (ORCPT + 99 others); Fri, 4 Mar 2022 12:33:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241328AbiCDRdE (ORCPT ); Fri, 4 Mar 2022 12:33:04 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7CA691CD9CD for ; Fri, 4 Mar 2022 09:32:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646415135; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jXjAemh+tgaeshWdU0Zw5DqV+Jw6OpdtZV+yJ3YWHiI=; b=C1Fa/jY7gUFx+oZV11T/bN8KB1Zkgee6kafC35dN8OUh8KK6C6rLeYcJ0t1qJD4bMzKiV5 k4hL1vzyyURZyLnKTF9NfbKik295+tJwhtIY1QHWJWqh7VpnG0YuPm9gqUGgc18IWgAIqw 0fBiXkmw1MxJfBPGhXhQ4iMMItDp/ik= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-204-hTrIEclbMQmRMq9TQ7IA5A-1; Fri, 04 Mar 2022 12:32:12 -0500 X-MC-Unique: hTrIEclbMQmRMq9TQ7IA5A-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 59BC51091DA0; Fri, 4 Mar 2022 17:32:10 +0000 (UTC) Received: from plouf.redhat.com (unknown [10.39.192.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 49C2486595; Fri, 4 Mar 2022 17:32:06 +0000 (UTC) From: Benjamin Tissoires To: Greg KH , Jiri Kosina , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Shuah Khan , Dave Marchevsky , Joe Stringer Cc: Tero Kristo , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, Benjamin Tissoires Subject: [PATCH bpf-next v2 11/28] samples/bpf: add a report descriptor fixup Date: Fri, 4 Mar 2022 18:28:35 +0100 Message-Id: <20220304172852.274126-12-benjamin.tissoires@redhat.com> In-Reply-To: <20220304172852.274126-1-benjamin.tissoires@redhat.com> References: <20220304172852.274126-1-benjamin.tissoires@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org the program inverts the definition of X and Y at a given place in the report descriptor of my mouse. Signed-off-by: Benjamin Tissoires --- changes in v2: - split the series by bpf/libbpf/hid/selftests and samples --- samples/bpf/hid_mouse_kern.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/samples/bpf/hid_mouse_kern.c b/samples/bpf/hid_mouse_kern.c index c24a12e06b40..958820caaf5d 100644 --- a/samples/bpf/hid_mouse_kern.c +++ b/samples/bpf/hid_mouse_kern.c @@ -62,5 +62,30 @@ int hid_x_event(struct hid_bpf_ctx *ctx) return 0; } +SEC("hid/rdesc_fixup") +int hid_rdesc_fixup(struct hid_bpf_ctx *ctx) +{ + if (ctx->type != HID_BPF_RDESC_FIXUP) + return 0; + + bpf_printk("rdesc: %02x %02x %02x", + ctx->data[0], + ctx->data[1], + ctx->data[2]); + bpf_printk(" %02x %02x %02x", + ctx->data[3], + ctx->data[4], + ctx->data[5]); + bpf_printk(" %02x %02x %02x ...", + ctx->data[6], + ctx->data[7], + ctx->data[8]); + + ctx->data[39] = 0x31; + ctx->data[41] = 0x30; + + return 0; +} + char _license[] SEC("license") = "GPL"; u32 _version SEC("version") = LINUX_VERSION_CODE; -- 2.35.1