Skip to content

Commit f4b65b9

Browse files
Che-Liang ChiouJiri Kosina
authored andcommitted
HID: magicmouse: Set multi-touch keybits for Magic Mouse
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 <[email protected]> Signed-off-by: Thierry Escande <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 2ac97f0 commit f4b65b9

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

drivers/hid/hid-magicmouse.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ static int magicmouse_raw_event(struct hid_device *hdev,
349349

350350
if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) {
351351
magicmouse_emit_buttons(msc, clicks & 3);
352+
input_mt_report_pointer_emulation(input, true);
352353
input_report_rel(input, REL_X, x);
353354
input_report_rel(input, REL_Y, y);
354355
} else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
@@ -388,16 +389,16 @@ static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hd
388389
__clear_bit(BTN_RIGHT, input->keybit);
389390
__clear_bit(BTN_MIDDLE, input->keybit);
390391
__set_bit(BTN_MOUSE, input->keybit);
391-
__set_bit(BTN_TOOL_FINGER, input->keybit);
392-
__set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
393-
__set_bit(BTN_TOOL_TRIPLETAP, input->keybit);
394-
__set_bit(BTN_TOOL_QUADTAP, input->keybit);
395-
__set_bit(BTN_TOOL_QUINTTAP, input->keybit);
396-
__set_bit(BTN_TOUCH, input->keybit);
397-
__set_bit(INPUT_PROP_POINTER, input->propbit);
398392
__set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
399393
}
400394

395+
__set_bit(BTN_TOOL_FINGER, input->keybit);
396+
__set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
397+
__set_bit(BTN_TOOL_TRIPLETAP, input->keybit);
398+
__set_bit(BTN_TOOL_QUADTAP, input->keybit);
399+
__set_bit(BTN_TOOL_QUINTTAP, input->keybit);
400+
__set_bit(BTN_TOUCH, input->keybit);
401+
__set_bit(INPUT_PROP_POINTER, input->propbit);
401402

402403
__set_bit(EV_ABS, input->evbit);
403404

0 commit comments

Comments
 (0)