From 80f4582c2f434ce7defd76ff5f5410ea9aa6ebdd Mon Sep 17 00:00:00 2001 From: wangyq13 Date: Mon, 7 Nov 2022 12:08:07 +0800 Subject: [PATCH] input: nova_0flash_mmi: update dda driver to v2.0 nova_0flash_mmi: Minor updates for safety coding in moto_ts_dda.c. Change-Id: I6233fc159bb49e2fb6414743c441bfc157a7a20b Signed-off-by: wangyq13 Reviewed-on: https://gerrit.mot.com/2422204 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jun Weng Reviewed-by: Huosheng Liao Submit-Approved: Jira Key --- .../touchscreen/nova_0flash_mmi/moto_ts_dda.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/input/touchscreen/nova_0flash_mmi/moto_ts_dda.c b/drivers/input/touchscreen/nova_0flash_mmi/moto_ts_dda.c index 525a510f96cd..2d123c564994 100644 --- a/drivers/input/touchscreen/nova_0flash_mmi/moto_ts_dda.c +++ b/drivers/input/touchscreen/nova_0flash_mmi/moto_ts_dda.c @@ -257,6 +257,7 @@ static int get_finger_report(int id, unsigned long arg){ finger_buffer_rp = (unsigned char)((wp + (DDA_MAX_BUFFER - MAX_IO_CONTROL_REPORT)) % DDA_MAX_BUFFER); } else { + num = MAX_IO_CONTROL_REPORT; //for safety implementation finger_buffer_rp = 0; } memset(&finger_reports, 0, sizeof(finger_reports)); @@ -339,6 +340,7 @@ static struct file_operations penraw_fops = { void moto_dda_process_finger_press(uint8_t touch_id, struct dda_finger_coords *finger_data) { struct dda_finger_info *pfinger_info; int i; + unsigned char id_is_found; if(touch_id >= DDA_TOUCH_ID_MAX){ return; @@ -358,12 +360,22 @@ void moto_dda_process_finger_press(uint8_t touch_id, struct dda_finger_coords *f dda_finger_report_buf[touch_id].frame_no++; if(DDA_FINGER_RELEASE == dda_finger_report_buf[touch_id].last_status){ pfinger_info->coords.status = DDA_FINGER_ENTER; + //check registerd iDs to avoid duplicated registration. + id_is_found = 0; for(i=0;icoords.status = DDA_FINGER_MOVE; } @@ -548,7 +560,7 @@ int moto_dda_register_cdevice(void) { void moto_dda_exit(void) { dev_t dev = MKDEV(dda_cdev_ctrl.major_number, MINOR_NUMBER_START); - /* remove "/dev/novatech_penraw" */ + /* remove "/dev/moto_penraw" */ if (NULL != dda_cdev_ctrl.penraw_char_dev_class) { device_destroy(dda_cdev_ctrl.penraw_char_dev_class, MKDEV(dda_cdev_ctrl.major_number, 0));