Repository navigation
HID: bring up the trackpad of the 14-inch M5 Max MacBook Pro - #1568
Draft
joshuaswarren wants to merge 4 commits into
Draft
joshuaswarren wants to merge 4 commits into
joshuaswarren wants to merge 4 commits into
Conversation
The multi-touch interface of the 14-inch M5 Max MacBook Pro (t6050) declares its raw touch report as a single Report Size item of 0x80000 bits. hid-core rejects any Report Size above 16384 with "invalid report_size 524288", so the trackpad never registered although the firmware, the interface and the keyboard all came up. hid-magicmouse consumes these reports in raw_event() and never uses the parsed field layout. Clamp each Report Size item in the copied descriptor to the hid-core limit before parsing, and log the clamp once per item. A KUnit case feeds a descriptor with a long item whose data looks like a Report Size prefix, a normal Report Size and the oversized one, and checks that only the oversized item changes. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
The K114c multi-touch descriptor has a Digitizer-page field under a Mouse application. hid-input reads that as a pen and sets INPUT_PROP_DIRECT, and udev then tags the trackpad as a touchscreen instead of a touchpad. The pad is an indirect pointing device: clear the property. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
The dockchannel MTP descriptor of the K114c opens with a Generic Desktop Mouse collection next to the multi-touch part. hid-input maps its buttons and axes, so the input device is a mouse and a multi-touch pad at once, and libinput refuses that hybrid. raw_event() drives every event of these devices. Ignore the usages of the Mouse application on dockchannel MTP devices so the input device is a plain touchpad. The keyboard interface is a GD Keyboard and is not affected. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
The K114c MTP firmware (personality K2C1, "AppleMTPFirmwareMac-6320.86.1") does not send the 0x75 report that magicmouse registers. It sends report 0x5a. hid_get_report() finds no report with that id, so hid_input_report() returned -1 for every packet and the trackpad never produced an input event, although the dockchannel interrupt fired on every touch. Register 0x5a next to 0x75 and parse it on dockchannel devices. 0x75 devices keep the old parser. Report layout. Offsets are bytes from the report id, little endian: 0 report id, 0x5a 1-47 firmware header: counter, timestamp. Not used. 48 contact section tag, 0x02 49 section header size, 8 50 contact record size, 48 51 section payload size, header size + count * record size 53 number of contact records 59 bit 4: physical button 60 start of the first record total 113 + 48 * count bytes, so 113, 161, 209, 257 for 0 to 3 contacts Contact record, 48 bytes: +1 tracking id, rolling +2 phase: 1 start, 2-3 approach, 4 touching, 5-7 lifting, 0 gone +5 f32 x, in micrometres +9 f32 y +13 f32 velocity x +17 f32 velocity y +21 f32 major axis +25 f32 minor axis +29 three f32 whose meaning is not known +41 f32 force, 0 to about 840 at a hard click +45 three bytes, not used A contact counts in phases 3 and 4. The floats are converted by hand because the kernel avoids the FPU. Positions and axes go out in tens of micrometres, which fits the J314 ranges the input device already advertises. The layout was read from kprobe captures of hid_input_report() on a 14-inch M5 Max MacBook Pro with one, two and three fingers and clicks. With the parser loaded, the input device reported 929 frames, X -5896 to 5875, four clicks and the two-finger tool bit. The button bit and the phase rule are read from those captures, not from documentation. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Contributor
|
Thanks Joshua. Regression rows for the shared MTP path, kernel integration c6c15ac + this PR (with #1601/#1605/#1606), one boot each:
|
Contributor
|
Neo (J700, T8140) row: PASS, the same as the M2 and J616s. Kernel fleet64 base 1de767b + this PR (with #1601/#1605/#1606). dockchannel-hid 0 errors, GPIO state and libinput devices identical to the base, s2idle 1/1. The only input change is again the multi-touch device dropping EV_MSC/MSC_SCAN. The J714s row is the last one before merging. |
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.
The trackpad of the 14-inch M5 Max MacBook Pro (K114c, T6050) did not register at all. This fixes it in four steps.
dockchannel-hidclamps oversized Report Size items. The multi-touch interface declares its raw touch report as one Report Size item of 0x80000 bits. hid-core rejects anything above 16384 withinvalid report_size 524288, so the device never came up even though the firmware, the interface and the keyboard did. A KUnit case covers the clamp.hid-magicmouseno longer marks the MTP trackpad as a direct device.hid-magicmousedrops the Generic Desktop mouse usages on dockchannel MTP devices.hid-magicmouseparses report 0x5a. This firmware does not send the 0x75 report magicmouse registers, sohid_input_report()returned -1 for every packet. The 0x75 path is unchanged.Tested on the hardware: with the parser loaded the input device reported 929 frames, X from -5896 to 5875, four clicks and the two-finger tool bit. The report layout comes from kprobe captures with one, two and three fingers, documented in the commit message. The button bit and the phase rule are read from those captures. Three floats in the contact record are still unidentified.
Opened as a draft: the layout is verified on one board only, and the MTP interface on other T6050 boards is untested.