Skip to content

HID: magicmouse: report the J813 trackpad's palms - #2116

Draft
gig3m wants to merge 2 commits into
aurora-silicon:integration/aurorafrom
gig3m:j813/palm-debounce
Draft

gig3m wants to merge 2 commits into
aurora-silicon:integration/aurorafrom
gig3m:j813/palm-debounce

Conversation

@gig3m

@gig3m gig3m commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

The J813 (MacBook Air 13" M5) trackpad sends the standard MTP report and classes its contacts like the T6041 (#636) and J616s (#1510) ones: low byte of a record's second word, 2 and 3 for fingers, 6 and above for palms (7 most often, with 6, 10 and 12 mixed in while a hand lands).

The T6041 class rule needs a tool area above 1400, and most J813 palms never get there. Recorded from HID debugfs on a J813 during normal use and a minute of typing practice, 1,238 contacts:

contacts n tool_major p50 / max
fingers (class 2, 3) 868 905 / 1560
palms (class 6 and above) 370 1305 / 4179
rule palms caught fingers caught
class >= 6 and tool area > 1400 (T6041/J616s) 149 / 370 0
class >= 6 on one report 370 / 370 4
class >= 6 on two consecutive reports, or the rule above 370 / 370, by the 2nd report 1

Lowering the area doesn't separate them, since fingers reach 1560. The class flickers to a palm for single reports on fingers, so on the J813 a contact also counts as a palm once two consecutive reports class it as one. The one finger that rule catches had been class 3 for 11 reports and went 7/10 for its last 8 while lifting off. Three to five consecutive reports catch it as well, and miss more palms.

The new state is a second bitmap of the contact IDs classed as palms in the previous report. It is only consulted where the root is apple,j813. As on the J616s, the J813 trackpad now also advertises ABS_MT_TOOL_TYPE and the full 16-bit range of its touch and width areas. T6041 and J616s behave as before.

Userspace: libinput's Apple MTP entry treats a touch size above 1600 as a palm, and J813 palms rarely get there. As with the J700 and T6041, it should be paired with:

[Apple MacBook Air J813 Touchpad]
MatchUdevType=touchpad
MatchName=Apple*MTP*
MatchVendor=0x05AC
MatchDeviceTree=*j813*
AttrPalmSizeThreshold=0

Testing:

  • Running on my J813 daily kernel (7.3, m0d16l14n1 j815/test-next base).
  • Palms resting on the pad while typing don't move the pointer or click, with tap-to-click on. That was with libinput's stock Apple MTP entry: the quirk above is installed but wasn't loaded yet.
  • ABS_MT_TOOL_TYPE events show MT_TOOL_PALM on palm contacts.
  • Pointer motion and two-finger scroll work as before.
  • Not covered: the recordings contain no thumb-classed contacts (class 1).
  • Builds clean on integration/aurora (67dd90873461); checkpatch clean.

🤖 Generated with Claude Code

The J813 (MacBook Air 13" M5) trackpad sends the standard MTP report
and classes its contacts like the T6041 and J616s ones: low byte of a
record's second word, 2 and 3 for fingers, 6 and above for palms.

Most J813 palms stay below the classed tool area of 1400 that the
T6041 rule needs: recorded in normal use and while typing, 221 of 370
palm-classed contacts never passed it, and fingers reached 1560, so
lowering it would not separate them. The class flickers to a palm for
single reports on fingers (4 of 868), so on the J813 a contact also
counts as a palm once two consecutive reports class it as one. That
caught all 370 palms by their second report, and one finger, classed a
palm for its last reports while lifting.

As on the J616s, the J813 trackpad now also advertises ABS_MT_TOOL_TYPE
and the full 16-bit range of its touch and width areas. Other machines
are unchanged.

Signed-off-by: Kyle Arrington <kyle@arrington.co>
@m0d16l14n1

Copy link
Copy Markdown
Contributor

J815 (MacBook Air 15", M5) follow-up for this PR: the J815's trackpad sends the same standard MTP report with the same contact classes, so the same rule works there. The patch below adds apple,j815 to the debounce gate and applies cleanly on this branch's head (611abdc), via git am.

The J815 has a larger pad (ADT hid-merge-personality C1FD3,3 vs the J813's C1FD1,4; firmware tpmtfw-j815.bin), so I recorded contacts on a J815 before sending it. I used a local, test-only per-contact log at lift; it isn't part of the patch.

  • 30 s typing with both palms resting: the controller classed 77 contacts as palms, and all 77 were marked (36 by their second report). 15 short contacts had fewer palm classes and 11 of them were marked; all of them had large tool areas (up to 5245) at the palms' edges.
  • 30 s pointing, tapping and two-finger scrolling: 54 finger contacts, none marked and none with a palm class. The largest finger tool area was 1028, below the 1400 the area rule needs. Another 6 contacts lifted in the first second; they were palms still resting from the typing phase, all classed as palms.
0001-HID-magicmouse-report-the-J815-trackpad-s-palms-too.patch
From 53dafde6d10beacddcaa73fb4244071a0f84a6b7 Mon Sep 17 00:00:00 2001
From: Nick <nekreshen@yandex.ru>
Date: Tue, 17 Nov 2026 15:06:47 +0700
Subject: [PATCH] HID: magicmouse: report the J815 trackpad's palms too

The J815 (MacBook Air 15" M5) has the J813's T8142 and MTP transport, and
its trackpad sends the standard MTP report the previous commit reads on
the J813, with the same contact classes. Take the J813's rule there as
well: the controller's palm classes are trusted, and two consecutive palm
classes mark a palm whatever its tool area.

The pads differ: the J813 ADT's multi-touch hid-merge-personality is
C1FD1,4, the J815's C1FD3,3 (a larger pad, firmware tpmtfw-j815.bin), so
the rule was checked on a J815 recording (one contact line per lift):

  30 s typing with both palms resting on the pad: 77 contacts the
  controller classed as palms, all 77 marked (36 by their second report);
  15 short contacts with fewer palm classes, 11 of them marked, all with
  large tool areas (up to 5245) at the palms' edges.

  30 s pointing, tapping and two-finger scrolling: 54 finger contacts,
  none marked and none with a palm class; the largest finger tool area
  was 1028, below the 1400 the area rule needs. (6 more contacts lifted
  in the first second: palms still resting from the typing phase, all
  classed as palms.)

Assisted-by: Claude Opus 5.5
Signed-off-by: Nick <nekreshen@yandex.ru>
---
 drivers/hid/hid-magicmouse.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index ea71bccd3896..b2ea417707bb 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -276,7 +276,7 @@ struct effect_job {
  * @mtp_palm_size: Whether a tool area alone marks an MTP contact as a palm.
  * @mtp_palm_ids: MTP contact IDs reported as palms until they lift.
  * @mtp_palm_debounce: Whether two consecutive palm classes mark an MTP contact
- *                     as a palm whatever its tool area (J813).
+ *                     as a palm whatever its tool area (J813, J815).
  * @mtp_palm_classed: MTP contact IDs the controller classed as palms in the
  *                    previous report.
  * @ntouches: Number of touches in most recent touch report.
@@ -2685,10 +2685,12 @@ static int magicmouse_probe(struct hid_device *hdev,
 				     of_machine_is_compatible("apple,t6041");
 		/*
 		 * The J813 controller classes contacts the same way, and two
-		 * consecutive palm classes mark its palms.
+		 * consecutive palm classes mark its palms. The J815 (15-inch)
+		 * sends the same standard report from its own, larger pad.
 		 */
 		msc->mtp_palm_debounce = !msc->mtp_c1fe &&
-					 of_machine_is_compatible("apple,j813");
+					 (of_machine_is_compatible("apple,j813") ||
+					  of_machine_is_compatible("apple,j815"));
 		/*
 		 * The J616s controller classes contacts the same way, but its
 		 * fingers reach a tool area of 2475, so only the class marks its
-- 
2.56.1

The J815 (MacBook Air 15" M5) has the J813's T8142 and MTP transport, and
its trackpad sends the standard MTP report the previous commit reads on
the J813, with the same contact classes. Take the J813's rule there as
well: the controller's palm classes are trusted, and two consecutive palm
classes mark a palm whatever its tool area.

The pads differ: the J813 ADT's multi-touch hid-merge-personality is
C1FD1,4, the J815's C1FD3,3 (a larger pad, firmware tpmtfw-j815.bin), so
the rule was checked on a J815 recording (one contact line per lift):

  30 s typing with both palms resting on the pad: 77 contacts the
  controller classed as palms, all 77 marked (36 by their second report);
  15 short contacts with fewer palm classes, 11 of them marked, all with
  large tool areas (up to 5245) at the palms' edges.

  30 s pointing, tapping and two-finger scrolling: 54 finger contacts,
  none marked and none with a palm class; the largest finger tool area
  was 1028, below the 1400 the area rule needs. (6 more contacts lifted
  in the first second: palms still resting from the typing phase, all
  classed as palms.)

Assisted-by: Claude Opus 5.5
Signed-off-by: Nick <nekreshen@yandex.ru>
Signed-off-by: Kyle Arrington <kyle@arrington.co>
@gig3m
gig3m force-pushed the j813/palm-debounce branch from 1202088 to c3ef84c Compare November 17, 2026 18:02
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.

2 participants