Skip to contentSkip to conversation

hid-magicmouse: Magic Trackpad has 1 button, not 2

PATCH Superseded Daniel van Vugt 2 participants 2 messages Oct 13, 2011 HID

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 in turn makes the xorg synaptics code 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]

---
drivers/hid/hid-magicmouse.c | 2 ++

 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/hid/hid-magicmouse.c +0 -0
index f0fbd7b..12200e6 100644
@@ -405,6 +405,8 @@ static void magicmouse_setup_input(struct input_dev

*input, struct hid_device *h
__set_bit(REL_HWHEEL, input->relbit);
}
} else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
+ __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);

Reviewed-by on v1 1/1
#1 lore raw
Quoted 31 lines · Daniel van Vugt

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 in turn makes the xorg synaptics code 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]

---
drivers/hid/hid-magicmouse.c | 2 ++

 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/hid/hid-magicmouse.c +2 -0
index f0fbd7b..12200e6 100644
@@ -405,6 +405,8 @@ static void magicmouse_setup_input(struct input_dev
 *input, struct hid_device *h
 			__set_bit(REL_HWHEEL, input->relbit);
 		}
 	} else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
+		__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);
Quoted 1 line

__set_bit(BTN_TOOL_DOUBLETAP, input->keybit);

Please put a comment above these lines stating that when the trackpad is put into multitouch mode, the right and middle buttons are not emitted. I can see someone later wondering why the clearing was there, and if commenting them out would magically make right and middle button events be emitted.

With that comment:

Thanks!