From 7ce98987df104935efd9506883e152b5b0f031d6 Mon Sep 17 00:00:00 2001 From: "eunwoo.nam" Date: Mon, 23 Dec 2024 18:10:20 +0900 Subject: [PATCH] drivers/input/ist415: Add debug log level cmd of touch coordinate log. The touch coordinates should be managed at a debug level, allowing them to be turned on only when necessary. Therefore, Apply debug log level of touch coordinate logs Signed-off-by: eunwoo.nam --- os/drivers/input/ist415.c | 37 ++++++++++++++++++++++++++++++++++--- os/drivers/input/ist415.h | 1 + 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/os/drivers/input/ist415.c b/os/drivers/input/ist415.c index 7d8a3e5b73..be37ca6d11 100644 --- a/os/drivers/input/ist415.c +++ b/os/drivers/input/ist415.c @@ -269,15 +269,21 @@ static int ist415_get_touch_data(struct ist415_dev_s *dev, FAR void *buf) switch (p_evt_coord->tsta) { case TOUCH_STA_PRESS: data->point[data->npoints].flags = TOUCH_DOWN; - touchvdbg("COORDDINATES: [P] Point ID=%2d, X=%4d, Y=%4d\n", data->point[data->npoints].id, data->point[data->npoints].x, data->point[data->npoints].y); + if (dev->log) { + touchdbg("COORDDINATES: [P] Point ID=%2d, X=%4d, Y=%4d\n", data->point[data->npoints].id, data->point[data->npoints].x, data->point[data->npoints].y); + } break; case TOUCH_STA_MOVE: data->point[data->npoints].flags = TOUCH_MOVE; - touchvdbg("COORDDINATES: [M] Point ID=%2d, X=%4d, Y=%4d\n", data->point[data->npoints].id, data->point[data->npoints].x, data->point[data->npoints].y); + if (dev->log) { + touchdbg("COORDDINATES: [M] Point ID=%2d, X=%4d, Y=%4d\n", data->point[data->npoints].id, data->point[data->npoints].x, data->point[data->npoints].y); + } break; case TOUCH_STA_RELEASE: data->point[data->npoints].flags = TOUCH_UP; - touchvdbg("COORDDINATES: [R] Point ID=%2d, X=%4d, Y=%4d\n", data->point[data->npoints].id, data->point[data->npoints].x, data->point[data->npoints].y); + if (dev->log) { + touchdbg("COORDDINATES: [R] Point ID=%2d, X=%4d, Y=%4d\n", data->point[data->npoints].id, data->point[data->npoints].x, data->point[data->npoints].y); + } break; default: break; @@ -376,6 +382,27 @@ static int ist415_get_touch_data(struct ist415_dev_s *dev, FAR void *buf) return ret; } +/**************************************************************************** + * Name: ist415_set_dbg + ****************************************************************************/ + +static int ist415_set_dbg(struct ist415_dev_s *dev, int argc, char **argv) +{ + if (argc < 3) { + return -EINVAL; + } + + if (strncmp(argv[2], "1", 2) == 0) { + dev->log = true; + } else if (strncmp(argv[2], "0", 2) == 0) { + dev->log = false; + } else { + return -EINVAL; + } + return OK; +} + + /**************************************************************************** * Name: ist415_cmd_show_usage ****************************************************************************/ @@ -390,6 +417,7 @@ static void ist415_cmd_show_usage(void) printf(" cpc : Display CPC\n"); printf(" update : Update binary\n"); printf(" intrdbg : Set Intr Debug\n"); + printf(" dbg : Enable(1)/Disable(0) coordinates logs\n"); } /**************************************************************************** @@ -415,6 +443,8 @@ static int ist415_cmd(struct touchscreen_s *upper, int argc, char **argv) ret = ist415_set_intr_debug(dev, argc, argv); } else if (strncmp(argv[1], "update", 7) == 0) { ret = ist415_force_update(dev, argc, argv); + } else if (strncmp(argv[1], "dbg", 4) == 0) { + ret = ist415_set_dbg(dev, argc, argv); } else { ret = -EINVAL; } @@ -928,6 +958,7 @@ int ist415_initialize(const char *path, struct i2c_dev_s *i2c, struct ist415_con dev->ready = false; dev->enable = false; dev->pre_enable = false; + dev->log = false; dev->sys_mode = SYS_MODE_TOUCH; dev->touch_type = (1 << TOUCH_TYPE_NORMAL) | (1 << TOUCH_TYPE_WET) | (1 << TOUCH_TYPE_PALMLARGE); diff --git a/os/drivers/input/ist415.h b/os/drivers/input/ist415.h index 5f13b46550..f3ba2a956f 100644 --- a/os/drivers/input/ist415.h +++ b/os/drivers/input/ist415.h @@ -390,6 +390,7 @@ struct ist415_dev_s { bool ready; bool enable; bool pre_enable; + bool log; uint8_t sys_mode; /* System Mode (NPM or LPM) */ uint16_t touch_type; /* Touch Type */