* [PATCH] HID: magicmouse: Set resolution of touch surfaces
@ 2011-07-29 2:01 Chase Douglas
2011-08-04 14:01 ` Jiri Kosina
0 siblings, 1 reply; 4+ messages in thread
From: Chase Douglas @ 2011-07-29 2:01 UTC (permalink / raw)
To: Jiri Kosina; +Cc: Michael Poole, linux-input, linux-kernel
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Michael Poole <mdpoole@troilus.org>
Cc: linux-input@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
---
drivers/hid/hid-magicmouse.c | 57 ++++++++++++++++++++++++++++++++++-------
1 files changed, 47 insertions(+), 10 deletions(-)
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index 698e645..8fdf702 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -81,6 +81,29 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state fie
#define NO_TOUCHES -1
#define SINGLE_TOUCH_UP -2
+/* Touch surface information. Dimension is in hundredths of a mm, min and max
+ * are in units. Dimensions gathered from IORegistryExplorer in OS X. Min and
+ * max gathered through testing of devices. */
+#define MOUSE_DIMENSION_X (float)9056
+#define MOUSE_MIN_X -1100
+#define MOUSE_MAX_X 1258
+#define MOUSE_RES_X ((MOUSE_MAX_X - MOUSE_MIN_X) / (MOUSE_DIMENSION_X / 100))
+#define MOUSE_DIMENSION_Y (float)5152
+#define MOUSE_MIN_Y -1589
+#define MOUSE_MAX_Y 2047
+#define MOUSE_RES_Y ((MOUSE_MAX_Y - MOUSE_MIN_Y) / (MOUSE_DIMENSION_Y / 100))
+
+#define TRACKPAD_DIMENSION_X (float)13000
+#define TRACKPAD_MIN_X -2909
+#define TRACKPAD_MAX_X 3167
+#define TRACKPAD_RES_X \
+ ((TRACKPAD_MAX_X - TRACKPAD_MIN_X) / (TRACKPAD_DIMENSION_X / 100))
+#define TRACKPAD_DIMENSION_Y (float)11000
+#define TRACKPAD_MIN_Y -2456
+#define TRACKPAD_MAX_Y 2565
+#define TRACKPAD_RES_Y \
+ ((TRACKPAD_MAX_Y - TRACKPAD_MIN_Y) / (TRACKPAD_DIMENSION_Y / 100))
+
/**
* struct magicmouse_sc - Tracks Magic Mouse-specific data.
* @input: Input device through which we report events.
@@ -406,17 +429,31 @@ static void magicmouse_setup_input(struct input_dev *input, struct hid_device *h
* inverse of the reported Y.
*/
if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) {
- input_set_abs_params(input, ABS_MT_POSITION_X, -1100,
- 1358, 4, 0);
- input_set_abs_params(input, ABS_MT_POSITION_Y, -1589,
- 2047, 4, 0);
+ input_set_abs_params(input, ABS_MT_POSITION_X,
+ MOUSE_MIN_X, MOUSE_MAX_X, 4, 0);
+ input_set_abs_params(input, ABS_MT_POSITION_Y,
+ MOUSE_MIN_Y, MOUSE_MAX_Y, 4, 0);
+
+ input_abs_set_res(input, ABS_MT_POSITION_X,
+ MOUSE_RES_X);
+ input_abs_set_res(input, ABS_MT_POSITION_Y,
+ MOUSE_RES_Y);
} else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
- input_set_abs_params(input, ABS_X, -2909, 3167, 4, 0);
- input_set_abs_params(input, ABS_Y, -2456, 2565, 4, 0);
- input_set_abs_params(input, ABS_MT_POSITION_X, -2909,
- 3167, 4, 0);
- input_set_abs_params(input, ABS_MT_POSITION_Y, -2456,
- 2565, 4, 0);
+ input_set_abs_params(input, ABS_X, TRACKPAD_MIN_X,
+ TRACKPAD_MAX_X, 4, 0);
+ input_set_abs_params(input, ABS_Y, TRACKPAD_MIN_Y,
+ TRACKPAD_MAX_Y, 4, 0);
+ input_set_abs_params(input, ABS_MT_POSITION_X,
+ TRACKPAD_MIN_X, TRACKPAD_MAX_X, 4, 0);
+ input_set_abs_params(input, ABS_MT_POSITION_Y,
+ TRACKPAD_MIN_Y, TRACKPAD_MAX_Y, 4, 0);
+
+ input_abs_set_res(input, ABS_X, TRACKPAD_RES_X);
+ input_abs_set_res(input, ABS_Y, TRACKPAD_RES_Y);
+ input_abs_set_res(input, ABS_MT_POSITION_X,
+ TRACKPAD_RES_X);
+ input_abs_set_res(input, ABS_MT_POSITION_Y,
+ TRACKPAD_RES_Y);
}
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] HID: magicmouse: Set resolution of touch surfaces
2011-07-29 2:01 [PATCH] HID: magicmouse: Set resolution of touch surfaces Chase Douglas
@ 2011-08-04 14:01 ` Jiri Kosina
0 siblings, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2011-08-04 14:01 UTC (permalink / raw)
To: Chase Douglas; +Cc: Michael Poole, linux-input, linux-kernel
On Thu, 28 Jul 2011, Chase Douglas wrote:
> Cc: Jiri Kosina <jkosina@suse.cz>
> Cc: Michael Poole <mdpoole@troilus.org>
> Cc: linux-input@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Chase, could you please provide some more verbose changelog for this
patch? :) Thanks.
> ---
> drivers/hid/hid-magicmouse.c | 57 ++++++++++++++++++++++++++++++++++-------
> 1 files changed, 47 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
> index 698e645..8fdf702 100644
> --- a/drivers/hid/hid-magicmouse.c
> +++ b/drivers/hid/hid-magicmouse.c
> @@ -81,6 +81,29 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state fie
> #define NO_TOUCHES -1
> #define SINGLE_TOUCH_UP -2
>
> +/* Touch surface information. Dimension is in hundredths of a mm, min and max
> + * are in units. Dimensions gathered from IORegistryExplorer in OS X. Min and
> + * max gathered through testing of devices. */
> +#define MOUSE_DIMENSION_X (float)9056
> +#define MOUSE_MIN_X -1100
> +#define MOUSE_MAX_X 1258
> +#define MOUSE_RES_X ((MOUSE_MAX_X - MOUSE_MIN_X) / (MOUSE_DIMENSION_X / 100))
> +#define MOUSE_DIMENSION_Y (float)5152
> +#define MOUSE_MIN_Y -1589
> +#define MOUSE_MAX_Y 2047
> +#define MOUSE_RES_Y ((MOUSE_MAX_Y - MOUSE_MIN_Y) / (MOUSE_DIMENSION_Y / 100))
> +
> +#define TRACKPAD_DIMENSION_X (float)13000
> +#define TRACKPAD_MIN_X -2909
> +#define TRACKPAD_MAX_X 3167
> +#define TRACKPAD_RES_X \
> + ((TRACKPAD_MAX_X - TRACKPAD_MIN_X) / (TRACKPAD_DIMENSION_X / 100))
> +#define TRACKPAD_DIMENSION_Y (float)11000
> +#define TRACKPAD_MIN_Y -2456
> +#define TRACKPAD_MAX_Y 2565
> +#define TRACKPAD_RES_Y \
> + ((TRACKPAD_MAX_Y - TRACKPAD_MIN_Y) / (TRACKPAD_DIMENSION_Y / 100))
> +
> /**
> * struct magicmouse_sc - Tracks Magic Mouse-specific data.
> * @input: Input device through which we report events.
> @@ -406,17 +429,31 @@ static void magicmouse_setup_input(struct input_dev *input, struct hid_device *h
> * inverse of the reported Y.
> */
> if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) {
> - input_set_abs_params(input, ABS_MT_POSITION_X, -1100,
> - 1358, 4, 0);
> - input_set_abs_params(input, ABS_MT_POSITION_Y, -1589,
> - 2047, 4, 0);
> + input_set_abs_params(input, ABS_MT_POSITION_X,
> + MOUSE_MIN_X, MOUSE_MAX_X, 4, 0);
> + input_set_abs_params(input, ABS_MT_POSITION_Y,
> + MOUSE_MIN_Y, MOUSE_MAX_Y, 4, 0);
> +
> + input_abs_set_res(input, ABS_MT_POSITION_X,
> + MOUSE_RES_X);
> + input_abs_set_res(input, ABS_MT_POSITION_Y,
> + MOUSE_RES_Y);
> } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
> - input_set_abs_params(input, ABS_X, -2909, 3167, 4, 0);
> - input_set_abs_params(input, ABS_Y, -2456, 2565, 4, 0);
> - input_set_abs_params(input, ABS_MT_POSITION_X, -2909,
> - 3167, 4, 0);
> - input_set_abs_params(input, ABS_MT_POSITION_Y, -2456,
> - 2565, 4, 0);
> + input_set_abs_params(input, ABS_X, TRACKPAD_MIN_X,
> + TRACKPAD_MAX_X, 4, 0);
> + input_set_abs_params(input, ABS_Y, TRACKPAD_MIN_Y,
> + TRACKPAD_MAX_Y, 4, 0);
> + input_set_abs_params(input, ABS_MT_POSITION_X,
> + TRACKPAD_MIN_X, TRACKPAD_MAX_X, 4, 0);
> + input_set_abs_params(input, ABS_MT_POSITION_Y,
> + TRACKPAD_MIN_Y, TRACKPAD_MAX_Y, 4, 0);
> +
> + input_abs_set_res(input, ABS_X, TRACKPAD_RES_X);
> + input_abs_set_res(input, ABS_Y, TRACKPAD_RES_Y);
> + input_abs_set_res(input, ABS_MT_POSITION_X,
> + TRACKPAD_RES_X);
> + input_abs_set_res(input, ABS_MT_POSITION_Y,
> + TRACKPAD_RES_Y);
> }
> }
>
> --
> 1.7.4.1
>
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] HID: magicmouse: Set resolution of touch surfaces
@ 2011-08-05 16:16 Chase Douglas
2011-08-10 12:09 ` Jiri Kosina
0 siblings, 1 reply; 4+ messages in thread
From: Chase Douglas @ 2011-08-05 16:16 UTC (permalink / raw)
To: Jiri Kosina; +Cc: Michael Poole, linux-input, linux-kernel
Add touch surface resolution information. The size of the touch surfaces
has been determined to the hundredth of a mm by viewing the device
properties in IORegistryExplorer in OS X.
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Michael Poole <mdpoole@troilus.org>
Cc: linux-input@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
---
drivers/hid/hid-magicmouse.c | 57 ++++++++++++++++++++++++++++++++++-------
1 files changed, 47 insertions(+), 10 deletions(-)
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index 698e645..8fdf702 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -81,6 +81,29 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state fie
#define NO_TOUCHES -1
#define SINGLE_TOUCH_UP -2
+/* Touch surface information. Dimension is in hundredths of a mm, min and max
+ * are in units. Dimensions gathered from IORegistryExplorer in OS X. Min and
+ * max gathered through testing of devices. */
+#define MOUSE_DIMENSION_X (float)9056
+#define MOUSE_MIN_X -1100
+#define MOUSE_MAX_X 1258
+#define MOUSE_RES_X ((MOUSE_MAX_X - MOUSE_MIN_X) / (MOUSE_DIMENSION_X / 100))
+#define MOUSE_DIMENSION_Y (float)5152
+#define MOUSE_MIN_Y -1589
+#define MOUSE_MAX_Y 2047
+#define MOUSE_RES_Y ((MOUSE_MAX_Y - MOUSE_MIN_Y) / (MOUSE_DIMENSION_Y / 100))
+
+#define TRACKPAD_DIMENSION_X (float)13000
+#define TRACKPAD_MIN_X -2909
+#define TRACKPAD_MAX_X 3167
+#define TRACKPAD_RES_X \
+ ((TRACKPAD_MAX_X - TRACKPAD_MIN_X) / (TRACKPAD_DIMENSION_X / 100))
+#define TRACKPAD_DIMENSION_Y (float)11000
+#define TRACKPAD_MIN_Y -2456
+#define TRACKPAD_MAX_Y 2565
+#define TRACKPAD_RES_Y \
+ ((TRACKPAD_MAX_Y - TRACKPAD_MIN_Y) / (TRACKPAD_DIMENSION_Y / 100))
+
/**
* struct magicmouse_sc - Tracks Magic Mouse-specific data.
* @input: Input device through which we report events.
@@ -406,17 +429,31 @@ static void magicmouse_setup_input(struct input_dev *input, struct hid_device *h
* inverse of the reported Y.
*/
if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) {
- input_set_abs_params(input, ABS_MT_POSITION_X, -1100,
- 1358, 4, 0);
- input_set_abs_params(input, ABS_MT_POSITION_Y, -1589,
- 2047, 4, 0);
+ input_set_abs_params(input, ABS_MT_POSITION_X,
+ MOUSE_MIN_X, MOUSE_MAX_X, 4, 0);
+ input_set_abs_params(input, ABS_MT_POSITION_Y,
+ MOUSE_MIN_Y, MOUSE_MAX_Y, 4, 0);
+
+ input_abs_set_res(input, ABS_MT_POSITION_X,
+ MOUSE_RES_X);
+ input_abs_set_res(input, ABS_MT_POSITION_Y,
+ MOUSE_RES_Y);
} else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
- input_set_abs_params(input, ABS_X, -2909, 3167, 4, 0);
- input_set_abs_params(input, ABS_Y, -2456, 2565, 4, 0);
- input_set_abs_params(input, ABS_MT_POSITION_X, -2909,
- 3167, 4, 0);
- input_set_abs_params(input, ABS_MT_POSITION_Y, -2456,
- 2565, 4, 0);
+ input_set_abs_params(input, ABS_X, TRACKPAD_MIN_X,
+ TRACKPAD_MAX_X, 4, 0);
+ input_set_abs_params(input, ABS_Y, TRACKPAD_MIN_Y,
+ TRACKPAD_MAX_Y, 4, 0);
+ input_set_abs_params(input, ABS_MT_POSITION_X,
+ TRACKPAD_MIN_X, TRACKPAD_MAX_X, 4, 0);
+ input_set_abs_params(input, ABS_MT_POSITION_Y,
+ TRACKPAD_MIN_Y, TRACKPAD_MAX_Y, 4, 0);
+
+ input_abs_set_res(input, ABS_X, TRACKPAD_RES_X);
+ input_abs_set_res(input, ABS_Y, TRACKPAD_RES_Y);
+ input_abs_set_res(input, ABS_MT_POSITION_X,
+ TRACKPAD_RES_X);
+ input_abs_set_res(input, ABS_MT_POSITION_Y,
+ TRACKPAD_RES_Y);
}
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-08-10 12:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-29 2:01 [PATCH] HID: magicmouse: Set resolution of touch surfaces Chase Douglas
2011-08-04 14:01 ` Jiri Kosina
-- strict thread matches above, loose matches on Subject: below --
2011-08-05 16:16 Chase Douglas
2011-08-10 12:09 ` Jiri Kosina
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).