From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=202.12.124.154 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796193811; b=ua+vmbh1vIhDLOAE+9BHK6owQvedAV0UXSjxt90FTj6kfQ66kvhYoXOZrCp2ReIZ0/Wy NsogecuwAW/NhC7K+5BzKcfHZUbo7EELsk9eIf5M6Fxvj7v/zO4N3FgVLqSXbKoSDul5d kI/pLIxuwcv0kOal3Txb6/zMwrBWkHEmDegR17ceq8y//lrxyC9S1o6n9qvd/VqdU2Pho rM8SsroB7gcK1NhNVwbuU/O+mIk5ALIGT2vb1CDAphyMhVgEedTyrmBZ4zIiJUZOxgAlG huaAyc+ZYAXMe7WeczR1i5iGzCeMv/VVFjM0yxsfug0EOgGzdQZhVxFUwATLsQY5N7g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796193811; h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature: X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:Message-Instance: X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID: Received:Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=TJZBSLT3HpgxjZ4qx2NXpZx5nSEKqnl0DNY3CyIlI5o=; b=ojUwoFebrce8OLwV2CIc6zmcBniTaOnD3yd7tjKzAL+OG5iX+EKbmjTi1bF6yZuthPwK tjDHzaXKUfvdff8ukj3wBXTg9PJyHQ9gZoIdIVi84Guh2hXk5dKZ/MJkqu4jMr82WqXDm VgGHTUysqAf9sYl1WIE2cOwr9gfrJRIb+Dqvm4IMn7pLNE0ImYUWx06xnIFDRFCrmhFFs GL+Meiom1krbgUg9oi34IYho8YG6P0mdhKO6kjpI3OpbKb34dNCyuiXJtA8kJimtmuxL2 Wy1KaJ0D4NxMI/7P6hBZ3DHArhutCFJIFwQYyPjSNb16ed30Y7paSDc1/M+Z1+EWviQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=who-t.net; spf=pass smtp.mailfrom=who-t.net; dkim=pass header.d=who-t.net header.i=@who-t.net header.a=rsa-sha256 header.s=fm2 header.b=CJI5tFNg; dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=Mkr55Pa7; arc=none smtp.remote-ip=202.12.124.154 Received: from fhigh-b3-smtp.messagingengine.com (fhigh-b3-smtp.messagingengine.com [202.12.124.154]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB4D9606A325 for ; Wed, 2 Dec 2026 06:43:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BB4D9606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=who-t.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=who-t.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=who-t.net header.i=@who-t.net header.a=rsa-sha256 header.s=fm2 header.b=CJI5tFNg; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=Mkr55Pa7 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfhigh.stl.internal (Postfix) with ESMTP id BE2787A00E5 for ; Wed, 2 Dec 2026 01:43:29 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Wed, 02 Dec 2026 01:43:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=who-t.net; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1796193807; x=1796280207; bh=TJZBSLT3Hp gxjZ4qx2NXpZx5nSEKqnl0DNY3CyIlI5o=; b=CJI5tFNgbNCqx9x6b1doqSIh92 +budqgykAya2rxVZqcm5bcLbs0ZSEvAXpSCKm28clSlp6kZtgXhRBhUmwL/lmV5O A0l/B2/N0251dgMOirGohTwPFfy6X37cKU8ywruvAKi3mf+PI6l1QA+YLCQ2SE2Z LySJLYMoKeLJiXkRFu3+GIEMWCKKdEv5tqRJ7WTGDKx2dpfyblXBHoZpSmb54fBy WijET60Nd1n4qbvWf2NcyKRJ//CV5Th3d+O9Ntp7pE25pVRSmyzHs4Cz8QkyO/9r zVXx9hnx0GaV3SbjstvwlvhbgdUpA1jtGRJAXDSx89k2c0vNqRgCcA75rdQQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1796193807; x=1796280207; bh=TJZBSLT3HpgxjZ4qx2NXpZx5nSEKqnl0DNY 3CyIlI5o=; b=Mkr55Pa7eaHNi/Wnkv3ydzw8OWbzwQqXzP2X313fy+cOSMiZFyR XzRrItLAIgP8ChuVBc/YzArRJWvWlkq3aNe/7Im7yG8NzojPQ5aNklW1EtYh3TMi y5cDnZJauTQ8UVmybHZqCab4d0fmJUqm7bQiI9OEBgLoMkiV+y9EqgUxhMY913n9 n+NDHMNOI0Vk3fP8qzvK6uqTHaZil7xL+8enKbbHDy3KDn46qipk2hUWC7Ag3WPD sFVLPu2F7YpbSsvVIb8yDB15LSWmrFxX9MCFiULrvyITI6AzA45rYS56JLnfZ8yx 4ftf3qTlpA/0Gzt6W/wrff85k9aDjbGdwCw== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=sign d=who-t.net a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1796193807; d=who-t.net; mf=PHBldGVyLmh1dHRlcmVyQHdoby10Lm5ldD4=; rt=PGxpbnV4LWRvY0B2Z2VyLmtlcm5lbC5vcmc+; s=fm2:rsa-sha256:jHv7hMm8cNTedbkPr8H2nwBOQuvjW11Ty/4JeLlEqPG2VK6 m9D7TlgeU80v2LyqhKMX83dAscZZ4Ofrehpl8yJazPXxgXNqnTiDNjNvvY7WqJVl wK2L1V3HuCQqb0NPQS5jk2tCpHcoBktuMMym0qhyYp4JuDCd5lWgwt6kn8hN7x5k I5ZkSaU9c0VymHmoOJ0L3vt+bwK2oMOM9tuLgaP1y07uNhykjj4Otcv890gSJUc/ Dv62ZqbpGriz/rt4V9pwYm+t2EQH5s8vF1T07bTlLRBs/4XJS3B3DRFpJlbDFyro 8bCvEPz3cT2yGcqHjoNAknxLH6r7/U4tjLZxJ6g==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=mi-m=1; hc=12; hn=cc,content-disposition,content-type,date,feedback-id,from, in-reply-to,message-id,mime-version,references,subject,to; Message-Instance: m=1; h=sha256:1O+TnUPye8H11g2IGns+qiMGg+HjVA9qQEbaE7MYA8g=:i4KVbaxcdlRUJ/CY3+H0Rl35dffJAYHcuiVmhCshYqM=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTEPeprUHldk8tSc9YPRZfxI2ypWuEU2TgqporPSS2nsOpqllHsSHcXUXYI8f+7uq+ BTvdilnDeTo5hYTUwkOhfrWB81hMEyesz2TEHtNbETuMM+jiFObIk27gY4kCY8fRzJVE2w t0dYXq8t4K6/G0Y24FkIR0Jo5jWMz3ZAwysFnqauONanNL2lkaCE0CvnDEcCz7OIapbQ68 tpj6rSEZLbJ97kTiD+ZNrgWtYcWzI5ujI7rYLLa1Pj2iIbLye0ZpVBYm4wX2bk0xz7ikO+ xLbC8e44qw27tTqEXBph7Jvllt/v3Zor0zNqthrPl0Z+G+fjZO6Ci1YJO+1dI76iIe0+iR 7/l/8uqC8B7+TaVWE+Nd9a3fw9O/HZzrL4OJf2aL7MD7No5pRCQFoNhp2w7CsByp/YtgZV sSJQDSLmra9aS5ASw/zIGs9EideE4cxLd5A8cQTT1gttHBosXUYLVdjNIo42h43ibBxP0T PBCEmNswZnCFafFvgstjMsT3C2Jl7mUEjJ4T6q7TjbkoJO2o2sO38+lnBKgwI/k5vBtaa/ GcvYlpVlARZNM1PFyNyiOe1bijQaJ7zYmjkCRUOujb/2umb6KRkAxYOq9+ar/6QshVRtzf d9JvA0+AOHF6vcF/dstb6GuGBFiBTeE1rr7ie++LvUnIQs9UNPK5b8rCGz7Q X-ME-Proxy: Feedback-ID: i7ce144cd:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 2 Dec 2026 01:43:22 -0500 (EST) Date: Wed, 2 Dec 2026 16:43:18 +1000 From: Peter Hutterer To: Dmitry Torokhov Cc: Siarhei Vishniakou , Jiri Kosina , Benjamin Tissoires , Ping Cheng , Jason Gerecke , Jason Gerecke , Jonathan Corbet , Shuah Khan , Randy Dunlap , Henrik Rydberg , linux-input@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/3] Input: add ABS_TWIST event code Message-ID: References: <20261126024337.4168845-1-svv@google.com> <20261126024337.4168845-2-svv@google.com> X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Nov 25, 2026 at 09:53:31PM -0800, Dmitry Torokhov wrote: > On Wed, Nov 25, 2026 at 06:43:35PM -0800, Siarhei Vishniakou wrote: > > Some styli can report the rotation along their long ("barrel") axis. > > This is typically referred to as "twist". > > > > Unlike ABS_MT_ORIENTATION (which describes the 2D alignment of the > > contact ellipse on the surface, analogous to stylus azimuth/tilt > > projected onto the surface), twist captures the roll of a tool around > > its own longitudinal axis independently of tilt or azimuth. > > > > In the HID usage pages, twist is already supported as HID_DG_TWIST > > (0x000d0041). However, this usage is not reported to userspace via the > > evdev interface today, since there is no MSC_SCAN equivalent for axes. > > > > Peripheral OEMs get around this today by mapping this axis to other axes > > like ABS_Z or ABS_RZ. This is not a valid way to report twist. > > > > As a result, userspace programs that would like to support twist must > > account for the various ways specific OEMs map this, since there is no > > generic axis for this. > > > > Unify this behaviour by introducing a new axis, ABS_TWIST (0x1d). This > > axis applies to single-pointer devices (such as styli), as opposed to > > per-slot multi-touch devices (which would use an ABS_MT_* axis). > > > > Document ABS_TWIST in event-codes.rst with its value semantics: > > clockwise-increasing when viewed down the tool's major axis toward the > > surface, 0 aligned toward the top (-Y, north) of the interaction surface > > matching HID_DG_TWIST, supporting either non-negative [0, maximum] or > > signed [minimum, maximum] full-revolution ranges, and resolution in > > units/radian. > > > > Signed-off-by: Siarhei Vishniakou > > --- > > Changes since v1: > > - Moved ABS_TWIST directly below ABS_SND_PROFILE in event-codes.rst > > (Dmitry). > > - Expanded event-codes.rst documentation with precise value semantics: > > clockwise-increasing direction viewed down the barrel toward the > > surface, 0 aligned toward the top (-Y, north) of the surface, > > non-negative [0, 360) and signed [-180, 180) ranges, wraparound > > behavior, and distinction from ABS_MT_ORIENTATION (Dmitry). > > I'd like Peter (CCed) to take a look at this too... thanks for the CC > > Documentation/input/event-codes.rst | 23 +++++++++++++++++++++++ > > drivers/hid/hid-debug.c | 1 + > > include/uapi/linux/input-event-codes.h | 1 + > > 3 files changed, 25 insertions(+) > > > > diff --git a/Documentation/input/event-codes.rst b/Documentation/input/event-codes.rst > > index 77a6c9b3956d..4f03dcacbd55 100644 > > --- a/Documentation/input/event-codes.rst > > +++ b/Documentation/input/event-codes.rst > > @@ -247,6 +247,29 @@ A few EV_ABS codes have special meanings: > > An event is emitted only when the selected profile changes, > > indicating the newly selected profile value. > > > > +* ABS_TWIST: > > + > > + - Used to describe the rotation of a tool (such as a stylus) around its own > > + major (barrel) axis. Unlike ABS_MT_ORIENTATION (which describes the 2D > > + orientation of a contact ellipse on the surface), ABS_TWIST reports the > > + tool's roll around its longitudinal axis independently of tilt or azimuth. > > + - Values increase for clockwise rotation and decrease for counter-clockwise > > + rotation when viewed looking down the tool's major axis toward the > > + interaction surface (e.g., from the eraser end of a stylus toward the tip). > > + - A value of 0 corresponds to the tool's neutral reference orientation (e.g., > > + its primary barrel button or flat edge) facing toward the top (-Y, north) > > + of the interaction surface. > > + - The range reported in struct input_absinfo may be either non-negative or > > + signed. A non-negative range ([0, maximum]) covers [0, 360) degrees. > > + A signed range ([minimum, maximum]) is centered at 0 and covers > > + [-180, 180) degrees. > > + - Unless the hardware only supports a restricted angular range, the > > + [minimum, maximum] range spans one full revolution and wraps between > > + maximum and minimum. > > + - If the resolution is non-zero, the twist data is in units/radian. If the > > + resolution is zero, userspace may assume the full [minimum, maximum] range > > + represents one full revolution. from what I remember about the tilt axes on some tablet devices they are happy reporting i8 ranges (-128/127 and -90/90 are popular iirc) without units and we have to quirk them for each device. What we ended up doing is quirking them to the available degrees, so -64/64 is a 0-centered range of 64 degrees. I'm suspicious that something like this will happen for twist as well, though I don't really have any good idea how to fix it - we *probably* end up putting heuristics in userspace for the full i8 range to be 360 degrees and anything else being degrees off center? Time will tell, I don't have enough hardware to confirm how often this will occur, and maybe this isn't as much of an issue for rotation as it is for tilt. Either way, not sure we can do much about this. This patch is Acked-by: Peter Hutterer Cheers, Peter > > + > > * ABS_MT_: > > > > - Used to describe multitouch input events. Please see > > diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c > > index f44e6e708404..2e9ff8a3b2cf 100644 > > --- a/drivers/hid/hid-debug.c > > +++ b/drivers/hid/hid-debug.c > > @@ -3518,6 +3518,7 @@ static const char *absolutes[ABS_CNT] = { > > [ABS_HAT3Y] = "Hat 3Y", [ABS_PRESSURE] = "Pressure", > > [ABS_DISTANCE] = "Distance", [ABS_TILT_X] = "XTilt", > > [ABS_TILT_Y] = "YTilt", [ABS_TOOL_WIDTH] = "ToolWidth", > > + [ABS_TWIST] = "Twist", > > [ABS_VOLUME] = "Volume", [ABS_PROFILE] = "Profile", > > [ABS_SND_PROFILE] = "SoundProfile", > > [ABS_MISC] = "Misc", > > diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h > > index 4217950e5d16..d4ed115fdeca 100644 > > --- a/include/uapi/linux/input-event-codes.h > > +++ b/include/uapi/linux/input-event-codes.h > > @@ -892,6 +892,7 @@ > > #define ABS_TILT_X 0x1a > > #define ABS_TILT_Y 0x1b > > #define ABS_TOOL_WIDTH 0x1c > > +#define ABS_TWIST 0x1d > > > > #define ABS_VOLUME 0x20 > > #define ABS_PROFILE 0x21 > > -- > Dmitry