Commit 4f6fdf08 authored by Chase Douglas's avatar Chase Douglas Committed by Jiri Kosina

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: default avatarChase Douglas <chase.douglas@canonical.com>
[jkosina@suse.cz: update comments and commit message]
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent f5fc8790
...@@ -81,6 +81,28 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state fie ...@@ -81,6 +81,28 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state fie
#define NO_TOUCHES -1 #define NO_TOUCHES -1
#define SINGLE_TOUCH_UP -2 #define SINGLE_TOUCH_UP -2
/* Touch surface information. Dimension is in hundredths of a mm, min and max
* are in units. */
#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. * struct magicmouse_sc - Tracks Magic Mouse-specific data.
* @input: Input device through which we report events. * @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,17 +428,31 @@ static void magicmouse_setup_input(struct input_dev *input, struct hid_device *h
* inverse of the reported Y. * inverse of the reported Y.
*/ */
if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) { if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) {
input_set_abs_params(input, ABS_MT_POSITION_X, -1100, input_set_abs_params(input, ABS_MT_POSITION_X,
1358, 4, 0); MOUSE_MIN_X, MOUSE_MAX_X, 4, 0);
input_set_abs_params(input, ABS_MT_POSITION_Y, -1589, input_set_abs_params(input, ABS_MT_POSITION_Y,
2047, 4, 0); 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 */ } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
input_set_abs_params(input, ABS_X, -2909, 3167, 4, 0); input_set_abs_params(input, ABS_X, TRACKPAD_MIN_X,
input_set_abs_params(input, ABS_Y, -2456, 2565, 4, 0); TRACKPAD_MAX_X, 4, 0);
input_set_abs_params(input, ABS_MT_POSITION_X, -2909, input_set_abs_params(input, ABS_Y, TRACKPAD_MIN_Y,
3167, 4, 0); TRACKPAD_MAX_Y, 4, 0);
input_set_abs_params(input, ABS_MT_POSITION_Y, -2456, input_set_abs_params(input, ABS_MT_POSITION_X,
2565, 4, 0); 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);
} }
input_set_events_per_packet(input, 60); input_set_events_per_packet(input, 60);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment