Share Pastebin
Guest
Public paste!

ugly double tap thing

By: a guest | Mar 14th, 2010 | Syntax: C | Size: 2.54 KB | Hits: 118 | Expires: Never
Copy text to clipboard
  1. :100644 100755 7d9e2bb... 0000000... M  drivers/input/touchscreen/tssc_manager.c
  2.  
  3. diff --git a/drivers/input/touchscreen/tssc_manager.c b/drivers/input/touchscreen/tssc_manager.c
  4. old mode 100644
  5. new mode 100755
  6. index 7d9e2bb..3360261
  7. --- a/drivers/input/touchscreen/tssc_manager.c
  8. +++ b/drivers/input/touchscreen/tssc_manager.c
  9. @@ -122,9 +122,12 @@ struct tssc_manager_data {
  10.  #endif
  11.  };
  12.  
  13. +//--- mysterious doubletap thingie
  14. +static int64_t last_up_ns;
  15. +#define DOUBLETAP_THRESHOLD_NSEC 25000000//25ms
  16.  
  17.  //----------------------------------------------
  18. -#define ENABLE_TSSC_AVERAGE
  19. +//#define ENABLE_TSSC_AVERAGE
  20.  
  21.  #define TOUCH_POLLING_NSEC 8400000//9000000//
  22.  #define TOUCH_QUEUE_NUMBER 2//3
  23. @@ -220,6 +223,24 @@ static int touch_add_queue(int x, int x16, int y, int y16,int p)
  24.   */
  25.  static void touch_input_up(struct input_dev *dev)
  26.  {
  27. +    // Here follows eval-'s new doubletap disaster
  28. +    struct timespec timespc;
  29. +    int64_t curr_ns = 0;
  30. +    int64_t t_diff = 0;
  31. +
  32. +    getnstimeofday(&timespc);
  33. +    curr_ns = timespec_to_ns(&timespc);
  34. +    t_diff = curr_ns-last_up_ns;
  35. +
  36. +    if(debug_tp & DEBUG_TP_ON)
  37. +        printk(KERN_DEBUG "touch_input_up(): t_delta: %lld  report count: %ld\n", t_diff, touch_report_count);
  38. +    last_up_ns = curr_ns;
  39. +
  40. +    // I have no (good) idea why this works.  eval, 3/13
  41. +       if (t_diff > DOUBLETAP_THRESHOLD_NSEC)
  42. +        return;
  43. +
  44. +    // original:
  45.         if (touch_report_count > 0) {
  46.                 input_report_abs(dev, ABS_PRESSURE, 0);
  47.                 input_report_abs(dev, ABS_TOOL_WIDTH, 0);
  48. @@ -272,8 +293,11 @@ static void touch_process_queue(struct input_dev *dev)
  49.                 return;
  50.         }
  51.  
  52. -       if (touch_sample_count >= TOUCH_QUEUE_NUMBER)
  53. +    // if TOUCH_QUEUE_NUMBER >2 but sample_count <TOUCH_QUEUE_NUMBER
  54. +    // then where the hell will calibration_translate et al get touch_average_x/y/p??
  55. +    if (touch_sample_count >= TOUCH_QUEUE_NUMBER)
  56.                 touch_get_average();
  57. +
  58.         calibration_translate(touch_average_x, touch_average_y, &x, &y);
  59.  
  60.         if (x >= 0 && y >= 0) {
  61. @@ -498,6 +522,7 @@ static int tssc_manager_input_init(void)
  62.         struct tssc_manager_data *ts;
  63.         int ret = 0;
  64.         int ret_down = 0;
  65. +    struct timespec timespc;
  66.  
  67.         ts = kzalloc(sizeof(*ts), GFP_KERNEL);
  68.         if (ts == NULL) {
  69. @@ -586,6 +611,10 @@ static int tssc_manager_input_init(void)
  70.                         ts->input_dev->name, ts->use_irq ? "interrupt" : "polling");
  71.         calibration_init();
  72.  
  73. +    // do something ugly for doubletap
  74. +    getnstimeofday(&timespc);
  75. +    last_up_ns = timespec_to_ns(&timespc);
  76. +
  77.         return 0;
  78.  
  79.  err_input_register_device_failed: