Example #1
0
static void wakefunc_rtc_callback(struct alarm *al)
{
	struct timeval ts;
	ts = ktime_to_timeval(alarm_get_elapsed_realtime());

	wake_pwrtrigger();
	
	pr_debug("%s: Time of alarm expiry: %ld\n", WAKEFUNC,
			ts.tv_sec);
}
Example #2
0
/* 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();
				}
			}
		}
	}
}
Example #3
0
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();
		}
	}
}
static void detect_sweep2wake_h(int x, int y, bool st, bool scr_suspended)
{
        int prevx = 0, nextx = 0;
        bool single_touch = st;

	if (firstx == 0) {
		firstx = x;
		firstx_time = jiffies;
	}

#if WG_DEBUG
        pr_info(LOGTAG"s2w Horz x,y(%4d,%4d) wake:%s\n",
                x, y, (scr_suspended) ? "true" : "false");
#endif
	//left->right
	if (firstx < SWEEP_X_START && single_touch &&
			((scr_suspended && (s2w_switch & SWEEP_RIGHT)) ||
			(!scr_suspended && (s2s_switch & SWEEP_POR) && (y < SWEEP_EDGE || y > SWEEP_Y_LIMIT)))) {
		prevx = 0;
		nextx = SWEEP_X_B1;
		if ((barrierx[0] == true) ||
		   ((x > prevx) && (x < nextx))) {
			prevx = nextx;
			nextx = SWEEP_X_B2;
			barrierx[0] = true;
			if ((barrierx[1] == true) ||
			   ((x > prevx) && (x < nextx))) {
				prevx = nextx;
				barrierx[1] = true;
				if (x > prevx) {
					if (x > (SWEEP_X_MAX - SWEEP_X_FINAL)) {
						if (exec_countx && (jiffies - firstx_time < SWEEP_TIMEOUT)) {
							pr_info(LOGTAG"sweep right\n");
#if (WAKE_GESTURES_ENABLED)
							if (gestures_switch && scr_suspended) {
								report_gesture(1);
							} else {
#endif
								wake_pwrtrigger();
#if (WAKE_GESTURES_ENABLED)
							}
#endif							
							exec_countx = false;
						}
					}
				}
			}
		}
	//right->left
	} else if (firstx >= SWEEP_X_START && single_touch &&
			((scr_suspended && (s2w_switch & SWEEP_LEFT)) ||
			(!scr_suspended && (s2s_switch & SWEEP_POR) && (y < SWEEP_EDGE || y > SWEEP_Y_LIMIT) ))) {
		prevx = (SWEEP_X_MAX - SWEEP_X_FINAL);
		nextx = SWEEP_X_B2;
		if ((barrierx[0] == true) ||
		   ((x < prevx) && (x > nextx))) {
			prevx = nextx;
			nextx = SWEEP_X_B1;
			barrierx[0] = true;
			if ((barrierx[1] == true) ||
			   ((x < prevx) && (x > nextx))) {
				prevx = nextx;
				barrierx[1] = true;
				if (x < prevx) {
					if (x < SWEEP_X_FINAL) {
						if (exec_countx) {
							pr_info(LOGTAG"sweep left\n");
#if (WAKE_GESTURES_ENABLED)
							if (gestures_switch && scr_suspended) {
								report_gesture(2);
							} else {
#endif
								wake_pwrtrigger();
#if (WAKE_GESTURES_ENABLED)
							}		
#endif							
							exec_countx = false;
						}
					}
				}
			}
		}
	}
}
static void detect_sweep2wake_v(int x, int y, bool st, bool scr_suspended)
{
	int prevy = 0, nexty = 0;
        bool single_touch = st;

	if (firsty == 0) {
		firsty = y;
		firsty_time = jiffies;
	}

#if WG_DEBUG
        pr_info(LOGTAG"s2w vert  x,y(%4d,%4d) single:%s\n",
                x, y, (single_touch) ? "true" : "false");
#endif

	//sweep up
	if (firsty > SWEEP_Y_START && single_touch &&
			((scr_suspended && (s2w_switch & SWEEP_UP)) ||
			(!scr_suspended && (s2s_switch & SWEEP_LAN) && (x < SWEEP_EDGE || x > SWEEP_X_LIMIT) ))) {
		prevy = firsty;
		nexty = prevy - SWEEP_Y_NEXT;
		if (barriery[0] == true || (y < prevy && y > nexty)) {
			prevy = nexty;
			nexty -= SWEEP_Y_NEXT;
			barriery[0] = true;
			if (barriery[1] == true || (y < prevy && y > nexty)) {
				prevy = nexty;
				barriery[1] = true;
				if (y < prevy) {
					if (y < (nexty - SWEEP_Y_NEXT)) {
						if (exec_county && (jiffies - firsty_time < SWEEP_TIMEOUT)) {
							pr_info(LOGTAG"sweep up\n");
#if (WAKE_GESTURES_ENABLED)
							if (gestures_switch && scr_suspended) {
								report_gesture(3);
							} else {
#endif
								wake_pwrtrigger();
#if (WAKE_GESTURES_ENABLED)
							}		
#endif								
							exec_county = false;
						}
					}
				}
			}
		}
	//sweep down
	} else if (firsty <= SWEEP_Y_START && single_touch &&
			((scr_suspended && (s2w_switch & SWEEP_DOWN)) ||
			(!scr_suspended && (s2s_switch & SWEEP_LAN) && (x < SWEEP_EDGE || x > SWEEP_X_LIMIT) ))) {
		prevy = firsty;
		nexty = prevy + SWEEP_Y_NEXT;
		if (barriery[0] == true || (y > prevy && y < nexty)) {
			prevy = nexty;
			nexty += SWEEP_Y_NEXT;
			barriery[0] = true;
			if (barriery[1] == true || (y > prevy && y < nexty)) {
				prevy = nexty;
				barriery[1] = true;
				if (y > prevy) {
					if (y > (nexty + SWEEP_Y_NEXT)) {
						if (exec_county && (jiffies - firsty_time < SWEEP_TIMEOUT)) {
							pr_info(LOGTAG"sweep down\n");
#if (WAKE_GESTURES_ENABLED)
							if (gestures_switch && scr_suspended) {
								report_gesture(4);
							} else {
#endif
								wake_pwrtrigger();
#if (WAKE_GESTURES_ENABLED)
							}								
#endif
							exec_county = false;
						}
					}
				}
			}
		}
	}
	
}
Example #7
0
static void detect_sweep2wake_v(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) {

			int prevy = 0, nexty = 0;
		        bool single_touch = st;

			if (firsty == 0) {
				firsty = y;
				firsty_time = jiffies;
			}

		#if WG_DEBUG
		        pr_info(LOGTAG"s2w vert  x,y(%4d,%4d) single:%s\n",
		                x, y, (single_touch) ? "true" : "false");
		#endif

			//sweep up
			if (firsty > SWEEP_Y_START && single_touch && s2w_switch & SWEEP_UP) {
				prevy = firsty;
				nexty = prevy - SWEEP_Y_NEXT;
				if (barriery[0] == true || (y < prevy && y > nexty)) {
					prevy = nexty;
					nexty -= SWEEP_Y_NEXT;
					barriery[0] = true;
					if (barriery[1] == true || (y < prevy && y > nexty)) {
						prevy = nexty;
						barriery[1] = true;
						if (y < prevy) {
							if (y < (nexty - SWEEP_Y_NEXT)) {
								if (exec_county && (jiffies - firsty_time < SWEEP_TIMEOUT)) {
									pr_debug(LOGTAG"sweep up\n");
										wake_pwrtrigger();
		#if (WAKE_GESTURES_ENABLED)
									if (gestures_switch) {
										report_gesture(3);
									} else {
		#endif
										wake_pwrtrigger();
		#if (WAKE_GESTURES_ENABLED)
									}		
		#endif								
									exec_county = false;
								}
							}
						}
					}
			}	//sweep down
			} else if (firsty <= SWEEP_Y_START && single_touch && s2w_switch & SWEEP_DOWN) {
				prevy = firsty;
				nexty = prevy + SWEEP_Y_NEXT;
				if (barriery[0] == true || (y > prevy && y < nexty)) {
					prevy = nexty;
					nexty += SWEEP_Y_NEXT;
					barriery[0] = true;
					if (barriery[1] == true || (y > prevy && y < nexty)) {
						prevy = nexty;
						barriery[1] = true;
						if (y > prevy) {
							if (y > (nexty + SWEEP_Y_NEXT)) {
								if (exec_county && (jiffies - firsty_time < SWEEP_TIMEOUT)) {
									pr_debug(LOGTAG"sweep down\n");
										wake_pwrtrigger();
		#if (WAKE_GESTURES_ENABLED)
									if (gestures_switch) {
										report_gesture(4);
									} else {
		#endif
										wake_pwrtrigger();
		#if (WAKE_GESTURES_ENABLED)
									}								
		#endif
									exec_county = false;
								}
							}
						}
					}
				}
			}
		}
	}
}