Ignore touch collections that carry no coordinate data - #31
Open
mhrpii wants to merge 2 commits into
Open
Conversation
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 a Waveshare 10.4" QLED capacitive touchscreen (VID
0x0712, PID0x000A,10-point HID digitizer), every finger lift spawns a phantom touch at a bogus
screen position. The phantom is visible in the debug overlay and lingers for the
0.5 s deferred-removal window. Rapid successive strokes accumulate several at
once.
Root cause
The panel reports
ContactCount = 10in its lift-off report instead of0:DispatchTouches()trusts that count and dispatches all ten collections.Collections 1–9 never received any values in this report, so
DispatchTouchDataForCollection()leavesxandyat their-1sentinel andstill calls
TouchInputManagerUpdateTouchPosition(). Each of those nine callscreates or revives a touch at a meaningless location.
Two details make it worse on this device: it never transmits
ContactIdentifierat all, so every collection resolves to contact ID0; andignoreOriginTouchescannot help, since it tests for exactCGPointZeroand thesentinel is
(-1, -1).The kernel-side view is clean —
evteston Linux shows a correctABS_MT_TRACKING_ID: -1on release — so this is purely about how the raw HIDreport is interpreted.
Fix
Bail out of
DispatchTouchDataForCollection()when the collection produced nocoordinate values. A collection with no X/Y data should never produce a touch,
regardless of what
ContactCountclaims.Testing
Verified on macOS Tahoe with the panel above: phantom touches are gone, and
normal tracking, tapping, dragging and scrolling are unaffected.