/* Doubletap2wake main function */ static void detect_doubletap2wake(int x, int y, bool st) { bool single_touch = st; #if DT2W_DEBUG pr_info(LOGTAG"x,y(%4d,%4d) single:%s\n", x, y, (single_touch) ? "true" : "false"); #endif if ((single_touch) && (dt2w_switch > 0) && (exec_count) && (touch_cnt)) { touch_cnt = false; if (touch_nr == 0) { new_touch(x, y); } else if (touch_nr == 1) { if ((calc_feather(x, x_pre) < DT2W_FEATHER) && (calc_feather(y, y_pre) < DT2W_FEATHER) && ((ktime_to_ms(ktime_get())-tap_time_pre) < DT2W_TIME)) touch_nr++; else { doubletap2wake_reset(); new_touch(x, y); } } else { doubletap2wake_reset(); new_touch(x, y); } if ((touch_nr > 1)) { pr_info(LOGTAG"ON\n"); exec_count = false; doubletap2wake_pwrtrigger(); doubletap2wake_reset(); } } }
/* Doubletap2wake main function */ static void detect_doubletap2wake(int x, int y, bool st) { if (flg_power_suspended) { // the screen is off. if ((!flg_tw_expired && sttg_tw_timeout > 0 && do_timesince(time_power_suspended) < sttg_tw_timeout) || sttg_tw_timeout == 0) { bool single_touch = st; #if WG_DEBUG pr_debug(LOGTAG"x,y(%4d,%4d) tap_time_pre:%llu\n", x, y, tap_time_pre); #endif if (x < SWEEP_EDGE || x > SWEEP_X_LIMIT) return; if (y < SWEEP_EDGE || y > SWEEP_Y_LIMIT) return; if ((single_touch) && (dt2w_switch == 1) && (exec_count) && (touch_cnt)) { touch_cnt = false; if (touch_nr == 0) { new_touch(x, y); } else if (touch_nr == 1) { if ((calc_feather(x, x_pre) < DT2W_FEATHER) && (calc_feather(y, y_pre) < DT2W_FEATHER) && ((ktime_to_ms(ktime_get())-tap_time_pre) < DT2W_TIME)) touch_nr++; else { doubletap2wake_reset(); new_touch(x, y); } } else { doubletap2wake_reset(); new_touch(x, y); } if ((touch_nr > 1)) { pr_debug(LOGTAG"double tap\n"); exec_count = false; #if (WAKE_GESTURES_ENABLED) if (gestures_switch) { report_gesture(5); } else { #endif wake_pwrtrigger(); #if (WAKE_GESTURES_ENABLED) } #endif doubletap2wake_reset(); } } } } }
static void dt2w_input_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) { if ((!scr_suspended) || (!dt2w_switch)) return; /* You can debug here with 'adb shell getevent -l' command. */ switch(code) { case ABS_MT_SLOT: doubletap2wake_reset(); break; case ABS_MT_TRACKING_ID: if (value == 0xffffffff) is_touching = false; break; case ABS_MT_POSITION_X: touch_x = value; queue_work_on(0, dt2w_input_wq, &dt2w_input_work); break; case ABS_MT_POSITION_Y: touch_y = value; queue_work_on(0, dt2w_input_wq, &dt2w_input_work); break; default: break; } }
static void dt2w_input_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) { #if DT2W_DEBUG pr_info("doubletap2wake: code: %s|%u, val: %i\n", ((code==ABS_MT_POSITION_X) ? "X" : (code==ABS_MT_POSITION_Y) ? "Y" : (code==ABS_MT_TRACKING_ID) ? "ID" : "undef"), code, value); #endif if (!scr_suspended) return; if (code == ABS_MT_SLOT) { doubletap2wake_reset(); return; } if (code == ABS_MT_TRACKING_ID && value == -1) { touch_cnt = true; queue_work_on(0, dt2w_input_wq, &dt2w_input_work); return; } if (code == ABS_MT_POSITION_X) { touch_x = value; touch_x_called = true; } if (code == ABS_MT_POSITION_Y) { touch_y = value; touch_y_called = true; } }
static void detect_doubletap2sleep(int x, int y, bool st) { bool single_touch = st; #if WG_DEBUG pr_debug(LOGTAG"x,y(%4d,%4d) tap_time_pre:%llu\n", x, y, tap_time_pre); #endif if (!flg_power_suspended && x > dt2s_x) return; if (!flg_power_suspended && y > dt2s_y) return; if (single_touch && dt2s_switch == 1 && !flg_power_suspended && exec_count && touch_cnt) { touch_cnt = false; if (touch_nr == 0) { new_touch(x, y); } else if (touch_nr == 1) { if ((calc_feather(x, x_pre) < DT2S_FEATHER) && (calc_feather(y, y_pre) < DT2S_FEATHER) && ((ktime_to_ms(ktime_get())-tap_time_pre) < DT2S_TIME)) touch_nr++; else { doubletap2wake_reset(); new_touch(x, y); } } else { doubletap2wake_reset(); new_touch(x, y); } if ((touch_nr > 1)) { pr_debug(LOGTAG"double tap\n"); exec_count = false; #if (WAKE_GESTURES_ENABLED) if (gestures_switch) { report_gesture(6); } else { #endif wake_pwrtrigger(); #if (WAKE_GESTURES_ENABLED) } #endif doubletap2wake_reset(); } } }
/* Doubletap2wake main function */ static void detect_doubletap2wake(int x, int y, bool st) { bool single_touch = st; #if WG_DEBUG pr_info(LOGTAG"x,y(%4d,%4d) tap_time_pre:%llu\n", x, y, tap_time_pre); #endif if (x < SWEEP_EDGE || x > SWEEP_X_LIMIT) return; if (y < SWEEP_EDGE || y > SWEEP_Y_LIMIT) return; if ((single_touch) && (dt2w_switch) && (exec_count) && (touch_cnt)) { touch_cnt = false; if (touch_nr == 0) { new_touch(x, y); } else if (touch_nr == 1) { if ((calc_feather(x, x_pre) < DT2W_FEATHER) && (calc_feather(y, y_pre) < DT2W_FEATHER) && ((jiffies-tap_time_pre) < DT2W_TIME)) touch_nr++; else { doubletap2wake_reset(); new_touch(x, y); } } else { doubletap2wake_reset(); new_touch(x, y); } if ((touch_nr > 1)) { pr_info(LOGTAG"double tap\n"); exec_count = false; #if (WAKE_GESTURES_ENABLED) if (gestures_switch) { report_gesture(5); } else { #endif wake_pwrtrigger(); #if (WAKE_GESTURES_ENABLED) } #endif doubletap2wake_reset(); } } }
/* Doubletap2wake main function */ static void detect_doubletap2wake(int x, int y, bool st) { bool single_touch = st; #if DT2W_DEBUG pr_info(LOGTAG"x,y(%4d,%4d) tap_time_pre:%llu\n", x, y, tap_time_pre); #endif if (x < 100 || x > 980) return; if (dt2w_switch < 2 && y < 1000) return; if ((single_touch) && (dt2w_switch > 0) && (exec_count) && (touch_cnt)) { touch_cnt = false; if (touch_nr == 0) { new_touch(x, y); } else if (touch_nr == 1) { if ((calc_feather(x, x_pre) < DT2W_FEATHER) && (calc_feather(y, y_pre) < DT2W_FEATHER) && ((jiffies-tap_time_pre) < DT2W_TIME)) touch_nr++; else { doubletap2wake_reset(); new_touch(x, y); } } else { doubletap2wake_reset(); new_touch(x, y); } if ((touch_nr > 1)) { pr_info(LOGTAG"double tap\n"); exec_count = false; set_vibrate(vib_strength); if (gestures_switch) { report_gesture(5); } else { doubletap2wake_pwrtrigger(); } doubletap2wake_reset(); } } }
/* Doubletap2wake main function */ static void detect_doubletap2wake(int x, int y) { #if DT2W_DEBUG pr_info(LOGTAG"x,y(%4d,%4d)\n", x, y); #endif if (!scr_suspended) return; if ((!is_touching) && (!is_screen_on)) { is_touching = true; // Make enable to set touch counts (Max : 10) - by jollaman999 if (touch_nr == 0) { new_touch(x, y); // dt2w: 'touch_nr++' when 'msm_pm_enter' called - by jollaman999 if (dt2w_msm_pm_enter) touch_nr++; // Make enable to set touch counts (Max : 10) - by jollaman999 } else if (touch_nr >= 1 && touch_nr <= dt2w_switch) { if (((calc_feather(x, x_pre) < DT2W_FEATHER) || (calc_feather(y, y_pre) < DT2W_FEATHER)) // Make enable to set touch counts (Max : 10) - by jollaman999 && ((ktime_to_ms(ktime_get()) - tap_time_pre) < (DT2W_TIME/2*(dt2w_switch+1)))) { touch_nr++; } else { doubletap2wake_reset(); new_touch(x, y); } } else { doubletap2wake_reset(); new_touch(x, y); } // Make enable to set touch counts (Max : 10) - by jollaman999 if ((touch_nr > dt2w_switch)) { pr_info(LOGTAG"ON\n"); is_screen_on = true; doubletap2wake_pwrtrigger(); doubletap2wake_reset(); } } }
static void wg_input_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) { if (scr_suspended() && code == ABS_MT_POSITION_X) { value -= 5000; } #if WG_DEBUG pr_info("wg: code: %s|%u, val: %i\n", ((code==ABS_MT_POSITION_X) ? "X" : (code==ABS_MT_POSITION_Y) ? "Y" : (code==ABS_MT_TRACKING_ID) ? "ID" : "undef"), code, value); #endif if (code == ABS_MT_SLOT) { sweep2wake_reset(); doubletap2wake_reset(); return; } if (code == ABS_MT_TRACKING_ID && value == -1) { sweep2wake_reset(); touch_cnt = true; queue_work_on(0, dt2w_input_wq, &dt2w_input_work); return; } if (code == ABS_MT_POSITION_X) { touch_x = value; touch_x_called = true; } if (code == ABS_MT_POSITION_Y) { touch_y = value; touch_y_called = true; } if (touch_x_called && touch_y_called) { touch_x_called = false; touch_y_called = false; queue_work_on(0, s2w_input_wq, &s2w_input_work); } else if (!scr_suspended() && touch_x_called && !touch_y_called) { touch_x_called = false; touch_y_called = false; queue_work_on(0, s2w_input_wq, &s2w_input_work); } }