Skip to content

HID: magicmouse: J700 trackpad touch states and contact areas - #3831

Draft
niteria wants to merge 3 commits into
aurora-silicon:mainfrom
niteria:hid/j700-touch-states
Draft

niteria wants to merge 3 commits into
aurora-silicon:mainfrom
niteria:hid/j700-touch-states

Conversation

@niteria

@niteria niteria commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

What: On the J700 (MacBook Neo) every contact record of a report is passed on as a touch, with its position only. A finger approaching or leaving the pad therefore moves the pointer, and a two-finger scroll that has stopped scrolls again as the fingers lift. With apple,touch-states on the J700 multi-touch node, the driver reports only the records that make or keep touch, in path-ID slots (the reporting #2613 added for the J813/J815), together with their touch and tool areas, so libinput can end a touch while its area collapses.
Tested: not at this head (b4e4808b). J700 (MacBook Neo), Aura 1.0.0b9, the same driver change backported to a 2026-11-21 integration tree (niteria/linux c6d6756e): scroll after a stopped two-finger lift 0.03 and 0.04 mm, against 1.9 mm before; 107 make-touch entries gave 107 touches; 0 failed units.
Risk: two-way door · Neo (J700) only, through its multi-touch node property. Without the property the driver reports as it does today.
Not yet: a run at this head: on main, with a supported Aura, and with the property coming from the device tree. The hardware run switched the states on with a local test parameter (not in this PR), because that boot chain supplies its own device tree, and I can't move this machine to main and a newer Aura right now. Also not measured: taps and tap-to-click, and palms and flat thumbs, which matter because libinput's Apple MTP palm size threshold starts to apply once sizes are reported (see Details). The commits get their Signed-off-by together with the hardware row; draft until then.

Details

Thanks to Nick for the touch-state reporting in #2613, which this reuses unchanged, and to LiamRay11 and Ryan for the C1FE report layout the driver already decodes.

What the J700 records carry

The first word of each 30-byte contact record holds the path ID in its low byte and the touch state in its high byte, the same encoding as on the J813/J815. Two captures of normal use on one J700 (raw reports read from HID debugfs, 9,585 reports, 13,735 records):

state meaning records touch area zero reported with the property
1 start in range 136 0 no
2 hover in range 88 0 no
3 make touch 136 0 yes
4 touching 12,761 0 yes
5 break touch 130 0 no
6 linger in range 88 0 no
7 out of range 132 132 no
0 the two records after out of range 264 264 no

Each contact goes through 1, (2,) 3, 4…, (5, 6,) 7 and then 0 under one path ID. The commit that added the layout (ecd5dac9b258) left the areas out because "the touch area field is zero on some real contacts". In these captures the zero areas are exactly the records in states 7 and 0; all 12,897 records in states 3 and 4 have nonzero touch and tool areas. Pressure is always zero.

Why the areas as well as the states

Today a landing finger is reported from its start-in-range record and moves up to 12 mm before its first touching record, which user space sees as a pointer jump. The states remove that.

The lift needs more. In the first capture one finger that had stopped moved 3.2 mm over its last three records while still in state 4, with its touch major falling 87, 74, 23 (125 and above while it rested). The states alone would report all of that as motion. With the areas, libinput's touch-size thresholds end the touch as the area falls.

The areas are reported as on the other MTP trackpads (ABS_MT_TOUCH_MAJOR/MINOR, ABS_MT_WIDTH_MAJOR/MINOR, the record's values times two), so libinput's existing Apple MTP entry (AttrTouchSizeRange=150:130) applies without a new quirk. As #2613 notes for the J813/J815, I don't claim these fields are geometric sizes; they are used as the same relative measure libinput already thresholds on the other pads. Pressure and orientation stay unadvertised.

libinput's palm size threshold

The Apple MTP entry also sets AttrPalmSizeThreshold=1600, which starts to apply once sizes are reported. aurora-neo-platform-config's J700 quirk already sets it to 0, so installs with that package are unaffected. The run below was on a system without that quirk: the largest touch major/minor reported in the captures was 658/694, and no palm or flat thumb was in them, so I can't say where those land.

Binding and fallback

The binding stops rejecting apple,touch-states on a node with the J700 compatible and describes what it adds there; the palm properties stay rejected for that layout. The driver reads the property as before; when it is absent the J700 path is unchanged (every record reported, position only), so an older device tree keeps today's behaviour.

Evidence

Hardware run (not at this head). J700, Aura 1.0.0b9, kernel niteria/linux c6d6756e = a 2026-11-21 integration tree with 89d09f9f41ff (#2613's touch-state commit, context-only backport), this PR's driver commit and dts commit, and a local test parameter that sets what the property sets. The installed boot chain's device tree was not replaced, so the parameter, not the property, switched the states on. hid-magicmouse.c's J700 path is otherwise the code in this PR. libinput 1.29.2, Hyprland.

Method: raw reports from HID debugfs, libinput record and libinput debug-events taken together; the pad's report clock runs 0.23 % fast against the kernel's, so the two were aligned with a linear fit over 14 button edges (residuals ≤ 1.3 ms). "Lift" starts when the first finger's touch area falls below 85 % of its plateau.

Row Before (every record reported) With the states and areas
Scroll libinput emitted after a stopped two-finger lift 1.9 mm (25.7 scroll units in 33 events; 1 lift in the capture) 0.03 and 0.04 mm (2 lifts)
Touches started by the kernel one per record sequence, including in-range records 107, for 107 entries into states 3/4 (one contact went 4 → 5 → 6 → 3 → 4 and got a new touch)
Two-finger scrolls in the capture 4 38; moving lifts scroll a median 1.0 mm after the lift begins, about what the fingers travel in the 2 to 4 reports a lift takes
libinput's size threshold (150:130), replayed on the kernel's touches n/a 0 of 105 complete touches ignored; 1 registers one report (8 ms) late
Regression on that boot 0 failed units; kernel errors as on boots without the change (one dockchannel-hid … uninitialized iface 3 at boot, also on 2 of the 24 boots before it); one deep sleep entered and resumed

Replaying the first capture (before the change) through "states 3/4 + 150:130": landing motion at most 11.9 mm → 1.6 mm; the four stopped-finger lifts 3.28, 0.30, 0.32, 0.33 mm → 0.42, 0.14, 0.02, 0.21 mm; no touch dropped while it rested.

At this head (b4e4808b), build only:

  • dt_binding_check on apple,dockchannel-hid.yaml passes; CHECK_DTBS on t8140-j700.dtb passes, and the same DTB is rejected against main's binding ("apple,touch-states: False schema does not allow True").
  • hid-magicmouse.c builds with W=1 and no warnings (as a module against a main-based arm64 build tree).
  • checkpatch --strict: only the missing Signed-off-by.

…n the J700

The contact records of the J700 report layout carry the touch state and
the path ID in their first word, as the standard records do. Allow
apple,touch-states on a multi-touch node with the J700 compatible, and
say what it adds there: the layout has no force, so the contacts that
make or keep touch are reported with their touch and tool areas.
On the J700 every record of a report is passed on as a touch, with its
position only. The records do carry the touch state and the path ID in
their first word, like the standard MTP records: a capture of normal
use (6102 records of 29 contacts) shows each contact going through
states 1, (2,) 3, 4..., (5, 6,) 7 and then 0 under one path ID. The
touch and tool areas are nonzero in states 1 to 6 and zero in 7 and 0,
which are the "real contacts" with a zero touch area that made the
driver ignore the areas.

A finger approaching or leaving the pad is therefore reported as
touching, and its position moves while it does: up to 12 mm between
the start in range and the first touching record, and 3.2 mm over the
last three records of a finger that had stopped, still in state 4 with
a touch major of 87, 74 and 23 (125 and above while it rested on the
pad). User space sees the first as a pointer jump and the second as a
scroll or a pointer motion at the moment the fingers lift; libinput
logs some of them as "Touch jump detected and discarded".

With apple,touch-states on the J700 multi-touch node, report only the
records that make or keep touch, each in the slot of its path ID, as on
the J813 and J815. The states alone do not cover the lift above, so
also report the touch and tool areas, scaled as for the other MTP
trackpads: libinput ends a touch once its area falls below the
threshold of its MTP quirk, as it does there. Pressure and orientation
stay unadvertised. Without the property nothing changes.

Replaying the capture through this rule and libinput's touch-size
thresholds for MTP trackpads (150:130), the motion reported while
landing falls from at most 11.9 mm to 1.6 mm, and over the lift of the
four fingers that had stopped from 3.28, 0.30, 0.32 and 0.33 mm to
0.42, 0.14, 0.02 and 0.21 mm, with no touch dropped while it rested.

Run on a J700 as a backport to a tree from 2026-11-21, with a local
test parameter standing in for the property: in a second capture the
107 entries into states 3 and 4 gave 107 touches, and a two-finger
scroll that had stopped scrolled 0.03 and 0.04 mm as the fingers
lifted, against 1.9 mm before. All 12897 records in states 3 and 4 of
the two captures have nonzero areas. Not run on this base, and the
property itself has not been through a boot.
The J700 trackpad's contact records carry the touch state and the path
ID. Report only the contacts that make or keep touch, with their touch
and tool areas.

This branch has not been deployed

No deployments
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