]> git.baikalelectronics.ru Git - kernel.git/commitdiff
HID: magicmouse: Do not set BTN_MOUSE on double report
authorJosé Expósito <jose.exposito89@gmail.com>
Sun, 9 Oct 2022 18:27:47 +0000 (20:27 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 29 Oct 2022 08:20:35 +0000 (10:20 +0200)
[ Upstream commit 6bbad19da7e1edb856053122aef3bb24fbde10ef ]

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
Fixes: c524c40cc083 ("HID: magicmouse: enable Magic Trackpad support")
Reported-by: Nulo <git@nulo.in>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Link: https://lore.kernel.org/r/20221009182747.90730-1-jose.exposito89@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hid/hid-magicmouse.c

index fc4c07459753909b8c2c187a846bed17fd0fb9de..28158d2f2352306c7a40fe8c4e3980e795aff5ff 100644 (file)
@@ -387,7 +387,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;
        }