Patchwork [NATTY] HID: magicmouse: Don't report REL_{X, Y} for Magic Trackpad

login
register
mail settings
Submitter Chase Douglas
Date Jan. 4, 2011, 2:28 p.m.
Message ID <1294151280-5329-1-git-send-email-chase.douglas@canonical.com>
Download mbox | patch
Permalink /patch/77475/
State Accepted
Headers show

Comments

Chase Douglas - Jan. 4, 2011, 2:28 p.m.
With the recent switch to having the hid layer handle standard axis
initialization, the Magic Trackpad now reports relative axes. This would
be fine in the normal mode, but the driver puts the device in multitouch
mode where no relative events are generated. Also, userspace software
depends on accurate axis information for device type detection. Thus,
ignoring the relative axes from the Magic Trackpad is best.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
---

This got stuck near the end of the .37 development cycle and didn't make it in
time. Since the next release with this will probably be .38-rc1 in a few weeks,
please include the patch in the Natty kernel in the meantime as it is causing
issues for our own development efforts.

Thanks!

 drivers/hid/hid-magicmouse.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
Tim Gardner - Jan. 4, 2011, 4:38 p.m.
On 01/04/2011 07:28 AM, Chase Douglas wrote:
> With the recent switch to having the hid layer handle standard axis
> initialization, the Magic Trackpad now reports relative axes. This would
> be fine in the normal mode, but the driver puts the device in multitouch
> mode where no relative events are generated. Also, userspace software
> depends on accurate axis information for device type detection. Thus,
> ignoring the relative axes from the Magic Trackpad is best.
>
> Signed-off-by: Chase Douglas<chase.douglas@canonical.com>
> Signed-off-by: Jiri Kosina<jkosina@suse.cz>
> ---
>
> This got stuck near the end of the .37 development cycle and didn't make it in
> time. Since the next release with this will probably be .38-rc1 in a few weeks,
> please include the patch in the Natty kernel in the meantime as it is causing
> issues for our own development efforts.
>
> Thanks!
>
>   drivers/hid/hid-magicmouse.c |    5 +++++
>   1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
> index e6dc151..ed732b7 100644
> --- a/drivers/hid/hid-magicmouse.c
> +++ b/drivers/hid/hid-magicmouse.c
> @@ -433,6 +433,11 @@ static int magicmouse_input_mapping(struct hid_device *hdev,
>   	if (!msc->input)
>   		msc->input = hi->input;
>
> +	/* Magic Trackpad does not give relative data after switching to MT */
> +	if (hi->input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD&&
> +	    field->flags&  HID_MAIN_ITEM_RELATIVE)
> +		return -1;
> +
>   	return 0;
>   }
>

applied

Patch

diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index e6dc151..ed732b7 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -433,6 +433,11 @@  static int magicmouse_input_mapping(struct hid_device *hdev,
 	if (!msc->input)
 		msc->input = hi->input;
 
+	/* Magic Trackpad does not give relative data after switching to MT */
+	if (hi->input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD &&
+	    field->flags & HID_MAIN_ITEM_RELATIVE)
+		return -1;
+
 	return 0;
 }