summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@chromium.org>2018-12-04 15:11:33 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-12-06 01:57:43 -0800
commite1b6bd6357caa5d8c45ce866c64712899188629f (patch)
treee5b563986d1cdcf7b5f0c58d78454ab332ec29e2 /common
parentf4f98c165e76df5941bef5637692e97889f9cabc (diff)
downloadchrome-ec-e1b6bd6357caa5d8c45ce866c64712899188629f.tar.gz
Add fingerprint match code for no template case
In the case where there are no templates to match against, we now return EC_MKBP_FP_ERR_MATCH_NO_TEMPLATES to distinguish between other error cases. BRANCH=nocturne BUG=b:120305002 TEST=enroll and unlock with updated firmware and biod TEST=delete enrolled fingerprint and verify logs when touching sensor Change-Id: If0d37d0cdb0792254b89814ac473fb6d1830f3cb Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1361814 Reviewed-by: Nicolas Norvez <norvez@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/fpsensor.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/common/fpsensor.c b/common/fpsensor.c
index 1899537649..481adad48d 100644
--- a/common/fpsensor.c
+++ b/common/fpsensor.c
@@ -191,18 +191,23 @@ static uint32_t fp_process_match(void)
/* match finger against current templates */
template_matched = -1;
CPRINTS("Matching/%d ...", templ_valid);
- if (templ_valid)
+ if (templ_valid) {
res = fp_finger_match(fp_template[0], templ_valid, fp_buffer,
&fgr, &updated);
- CPRINTS("Match =>%d (finger %d)", res, fgr);
- if (res < 0) {
- res = EC_MKBP_FP_ERR_MATCH_NO_INTERNAL;
- timestamps_invalid |= FPSTATS_MATCHING_INV;
+ CPRINTS("Match =>%d (finger %d)", res, fgr);
+ if (res < 0) {
+ res = EC_MKBP_FP_ERR_MATCH_NO_INTERNAL;
+ timestamps_invalid |= FPSTATS_MATCHING_INV;
+ } else {
+ template_matched = (int8_t)fgr;
+ }
+ if (res == EC_MKBP_FP_ERR_MATCH_YES_UPDATED)
+ templ_dirty |= updated;
} else {
- template_matched = (int8_t)fgr;
+ CPRINTS("No enrolled templates");
+ res = EC_MKBP_FP_ERR_MATCH_NO_TEMPLATES;
+ timestamps_invalid |= FPSTATS_MATCHING_INV;
}
- if (res == EC_MKBP_FP_ERR_MATCH_YES_UPDATED)
- templ_dirty |= updated;
matching_time_us = time_since32(t0);
return EC_MKBP_FP_MATCH | EC_MKBP_FP_ERRCODE(res)
| ((fgr << EC_MKBP_FP_MATCH_IDX_OFFSET) & EC_MKBP_FP_MATCH_IDX_MASK);