From 3b4711312219c205542a1cf5b1f0fef6e3d1828c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 16 Jan 2020 20:00:15 +0100 Subject: [PATCH] synaptics: Immediately complete verification if finger removed When quickly scanning a finger with the synaptic driver, it may wait forever for finger removal even if this has already happened. In fact we don't take care of the finger status when reporting the verification. To avoid this, add a function that delays the completion of the verification until the finger removal if the finger is on sensor, otherwise it just performs it. Fixes #228 --- libfprint/drivers/synaptics/synaptics.c | 28 +++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/libfprint/drivers/synaptics/synaptics.c b/libfprint/drivers/synaptics/synaptics.c index c7fbe35..49bdfec 100644 --- a/libfprint/drivers/synaptics/synaptics.c +++ b/libfprint/drivers/synaptics/synaptics.c @@ -575,6 +575,22 @@ list (FpDevice *device) synaptics_sensor_cmd (self, 0, BMKT_CMD_GET_TEMPLATE_RECORDS, NULL, 0, list_msg_cb); } +static void +verify_complete_after_finger_removal (FpiDeviceSynaptics *self) +{ + FpDevice *device = FP_DEVICE (self); + + if (self->finger_on_sensor) + { + fp_dbg ("delaying verify report until after finger removal!"); + self->cmd_complete_on_removal = TRUE; + } + else + { + fpi_device_verify_complete (device, NULL); + } +} + static void verify_msg_cb (FpiDeviceSynaptics *self, bmkt_response_t *resp, @@ -610,18 +626,18 @@ verify_msg_cb (FpiDeviceSynaptics *self, break; case BMKT_RSP_VERIFY_FAIL: - if(resp->result == BMKT_SENSOR_STIMULUS_ERROR) + if (resp->result == BMKT_SENSOR_STIMULUS_ERROR) { - fp_dbg ("delaying retry error until after finger removal!"); - self->cmd_complete_on_removal = TRUE; + fp_info ("Match error occurred"); fpi_device_verify_report (device, FPI_MATCH_ERROR, NULL, fpi_device_retry_new (FP_DEVICE_RETRY_GENERAL)); + verify_complete_after_finger_removal (self); } else if (resp->result == BMKT_FP_NO_MATCH) { - fp_dbg ("delaying match failure until after finger removal!"); - self->cmd_complete_on_removal = TRUE; - fpi_device_verify_report (device, FPI_MATCH_FAIL, NULL, NULL); + fp_info ("Print didn't match"); + fpi_device_verify_report (device, FPI_MATCH_FAIL, NULL, error); + verify_complete_after_finger_removal (self); } else if (resp->result == BMKT_FP_DATABASE_NO_RECORD_EXISTS) {