Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.71 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796263815; b=pE4/+PMgcg6pve9GOi5U2jOlKs8rp46c9drlMuzImuzD/S67rNAxQMAsjdjpBRz/WXgz xgugVMhXz497N7jeSGdAoTLPgobmdLk3XQgZfZ9pfAfgtpkuR5knNBnQJ1UalPmfg3Li3 rEOccR2QS2SxbfKlBtyD/tvfHkTx45gjx7GL+T320HzrIYC1LvsfCYjNTAMZ/VLDNdmll QH8C/7N9Stk7W+vdI/ioZPPiAtYVrtPFt3Si/2aBeHQXvbAIacV3ETGjrufCNkoqX5Vsw an+pYFY5Q4bapuIguS4KEXk2BlwTlzi3scL7aTDeuM/ZOcduBpvoDwSTMfjU4jFg8Fg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796263815; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:Mime-Version: X-Mailer:Message-ID:Subject:From:To:Cc:Content-Type; bh=i/CFWqEykz4bbekqMJ3FrwuzmWVsUCaRzUqUQuZusdo=; b=mre2qP9XY9U0BmgnjW3NX/fCrVCIiSLqcn8dLlx9OmfyFaAy2rtMxGdwDA7wA5dVZx85 rGoSgRabbUUDNxWPF2GpOWabqQ0ieorS8hDBys0e5L53SFgi9UZA8f2lKhrDERF26N/1W c60hv06rtiKbRl9SNELP5tDSmsKetiETlMQxXzICzsC9OCvzmNdeTJqCejwbURqs/rbHT pujRgZqm2eFTGx8iNjQnpXH/Z+LXkeX00sTGlcgw3oIi7DVa4rDRDnrkMp6yQPNkRWksa WTHcxSbPmHl0aUz560ZiA18MI6WyUseHpktroTFTlLQ7hjtEx9Wm5eBLek8hhsExvRg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--svv.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b="BOD/gbnt"; arc=none smtp.remote-ip=74.125.82.71 Received: from mail-dl1-f71.google.com (mail-dl1-f71.google.com [74.125.82.71]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78F85606A322 for ; Thu, 3 Dec 2026 02:10:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 78F85606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--svv.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=BOD/gbnt Received: by mail-dl1-f71.google.com with SMTP id a92af1059eb24-1383723dfddso2088468c88.0 for ; Wed, 02 Dec 2026 18:10:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796263814; x=1796868614; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:mime-version:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=i/CFWqEykz4bbekqMJ3FrwuzmWVsUCaRzUqUQuZusdo=; b=BOD/gbntOUIVBLQyScQc7wR83615Y2D6E2ZdpKt/PG9IkO+xdDZ41CC+VJd2mRe7Eh yAQeJo7z9jxebqFy4n6lCgkEg4P3D6UZ4pzKdCgTZIc0GfH7bPekzaU1zmJZWMp7K80R uYCpz2SHlBIPAO+Ce4Gnxoka6bakqLawvRQwYbBFrZ8PI5GalUw6RJ/1ulmSNwoNfPjA oMMAtsraxWInSOYj8nHUm2i7ebumNZ3ycr2EK41JteFbGM6tD4CdtsRR9yxhHsAQXaAb vqTOifGEuYNkxOwxe3ny3N9Iz6J9G0rsinMsqc9Q/SxiFfdYFwRUhWnrrsCcK78On2DO R6ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796263814; x=1796868614; h=content-type:cc:to:from:subject:message-id:mime-version:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=i/CFWqEykz4bbekqMJ3FrwuzmWVsUCaRzUqUQuZusdo=; b=txTw1ng5shvEk4yQF7MJbcjwOWuMNDFZsGgQER42OTWtsCJiCSLT7M2WY9FyTSpxzP Q1bcCbyvmUd912X1y7eWiztvdlmWORSiDAnIdJN5DTi7wKoTTPeDOL44l2jSU/2X4qfl 2fn22Rz60nOk12E49UrQiDiaiCo5Q6tDC7UzEL8hGQiVFXDOPRcC8aUSeWm926DKrupo 1HSVX1iuJzaajrbPRvBlqyHskehHwTzyJ7XYadTrA8SA7oOtLM7v0VbBANJTAsElfrFA nWxz82e9lsnUnUP3ZCioFGpAg9ecHsntKiSrolF+O8r4Z/sTwMUUmaQA54uXfZ8KooVb 9sbA== X-Forwarded-Encrypted: i=1; AL+hErGpzgksehxY00mWhAZLYvxWLz9oBSGTW16zHjC+miNhcH3Kpe4yjUXAsbMKzwdxVQng1bRZEjas9cI=@vger.kernel.org X-Gm-Message-State: APuU4Z8RF5adzLgUTUqttW8klFzP+5jGxTzK7W/bpAbqxbf3lrGI09I8 HfrO9PSdD2gNLjXT7/5V1nnmkCY4D/rvCQOmqF5qXXpRL8Xml0mwheCda2LQs95EeU+8YA== X-Received: from dlxx13.prod.google.com ([2002:a05:7022:408d:b0:1b2:4b00:1331]) (user=svv job=prod-delivery.src-stubby-dispatcher) by 2002:a05:701b:4555:20b0:1b5:2988:eba7 with SMTP id a92af1059eb24-1b556947286mr42507328c88.41.1796263813311; Wed, 02 Dec 2026 18:10:13 -0800 (PST) Date: Wed, 2 Dec 2026 18:10:02 -0800 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 X-Mailer: git-send-email 2.56.1.911.g883d8bcb20-goog Message-ID: <20261203021005.1106826-1-svv@google.com> Subject: [PATCH v3 0/3] Input: add ABS_TWIST and support it in HID and Wacom From: Siarhei Vishniakou To: Dmitry Torokhov , Jiri Kosina , Benjamin Tissoires , Ping Cheng , Jason Gerecke Cc: Peter Hutterer , 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, Siarhei Vishniakou Content-Type: text/plain; charset="UTF-8" Some styli can report rotation along their long ("barrel") axis, commonly referred to as "twist". While the HID specification defines this usage as HID_DG_TWIST (0x000d0041) in the Digitizers page, there is currently no corresponding evdev axis code to expose it to userspace. Because evdev has no MSC_SCAN equivalent for axes, drivers and OEMs currently work around this by mapping stylus twist onto unrelated axes such as ABS_Z or ABS_RZ. As a result, userspace input stacks must maintain device-specific workarounds to know which axis carries twist. This series introduces a dedicated ABS_TWIST (0x1d) axis for single-tool devices such as styli and wires it up in the HID subsystem: 1. Input: Define ABS_TWIST (0x1d) in input-event-codes.h, add its name to hid-debug.c, and document its semantics in event-codes.rst. 2. HID: Map HID_DG_TWIST (0x000d0041) to ABS_TWIST in hid-input, compute its resolution in units/radian, and add KUnit test coverage. 3. HID: wacom: Report un-offset pen twist on ABS_TWIST (zero at top/-Y) while keeping the shifted ABS_Z axis (zero at left/-X) for backwards compatibility with existing applications. v2: https://lore.kernel.org/linux-input/20261126024337.4168845-1-svv@google.com/ v1: https://lore.kernel.org/linux-input/20261110020632.4003499-1-svv@google.com/ Changes in v3: - Patch 1 (Jason, Peter): - Clarified docs on how to properly handle restricted angular ranges. Also explained that asymmetric ranges are acceptable. - Patch 2: - No changes. - Patch 3: - No changes. Changes in v2: - Rebased onto v7.4-rc4 (8d7fe9885c62, including hid-for-linus-2026112301). - Patch 1 (Dmitry): - Moved ABS_TWIST directly below ABS_SND_PROFILE in event-codes.rst. - Expanded event-codes.rst with precise value semantics: clockwise rotation when viewed down the barrel toward the surface, zero when the neutral reference faces the top (-Y, north) of the surface, support for both non-negative [0, 360) and signed [-180, 180) full-revolution ranges with wraparound, units/radian resolution, and the distinction from ABS_MT_ORIENTATION. - Patch 2: - No changes. - Patch 3 (Jason): - Added comments explaining the forced angular resolution_code in wacom_map_usage(), the order-dependent double-mapping in wacom_wac_pen_usage_mapping(), and explicit ABS_Z emission in wacom_wac_pen_event(). - Emit un-offset twist (zero at top/-Y, matching ABS_TWIST documentation and HID_DG_TWIST) on ABS_TWIST across all three pen rotation paths, while preserving the +1/4 revolution offset (zero at left/-X) on legacy ABS_Z. Testing: Hardware-tested with a Wacom Intuos Pro and Art Pen 2 (HID_GENERIC path): verified ABS_TWIST reports 0 when the barrel button points to the top (-Y) edge, increases clockwise when viewed from eraser toward tip, tracks ABS_Z with a constant +450 (+90 deg) offset, resets cleanly to 0 on proximity exit, and exposes min -900, max 899, resolution 287. Note for Input/HID maintainers: Patch 1 has Peter's Acked-by and Patch 3 has Jason's Reviewed-by. Patch 2 still needs HID review, and please let me know how you prefer to merge this cross-subsystem series (e.g., all patches via the HID tree with Dmitry's Ack on Patch 1, or Patch 1 via an Input immutable branch). Siarhei Vishniakou (3): Input: add ABS_TWIST event code HID: input: map Digitizers Twist usage to ABS_TWIST HID: wacom: report ABS_TWIST alongside ABS_Z for pen twist Documentation/input/event-codes.rst | 26 +++++++ drivers/hid/hid-debug.c | 1 + drivers/hid/hid-input-test.c | 87 ++++++++++++++++++++++++ drivers/hid/hid-input.c | 5 ++ drivers/hid/wacom_wac.c | 94 ++++++++++++++++++++------ include/uapi/linux/input-event-codes.h | 1 + 6 files changed, 192 insertions(+), 22 deletions(-) base-commit: 8d7fe9885c62fc9a95bf55d9db244d9672a8aadc -- 2.56.1.911.g883d8bcb20-goog