linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] hid-magicmouse: Magic Trackpad has 1 button, not 2
@ 2011-10-13 10:05 Daniel van Vugt
  2011-10-13 16:28 ` Chase Douglas
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel van Vugt @ 2011-10-13 10:05 UTC (permalink / raw)
  To: linux-input

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]

Signed-off-by: Daniel van Vugt <vanvugt@gmail.com>
---
drivers/hid/hid-magicmouse.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index f0fbd7b..12200e6 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -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);

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

* Re: [PATCH v1 1/1] hid-magicmouse: Magic Trackpad has 1 button, not 2
  2011-10-13 10:05 [PATCH v1 1/1] hid-magicmouse: Magic Trackpad has 1 button, not 2 Daniel van Vugt
@ 2011-10-13 16:28 ` Chase Douglas
  0 siblings, 0 replies; 2+ messages in thread
From: Chase Douglas @ 2011-10-13 16:28 UTC (permalink / raw)
  To: Daniel van Vugt; +Cc: linux-input

On 10/13/2011 03:05 AM, Daniel van Vugt wrote:
> 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]
> 
> Signed-off-by: Daniel van Vugt <vanvugt@gmail.com>
> ---
> drivers/hid/hid-magicmouse.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
> index f0fbd7b..12200e6 100644
> --- a/drivers/hid/hid-magicmouse.c
> +++ b/drivers/hid/hid-magicmouse.c
> @@ -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);

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:

Reviewed-by: Chase Douglas <chase.douglas@canonical.com>

Thanks!

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

end of thread, other threads:[~2011-10-13 16:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-13 10:05 [PATCH v1 1/1] hid-magicmouse: Magic Trackpad has 1 button, not 2 Daniel van Vugt
2011-10-13 16:28 ` Chase Douglas

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).