Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- commit e782508208df183b7cf93695c28a9aaf4a4d7495
- Author: Paul Keith <javelinanddart@gmail.com>
- Date: Wed Nov 22 04:49:25 2017 +0100
- fix
- Change-Id: Ie3807cee17749fe8f03958ce700718b2c84111c7
- diff --git a/drivers/input/touchscreen/wacom/wacom_i2c_func.c b/drivers/input/touchscreen/wacom/wacom_i2c_func.c
- index 2f6dfc1..0084045 100644
- --- a/drivers/input/touchscreen/wacom/wacom_i2c_func.c
- +++ b/drivers/input/touchscreen/wacom/wacom_i2c_func.c
- @@ -28,12 +28,6 @@
- #define CONFIG_SAMSUNG_KERNEL_DEBUG_USER
- #endif
- -#define LONG_PRESS_TIME 500
- -#define MIN_GEST_DIST 384
- -static int gesture_start_x;
- -static int gesture_start_y;
- -static ktime_t gesture_start_time;
- -
- #ifdef WACOM_BOOSTER
- static void wacom_change_dvfs_lock(struct work_struct *work)
- {
- @@ -913,27 +907,28 @@ void wacom_i2c_softkey(struct wacom_i2c *wac_i2c, s16 key, s16 pressed)
- }
- #endif
- -static int handle_gestures(int x, int y, ktime_t end)
- +static void handle_gestures(int x, int y, ktime_t end, struct wacom_i2c *wac_i2c)
- {
- - int dx = x - gesture_start_x;
- - int dy = y - gesture_start_y;
- - int dt = ktime_to_ms(ktime_sub(end, gesture_start_time));
- + int dx = x - wac_i2c->gesture_start_x;
- + int dy = y - wac_i2c->gesture_start_y;
- + int dt = ktime_to_ms(ktime_sub(end, wac_i2c->gesture_start_time));
- if (abs(dx) > abs(dy)) {
- if (abs(dx) > MIN_GEST_DIST) {
- - return dx > 0 ? KEY_PEN_LTR : KEY_PEN_RTL;
- + wac_i2c->gesture_key = dx > 0 ? KEY_PEN_LTR : KEY_PEN_RTL;
- + return;
- }
- } else {
- if (abs(dy) > MIN_GEST_DIST) {
- - return dy > 0 ? KEY_PEN_UTD : KEY_PEN_DTU;
- + wac_i2c->gesture_key = dy > 0 ? KEY_PEN_UTD : KEY_PEN_DTU;
- + return;
- }
- }
- if (dt >= LONG_PRESS_TIME) {
- - return KEY_PEN_LP;
- + wac_i2c->gesture_key = KEY_PEN_LP;
- + return;
- }
- -
- - return -1;
- }
- int wacom_i2c_coord(struct wacom_i2c *wac_i2c)
- @@ -945,7 +940,6 @@ int wacom_i2c_coord(struct wacom_i2c *wac_i2c)
- static s16 x, y, pressure;
- static s16 tmp;
- int rdy = 0;
- - int key = -1;
- #if defined(WACOM_USE_GAIN)
- u8 gain = 0;
- @@ -1172,19 +1166,20 @@ int wacom_i2c_coord(struct wacom_i2c *wac_i2c)
- dev_info(&wac_i2c->client->dev,
- "%s: side on\n",
- __func__);
- - gesture_start_x = x;
- - gesture_start_y = y;
- - gesture_start_time = ktime_get();
- + wac_i2c->gesture_start_x = x;
- + wac_i2c->gesture_start_y = y;
- + wac_i2c->gesture_start_time = ktime_get();
- } else if (!stylus && wac_i2c->side_pressed) {
- dev_info(&wac_i2c->client->dev,
- "%s: side off\n",
- __func__);
- - key = handle_gestures(x, y, ktime_get());
- - if (key > -1) {
- - input_report_key(wac_i2c->input_dev, key, 1);
- + handle_gestures(x, y, ktime_get(), wac_i2c);
- + if (wac_i2c->gesture_key > -1) {
- + input_report_key(wac_i2c->input_dev, wac_i2c->gesture_key, 1);
- input_sync(wac_i2c->input_dev);
- - input_report_key(wac_i2c->input_dev, key, 0);
- + input_report_key(wac_i2c->input_dev, wac_i2c->gesture_key, 0);
- input_sync(wac_i2c->input_dev);
- + wac_i2c->gesture_key = -1;
- }
- }
- diff --git a/include/linux/wacom_i2c.h b/include/linux/wacom_i2c.h
- index aa63618..9f8d499 100644
- --- a/include/linux/wacom_i2c.h
- +++ b/include/linux/wacom_i2c.h
- @@ -215,6 +215,9 @@ struct wacom_g5_callbacks {
- int (*check_prox)(struct wacom_g5_callbacks *);
- };
- +#define LONG_PRESS_TIME 500
- +#define MIN_GEST_DIST 384
- +
- /*Parameters for i2c driver*/
- struct wacom_i2c {
- struct i2c_client *client;
- @@ -302,6 +305,11 @@ struct wacom_i2c {
- bool touch_pressed;
- #endif
- bool enabled;
- +
- + int gesture_key;
- + int gesture_start_x;
- + int gesture_start_y;
- + ktime_t gesture_start_time;
- };
- struct wacom_g5_platform_data {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement