diff options
author | Chase Douglas <chase.douglas@canonical.com> | 2011-08-05 12:16:57 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-08-10 08:08:46 -0400 |
commit | 4f6fdf08681cecd9f38499de7a02eb4f05f399a7 (patch) | |
tree | c347ed9446eff0264f3c3b9824ab87fd2e360863 /drivers | |
parent | f5fc87905ea075a0b14878086fd4fe38be128844 (diff) |
HID: magicmouse: Set resolution of touch surfaces
Add touch surface resolution information. The size of the touch surfaces
has been determined to the hundredth of a mm.
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>
[jkosina@suse.cz: update comments and commit message]
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hid/hid-magicmouse.c | 56 |
1 files changed, 46 insertions, 10 deletions
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c index 0ec91c18a421..b5bdab3299bc 100644 --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c | |||
@@ -81,6 +81,28 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state fie | |||
81 | #define NO_TOUCHES -1 | 81 | #define NO_TOUCHES -1 |
82 | #define SINGLE_TOUCH_UP -2 | 82 | #define SINGLE_TOUCH_UP -2 |
83 | 83 | ||
84 | /* Touch surface information. Dimension is in hundredths of a mm, min and max | ||
85 | * are in units. */ | ||
86 | #define MOUSE_DIMENSION_X (float)9056 | ||
87 | #define MOUSE_MIN_X -1100 | ||
88 | #define MOUSE_MAX_X 1258 | ||
89 | #define MOUSE_RES_X ((MOUSE_MAX_X - MOUSE_MIN_X) / (MOUSE_DIMENSION_X / 100)) | ||
90 | #define MOUSE_DIMENSION_Y (float)5152 | ||
91 | #define MOUSE_MIN_Y -1589 | ||
92 | #define MOUSE_MAX_Y 2047 | ||
93 | #define MOUSE_RES_Y ((MOUSE_MAX_Y - MOUSE_MIN_Y) / (MOUSE_DIMENSION_Y / 100)) | ||
94 | |||
95 | #define TRACKPAD_DIMENSION_X (float)13000 | ||
96 | #define TRACKPAD_MIN_X -2909 | ||
97 | #define TRACKPAD_MAX_X 3167 | ||
98 | #define TRACKPAD_RES_X \ | ||
99 | ((TRACKPAD_MAX_X - TRACKPAD_MIN_X) / (TRACKPAD_DIMENSION_X / 100)) | ||
100 | #define TRACKPAD_DIMENSION_Y (float)11000 | ||
101 | #define TRACKPAD_MIN_Y -2456 | ||
102 | #define TRACKPAD_MAX_Y 2565 | ||
103 | #define TRACKPAD_RES_Y \ | ||
104 | ((TRACKPAD_MAX_Y - TRACKPAD_MIN_Y) / (TRACKPAD_DIMENSION_Y / 100)) | ||
105 | |||
84 | /** | 106 | /** |
85 | * struct magicmouse_sc - Tracks Magic Mouse-specific data. | 107 | * struct magicmouse_sc - Tracks Magic Mouse-specific data. |
86 | * @input: Input device through which we report events. | 108 | * @input: Input device through which we report events. |
@@ -406,17 +428,31 @@ static void magicmouse_setup_input(struct input_dev *input, struct hid_device *h | |||
406 | * inverse of the reported Y. | 428 | * inverse of the reported Y. |
407 | */ | 429 | */ |
408 | if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) { | 430 | if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) { |
409 | input_set_abs_params(input, ABS_MT_POSITION_X, -1100, | 431 | input_set_abs_params(input, ABS_MT_POSITION_X, |
410 | 1358, 4, 0); | 432 | MOUSE_MIN_X, MOUSE_MAX_X, 4, 0); |
411 | input_set_abs_params(input, ABS_MT_POSITION_Y, -1589, | 433 | input_set_abs_params(input, ABS_MT_POSITION_Y, |
412 | 2047, 4, 0); | 434 | MOUSE_MIN_Y, MOUSE_MAX_Y, 4, 0); |
435 | |||
436 | input_abs_set_res(input, ABS_MT_POSITION_X, | ||
437 | MOUSE_RES_X); | ||
438 | input_abs_set_res(input, ABS_MT_POSITION_Y, | ||
439 | MOUSE_RES_Y); | ||
413 | } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */ | 440 | } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */ |
414 | input_set_abs_params(input, ABS_X, -2909, 3167, 4, 0); | 441 | input_set_abs_params(input, ABS_X, TRACKPAD_MIN_X, |
415 | input_set_abs_params(input, ABS_Y, -2456, 2565, 4, 0); | 442 | TRACKPAD_MAX_X, 4, 0); |
416 | input_set_abs_params(input, ABS_MT_POSITION_X, -2909, | 443 | input_set_abs_params(input, ABS_Y, TRACKPAD_MIN_Y, |
417 | 3167, 4, 0); | 444 | TRACKPAD_MAX_Y, 4, 0); |
418 | input_set_abs_params(input, ABS_MT_POSITION_Y, -2456, | 445 | input_set_abs_params(input, ABS_MT_POSITION_X, |
419 | 2565, 4, 0); | 446 | TRACKPAD_MIN_X, TRACKPAD_MAX_X, 4, 0); |
447 | input_set_abs_params(input, ABS_MT_POSITION_Y, | ||
448 | TRACKPAD_MIN_Y, TRACKPAD_MAX_Y, 4, 0); | ||
449 | |||
450 | input_abs_set_res(input, ABS_X, TRACKPAD_RES_X); | ||
451 | input_abs_set_res(input, ABS_Y, TRACKPAD_RES_Y); | ||
452 | input_abs_set_res(input, ABS_MT_POSITION_X, | ||
453 | TRACKPAD_RES_X); | ||
454 | input_abs_set_res(input, ABS_MT_POSITION_Y, | ||
455 | TRACKPAD_RES_Y); | ||
420 | } | 456 | } |
421 | 457 | ||
422 | input_set_events_per_packet(input, 60); | 458 | input_set_events_per_packet(input, 60); |