Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
508
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.82 KB | None | 0 0
  1. commit e782508208df183b7cf93695c28a9aaf4a4d7495
  2. Author: Paul Keith <javelinanddart@gmail.com>
  3. Date: Wed Nov 22 04:49:25 2017 +0100
  4.  
  5. fix
  6.  
  7. Change-Id: Ie3807cee17749fe8f03958ce700718b2c84111c7
  8.  
  9. diff --git a/drivers/input/touchscreen/wacom/wacom_i2c_func.c b/drivers/input/touchscreen/wacom/wacom_i2c_func.c
  10. index 2f6dfc1..0084045 100644
  11. --- a/drivers/input/touchscreen/wacom/wacom_i2c_func.c
  12. +++ b/drivers/input/touchscreen/wacom/wacom_i2c_func.c
  13. @@ -28,12 +28,6 @@
  14. #define CONFIG_SAMSUNG_KERNEL_DEBUG_USER
  15. #endif
  16.  
  17. -#define LONG_PRESS_TIME 500
  18. -#define MIN_GEST_DIST 384
  19. -static int gesture_start_x;
  20. -static int gesture_start_y;
  21. -static ktime_t gesture_start_time;
  22. -
  23. #ifdef WACOM_BOOSTER
  24. static void wacom_change_dvfs_lock(struct work_struct *work)
  25. {
  26. @@ -913,27 +907,28 @@ void wacom_i2c_softkey(struct wacom_i2c *wac_i2c, s16 key, s16 pressed)
  27. }
  28. #endif
  29.  
  30. -static int handle_gestures(int x, int y, ktime_t end)
  31. +static void handle_gestures(int x, int y, ktime_t end, struct wacom_i2c *wac_i2c)
  32. {
  33. - int dx = x - gesture_start_x;
  34. - int dy = y - gesture_start_y;
  35. - int dt = ktime_to_ms(ktime_sub(end, gesture_start_time));
  36. + int dx = x - wac_i2c->gesture_start_x;
  37. + int dy = y - wac_i2c->gesture_start_y;
  38. + int dt = ktime_to_ms(ktime_sub(end, wac_i2c->gesture_start_time));
  39.  
  40. if (abs(dx) > abs(dy)) {
  41. if (abs(dx) > MIN_GEST_DIST) {
  42. - return dx > 0 ? KEY_PEN_LTR : KEY_PEN_RTL;
  43. + wac_i2c->gesture_key = dx > 0 ? KEY_PEN_LTR : KEY_PEN_RTL;
  44. + return;
  45. }
  46. } else {
  47. if (abs(dy) > MIN_GEST_DIST) {
  48. - return dy > 0 ? KEY_PEN_UTD : KEY_PEN_DTU;
  49. + wac_i2c->gesture_key = dy > 0 ? KEY_PEN_UTD : KEY_PEN_DTU;
  50. + return;
  51. }
  52. }
  53.  
  54. if (dt >= LONG_PRESS_TIME) {
  55. - return KEY_PEN_LP;
  56. + wac_i2c->gesture_key = KEY_PEN_LP;
  57. + return;
  58. }
  59. -
  60. - return -1;
  61. }
  62.  
  63. int wacom_i2c_coord(struct wacom_i2c *wac_i2c)
  64. @@ -945,7 +940,6 @@ int wacom_i2c_coord(struct wacom_i2c *wac_i2c)
  65. static s16 x, y, pressure;
  66. static s16 tmp;
  67. int rdy = 0;
  68. - int key = -1;
  69.  
  70. #if defined(WACOM_USE_GAIN)
  71. u8 gain = 0;
  72. @@ -1172,19 +1166,20 @@ int wacom_i2c_coord(struct wacom_i2c *wac_i2c)
  73. dev_info(&wac_i2c->client->dev,
  74. "%s: side on\n",
  75. __func__);
  76. - gesture_start_x = x;
  77. - gesture_start_y = y;
  78. - gesture_start_time = ktime_get();
  79. + wac_i2c->gesture_start_x = x;
  80. + wac_i2c->gesture_start_y = y;
  81. + wac_i2c->gesture_start_time = ktime_get();
  82. } else if (!stylus && wac_i2c->side_pressed) {
  83. dev_info(&wac_i2c->client->dev,
  84. "%s: side off\n",
  85. __func__);
  86. - key = handle_gestures(x, y, ktime_get());
  87. - if (key > -1) {
  88. - input_report_key(wac_i2c->input_dev, key, 1);
  89. + handle_gestures(x, y, ktime_get(), wac_i2c);
  90. + if (wac_i2c->gesture_key > -1) {
  91. + input_report_key(wac_i2c->input_dev, wac_i2c->gesture_key, 1);
  92. input_sync(wac_i2c->input_dev);
  93. - input_report_key(wac_i2c->input_dev, key, 0);
  94. + input_report_key(wac_i2c->input_dev, wac_i2c->gesture_key, 0);
  95. input_sync(wac_i2c->input_dev);
  96. + wac_i2c->gesture_key = -1;
  97. }
  98. }
  99.  
  100. diff --git a/include/linux/wacom_i2c.h b/include/linux/wacom_i2c.h
  101. index aa63618..9f8d499 100644
  102. --- a/include/linux/wacom_i2c.h
  103. +++ b/include/linux/wacom_i2c.h
  104. @@ -215,6 +215,9 @@ struct wacom_g5_callbacks {
  105. int (*check_prox)(struct wacom_g5_callbacks *);
  106. };
  107.  
  108. +#define LONG_PRESS_TIME 500
  109. +#define MIN_GEST_DIST 384
  110. +
  111. /*Parameters for i2c driver*/
  112. struct wacom_i2c {
  113. struct i2c_client *client;
  114. @@ -302,6 +305,11 @@ struct wacom_i2c {
  115. bool touch_pressed;
  116. #endif
  117. bool enabled;
  118. +
  119. + int gesture_key;
  120. + int gesture_start_x;
  121. + int gesture_start_y;
  122. + ktime_t gesture_start_time;
  123. };
  124.  
  125. struct wacom_g5_platform_data {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement