Skip to content

Commit bca6214

Browse files
vanvugtJiri Kosina
authored andcommitted
HID: hid-magicmouse: Magic Trackpad has 1 button, not 2
hid-magicmouse was advertising the Apple Magic Trackpad as having 2 buttons (left and right) when it actually only has 1 button. Advertising multiple buttons makes Xorg disable all button 2 and 3 emulation (using multi-finger clicks). So Xorg users don't get working right/middle-click emulation out of the box. This patch makes hid-magicmouse correctly only report one real button for Magic Trackpad, which in turn makes Xorg enable multi-finger click support to emulate right/middle buttons. [http://launchpad.net/bugs/862094] Signed-off-by: Daniel van Vugt <vanvugt@gmail.com> Reviewed-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent fad9fbe commit bca6214

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎drivers/hid/hid-magicmouse.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,13 @@ static void magicmouse_setup_input(struct input_dev *input, struct hid_device *h
405405
__set_bit(REL_HWHEEL, input->relbit);
406406
}
407407
} else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
408+
/* input->keybit is initialized with incorrect button info
409+
* for Magic Trackpad. There really is only one physical
410+
* button (BTN_LEFT == BTN_MOUSE). Make sure we don't
411+
* advertise buttons that don't exist...
412+
*/
413+
__clear_bit(BTN_RIGHT, input->keybit);
414+
__clear_bit(BTN_MIDDLE, input->keybit);
408415
__set_bit(BTN_MOUSE, input->keybit);
409416
__set_bit(BTN_TOOL_FINGER, input->keybit);
410417
__set_bit(BTN_TOOL_DOUBLETAP, input->keybit);

0 commit comments

Comments
 (0)