aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2018-07-13 10:13:52 -0400
committerJiri Kosina <jkosina@suse.cz>2018-07-17 09:33:47 -0400
commit9152c7d77d87e2b6b9ccc21bb52f8eea15744f50 (patch)
treee0a8982cdfac38df1fc87796179e37278766de8b
parent30576c5f490cb220ae8c1dcd918605ac1c4c103e (diff)
HID: multitouch: report MT_TOOL_PALM for non-confident touches
According to Microsoft specification [1] for Precision Touchpads (and Touchscreens) the devices use "confidence" reports to signal accidental touches, or contacts that are "too large to be a finger". Instead of simply marking contact inactive in this case (which causes issues if contact was originally proper and we lost confidence in it later, as this results in accidental clicks, drags, etc), let's report such contacts as MT_TOOL_PALM and let userspace decide what to do. [1] https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/touchpad-windows-precision-touchpad-collection Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> [splitted and rebased] Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/hid-multitouch.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index a4a274ebfbef..587369443f50 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -736,6 +736,13 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
736 cls->name == MT_CLS_WIN_8_DUAL) && 736 cls->name == MT_CLS_WIN_8_DUAL) &&
737 field->application == HID_DG_TOUCHPAD) 737 field->application == HID_DG_TOUCHPAD)
738 app->quirks |= MT_QUIRK_CONFIDENCE; 738 app->quirks |= MT_QUIRK_CONFIDENCE;
739
740 if (app->quirks & MT_QUIRK_CONFIDENCE)
741 input_set_abs_params(hi->input,
742 ABS_MT_TOOL_TYPE,
743 MT_TOOL_FINGER,
744 MT_TOOL_PALM, 0, 0);
745
739 MT_STORE_FIELD(confidence_state); 746 MT_STORE_FIELD(confidence_state);
740 return 1; 747 return 1;
741 case HID_DG_TIPSWITCH: 748 case HID_DG_TIPSWITCH:
@@ -958,10 +965,12 @@ static int mt_process_slot(struct mt_device *td, struct input_dev *input,
958 if (quirks & MT_QUIRK_HOVERING) 965 if (quirks & MT_QUIRK_HOVERING)
959 inrange_state = *slot->inrange_state; 966 inrange_state = *slot->inrange_state;
960 967
961 active = (*slot->tip_state || inrange_state) && confidence_state; 968 active = *slot->tip_state || inrange_state;
962 969
963 if (app->application == HID_GD_SYSTEM_MULTIAXIS) 970 if (app->application == HID_GD_SYSTEM_MULTIAXIS)
964 tool = MT_TOOL_DIAL; 971 tool = MT_TOOL_DIAL;
972 else if (unlikely(!confidence_state))
973 tool = MT_TOOL_PALM;
965 974
966 input_mt_slot(input, slotnum); 975 input_mt_slot(input, slotnum);
967 input_mt_report_slot_state(input, tool, active); 976 input_mt_report_slot_state(input, tool, active);
@@ -993,11 +1002,11 @@ static int mt_process_slot(struct mt_device *td, struct input_dev *input,
993 orientation = -azimuth; 1002 orientation = -azimuth;
994 } 1003 }
995 1004
996 /*
997 * divided by two to match visual scale of touch
998 * for devices with this quirk
999 */
1000 if (quirks & MT_QUIRK_TOUCH_SIZE_SCALING) { 1005 if (quirks & MT_QUIRK_TOUCH_SIZE_SCALING) {
1006 /*
1007 * divided by two to match visual scale of touch
1008 * for devices with this quirk
1009 */
1001 major = major >> 1; 1010 major = major >> 1;
1002 minor = minor >> 1; 1011 minor = minor >> 1;
1003 } 1012 }