Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5989632pxb; Mon, 14 Feb 2022 12:31:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJwhcK3HPpsp4Orr4rZdyAxJxbT87sVLGBM8TJwm/IOUTF0GlPO09247l9EEkn0alJuvgbDR X-Received: by 2002:a17:90a:4f:: with SMTP id 15mr418590pjb.218.1644870666131; Mon, 14 Feb 2022 12:31:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644870666; cv=none; d=google.com; s=arc-20160816; b=Cct/XYHIp91ZrwDqkLFIqSR3bWwyFxeBXGIvXdO+sgV0vHi2IiZcPV1Yg8jjx3fcsC S7/ANS82pK3LpjsLR3YBoyAZTEZuBgTgKGKQ9WKGwpepVQ6RgMrI+10SE+amotQAtwHx BZzNsDk7MUggviI4cCbEP/uANugMFRKlVj6WxQoAKzrEfWBuVyM+B7kRzkOiPaB5XhLL jFESzOlFJNGadqnMg0FTqHfYUcN8WsCxrkl84KQGrl0j5bRVV7mcwJIPpmsGTZimQsUG 3ZsEshHvv5RfcjpCi0EtGl4UQpQahGCZB6JLcQswKK3RN4zMENk2DMq9mLkqD6yb/G7Q eXGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=hWhbGGGKn+bDX+rmVqjerjVIp4FoCEokyN680ikvwEs=; b=ycyZD4jFyZ8l3KrbI/weunfCGokQWUL30aEHXOnPIFYT6xVTKMfXMy5fdULX1vDp5k tSTVROQDQTO4Oux4NI/XXFRmoIvWeg19wNr9mb8Z1jbncUJuDcN60vh36raDf3yEEcRP QKPKqUIUX4Gthoz9VDe0/eEw5IG7wcCwbotfmKfliI9aq7SydK1foBXW4Pxi7B/8hbBc TI1F0H/nl9488yzWG5a0NlBYnoT7R4hFF8/iRIbiodiPz/Jcv8uGhaKS2l9TzCTR8IIs VhnuFL4h2os7AwEQ0ukSJsab/8AiQuzrCxiXS+N51UDcDqmHxkCQPsQ1tvkk7WPXnFH+ rLLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IgPRyc42; 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 k3si17258912pfd.217.2022.02.14.12.31.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 12:31:06 -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=IgPRyc42; 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 07C16C4B54; Mon, 14 Feb 2022 12:01:39 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242706AbiBNL1i (ORCPT + 99 others); Mon, 14 Feb 2022 06:27:38 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:54360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351280AbiBNL1O (ORCPT ); Mon, 14 Feb 2022 06:27:14 -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 06A39606DC for ; Mon, 14 Feb 2022 03:03:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644836603; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hWhbGGGKn+bDX+rmVqjerjVIp4FoCEokyN680ikvwEs=; b=IgPRyc42bJh6PRxRTxXu1ncoNpntuNRYNVoQysqz0mKHeS1A/u2ALKg0V6XtJsJn3RROZE nx4t1uAUc7dZCNusC+XsTTWaS1V2XfV6d5AsOBKDBUWw0N5/+97RNjQ8VmvBo5IGe0nyd9 Cz773Zod+eyjB4cLt+fPLiflLPqJps0= Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-272-CZVJmjI5O0qrQRRtsscYBw-1; Mon, 14 Feb 2022 06:03:22 -0500 X-MC-Unique: CZVJmjI5O0qrQRRtsscYBw-1 Received: by mail-pf1-f200.google.com with SMTP id j204-20020a6280d5000000b004e107ad3488so2483690pfd.15 for ; Mon, 14 Feb 2022 03:03:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hWhbGGGKn+bDX+rmVqjerjVIp4FoCEokyN680ikvwEs=; b=oU/sZC9AfO6hPKmugJxTJC/kWLBVgqSRRM/nPCVr9rLDF1Hd3b7ZQbmAcWRLop2YiW qsYJqyLtHkyulQgYUYNSz8kX/SbVTNqLGaU+D2JCJlu/laEXx/C9z03nIMlGL+w2LL5R guG9WuY1Dzls73Ffa9FY1enqvE+xqzDH3qYu2yHYizGnUDK6dvalAUw5HzBsKqpFrWCn RNeR//BOvTSYetNf7c8bijHeEL9Qyd6pdhC3mnQ5yzqQXbCok1k0QaTnY8GVrBtHSR9J fEyOT8DIL0Hqp3+RDf+Bg+ms5S8GV2WsxRGyf1HlJx7gu9mCSBe2UE7m3hay7LCEpOJX wAPQ== X-Gm-Message-State: AOAM530haZrASC5a5Ac+hWoC0sPRsYTgNvH38jbrnapy6sIZjBWwK8AS VqcOfL6Ob2XmUbfTQcNnhVIHe3qaH+2XPPtCQRo6u0hYBAT3lHnmXeyhR/B6v7jStJAw/xHG/eR NPEmmNcyQ16qQhXOYBcRkgKW8BSGXiJrqAZQ3CwD4 X-Received: by 2002:a17:90b:4a48:: with SMTP id lb8mr13869252pjb.246.1644836600822; Mon, 14 Feb 2022 03:03:20 -0800 (PST) X-Received: by 2002:a17:90b:4a48:: with SMTP id lb8mr13869208pjb.246.1644836600472; Mon, 14 Feb 2022 03:03:20 -0800 (PST) MIME-Version: 1.0 References: <20220126161832.3193805-1-benjamin.tissoires@redhat.com> In-Reply-To: From: Benjamin Tissoires Date: Mon, 14 Feb 2022 12:03:09 +0100 Message-ID: Subject: Re: [PATCH 00/12] HID: fix for generic input processing To: Angela Czubak Cc: Jiri Kosina , Dmitry Torokhov , Jonathan Corbet , =?UTF-8?Q?Ahelenia_Ziemia=C5=84ska?= , Ping Cheng , Aaron Armstrong Skomra , Jason Gerecke , Peter Hutterer , "open list:HID CORE LAYER" , Linux Doc Mailing List , lkml Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 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=no 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 On Mon, Feb 14, 2022 at 11:51 AM Angela Czubak wrote: > > On Tue, Feb 8, 2022 at 8:19 PM Angela Czubak wrote: > > > > Hi Benjamin, > > > > On Wed, Jan 26, 2022 at 5:18 PM Benjamin Tissoires > > wrote: > > > > > > Hi, > > > > > > This is a followup of the discussion we had between Wacom and > > > the maintainers, and a followup of those 2 patch series: > > > > > > https://lore.kernel.org/r/20211022232837.18988-1-ping.cheng@wacom.com/ > > > https://lore.kernel.org/r/2ca91ac7cf92e3048a236db3cd519f04e12c1e61.1615224800.git.nabijaczleweli@nabijaczleweli.xyz/ > > > > > > It took me a while to get it right, but I finally can submit the > > > series: > > > > > > - the first 8 patches are some cleanup in the hid-input.c and > > > hid-core.c code. They also create a list of input fields that > > > is then used to process the event, in the priority we think > > > is good. > > > > > > For instance, on multitouch devices, it is better to have > > > Contact Count before processing all touches, and in each > > > touch, having Contact ID first is better. This series doesn't > > > cover hid-multitouch, but I have a series on top of this one that > > > does cover it. > > > > > > Anyway, in our case, here, we need to process Invert before > > > In Range for tablets so we can make a decision whether the user > > > has the intend to erase or not. > > > > > > - patch 9 enforces the invert usage before In Range as mentioned > > > above > > > > > > - patch 10 is the actual bulk of processing that should fix the > > > generic tablet handling. Now that we have a reliable ordering > > > of the fields, we can compute the state of the tool in a reliable > > > way, and be kinder to userspace by not sending to it 2 tools at > > > the same time. > > > > > > This patch has been extensively tested by hid-tools with the new > > > MR I submitted that add tests for tablets [0]. > > > > > > - patch 11 is a nice to have that I need for my second series regarding > > > hid-multitouch. It is not mandatory with that series, but given > > > that it changes the format of the priorities in hid-input.c I thought > > > it would be best to send it as part of this series. > > > > > > Note that now we are tagging the *reports* and the individual fields > > > when they are part of a multitouch collection, which should help > > > the drivers that implement this processing (hid-multitouch and wacom). > > > > > > - last, patch 12 is an attempt at fixing the documentation regarding > > > BTN_TOOL_* (requested by Peter). > > > > > > Dmitry, feel free to take this one through your tree if you prefer > > > to do so (and if you are happy with it), otherwise we can take it > > > through the hid tree. > > > > > > As mentioned above, I have a followup series not entirely tidied up > > > that implements the processing of Win8 mutltiouch devices in > > > hid-input.c. > > > There are several benefits for that: we should be able to drop the > > > multitouch code in wacom.ko, we can simplify part of hid-multitouch, > > > and we will be able to quirk a particular device in a separate module, > > > without touching at the generic code (in hid-multitouch or hid-input). > > > > > > Anyway, I am missing a few bits for that so that's coming in later. > > > > > > > Is there any timeline for the followup series? I am wondering how that > > would affect haptic support implementation. > > Hi Benjamin, > > just pinging in hope of receiving some answer :) > I am thinking of preparing another version of haptic support patches > (https://lore.kernel.org/all/20220114183152.1691659-1-acz@semihalf.com/T/) > and if I could already start remodelling them based on your changes so that > it is actually a haptic hid driver and not and API that would be great :) > I am simply wondering when multitouch driver is going to be expressed simply > by your changes. Hi Angela, FWIW, I got a public branch that has the multitouch changes at https://gitlab.freedesktop.org/bentiss/hid/-/commits/wip/input-mt-v5 The logic in the multitouch processing is correct but it is missing a few bits IIRC: - suspend/resume doesn't unset/set the multitouch parameters (doesn't seem to be an issue on my devel laptop though) - scantime is not properly handled - width/height is not using the same path than hid-multitouch (and probably not reported at all) - hid-multitouch needs to be cleaned up to use the new core changes instead of re-doing stuffs itself I think that you should be able to experiment your hid-haptic changes already, and see if that is indeed easier to use than creating an API driver. Cheers, Benjamin > > > > > > Cheers, > > > Benjamin > > > > > > > > > [0] https://gitlab.freedesktop.org/libevdev/hid-tools/-/merge_requests/127 > > > > > > Benjamin Tissoires (12): > > > HID: core: statically allocate read buffers > > > HID: core: de-duplicate some code in hid_input_field() > > > HID: core: split data fetching from processing in hid_input_field() > > > HID: input: tag touchscreens as such if the physical is not there > > > HID: input: rework spaghetti code with switch statements > > > HID: input: move up out-of-range processing of input values > > > HID: compute an ordered list of input fields to process > > > HID: core: for input reports, process the usages by priority list > > > HID: input: enforce Invert usage to be processed before InRange > > > HID: input: remove the need for HID_QUIRK_INVERT > > > HID: input: accommodate priorities for slotted devices > > > Input: docs: add more details on the use of BTN_TOOL > > > > > > Documentation/input/event-codes.rst | 5 +- > > > drivers/hid/hid-core.c | 280 ++++++++++++++++++++--- > > > drivers/hid/hid-input.c | 330 ++++++++++++++++++++++------ > > > include/linux/hid.h | 23 +- > > > 4 files changed, 533 insertions(+), 105 deletions(-) > > > > > > -- > > > 2.33.1 > > > > > > > Does this patch series introduce the leaf driver support you mentioned > > in the haptic review? >