int check_pocket(void) {
        if (pocket_detect == 1) {
                pocket_mode = pocket_detection_check();
                return pocket_mode;
        }
        return pocket_mode;
}
Exemplo n.º 2
0
/* PowerKey trigger */
void sweep2wake_pwrtrigger(void) {
	if (pocket_detection_check() == 1 && pocket_detect == 1) {
		printk("[SWEEP2WAKE]: power triggered\n");
		schedule_work(&sweep2wake_presspwr_work);
	}
	
	return;
}
/* PowerKey work func */
static void doubletap2wake_presspwr(struct work_struct * doubletap2wake_presspwr_work) {
	int pocket_mode = 0;

	if (scr_suspended == true && pocket_detect == 1)
			pocket_mode = pocket_detection_check();

	if (!pocket_mode || pocket_detect == 0) {
	if (!mutex_trylock(&pwrkeyworklock))
                return;
	input_event(doubletap2wake_pwrdev, EV_KEY, KEY_POWER, 1);
	input_event(doubletap2wake_pwrdev, EV_SYN, 0, 0);
	msleep(DT2W_PWRKEY_DUR);
	input_event(doubletap2wake_pwrdev, EV_KEY, KEY_POWER, 0);
	input_event(doubletap2wake_pwrdev, EV_SYN, 0, 0);
	msleep(DT2W_PWRKEY_DUR);
        mutex_unlock(&pwrkeyworklock);
	return;
	}
}