Repository navigation
Conversation
87b7a9a to
3e34e34
Compare
|
See https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1508 for an example of a userspace program that uses this functionality |
chadmed
left a comment
There was a problem hiding this comment.
Please also follow kernel commit message convention, it makes our life easier when upstreaming. This should be split into multiple commits, at least one adding the new driver and another integrating it into hid-magicmouse.
3e34e34 to
94951f1
Compare
Hi! Thanks for the feedback, how's this now? |
89e4a79 to
807128b
Compare
807128b to
e29d16a
Compare
d2be5bd to
152cea7
Compare
152cea7 to
9b260ab
Compare
|
Thank you!!! I'm really glad that people are finding my work (Including the libinput stuff!) beneficial, that's all I want really!! :D And also it's good to note that my driver works exactly as intended without modification on M3, wider range of devices to test is good also! Yep, I really would like my changes to be upstreamed to mainline Linux, but our tree is quite different from the mainline tree for magicmouse and dockchannel, so I'm not really sure how one would go around upstreaming that 😅 But hopefully at this point, that's everything! I'm pretty happy with where the driver is at this point |
15b55d3 to
7039e98
Compare
7039e98 to
8cbfcf2
Compare
|
Oops sorry didn't mean to request a review! |
8cbfcf2 to
b81e8e0
Compare
|
As a final touch I went through and renamed the variables to make it clearer - in previous versions At this point I am happy to see this get merged, can't think of anything else that this MR needs. |
414e55d to
c8ec9be
Compare
b81e8e0 to
01d3742
Compare
dchid_set_report() always sends HID_OUTPUT_REPORT regardless of the report type requested by the caller. Inline it into its sole caller and forward rtype directly, so SET_REPORT works correctly for feature reports too, not just output reports, and to simplify function calls. Signed-off-by: Yicong Hui <yicong@ycstuff.net>
Adds a driver to control the actuator of the MTP touchpad for M2 and later devices. This driver provides apple_actuator_init_haptics as an entrypoint, which upon being called, will create a force feedback device and attach it to the trackpad's input device, as well as installing all the relevant callback functions. It also sets the FF_HAPTIC capability to indicate that force feedback haptic effects can be uploaded to the trackpad [1]. Through upload functions, userspace may control the intensity or effect played when clicking. This patch implements press, release and deep click waveforms, as well as the softness module parameter, which sets the softness of all the actuator's click effects. Upon effect upload to the trackpad, the actuator will autonomously switch from device-controlled to host-controlled mode, where it will only click when signalled to do so by userspace. It will return to its autonomous device-controlled mode upon erasure of the last haptic effect, destruction of the force feedback device, or removal of the actuator driver. This patch is unconventional for a haptic driver, as it implements the haptic driver as a separate loadable module from the trackpad driver. This is because the haptic actuator is considered a separate device on MTP trackpads, whereas haptics for HUTRR63 (and the other kernel drivers) consider the haptic actuator and the touchpad to be the very same device. Therefore, to conform to the standardized interface in [2] this patch creates a separate driver for the separate HID device, and is designed such that userspace controls the actuator through the trackpad's input device. The specific hardware commands and their fields have been reverse engineered on my own machine (MacBook Pro 2023 M2 Max) using the m1n1 hypervisor. [1] https://docs.kernel.org/input/event-codes.html#input-prop-pressurepad [2] https://lore.kernel.org/all/20250818-support-forcepads-v3-0-e4f9ab0add84@google.com/T/#m12f9be6691015fb9b2e834248c368e5f90 Signed-off-by: Yicong Hui <yicong@ycstuff.net>
Apple MTP trackpads already report real pressure with ABS_MT_PRESSURE. Set the INPUT_PROP_PRESSUREPAD property as specified in commit ae8966b ("Input: rename INPUT_PROP_HAPTIC_TOUCHPAD to INPUT_PROP_PRESSUREPAD") to indicate it as a haptic touchpad that correctly reports 5 fingers and force in grams, rather than a traditional trackpad using pressure on a unitless scale as a proxy for contact size. Also set the INPUT_MT_TOTAL_FORCE bit to allow reporting of the total force across all contacts. Signed-off-by: Yicong Hui <yicong@ycstuff.net>
Integrate the MTP actuator driver with the MTP trackpad driver to
expose new functionality that allows userspace to control the haptic
effects of the touchpad actuator as a force feedback device, following
the convention for haptic touchpad functionality as specified in [1].
At probe, the trackpad driver calls apple_actuator_init_haptics(), which
looks for the actuator device alongside the trackpad. Devices without an
actuator are left unchanged. If setting up haptics fails, an error is
logged and the trackpad keeps working without haptics.
This changeset will allow modification and triggering of the haptics
such that userspace may control:
1. Click feedback intensity
2. Sensitivity of when clicks trigger
3. Configuring "Force Touch"-like deep click functionality
[1] https://lore.kernel.org/all/20250818-support-forcepads-v3-0-e4f9ab0add84@google.com/T/#m12f9be6691015fb9b2e834248c368e5f90
Signed-off-by: Yicong Hui <yicong@ycstuff.net>
01d3742 to
168e216
Compare
|
Hi, what's the status of this MR now? |
This merge request adds a new driver into the kernel to allow for the userspace to custom control the haptic effects of the apple MTP trackpad and follows the convention for haptic touchpad functionality as specified in [1].
Set the INPUT_PROP_PRESSUREPAD property within the MTP trackpad device indicating that this device is a haptic touchpad, and set the FF_HAPTIC capability to indicate that force feedback haptic effects can be uploaded to the trackpad [2]. Userspace can thus choose to upload force feedback effects to the touchpad, which would trigger it to switch into "Host controlled" mode, where the touchpad will no longer click unless signalled to do so by userspace.
This patch uses an unconventional means of doing so, by writing a separate loadable module for the haptic actuator. This is because the haptic actuator is considered a separate device on MTP trackpads, whereas haptics for HUTRR63 (And the other kernel drivers) considers the haptic actuator and the touchpad to be the very same device. Therefore, to conform to the standardized interface in [1] this patch creates a separate driver for the separate HID device, and is designed such that commands to the actuator are sent through the touchpad.
This changeset is relevant because allowing userspace control of the haptics allows for user control of:
1. Click feedback intensity
2. Sensitivity of when clicks trigger
3. Configuring "Force Touch"-like deep click functionality
The specific hardware commands and their fields have been reverse engineered on my own machine (Macbook Pro 2023 M2 Max) using the m1n1 hypervisor. The changes have not been tested on any other machine.
See also [3] where discussions were previously had on some of the specifics of the hardware
[1] https://lore.kernel.org/all/20250818-support-forcepads-v3-0-e4f9ab0add84@google.com/T/#m12f9be6691015fb9b2e834248c368e5f90
[2] https://docs.kernel.org/input/event-codes.html#input-prop-pressurepad
[3] https://gitlab.freedesktop.org/libinput/libinput/-/work_items/1027