summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/fpsensor.c21
-rw-r--r--include/ec_commands.h1
2 files changed, 14 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);
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 7e651ea214..5340c3d470 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -3477,6 +3477,7 @@ struct ec_response_keyboard_factory_test {
/* code given by EC_MKBP_FP_ERRCODE() when EC_MKBP_FP_MATCH is set */
#define EC_MKBP_FP_ERR_MATCH_NO 0
#define EC_MKBP_FP_ERR_MATCH_NO_INTERNAL 6
+#define EC_MKBP_FP_ERR_MATCH_NO_TEMPLATES 7
#define EC_MKBP_FP_ERR_MATCH_NO_LOW_QUALITY 2
#define EC_MKBP_FP_ERR_MATCH_NO_LOW_COVERAGE 4
#define EC_MKBP_FP_ERR_MATCH_YES 1