linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: magicmouse: Set multi-touch keybits for Magic Mouse
@ 2017-04-07  8:12 Thierry Escande
  2017-05-05 13:32 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: Thierry Escande @ 2017-04-07  8:12 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-input, linux-kernel

From: Che-Liang Chiou <clchiou@chromium.org>

The driver emits multi-touch events for Magic Trackpad as well as Magic
Mouse, but it does not set keybits that are related to multi-touch event
for Magic Mouse; so set these keybits.

The keybits that are not set cause trouble because user programs often
probe these keybits for self-configuration and thus they cannot operate
properly if the keybits are not set.

One of such troubles is that libevdev will not be able to emit correct
touch count, causing gestures library failed to do fling stop.

Signed-off-by: Che-Liang Chiou <clchiou@chromium.org>
Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
---
 drivers/hid/hid-magicmouse.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index 20b40ad..1d6c997 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -349,6 +349,7 @@ static int magicmouse_raw_event(struct hid_device *hdev,
 
 	if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) {
 		magicmouse_emit_buttons(msc, clicks & 3);
+		input_mt_report_pointer_emulation(input, true);
 		input_report_rel(input, REL_X, x);
 		input_report_rel(input, REL_Y, y);
 	} else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
@@ -388,16 +389,16 @@ static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hd
 		__clear_bit(BTN_RIGHT, input->keybit);
 		__clear_bit(BTN_MIDDLE, input->keybit);
 		__set_bit(BTN_MOUSE, input->keybit);
-		__set_bit(BTN_TOOL_FINGER, input->keybit);
-		__set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
-		__set_bit(BTN_TOOL_TRIPLETAP, input->keybit);
-		__set_bit(BTN_TOOL_QUADTAP, input->keybit);
-		__set_bit(BTN_TOOL_QUINTTAP, input->keybit);
-		__set_bit(BTN_TOUCH, input->keybit);
-		__set_bit(INPUT_PROP_POINTER, input->propbit);
 		__set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
 	}
 
+	__set_bit(BTN_TOOL_FINGER, input->keybit);
+	__set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
+	__set_bit(BTN_TOOL_TRIPLETAP, input->keybit);
+	__set_bit(BTN_TOOL_QUADTAP, input->keybit);
+	__set_bit(BTN_TOOL_QUINTTAP, input->keybit);
+	__set_bit(BTN_TOUCH, input->keybit);
+	__set_bit(INPUT_PROP_POINTER, input->propbit);
 
 	__set_bit(EV_ABS, input->evbit);
 
-- 
2.7.4

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

* Re: [PATCH] HID: magicmouse: Set multi-touch keybits for Magic Mouse
  2017-04-07  8:12 [PATCH] HID: magicmouse: Set multi-touch keybits for Magic Mouse Thierry Escande
@ 2017-05-05 13:32 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2017-05-05 13:32 UTC (permalink / raw)
  To: Thierry Escande; +Cc: linux-input, linux-kernel

On Fri, 7 Apr 2017, Thierry Escande wrote:

> From: Che-Liang Chiou <clchiou@chromium.org>
> 
> The driver emits multi-touch events for Magic Trackpad as well as Magic
> Mouse, but it does not set keybits that are related to multi-touch event
> for Magic Mouse; so set these keybits.
> 
> The keybits that are not set cause trouble because user programs often
> probe these keybits for self-configuration and thus they cannot operate
> properly if the keybits are not set.
> 
> One of such troubles is that libevdev will not be able to emit correct
> touch count, causing gestures library failed to do fling stop.
> 
> Signed-off-by: Che-Liang Chiou <clchiou@chromium.org>
> Signed-off-by: Thierry Escande <thierry.escande@collabora.com>

Applied to for-4.12/upstream-fixes. Thanks,

-- 
Jiri Kosina
SUSE Labs

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

end of thread, other threads:[~2017-05-05 13:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-07  8:12 [PATCH] HID: magicmouse: Set multi-touch keybits for Magic Mouse Thierry Escande
2017-05-05 13:32 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).