Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1395955pxb; Thu, 28 Jan 2021 15:49:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJwOjHBSRSD5+OJkzuRBrqiuH5vYPtLb7YB4G75J2gtLLq6fySOqtScTIS1rF7G1wA4qw1a0 X-Received: by 2002:a17:906:e48:: with SMTP id q8mr1878382eji.478.1611877742207; Thu, 28 Jan 2021 15:49:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611877742; cv=none; d=google.com; s=arc-20160816; b=mobYwSXXynHc6ANvJxnt//AwkQsBmM240qzO+fiZqQIs6UM6PJyYNbdtq/IC1lz2f8 gcS76G+dxHL2UrF3XrKSO/YXq+OVsmpLyqkTovqKYLxM3T28yE+zQwCa4Ab8EIOMB2QX 3moOwNrWkdiftAk+2lBoILB/S8FhSpOktFcvMqIR/GtnLewg3JWdhSW2F6Aryh7VejOk aU4L5W50Wdvl6LLkYWreD49savfIpHsRO7aTnfNDvY4OcBWNwwvpMD5y7/flFkqNQ9ah dsAH+Bxs0RykC4JJu/5v65B2N+mBxL9EZZXdLO8ykJDeiY8mztw6yq4kqh/NNxDJMIFK WGgg== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature:dkim-filter; bh=aM8jK69L2OObytiFwSPBUze10voMNgHvPClMSv8Seik=; b=GVozt1oC8dSgn+/Ou3v/MIUOPyCo3uv+XnmZ5x1rpVySvNFjTKON54baExcfX/Dlqc ADfOGVpZuRimz6VEjr4RaL6iWtUAU7FZnjGOfaKBmviOXkQx6EKAd+O4VOlbuUt9JfYh /nFKjNL9DBZp4uHMe1tCCy37ounOSi96pvlbimUkkplMKglm5Mg6W3UID73viLKH0Y7d rwt0RQnNYgi9859fiQKWMNwAFYDdEORvxGAIKy+2ht8o01u3toDz8rjdk9qrxrf/stdX hwgTEAKp2XaYKlq2By6IAqqfAUH6Dv63qhAYqGwU5k24zOAw+7ov/FHhljaF9K8+lV82 SDEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lwn.net header.s=20201203 header.b=Kj+PlQP4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a1si4150640edq.48.2021.01.28.15.48.37; Thu, 28 Jan 2021 15:49:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@lwn.net header.s=20201203 header.b=Kj+PlQP4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231325AbhA1Xow (ORCPT + 99 others); Thu, 28 Jan 2021 18:44:52 -0500 Received: from ms.lwn.net ([45.79.88.28]:51376 "EHLO ms.lwn.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231314AbhA1Xog (ORCPT ); Thu, 28 Jan 2021 18:44:36 -0500 Received: from lwn.net (unknown [IPv6:2601:281:8300:104d::5f6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ms.lwn.net (Postfix) with ESMTPSA id 224666173; Thu, 28 Jan 2021 23:43:37 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 ms.lwn.net 224666173 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lwn.net; s=20201203; t=1611877417; bh=aM8jK69L2OObytiFwSPBUze10voMNgHvPClMSv8Seik=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Kj+PlQP46+U16dacGUjvC29DQZoQmKXSkuLgmhgw/o4i6nEp18N2uTmJPODZaL6K9 NVFPZArNOjoguezxg3AEcRw90ch569uv6X0uimDvpgw86neZFRzHsu1pty+zSiDYCg ybaUZRbADpjN59S3fLLMvqVzbmN4Uj9IBtCuhc8/qJmtaeq861ea943iTyqyUfr0sp S1FfpL7frMtmLPO3h//dviMZL5Opm3XftshmAVlWTMXW0foIVbP1vxhtBKt40Vots1 U6Fn1eJIP6MMmcpLncaq5M7yiyMhMlU6LyxTWHzESt2JekrojQ+L4DLIBruw5ALKhw eIAqrSJDV4x5Q== Date: Thu, 28 Jan 2021 16:43:36 -0700 From: Jonathan Corbet To: Peter Hutterer Cc: Dmitry Torokhov , Benjamin Tissoires , Jason Gerecke , Ping Cheng , linux-input@vger.kernel.org, Jiri Kosina , Henrik Rydberg , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: Re: [PATCH] Documentation: input: define ABS_PRESSURE/ABS_MT_PRESSURE resolution as grams Message-ID: <20210128164336.3be90423@lwn.net> In-Reply-To: <20210112230310.GA149342@jelly> References: <20210112230310.GA149342@jelly> Organization: LWN.net MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 13 Jan 2021 09:03:10 +1000 Peter Hutterer wrote: > ABS_PRESSURE and ABS_MT_PRESSURE on touch devices usually represent > contact size (as a finger flattens with higher pressure the contact size > increases) and userspace translates the kernel pressure value back into > contact size. For example, libinput has pressure thresholds when a touch is > considered a palm (palm == large contact area -> high pressure). The values > themselves are on an arbitrary scale and device-specific. > > On pressurepads however, the pressure axis may represent the real physical > pressure. Pressurepads are touchpads without a hinge but an actual pressure > sensor underneath the device instead, for example the Lenovo Yoga 9i. > > A high-enough pressure is converted to a button click by the firmware. > Microsoft does not require a pressure axis to be present, see [1], so as seen > from userspace most pressurepads are identical to clickpads - one button and > INPUT_PROP_BUTTONPAD set. > > However, pressurepads that export the pressure axis break userspace because > that axis no longer represents contact size, resulting in inconsistent touch > tracking, e.g. [2]. Userspace needs to know when a pressure axis represents > real pressure and the best way to do so is to define what the resolution > field means. Userspace can then treat data with a pressure resolution as > true pressure. > > This patch documents that the pressure resolution is in units/gram. This > allows for fine-grained detail and tops out at roughly ~2000t, enough for the > devices we're dealing with. Grams is not a scientific pressure unit but the > alternative is: > - Pascal: defined as force per area and area is unreliable on many devices and > seems like the wrong option here anyway, especially for devices with a > single pressure sensor only. > - Newton: defined as mass * distance/acceleration and for the purposes of a > pressure axis, the distance is tricky to interpret and we get the data to > calculate acceleration from event timestamps anyway. > > For the purposes of touch devices and digitizers, grams seems the best choice > and the easiest to interpret. > > Bonus side effect: we can use the existing hwdb infrastructure in userspace to > fix devices that advertise false pressure. > > [1] https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/windows-precision-touchpad-required-hid-top-level-collections#windows-precision-touchpad-input-reports > [2] https://gitlab.freedesktop.org/libinput/libinput/-/issues/562 > > Signed-off-by: Peter Hutterer > --- > Documentation/input/event-codes.rst | 15 +++++++++++++++ > Documentation/input/multi-touch-protocol.rst | 4 ++++ > 2 files changed, 19 insertions(+) It looks like nobody has picked this up, so I went ahead and applied it. Thanks, jon