static void detect_sweep2sleep (int x, int y) { switch (y_res) { case 1280: if (y < y_res - 100) { s2s_reset(); return; } break; case 1920: if (y < y_res - 145) { s2s_reset(); return; } break; } if (x0 == -1) { x0 = x_pre = x; return; } if ((x0 <= x_pre && x_pre <= x) || (x0 >= x_pre && x_pre >= x)) { if (abs(x0 - x) >= s2s_length) { doubletap2wake_pwrtrigger(); s2s_reset(); return; } x_pre = x; } else s2s_reset(); return; }
static void detect_sweep2sleep (int x, int y) { if (y < (y_res - s2s_height - s2s_feather)) { s2s_reset(); return; } if (x0 == -1) { if (y < y_res - s2s_height) { s2s_reset(); return; } x0 = x_pre = x; return; } if ((x0 <= x_pre && x_pre <= x) || (x0 >= x_pre && x_pre >= x)) { if (abs(x0 - x) >= s2s_length && y >= y_res - s2s_height) { doubletap2wake_pwrtrigger(); s2s_reset(); return; } x_pre = x; } else s2s_reset(); return; }
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 type: %d\n", ((code==ABS_MT_POSITION_X) ? "X" : (code==ABS_MT_POSITION_Y) ? "Y" : (code==ABS_MT_TRACKING_ID) ? "ID" : "undef"), code, value, type); #endif if (!scr_suspended && s2s_switch > 0) { if (code == BTN_TOUCH) { if (value == 1) touch_cnt = true; else s2s_reset(); return; } if (!touch_cnt) 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_cnt) { touch_x_called = false; touch_y_called = false; queue_work_on(0, dt2w_input_wq, &s2s_input_work); } } if (!scr_suspended || dt2w_switch == 0) return; if (code == BTN_TOUCH && value == 1) { touch_cnt = true; return; } if (code == ABS_MT_POSITION_X) { touch_x = value; touch_x_called = true; } if (code == ABS_MT_POSITION_Y) { switch (dt2w_switch) { case DT2W_TOP_HALF: if (value > y_res / 2) return; break; case DT2W_BOTTOM_HALF: if (value < y_res / 2) return; break; case DT2W_NAVBAR: switch (y_res) { case 1280: if (value < y_res - 100) return; break; case 1920: if (value < y_res - 145) return; break; } } touch_y = value; touch_y_called = true; } if (touch_x_called && touch_y_called && touch_cnt) { touch_x_called = false; touch_y_called = false; queue_work_on(0, dt2w_input_wq, &dt2w_input_work); } }