summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTai Kuo <taikuo@google.com>2020-10-28 20:07:15 +0800
committerTai Kuo <taikuo@google.com>2020-10-29 13:59:31 +0800
commita49f1eca5b0001de64c272a940b54d49b1dd2635 (patch)
tree080bca58b6b8ddf6d8f2ddd2bd3eda7d44ce610d
parent5b34d87763a7fc5e27b48ec08f22856257fc1442 (diff)
downloadfts_touch-a49f1eca5b0001de64c272a940b54d49b1dd2635.tar.gz
touch: fts: show ito_max_val at stdout only for ITO commands
Fix bugs from commit a024da8a94e748425c315e86f966dedaa317bd84: 1. Fix CMD_GETMSFRAME, CMD_TP_SENS_STD driver_test stdout overflow. 2. Remove the first line redundant zeros of MS raw and strength stm_fts_cmd stdout. Bug: 171869006 Test: Test CMD_GETMSFRAME, CMD_TP_SENS_STD and CMD_ITOTEST of driver_test. Test: Test MS raw, MS strength and ITO commands of stm_fts_cmd. Signed-off-by: Tai Kuo <taikuo@google.com> Change-Id: I4e9195c6bffd930eef52490bacd9fc76b792ecd5
-rw-r--r--fts.c37
-rw-r--r--fts_proc.c27
2 files changed, 36 insertions, 28 deletions
diff --git a/fts.c b/fts.c
index 2ed1d39..5b7c5cb 100644
--- a/fts.c
+++ b/fts.c
@@ -2262,12 +2262,14 @@ END:
index += scnprintf(all_strbuff + index, size - index,
"%3d",
(u8)frameMS.header.sense_node);
- index += scnprintf(all_strbuff + index,
- size - index, " %d ",
- ito_max_val[0]);
- index += scnprintf(all_strbuff + index,
- size - index, "%d ",
- ito_max_val[1]);
+ if (typeOfCommand[0] == 0x01) {
+ index += scnprintf(all_strbuff + index,
+ size - index, " %d ",
+ ito_max_val[0]);
+ index += scnprintf(all_strbuff + index,
+ size - index, "%d ",
+ ito_max_val[1]);
+ }
#else
index += scnprintf(all_strbuff + index,
size - index, "%02X",
@@ -2276,18 +2278,19 @@ END:
index += scnprintf(all_strbuff + index,
size - index, "%02X",
(u8)frameMS.header.sense_node);
+ if (typeOfCommand[0] == 0x01) {
+ index += scnprintf(all_strbuff + index,
+ size - index,
+ "%02X%02X",
+ (ito_max_val[0] & 0xFF00) >> 8,
+ ito_max_val[0] & 0xFF);
- index += scnprintf(all_strbuff + index,
- size - index,
- "%02X%02X",
- (ito_max_val[0] & 0xFF00) >> 8,
- ito_max_val[0] & 0xFF);
-
- index += scnprintf(all_strbuff + index,
- size - index,
- "%02X%02X",
- (ito_max_val[1] & 0xFF00) >> 8,
- ito_max_val[1] & 0xFF);
+ index += scnprintf(all_strbuff + index,
+ size - index,
+ "%02X%02X",
+ (ito_max_val[1] & 0xFF00) >> 8,
+ ito_max_val[1] & 0xFF);
+ }
#endif
for (j = 0; j < frameMS.node_data_size; j++) {
diff --git a/fts_proc.c b/fts_proc.c
index 5150ffa..9b1ea6e 100644
--- a/fts_proc.c
+++ b/fts_proc.c
@@ -2928,6 +2928,9 @@ END: /* here start the reporting phase, assembling the data to send in the
}
if (byte_call == 0) {
+ /* keep for ito_max_val array */
+ if (funcToTest[0] == CMD_ITOTEST)
+ size += (ARRAY_SIZE(ito_max_val) * sizeof(u16));
size *= 2;
size += 2; /* add \n and \0 (terminator char) */
} else {
@@ -3020,17 +3023,19 @@ END: /* here start the reporting phase, assembling the data to send in the
size - index, "%02X",
(u8)frameMS.header.sense_node);
- index += scnprintf(&driver_test_buff[index],
- size - index,
- "%02X%02X",
- (ito_max_val[0] & 0xFF00) >> 8,
- ito_max_val[0] & 0xFF);
-
- index += scnprintf(&driver_test_buff[index],
- size - index,
- "%02X%02X",
- (ito_max_val[1] & 0xFF00) >> 8,
- ito_max_val[1] & 0xFF);
+ if (funcToTest[0] == CMD_ITOTEST) {
+ index += scnprintf(&driver_test_buff[index],
+ size - index,
+ "%02X%02X",
+ (ito_max_val[0] & 0xFF00) >> 8,
+ ito_max_val[0] & 0xFF);
+
+ index += scnprintf(&driver_test_buff[index],
+ size - index,
+ "%02X%02X",
+ (ito_max_val[1] & 0xFF00) >> 8,
+ ito_max_val[1] & 0xFF);
+ }
for (j = 0; j < frameMS.node_data_size; j++) {
index += scnprintf(