From 32bdd8d5c4928a720eaaaf63ec23282fecfbb2d8 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Fri, 22 May 2020 17:03:23 +0200 Subject: [PATCH] image: Fix reporting of retry on activation timeout The image driver may still be deactivating when a new activation request comes in. This is because of a hack to do early reporting, which is technically not needed anymore. Fix the immediate issue by properly reporting the retry case. The proper fix is to only finish the previous operation after the device has been deactivated. --- libfprint/fp-image-device.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/libfprint/fp-image-device.c b/libfprint/fp-image-device.c index 4e1b80e..cc5fa4c 100644 --- a/libfprint/fp-image-device.c +++ b/libfprint/fp-image-device.c @@ -62,17 +62,34 @@ static gboolean pending_activation_timeout (gpointer user_data) { FpImageDevice *self = FP_IMAGE_DEVICE (user_data); + FpDevice *device = FP_DEVICE (self); FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self); + FpiDeviceAction action = fpi_device_get_current_action (device); + GError *error; priv->pending_activation_timeout_id = 0; if (priv->pending_activation_timeout_waiting_finger_off) - fpi_device_action_error (FP_DEVICE (self), - fpi_device_retry_new_msg (FP_DEVICE_RETRY_REMOVE_FINGER, - "Remove finger before requesting another scan operation")); + error = fpi_device_retry_new_msg (FP_DEVICE_RETRY_REMOVE_FINGER, + "Remove finger before requesting another scan operation"); else - fpi_device_action_error (FP_DEVICE (self), - fpi_device_retry_new (FP_DEVICE_RETRY_GENERAL)); + error = fpi_device_retry_new (FP_DEVICE_RETRY_GENERAL); + + if (action == FPI_DEVICE_ACTION_VERIFY) + { + fpi_device_verify_report (device, FPI_MATCH_ERROR, NULL, error); + fpi_device_verify_complete (device, NULL); + } + else if (action == FPI_DEVICE_ACTION_IDENTIFY) + { + fpi_device_identify_report (device, NULL, NULL, error); + fpi_device_identify_complete (device, NULL); + } + else + { + /* Can this happen for enroll? */ + fpi_device_action_error (device, error); + } return G_SOURCE_REMOVE; }