touch:fts: add command to avoid sensing off before reading rawdata
There would be a sense on force calibration after we set the sensing
mode off and on and thus caused the rawdata incorrect.
Bug: 154291200
Test: Read touch rawdate correctly.
Change-Id: I37b18760c70149a884198abf0524c380b2672df1
Signed-off-by: davidycchen <davidycchen@google.com>
diff --git a/fts.c b/fts.c
index eb95b5f..400a201 100644
--- a/fts.c
+++ b/fts.c
@@ -1953,14 +1953,20 @@
else
setScanMode(SCAN_MODE_LOCKED, LOCKED_ACTIVE);
msleep(WAIT_FOR_FRESH_FRAMES);
- setScanMode(SCAN_MODE_ACTIVE, 0x00);
- msleep(WAIT_AFTER_SENSEOFF);
- /* Delete the events related to some touch
- * (allow to call this function while touching
- * the screen without having a flooding of the
- * FIFO)
+ /* Skip sensing off when typeOfCommand[2]=0x01
+ * to avoid sense on force cal after reading raw data
*/
- flushFIFO();
+ if (!(numberParameters >= 3 &&
+ typeOfCommand[2] == 0x01)) {
+ setScanMode(SCAN_MODE_ACTIVE, 0x00);
+ msleep(WAIT_AFTER_SENSEOFF);
+ /* Delete the events related to some touch
+ * (allow to call this function while touching
+ * the screen without having a flooding of the
+ * FIFO)
+ */
+ flushFIFO();
+ }
#ifdef READ_FILTERED_RAW
res = getMSFrame3(MS_FILTER, &frameMS);
#else
@@ -2002,14 +2008,20 @@
else
setScanMode(SCAN_MODE_LOCKED, LOCKED_ACTIVE);
msleep(WAIT_FOR_FRESH_FRAMES);
- setScanMode(SCAN_MODE_ACTIVE, 0x00);
- msleep(WAIT_AFTER_SENSEOFF);
- flushFIFO();
- /* delete the events related to some touch
- * (allow to call this function while touching
- * the screen without having a flooding of the
- * FIFO)
+ /* Skip sensing off when typeOfCommand[2]=0x01
+ * to avoid sense on force cal after reading raw data
*/
+ if (!(numberParameters >= 3 &&
+ typeOfCommand[2] == 0x01)) {
+ setScanMode(SCAN_MODE_ACTIVE, 0x00);
+ msleep(WAIT_AFTER_SENSEOFF);
+ flushFIFO();
+ /* delete the events related to some touch
+ * (allow to call this function while touching
+ * the screen without having a flooding of the
+ * FIFO)
+ */
+ }
if (numberParameters >= 2 &&
typeOfCommand[1] == LOCKED_LP_DETECT)
#ifdef READ_FILTERED_RAW
@@ -2120,12 +2132,18 @@
break;
case 0x17: /* Read mutual strength */
pr_info("Get 1 MS Strength\n");
- setScanMode(SCAN_MODE_ACTIVE, 0xFF);
- msleep(WAIT_FOR_FRESH_FRAMES);
- setScanMode(SCAN_MODE_ACTIVE, 0x00);
- msleep(WAIT_AFTER_SENSEOFF);
- /* Flush outstanding touch events */
- flushFIFO();
+ /* Skip sensing off when typeOfCommand[1]=0x01
+ * to avoid sense on force cal after reading raw data
+ */
+ if (!(numberParameters >= 2 &&
+ typeOfCommand[1] == 0x01)) {
+ setScanMode(SCAN_MODE_ACTIVE, 0xFF);
+ msleep(WAIT_FOR_FRESH_FRAMES);
+ setScanMode(SCAN_MODE_ACTIVE, 0x00);
+ msleep(WAIT_AFTER_SENSEOFF);
+ /* Flush outstanding touch events */
+ flushFIFO();
+ }
nodes = getMSFrame3(MS_STRENGTH, &frameMS);
if (nodes < 0) {
res = nodes;