From 3c9f4c80e609197a28170b0be6ab5b37759c0f84 Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Tue, 24 Nov 2026 14:37:16 +1100 Subject: [PATCH 1/2] HID: magicmouse: report the force click as KEY_INFO by default The host already tells a deep click (the second, firmer stage of a Force Touch click) from an ordinary one and plays its haptic, but reports it to userspace only if haptic_deep_keycode names a key, and nothing names one. So a force click does nothing on the desktop, where macOS opens Quick Look on the item under the pointer. Default the key to KEY_INFO. Linux has no force-click key; KEY_INFO (keysym XF86Info) has no default binding on the desktops we ship, so the key is inert until the desktop binds it to what a force click does there (in GNOME Files: the preview of the item clicked). It stays on the separate " Force Click" input device, held for as long as the deep stage lasts; haptic_deep_keycode=0 still turns it off. This applies to every trackpad with host-derived clicks (the MTP pads with an actuator); the SPI pads have no deep-click detection yet. Signed-off-by: Ryan Murray --- drivers/hid/hid-magicmouse.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c index 4d8ffa36d7700..c89f657daf5b4 100644 --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c @@ -148,16 +148,18 @@ module_param(haptic_deep_gap_ms, byte, 0644); MODULE_PARM_DESC(haptic_deep_gap_ms, "milliseconds between deep-click pulses, 0 to use haptic_pulse_gap_ms (default 15)"); /* - * Linux has no key for a force click, so which one to send is the user's - * choice; nothing is sent unless one is named. It is held down for as long as + * Linux has no key for a force click. KEY_INFO (XF86Info) stands for it: the + * desktop binds that keysym to what a force click does there (in GNOME Files, + * the preview of the item clicked), and nothing binds it by default, so the + * key does nothing where no one asks for it. It is held down for as long as * the deep stage lasts. The key comes from a separate input device: libinput * drives a touchpad with its own dispatcher, which drops every key that is not * a button, so a key on the trackpad's own device never reaches userspace. It * is read at probe because that device is set up there. */ -static u16 haptic_deep_keycode; +static u16 haptic_deep_keycode = KEY_INFO; module_param(haptic_deep_keycode, ushort, 0444); -MODULE_PARM_DESC(haptic_deep_keycode, "key code held during a deep click on a separate \"Force Click\" input device, 0 for none (default 0)"); +MODULE_PARM_DESC(haptic_deep_keycode, "key code held during a deep click on a separate \"Force Click\" input device, 0 for none (default KEY_INFO)"); static u8 haptic_pulse_gap_ms = 25; module_param(haptic_pulse_gap_ms, byte, 0644); From 1f033871260a9878d42903b1e6674495d85a2aee Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Tue, 24 Nov 2026 15:07:20 +1100 Subject: [PATCH 2/2] HID: magicmouse: create the Force Click device after the FF device magicmouse_setup_force_input() ran before input_ff_create(). When input_ff_create() failed, the trackpad was left without haptics but with a registered " Force Click" input device that could never send anything, until the driver was unbound. Set the Force Click device up only once the FF device exists. Signed-off-by: Ryan Murray --- drivers/hid/hid-magicmouse.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c index c89f657daf5b4..e4df604fcfcd3 100644 --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c @@ -2730,9 +2730,6 @@ static int apple_taptic_init_mtp(struct magicmouse_sc *msc, INIT_WORK(&msc->haptic_deep_release_work, magicmouse_deep_release_worker); - if (haptic_deep_keycode) - magicmouse_setup_force_input(msc); - /* FF_HAPTIC has to be in ffbit before the FF device is created. */ input_set_capability(msc->input, EV_FF, FF_HAPTIC); @@ -2752,6 +2749,13 @@ static int apple_taptic_init_mtp(struct magicmouse_sc *msc, return ret; } + /* + * Only now: if the FF device could not be created there are no + * haptics, and no Force Click device must be left registered. + */ + if (haptic_deep_keycode) + magicmouse_setup_force_input(msc); + ff = msc->input->ff; ff->private = haptic_dev; ff->upload = apple_upload_effects;