Commit 20898974 authored by Emanuele Ghidoli's avatar Emanuele Ghidoli Committed by Dmitry Torokhov

Input: ilitek_ts_i2c - add report id message validation

Ensure that the touchscreen response has correct "report id" byte
before processing the touch data and discard other messages.

Fixes: 42370681 ("Input: Add support for ILITEK Lego Series")
Signed-off-by: default avatarEmanuele Ghidoli <emanuele.ghidoli@toradex.com>
Signed-off-by: default avatarFrancesco Dolcini <francesco.dolcini@toradex.com>
Link: https://lore.kernel.org/r/20240805085511.43955-3-francesco@dolcini.itSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 7d0b18cd
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#define ILITEK_TP_CMD_GET_MCU_VER 0x61 #define ILITEK_TP_CMD_GET_MCU_VER 0x61
#define ILITEK_TP_CMD_GET_IC_MODE 0xC0 #define ILITEK_TP_CMD_GET_IC_MODE 0xC0
#define ILITEK_TP_I2C_REPORT_ID 0x48
#define REPORT_COUNT_ADDRESS 61 #define REPORT_COUNT_ADDRESS 61
#define ILITEK_SUPPORT_MAX_POINT 40 #define ILITEK_SUPPORT_MAX_POINT 40
...@@ -163,6 +165,11 @@ static int ilitek_process_and_report_v6(struct ilitek_ts_data *ts) ...@@ -163,6 +165,11 @@ static int ilitek_process_and_report_v6(struct ilitek_ts_data *ts)
return error; return error;
} }
if (buf[0] != ILITEK_TP_I2C_REPORT_ID) {
dev_err(dev, "get touch info failed. Wrong id: 0x%02X\n", buf[0]);
return -EINVAL;
}
report_max_point = buf[REPORT_COUNT_ADDRESS]; report_max_point = buf[REPORT_COUNT_ADDRESS];
if (report_max_point > ts->max_tp) { if (report_max_point > ts->max_tp) {
dev_err(dev, "FW report max point:%d > panel info. max:%d\n", dev_err(dev, "FW report max point:%d > panel info. max:%d\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment