All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] hid-magicmouse: Magic Trackpad has 1 button, not 2
@ 2011-10-14  5:39 Daniel van Vugt
  2011-10-14 17:08 ` Chase Douglas
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel van Vugt @ 2011-10-14  5:39 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 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>
---
 drivers/hid/hid-magicmouse.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index f0fbd7b..2ab7175 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -405,6 +405,13 @@ 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 */
+		/* input->keybit is initialized with incorrect button info
+		 * for Magic Trackpad. There really is only one physical
+		 * button (BTN_LEFT == BTN_MOUSE). Make sure we don't
+		 * advertise buttons that don't exist...
+		 */
+		__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] 4+ messages in thread

* Re: [PATCH v2] hid-magicmouse: Magic Trackpad has 1 button, not 2
  2011-10-14  5:39 [PATCH v2] hid-magicmouse: Magic Trackpad has 1 button, not 2 Daniel van Vugt
@ 2011-10-14 17:08 ` Chase Douglas
  2011-10-21  0:27   ` Chase Douglas
  0 siblings, 1 reply; 4+ messages in thread
From: Chase Douglas @ 2011-10-14 17:08 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: Daniel van Vugt, linux-input

On 10/13/2011 10:39 PM, 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 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>
> ---
>  drivers/hid/hid-magicmouse.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
> index f0fbd7b..2ab7175 100644
> --- a/drivers/hid/hid-magicmouse.c
> +++ b/drivers/hid/hid-magicmouse.c
> @@ -405,6 +405,13 @@ 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 */
> +		/* input->keybit is initialized with incorrect button info
> +		 * for Magic Trackpad. There really is only one physical
> +		 * button (BTN_LEFT == BTN_MOUSE). Make sure we don't
> +		 * advertise buttons that don't exist...
> +		 */
> +		__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);

To'ing Jiri Kosina, the HID maintainer.

Thanks again Daniel!

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

* Re: [PATCH v2] hid-magicmouse: Magic Trackpad has 1 button, not 2
  2011-10-14 17:08 ` Chase Douglas
@ 2011-10-21  0:27   ` Chase Douglas
  2011-10-21  8:15     ` Jiri Kosina
  0 siblings, 1 reply; 4+ messages in thread
From: Chase Douglas @ 2011-10-21  0:27 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: Daniel van Vugt, linux-input

Ping, Jiri?

On 10/14/2011 10:08 AM, Chase Douglas wrote:
> On 10/13/2011 10:39 PM, 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 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>
>> ---
>>  drivers/hid/hid-magicmouse.c |    7 +++++++
>>  1 files changed, 7 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
>> index f0fbd7b..2ab7175 100644
>> --- a/drivers/hid/hid-magicmouse.c
>> +++ b/drivers/hid/hid-magicmouse.c
>> @@ -405,6 +405,13 @@ 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 */
>> +		/* input->keybit is initialized with incorrect button info
>> +		 * for Magic Trackpad. There really is only one physical
>> +		 * button (BTN_LEFT == BTN_MOUSE). Make sure we don't
>> +		 * advertise buttons that don't exist...
>> +		 */
>> +		__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);
> 
> To'ing Jiri Kosina, the HID maintainer.
> 
> Thanks again Daniel!

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

* Re: [PATCH v2] hid-magicmouse: Magic Trackpad has 1 button, not 2
  2011-10-21  0:27   ` Chase Douglas
@ 2011-10-21  8:15     ` Jiri Kosina
  0 siblings, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2011-10-21  8:15 UTC (permalink / raw)
  To: Chase Douglas; +Cc: Daniel van Vugt, linux-input

On Thu, 20 Oct 2011, Chase Douglas wrote:

> Ping, Jiri?

Somehow I haven't seen the patch in my mailbox. Applied now, thanks.

(Daniel, please fix your mail client for future patch submissions, so that 
it doesn't wrap lines, I had to fix that up by hand).

> 
> On 10/14/2011 10:08 AM, Chase Douglas wrote:
> > On 10/13/2011 10:39 PM, 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 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>
> >> ---
> >>  drivers/hid/hid-magicmouse.c |    7 +++++++
> >>  1 files changed, 7 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
> >> index f0fbd7b..2ab7175 100644
> >> --- a/drivers/hid/hid-magicmouse.c
> >> +++ b/drivers/hid/hid-magicmouse.c
> >> @@ -405,6 +405,13 @@ 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 */
> >> +		/* input->keybit is initialized with incorrect button info
> >> +		 * for Magic Trackpad. There really is only one physical
> >> +		 * button (BTN_LEFT == BTN_MOUSE). Make sure we don't
> >> +		 * advertise buttons that don't exist...
> >> +		 */
> >> +		__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);
> > 
> > To'ing Jiri Kosina, the HID maintainer.
> > 
> > Thanks again Daniel!
> 

-- 
Jiri Kosina
SUSE Labs

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

end of thread, other threads:[~2011-10-21  8:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-14  5:39 [PATCH v2] hid-magicmouse: Magic Trackpad has 1 button, not 2 Daniel van Vugt
2011-10-14 17:08 ` Chase Douglas
2011-10-21  0:27   ` Chase Douglas
2011-10-21  8:15     ` Jiri Kosina

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.