コード例 #1
0
void doubletap2wake_func(int x, int y, unsigned long time)
{

	int delta_x = 0;
	int delta_y = 0;

	printk("[dt2wake]: x,y(%d,%d) jiffies:%lu\n", x, y, time);

        dt2w_time[1] = dt2w_time[0];
        dt2w_time[0] = time;

	if (initial_time == 0)
		initial_time = time;	

	if (time - initial_time > DT2W_TIMEOUT_MAX) {
		reset_sweep2wake();
		printk("[SWEEP2WAKE]: d2w max timeout reset\n");
		return;
	}
	
	if ((dt2w_time[0] - dt2w_time[1]) < 10) {
		reset_sweep2wake();
		printk("[SWEEP2WAKE]: d2w min timeout reset\n");
		return;
	}
printk("[SWEEP2WAKE]: checking d2w\n");
	dt2w_x[1] = dt2w_x[0];
    dt2w_x[0] = x;
	dt2w_y[1] = dt2w_y[0];
    dt2w_y[0] = y;

	delta_x = (dt2w_x[0]-dt2w_x[1]);
	delta_y = (dt2w_y[0]-dt2w_y[1]);

        if (scr_suspended && doubletap2wake > 0) {
printk("[SWEEP2WAKE]: y = %d, timedelta = %lu, deltax= %d, deltay = %d\n",y,(dt2w_time[0] - initial_time),delta_x,delta_y);
		if (y > 50 && y < 1200
			&& ((dt2w_time[0] - initial_time) > DT2W_TIMEOUT_MIN)
			&& ((dt2w_time[0] - initial_time) < DT2W_TIMEOUT_MAX)
			&& (abs(delta_x) < DT2W_DELTA)
			&& (abs(delta_y) < DT2W_DELTA)
			) {
                printk("[DT2W]: OFF->ON\n");
                sweep2wake_pwrtrigger();
		}
	}
        return;
}
コード例 #2
0
/* PowerKey work func */
static void sweep2wake_presspwr(struct work_struct * sweep2wake_presspwr_work) {
	if (!mutex_trylock(&pwrkeyworklock))
                return;
printk("[SWEEP2WAKE]: pressing power\n");
        reset_sweep2wake();
	input_event(sweep2wake_pwrdev, EV_KEY, KEY_POWER, 1);
	input_event(sweep2wake_pwrdev, EV_SYN, 0, 0);
	msleep(DEFAULT_S2W_PWRKEY_DUR);
	input_event(sweep2wake_pwrdev, EV_KEY, KEY_POWER, 0);
	input_event(sweep2wake_pwrdev, EV_SYN, 0, 0);
	msleep(DEFAULT_S2W_PWRKEY_DUR);
        mutex_unlock(&pwrkeyworklock);
	return;
}