Fix touches pinned to a screen corner on multi-sample digitizers (e.g. ELAN Slice20) - #37
Open
schreinerman wants to merge 2 commits into
Open
Fix touches pinned to a screen corner on multi-sample digitizers (e.g. ELAN Slice20)#37schreinerman wants to merge 2 commits into
schreinerman wants to merge 2 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
IOHIDValueGetIntegerValuethen 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
TouchUpCore/HIDInterpreter.c—StoreInputValuenow 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.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.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.