Skip to content

Fix touches pinned to a screen corner on multi-sample digitizers (e.g. ELAN Slice20) - #37

Open
schreinerman wants to merge 2 commits into
shueber:mainfrom
schreinerman:slice20-support
Open

Fix touches pinned to a screen corner on multi-sample digitizers (e.g. ELAN Slice20)#37
schreinerman wants to merge 2 commits into
shueber:mainfrom
schreinerman:slice20-support

Conversation

@schreinerman

Copy link
Copy Markdown

Problem

On certain touchscreens, every touch lands in the bottom-right corner — both in the macOS system mouse and in Touch Up's DebugView. Reproduced on the ELAN "Slice20" panel (1440×960, connected via a USB-C DP dongle).

Root cause

The panel's report descriptor declares its X/Y axis elements as 16 bit × report count 2 (a 32-bit field), but the firmware writes the same 16-bit coordinate into both sample slots. IOHIDValueGetIntegerValue then decodes the full 32-bit field, producing a value 65537× the true coordinate (e.g. 163,580,352 = 2496 × 65537 at the right edge). A live capture of the panel confirms the low and high 16-bit words are always identical, while the low word itself tracks the finger correctly within the declared logical range.

Normalizing such a value against the element's logical maximum (2496 / 1680) saturates to (1, 1) — the bottom-right corner — in every consumer of the data: Touch Up's DebugView and the system mouse (handled by macOS' built-in event driver, which cannot be changed from user space).

Changes

  1. TouchUpCore/HIDInterpreter.cStoreInputValue now reduces the value of multi-sample elements (report count > 1) to their first sample, the canonical reading of such elements. Single-sample, signed, or non-uniform elements pass through unchanged, so previously working screens are unaffected.
  2. New "Exclusive Device Access" setting (Settings → Troubleshooting) — wires up the existing but previously unreachable setTouchscreensSeized: core API and persists the choice across launches. For affected screens this stops macOS from processing the touchscreen, so the system mouse no longer jumps to a corner. Default is off, so existing users are unaffected.
  3. README.md — short troubleshooting note for screens whose firmware reports out-of-range coordinates.

Verification

Built and run on macOS (Apple silicon) with the Slice20 connected: the DebugView now tracks the finger 1:1 across the whole panel (previously pinned to the bottom-right corner), and with Exclusive Device Access enabled the system mouse no longer jumps.

Some digitizers (e.g. the ELAN 'Slice20' panel) declare axis elements
with a report count greater than one and write the same coordinate into
every sample slot. For a 16-bit x 2 field the raw value becomes the true
coordinate times 65537, far exceeding the logical maximum, so the touch
is clamped to the far corner of the screen.

StoreInputValue now reduces such values to their first sample, which is
the canonical interpretation of a multi-sample element and a no-op for
all single-sample elements.
Wire the existing (previously unused) seize API into the settings UI as
an 'Exclusive Device Access' toggle, persisted across launches. When
enabled, connected touchscreens are opened exclusively so macOS stops
processing their events and Touch Up becomes the sole handler.

Also document in the README how to use this for screens whose firmware
reports out-of-range coordinates, which makes the system mouse jump to a
screen corner.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant