Files
OpenCellular/common
Alec Berg a490cbfe80 gesture: fix double tap doesn't always work in suspend
Fix bug where sometimes on suspend tap for battery would never work,
but open a resume and suspend again it would work fine. Problem is
that if suspended when accel circular buffer index is 1, then
we would never run the detection algorithm, because the check for
if the history buffer has been initialized is incorrect.

This also fixes the algorithm so that on suspend, it requires the
full sensor history buffer  be filled up again before starting to
detect the double tap.

BUG=chrome-os-partner:45930
BRANCH=samus
TEST=go in to suspend when history_index is 1 and verify that tap
for battery works. wrote following console command to pause the
circular buffer at a specific index.

static int pause_index = -1;
static int check_pause;
static void gesture_chipset_resume(void)
{
        /* disable tap detection */
        check_pause = 1;
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, gesture_chipset_resume,
             GESTURE_HOOK_PRIO);

void gesture_calc(void)
{
        if (check_pause) {
                if (pause_index < 0 || history_idx == pause_index) {
                        ccprintf("Paused at %d\n", pause_index);
                        tap_detection = 0;
                        pause_index = -1;
                        check_pause = 0;
                }
        }
	...

static int command_tap_pause(int argc, char **argv)
{
        char *e;
        int v;

        if (argc == 2) {
                v = strtoi(argv[1], &e, 0);
                if (*e)
                        return EC_ERROR_PARAM1;

                pause_index = v;
        }

        return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(tappause, command_tap_pause,
                        "",
                        "", NULL);

Change-Id: I2ba4ab2c807ec6ac1885a4829efedac3c83b32f1
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/302648
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2015-09-29 11:28:40 -07:00
..
2013-12-20 05:07:58 +00:00
2014-05-21 20:32:17 +00:00
2015-06-04 19:33:00 +00:00
2015-09-23 21:26:22 -07:00
2014-05-21 20:32:17 +00:00
2014-05-21 20:32:17 +00:00
2014-05-21 20:32:17 +00:00
2015-05-19 02:46:27 +00:00
2015-09-25 18:05:27 -07:00
2014-03-06 21:33:09 +00:00
2015-08-22 01:37:51 +00:00
2015-09-25 09:13:34 -07:00
2014-01-14 09:19:45 +00:00
2014-05-17 20:14:17 +00:00
2013-12-19 00:12:28 +00:00
2015-09-23 21:26:22 -07:00
2014-05-21 20:32:17 +00:00
2015-09-21 11:23:31 -07:00
2014-05-21 20:32:17 +00:00
2015-09-21 01:13:54 -07:00
2015-09-24 12:46:28 -07:00