From: Siarhei Vishniakou <svv@google.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <bentiss@kernel.org>,
Ping Cheng <ping.cheng@wacom.com>,
Jason Gerecke <jason.gerecke@wacom.com>
Cc: Jason Gerecke <killertofu@gmail.com>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Randy Dunlap <rdunlap@infradead.org>,
Henrik Rydberg <rydberg@bitmath.org>,
linux-input@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org,
Siarhei Vishniakou <svv@google.com>
Subject: [PATCH v2 0/3] Input: add ABS_TWIST and support it in HID and Wacom
Date: Wed, 25 Nov 2026 18:43:34 -0800 [thread overview]
Message-ID: <20261126024337.4168845-1-svv@google.com> (raw)
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.
v1: https://lore.kernel.org/linux-input/20261110020632.4003499-1-svv@google.com/
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.
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 | 23 +++++++
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, 189 insertions(+), 22 deletions(-)
base-commit: 8d7fe9885c62fc9a95bf55d9db244d9672a8aadc
--
2.56.1.911.g883d8bcb20-goog
next reply other threads:[~2026-11-26 2:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 2:43 Siarhei Vishniakou [this message]
2026-11-26 2:43 ` [PATCH v2 1/3] Input: add ABS_TWIST event code Siarhei Vishniakou
2026-11-26 2:43 ` [PATCH v2 2/3] HID: input: map Digitizers Twist usage to ABS_TWIST Siarhei Vishniakou
2026-11-26 2:43 ` [PATCH v2 3/3] HID: wacom: report ABS_TWIST alongside ABS_Z for pen twist Siarhei Vishniakou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261126024337.4168845-1-svv@google.com \
--to=svv@google.com \
--cc=bentiss@kernel.org \
--cc=corbet@lwn.net \
--cc=dmitry.torokhov@gmail.com \
--cc=jason.gerecke@wacom.com \
--cc=jikos@kernel.org \
--cc=killertofu@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ping.cheng@wacom.com \
--cc=rdunlap@infradead.org \
--cc=rydberg@bitmath.org \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®