summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidycchen <davidycchen@google.com>2020-02-21 18:03:11 +0800
committerDavid Chen <davidycchen@google.com>2020-06-02 02:11:10 +0000
commit882233622bfe0e8ba70da62645c6fa429c763f20 (patch)
tree1c3dfd2be4a2f89899c70c7b6e6f2938c3a26c40
parentc5d37bc9006325d1724cb2cd1ef79d5f5f06fbed (diff)
downloadfts_touch-882233622bfe0e8ba70da62645c6fa429c763f20.tar.gz
touch:fts: support touch cancel mode
support to report MT_TOOL_PALM type for new cancel mode feature. Bug: 148993292 Test: use test firmware with the new feature. Change-Id: I1a14a219d2c44d4923e4d57ea742620d54b7457a Signed-off-by: davidycchen <davidycchen@google.com>
-rw-r--r--fts.c33
-rw-r--r--fts.h2
-rw-r--r--fts_lib/ftsSoftware.h1
3 files changed, 34 insertions, 2 deletions
diff --git a/fts.c b/fts.c
index fe377c7..1bf5c06 100644
--- a/fts.c
+++ b/fts.c
@@ -176,6 +176,8 @@ void release_all_touches(struct fts_ts_info *info)
input_report_key(info->input_dev, BTN_TOUCH, 0);
input_sync(info->input_dev);
info->touch_id = 0;
+ info->palm_touch_mask = 0;
+ info->grip_touch_mask = 0;
#ifdef STYLUS_MODE
info->stylus_id = 0;
#endif
@@ -3040,13 +3042,32 @@ static bool fts_enter_pointer_event_handler(struct fts_ts_info *info, unsigned
* touch */
case TOUCH_TYPE_FINGER:
case TOUCH_TYPE_GLOVE:
+ pr_debug("%s : It is a touch type %d!\n", __func__, touchType);
+ if (info->palm_touch_mask)
+ tool = MT_TOOL_PALM;
+ else
+ tool = MT_TOOL_FINGER;
+ touch_condition = 1;
+ __set_bit(touchId, &info->touch_id);
+ __clear_bit(touchId, &info->palm_touch_mask);
+ __clear_bit(touchId, &info->grip_touch_mask);
+ break;
case TOUCH_TYPE_PALM:
pr_debug("%s : It is a touch type %d!\n", __func__, touchType);
- tool = MT_TOOL_FINGER;
+ tool = MT_TOOL_PALM;
touch_condition = 1;
__set_bit(touchId, &info->touch_id);
+ __set_bit(touchId, &info->palm_touch_mask);
+ __clear_bit(touchId, &info->grip_touch_mask);
+ break;
+ case TOUCH_TYPE_GRIP:
+ pr_debug("%s : It is a touch type %d!\n", __func__, touchType);
+ tool = MT_TOOL_PALM;
+ touch_condition = 1;
+ __set_bit(touchId, &info->touch_id);
+ __clear_bit(touchId, &info->palm_touch_mask);
+ __set_bit(touchId, &info->grip_touch_mask);
break;
-
case TOUCH_TYPE_HOVER:
tool = MT_TOOL_FINGER;
@@ -3125,9 +3146,13 @@ static bool fts_leave_pointer_event_handler(struct fts_ts_info *info, unsigned
/* pr_info("%s : It is a glove!\n", __func__); */
case TOUCH_TYPE_PALM:
/* pr_info("%s : It is a palm!\n", __func__); */
+ case TOUCH_TYPE_GRIP:
+ /* pr_info("%s : It is a grip!\n", __func__); */
case TOUCH_TYPE_HOVER:
tool = MT_TOOL_FINGER;
__clear_bit(touchId, &info->touch_id);
+ __clear_bit(touchId, &info->palm_touch_mask);
+ __clear_bit(touchId, &info->grip_touch_mask);
break;
default:
@@ -5831,6 +5856,8 @@ static int fts_probe(struct spi_device *client)
AREA_MAX, 0, 0);
input_set_abs_params(info->input_dev, ABS_MT_TOUCH_MINOR, AREA_MIN,
AREA_MAX, 0, 0);
+ input_set_abs_params(info->input_dev, ABS_MT_TOOL_TYPE, MT_TOOL_FINGER,
+ MT_TOOL_FINGER, 0, 0);
#ifndef SKIP_PRESSURE
input_set_abs_params(info->input_dev, ABS_MT_PRESSURE, PRESSURE_MIN,
PRESSURE_MAX, 0, 0);
@@ -5902,6 +5929,8 @@ static int fts_probe(struct spi_device *client)
skip_5_1 = 1;
/* track slots */
info->touch_id = 0;
+ info->palm_touch_mask = 0;
+ info->grip_touch_mask = 0;
#ifdef STYLUS_MODE
info->stylus_id = 0;
#endif
diff --git a/fts.h b/fts.h
index 410a304..3b3e0b2 100644
--- a/fts.h
+++ b/fts.h
@@ -424,6 +424,8 @@ struct fts_ts_info {
unsigned int mode; /* Device operating mode */
/* MSB - active or lpm */
unsigned long touch_id; /* Bitmask for touch id */
+ unsigned long palm_touch_mask; /* Bitmask for palm touch */
+ unsigned long grip_touch_mask; /* Bitmask for grip touch */
#ifdef STYLUS_MODE
unsigned long stylus_id; /* Bitmask for the stylus */
#endif
diff --git a/fts_lib/ftsSoftware.h b/fts_lib/ftsSoftware.h
index 8962411..6aa9e18 100644
--- a/fts_lib/ftsSoftware.h
+++ b/fts_lib/ftsSoftware.h
@@ -542,6 +542,7 @@ typedef enum {
#define TOUCH_TYPE_STYLUS 0x03 /* /< Stylus touch */
#define TOUCH_TYPE_PALM 0x04 /* /< Palm touch */
#define TOUCH_TYPE_HOVER 0x00 /* /< Hovering touch */
+#define TOUCH_TYPE_GRIP 0x07 /* /< Hovering touch */
/* Keys code */
#define FTS_KEY_0 0x01 /* /< Key 0 bit */