All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] Input: add ABS_TWIST and support it in HID and Wacom
@ 2026-12-03  2:10 Siarhei Vishniakou
  2026-12-03  2:10 ` [PATCH v3 1/3] Input: add ABS_TWIST event code Siarhei Vishniakou
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Siarhei Vishniakou @ 2026-12-03  2:10 UTC (permalink / raw)
  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, linux-doc,
	linux-kernel, Siarhei Vishniakou

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-12-03  2:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03  2:10 [PATCH v3 0/3] Input: add ABS_TWIST and support it in HID and Wacom Siarhei Vishniakou
2026-12-03  2:10 ` [PATCH v3 1/3] Input: add ABS_TWIST event code Siarhei Vishniakou
2026-12-03  2:10 ` [PATCH v3 2/3] HID: input: map Digitizers Twist usage to ABS_TWIST Siarhei Vishniakou
2026-12-03  2:10 ` [PATCH v3 3/3] HID: wacom: report ABS_TWIST alongside ABS_Z for pen twist Siarhei Vishniakou

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.