summaryrefslogtreecommitdiff
path: root/board/cr50
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@google.com>2019-01-23 16:35:02 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-01-30 20:41:20 -0800
commitf3a919e2f449a65c4be223938318bf37f5164ad8 (patch)
tree437593d1c03253b208d5861e6c8824f66d47ad91 /board/cr50
parent607684deda0af0c8c143b107685b47283acac65d (diff)
downloadchrome-ec-f3a919e2f449a65c4be223938318bf37f5164ad8.tar.gz
cr50: change how u2f calculates recent power button presses
The logic was wrong, so we were ignoring power button presses for the first 10 seconds after cr50 reset. This changes the logic, so if there was a power button press and it happened in the last 10 seconds pop_check_presence will return that there was a power button press. BUG=b:123310652 BRANCH=none TEST=Reboot cr50. Press the power button 5s after boot. Use powerbtn command within 10 seconds of the press and make sure Presence shows 1. Press the power button. Wait 10 seconds and make sure Presence shows 0. Change-Id: Idd4a285619b1ee9d46ed8774c5b826dd8600eeed Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1432914 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'board/cr50')
-rw-r--r--board/cr50/u2f.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/board/cr50/u2f.c b/board/cr50/u2f.c
index 285ca2af93..0d474ef33d 100644
--- a/board/cr50/u2f.c
+++ b/board/cr50/u2f.c
@@ -40,7 +40,8 @@ void power_button_record(void)
enum touch_state pop_check_presence(int consume)
{
- int recent = (get_time().val - PRESENCE_TIMEOUT) < last_press.val;
+ int recent = ((last_press.val > 0) &&
+ ((get_time().val - last_press.val) < PRESENCE_TIMEOUT));
CPRINTS("Presence:%d", recent);
if (consume)