diff options
author | Yufeng Shen <miletus@chromium.org> | 2012-07-04 12:14:43 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2012-07-04 14:58:48 -0400 |
commit | 6264307ed090cc41a47a1e55be713d75e81f1b27 (patch) | |
tree | bc1a949ef560459d1542cfbee06c38ccc2a77421 | |
parent | 60d2c25251cac20d8c142a03e230237528b68430 (diff) |
HID: magicmouse: Removing report_touches switch
Remove the report_touches switch as it is not so useful to turn
off reporting touch events for a touch device. Let the userspace
to do the filtering if the turning off is needed.
V2: Remove report_touches as suggeted by Chase Douglas
Signed-off-by: Yufeng Shen <miletus@chromium.org>
Reviewed-and-tested-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/hid/hid-magicmouse.c | 95 |
1 files changed, 45 insertions, 50 deletions
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c index 40ac6654f1d1..fd88f216720a 100644 --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c | |||
@@ -48,10 +48,6 @@ static bool scroll_acceleration = false; | |||
48 | module_param(scroll_acceleration, bool, 0644); | 48 | module_param(scroll_acceleration, bool, 0644); |
49 | MODULE_PARM_DESC(scroll_acceleration, "Accelerate sequential scroll events"); | 49 | MODULE_PARM_DESC(scroll_acceleration, "Accelerate sequential scroll events"); |
50 | 50 | ||
51 | static bool report_touches = true; | ||
52 | module_param(report_touches, bool, 0644); | ||
53 | MODULE_PARM_DESC(report_touches, "Emit touch records (otherwise, only use them for emulation)"); | ||
54 | |||
55 | static bool report_undeciphered; | 51 | static bool report_undeciphered; |
56 | module_param(report_undeciphered, bool, 0644); | 52 | module_param(report_undeciphered, bool, 0644); |
57 | MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state field using a MSC_RAW event"); | 53 | MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state field using a MSC_RAW event"); |
@@ -276,7 +272,7 @@ static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tda | |||
276 | msc->single_touch_id = SINGLE_TOUCH_UP; | 272 | msc->single_touch_id = SINGLE_TOUCH_UP; |
277 | 273 | ||
278 | /* Generate the input events for this touch. */ | 274 | /* Generate the input events for this touch. */ |
279 | if (report_touches && down) { | 275 | if (down) { |
280 | input_report_abs(input, ABS_MT_TRACKING_ID, id); | 276 | input_report_abs(input, ABS_MT_TRACKING_ID, id); |
281 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, touch_major << 2); | 277 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, touch_major << 2); |
282 | input_report_abs(input, ABS_MT_TOUCH_MINOR, touch_minor << 2); | 278 | input_report_abs(input, ABS_MT_TOUCH_MINOR, touch_minor << 2); |
@@ -335,7 +331,7 @@ static int magicmouse_raw_event(struct hid_device *hdev, | |||
335 | for (ii = 0; ii < npoints; ii++) | 331 | for (ii = 0; ii < npoints; ii++) |
336 | magicmouse_emit_touch(msc, ii, data + ii * 8 + 6); | 332 | magicmouse_emit_touch(msc, ii, data + ii * 8 + 6); |
337 | 333 | ||
338 | if (report_touches && msc->ntouches == 0) | 334 | if (msc->ntouches == 0) |
339 | input_mt_sync(input); | 335 | input_mt_sync(input); |
340 | 336 | ||
341 | /* When emulating three-button mode, it is important | 337 | /* When emulating three-button mode, it is important |
@@ -422,53 +418,52 @@ static void magicmouse_setup_input(struct input_dev *input, struct hid_device *h | |||
422 | __set_bit(INPUT_PROP_BUTTONPAD, input->propbit); | 418 | __set_bit(INPUT_PROP_BUTTONPAD, input->propbit); |
423 | } | 419 | } |
424 | 420 | ||
425 | if (report_touches) { | ||
426 | __set_bit(EV_ABS, input->evbit); | ||
427 | |||
428 | input_set_abs_params(input, ABS_MT_TRACKING_ID, 0, 15, 0, 0); | ||
429 | input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255 << 2, | ||
430 | 4, 0); | ||
431 | input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, 255 << 2, | ||
432 | 4, 0); | ||
433 | input_set_abs_params(input, ABS_MT_ORIENTATION, -31, 32, 1, 0); | ||
434 | |||
435 | /* Note: Touch Y position from the device is inverted relative | ||
436 | * to how pointer motion is reported (and relative to how USB | ||
437 | * HID recommends the coordinates work). This driver keeps | ||
438 | * the origin at the same position, and just uses the additive | ||
439 | * inverse of the reported Y. | ||
440 | */ | ||
441 | if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) { | ||
442 | input_set_abs_params(input, ABS_MT_POSITION_X, | ||
443 | MOUSE_MIN_X, MOUSE_MAX_X, 4, 0); | ||
444 | input_set_abs_params(input, ABS_MT_POSITION_Y, | ||
445 | MOUSE_MIN_Y, MOUSE_MAX_Y, 4, 0); | ||
446 | |||
447 | input_abs_set_res(input, ABS_MT_POSITION_X, | ||
448 | MOUSE_RES_X); | ||
449 | input_abs_set_res(input, ABS_MT_POSITION_Y, | ||
450 | MOUSE_RES_Y); | ||
451 | } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */ | ||
452 | input_set_abs_params(input, ABS_X, TRACKPAD_MIN_X, | ||
453 | TRACKPAD_MAX_X, 4, 0); | ||
454 | input_set_abs_params(input, ABS_Y, TRACKPAD_MIN_Y, | ||
455 | TRACKPAD_MAX_Y, 4, 0); | ||
456 | input_set_abs_params(input, ABS_MT_POSITION_X, | ||
457 | TRACKPAD_MIN_X, TRACKPAD_MAX_X, 4, 0); | ||
458 | input_set_abs_params(input, ABS_MT_POSITION_Y, | ||
459 | TRACKPAD_MIN_Y, TRACKPAD_MAX_Y, 4, 0); | ||
460 | |||
461 | input_abs_set_res(input, ABS_X, TRACKPAD_RES_X); | ||
462 | input_abs_set_res(input, ABS_Y, TRACKPAD_RES_Y); | ||
463 | input_abs_set_res(input, ABS_MT_POSITION_X, | ||
464 | TRACKPAD_RES_X); | ||
465 | input_abs_set_res(input, ABS_MT_POSITION_Y, | ||
466 | TRACKPAD_RES_Y); | ||
467 | } | ||
468 | 421 | ||
469 | input_set_events_per_packet(input, 60); | 422 | __set_bit(EV_ABS, input->evbit); |
423 | |||
424 | input_set_abs_params(input, ABS_MT_TRACKING_ID, 0, 15, 0, 0); | ||
425 | input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255 << 2, | ||
426 | 4, 0); | ||
427 | input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, 255 << 2, | ||
428 | 4, 0); | ||
429 | input_set_abs_params(input, ABS_MT_ORIENTATION, -31, 32, 1, 0); | ||
430 | |||
431 | /* Note: Touch Y position from the device is inverted relative | ||
432 | * to how pointer motion is reported (and relative to how USB | ||
433 | * HID recommends the coordinates work). This driver keeps | ||
434 | * the origin at the same position, and just uses the additive | ||
435 | * inverse of the reported Y. | ||
436 | */ | ||
437 | if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) { | ||
438 | input_set_abs_params(input, ABS_MT_POSITION_X, | ||
439 | MOUSE_MIN_X, MOUSE_MAX_X, 4, 0); | ||
440 | input_set_abs_params(input, ABS_MT_POSITION_Y, | ||
441 | MOUSE_MIN_Y, MOUSE_MAX_Y, 4, 0); | ||
442 | |||
443 | input_abs_set_res(input, ABS_MT_POSITION_X, | ||
444 | MOUSE_RES_X); | ||
445 | input_abs_set_res(input, ABS_MT_POSITION_Y, | ||
446 | MOUSE_RES_Y); | ||
447 | } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */ | ||
448 | input_set_abs_params(input, ABS_X, TRACKPAD_MIN_X, | ||
449 | TRACKPAD_MAX_X, 4, 0); | ||
450 | input_set_abs_params(input, ABS_Y, TRACKPAD_MIN_Y, | ||
451 | TRACKPAD_MAX_Y, 4, 0); | ||
452 | input_set_abs_params(input, ABS_MT_POSITION_X, | ||
453 | TRACKPAD_MIN_X, TRACKPAD_MAX_X, 4, 0); | ||
454 | input_set_abs_params(input, ABS_MT_POSITION_Y, | ||
455 | TRACKPAD_MIN_Y, TRACKPAD_MAX_Y, 4, 0); | ||
456 | |||
457 | input_abs_set_res(input, ABS_X, TRACKPAD_RES_X); | ||
458 | input_abs_set_res(input, ABS_Y, TRACKPAD_RES_Y); | ||
459 | input_abs_set_res(input, ABS_MT_POSITION_X, | ||
460 | TRACKPAD_RES_X); | ||
461 | input_abs_set_res(input, ABS_MT_POSITION_Y, | ||
462 | TRACKPAD_RES_Y); | ||
470 | } | 463 | } |
471 | 464 | ||
465 | input_set_events_per_packet(input, 60); | ||
466 | |||
472 | if (report_undeciphered) { | 467 | if (report_undeciphered) { |
473 | __set_bit(EV_MSC, input->evbit); | 468 | __set_bit(EV_MSC, input->evbit); |
474 | __set_bit(MSC_RAW, input->mscbit); | 469 | __set_bit(MSC_RAW, input->mscbit); |