mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] HID: magicmouse: Do not set BTN_MOUSE on double report
@ 2022-10-09 18:27 José Expósito
  2022-10-14 11:44 ` Benjamin Tissoires
  0 siblings, 1 reply; 2+ messages in thread
From: José Expósito @ 2022-10-09 18:27 UTC (permalink / raw)
  To: jikos
  Cc: benjamin.tissoires, rydberg, linux-input, linux-kernel,
	José Expósito, Nulo

Under certain conditions the Magic Trackpad can group 2 reports in a
single packet. The packet is split and the raw event function is
invoked recursively for each part.

However, after processing each part, the BTN_MOUSE status is updated,
sending multiple click events. [1]

Return after processing double reports to avoid this issue.

Link: https://gitlab.freedesktop.org/libinput/libinput/-/issues/811  # [1]
Fixes: a462230e16ac ("HID: magicmouse: enable Magic Trackpad support")
Reported-by: Nulo <git@nulo.in>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
 drivers/hid/hid-magicmouse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index 664a624a363d..c9c968d4b36a 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -480,7 +480,7 @@ static int magicmouse_raw_event(struct hid_device *hdev,
 		magicmouse_raw_event(hdev, report, data + 2, data[1]);
 		magicmouse_raw_event(hdev, report, data + 2 + data[1],
 			size - 2 - data[1]);
-		break;
+		return 0;
 	default:
 		return 0;
 	}
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] HID: magicmouse: Do not set BTN_MOUSE on double report
  2022-10-09 18:27 [PATCH] HID: magicmouse: Do not set BTN_MOUSE on double report José Expósito
@ 2022-10-14 11:44 ` Benjamin Tissoires
  0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Tissoires @ 2022-10-14 11:44 UTC (permalink / raw)
  To: José Expósito; +Cc: jikos, rydberg, linux-input, linux-kernel, Nulo

On Sun, Oct 9, 2022 at 8:28 PM José Expósito <jose.exposito89@gmail.com> wrote:
>
> Under certain conditions the Magic Trackpad can group 2 reports in a
> single packet. The packet is split and the raw event function is
> invoked recursively for each part.
>
> However, after processing each part, the BTN_MOUSE status is updated,
> sending multiple click events. [1]
>
> Return after processing double reports to avoid this issue.
>
> Link: https://gitlab.freedesktop.org/libinput/libinput/-/issues/811  # [1]
> Fixes: a462230e16ac ("HID: magicmouse: enable Magic Trackpad support")
> Reported-by: Nulo <git@nulo.in>
> Signed-off-by: José Expósito <jose.exposito89@gmail.com>
> ---

Applied to for-6.1/upstream-fixes, thanks for spotting that old bug :)

Cheers,
Benjamin

>  drivers/hid/hid-magicmouse.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
> index 664a624a363d..c9c968d4b36a 100644
> --- a/drivers/hid/hid-magicmouse.c
> +++ b/drivers/hid/hid-magicmouse.c
> @@ -480,7 +480,7 @@ static int magicmouse_raw_event(struct hid_device *hdev,
>                 magicmouse_raw_event(hdev, report, data + 2, data[1]);
>                 magicmouse_raw_event(hdev, report, data + 2 + data[1],
>                         size - 2 - data[1]);
> -               break;
> +               return 0;
>         default:
>                 return 0;
>         }
> --
> 2.25.1
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-14 11:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-09 18:27 [PATCH] HID: magicmouse: Do not set BTN_MOUSE on double report José Expósito
2022-10-14 11:44 ` Benjamin Tissoires

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®