From 9cbd3130c85e9f3c388df1cfbb0794b7bc6f27ad Mon Sep 17 00:00:00 2001 From: Wenge Zhu Date: Thu, 27 Oct 2022 17:19:19 +0800 Subject: [PATCH] Use s-dt-gesture to report CLI touch gesture TP: Use s-dt-gesture to report CLI touch gesture. Change-Id: I8f8c488a19ba7e0f535b5f63773d4ae4a5d7b210 Signed-off-by: Wenge Zhu Reviewed-on: https://gerrit.mot.com/2415030 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jianqi Yang Submit-Approved: Jira Key --- .../touchscreen_mmi/touchscreen_mmi_gesture.c | 47 ++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_gesture.c b/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_gesture.c index 2cf634f04d48..4e23c20c510d 100644 --- a/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_gesture.c +++ b/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_gesture.c @@ -254,6 +254,51 @@ static int ts_mmi_gesture_handler(struct gesture_event_data *gev) return 0; } +static int ts_mmi_cli_gesture_handler(struct gesture_event_data *gev) +{ + int key_code; + bool need2report = true; + struct ts_mmi_dev *touch_cdev = cli_sensor_pdata->touch_cdev; + + switch (gev->evcode) { + case 1: + key_code = KEY_F1; + pr_info("%s: single tap\n", __func__); + break; + case 2: + key_code = KEY_F2; + if(gev->evdata.x == 0) + gev->evdata.x = touch_cdev->pdata.fod_x ; + if(gev->evdata.y== 0) + gev->evdata.y = touch_cdev->pdata.fod_y; + input_report_abs(cli_sensor_pdata->input_sensor_dev, ABS_X, gev->evdata.x); + input_report_abs(cli_sensor_pdata->input_sensor_dev, ABS_Y, gev->evdata.y); + pr_info("%s: zero tap; x=%x, y=%x\n", __func__, gev->evdata.x, gev->evdata.y); + break; + case 3: + key_code = KEY_F3; + pr_info("%s: zero tap up\n", __func__); + break; + case 4: + key_code = KEY_F4; + pr_info("%s: double tap\n", __func__); + break; + default: + need2report = false; + pr_info("%s: unknown id=%x\n", __func__, gev->evcode); + } + + if (!need2report) + return 1; + + input_report_key(cli_sensor_pdata->input_sensor_dev, key_code, 1); + input_sync(cli_sensor_pdata->input_sensor_dev); + input_report_key(cli_sensor_pdata->input_sensor_dev, key_code, 0); + input_sync(cli_sensor_pdata->input_sensor_dev); + + return 0; +} + static int ts_mmi_palm_handler(bool value) { if (!palm_sensor_pdata->input_sensor_dev) @@ -627,7 +672,7 @@ int ts_mmi_cli_gesture_init(struct ts_mmi_dev *touch_cdev) goto unregister_sensor_input_device; /* export report gesture function to vendor */ - touch_cdev->mdata->exports.report_gesture = ts_mmi_gesture_handler; + touch_cdev->mdata->exports.report_gesture = ts_mmi_cli_gesture_handler; return 0;