|
|
73b847 |
From 56126df4a2b5ecee1a9580e8d27f4d3d6f6925cd Mon Sep 17 00:00:00 2001
|
|
|
73b847 |
From: Benjamin Berg <bberg@redhat.com>
|
|
|
73b847 |
Date: Wed, 4 Dec 2019 15:50:06 +0100
|
|
|
73b847 |
Subject: [PATCH 087/181] image-device: Prevent deactivation when waiting for
|
|
|
73b847 |
finger
|
|
|
73b847 |
|
|
|
73b847 |
At the end of enroll, the image device would put the driver into the
|
|
|
73b847 |
AWAIT_FINGER_ON state and then deactivate the device afterwards. Doing
|
|
|
73b847 |
this adds additional complexity to drivers which would need to handle
|
|
|
73b847 |
both cancellation and normal deactivation from that state.
|
|
|
73b847 |
|
|
|
73b847 |
Only put the device into the AWAIT_FINGER_ON state when we know that
|
|
|
73b847 |
another enroll stage is needed. This avoids the critical state
|
|
|
73b847 |
transition simplifying the driver state machine.
|
|
|
73b847 |
|
|
|
73b847 |
Fixes: #203
|
|
|
73b847 |
Fixes: 689aff023253e4ca970c9f76f9e4209188175d3d
|
|
|
73b847 |
---
|
|
|
73b847 |
libfprint/fp-image-device.c | 31 ++++++++++++++++++++++++++++---
|
|
|
73b847 |
1 file changed, 28 insertions(+), 3 deletions(-)
|
|
|
73b847 |
|
|
|
73b847 |
diff --git a/libfprint/fp-image-device.c b/libfprint/fp-image-device.c
|
|
|
73b847 |
index e45b6a9..26c3cb0 100644
|
|
|
73b847 |
--- a/libfprint/fp-image-device.c
|
|
|
73b847 |
+++ b/libfprint/fp-image-device.c
|
|
|
73b847 |
@@ -51,6 +51,7 @@ typedef struct
|
|
|
73b847 |
FpImageDeviceState state;
|
|
|
73b847 |
gboolean active;
|
|
|
73b847 |
|
|
|
73b847 |
+ gboolean enroll_await_on_pending;
|
|
|
73b847 |
gint enroll_stage;
|
|
|
73b847 |
|
|
|
73b847 |
guint pending_activation_timeout_id;
|
|
|
73b847 |
@@ -256,6 +257,7 @@ fp_image_device_start_capture_action (FpDevice *device)
|
|
|
73b847 |
}
|
|
|
73b847 |
|
|
|
73b847 |
priv->enroll_stage = 0;
|
|
|
73b847 |
+ priv->enroll_await_on_pending = FALSE;
|
|
|
73b847 |
|
|
|
73b847 |
/* The device might still be deactivating from a previous call.
|
|
|
73b847 |
* In that situation, try to wait for a bit before reporting back an
|
|
|
73b847 |
@@ -385,6 +387,22 @@ fp_image_device_init (FpImageDevice *self)
|
|
|
73b847 |
|
|
|
73b847 |
}
|
|
|
73b847 |
|
|
|
73b847 |
+static void
|
|
|
73b847 |
+fp_image_device_enroll_maybe_await_finger_on (FpImageDevice *self)
|
|
|
73b847 |
+{
|
|
|
73b847 |
+ FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
|
|
|
73b847 |
+
|
|
|
73b847 |
+ if (priv->enroll_await_on_pending)
|
|
|
73b847 |
+ {
|
|
|
73b847 |
+ priv->enroll_await_on_pending = FALSE;
|
|
|
73b847 |
+ fp_image_device_change_state (self, FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON);
|
|
|
73b847 |
+ }
|
|
|
73b847 |
+ else
|
|
|
73b847 |
+ {
|
|
|
73b847 |
+ priv->enroll_await_on_pending = TRUE;
|
|
|
73b847 |
+ }
|
|
|
73b847 |
+}
|
|
|
73b847 |
+
|
|
|
73b847 |
static void
|
|
|
73b847 |
fpi_image_device_minutiae_detected (GObject *source_object, GAsyncResult *res, gpointer user_data)
|
|
|
73b847 |
{
|
|
|
73b847 |
@@ -446,11 +464,16 @@ fpi_image_device_minutiae_detected (GObject *source_object, GAsyncResult *res, g
|
|
|
73b847 |
fpi_device_enroll_progress (device, priv->enroll_stage,
|
|
|
73b847 |
g_steal_pointer (&print), error);
|
|
|
73b847 |
|
|
|
73b847 |
+ /* Start another scan or deactivate. */
|
|
|
73b847 |
if (priv->enroll_stage == IMG_ENROLL_STAGES)
|
|
|
73b847 |
{
|
|
|
73b847 |
fpi_device_enroll_complete (device, g_object_ref (enroll_print), NULL);
|
|
|
73b847 |
fp_image_device_deactivate (device);
|
|
|
73b847 |
}
|
|
|
73b847 |
+ else
|
|
|
73b847 |
+ {
|
|
|
73b847 |
+ fp_image_device_enroll_maybe_await_finger_on (FP_IMAGE_DEVICE (device));
|
|
|
73b847 |
+ }
|
|
|
73b847 |
}
|
|
|
73b847 |
else if (action == FP_DEVICE_ACTION_VERIFY)
|
|
|
73b847 |
{
|
|
|
73b847 |
@@ -572,13 +595,15 @@ fpi_image_device_report_finger_status (FpImageDevice *self,
|
|
|
73b847 |
* 2. We are still deactivating the device after an action completed
|
|
|
73b847 |
* 3. We were waiting for finger removal to start the new action
|
|
|
73b847 |
* Either way, we always end up deactivating except for the enroll case.
|
|
|
73b847 |
- * XXX: This is not quite correct though, as we assume we need another finger
|
|
|
73b847 |
- * scan even though we might be processing the last one (successfully).
|
|
|
73b847 |
+ *
|
|
|
73b847 |
+ * The enroll case is special as AWAIT_FINGER_ON should only happen after
|
|
|
73b847 |
+ * minutiae detection to prevent deactivation (without cancellation)
|
|
|
73b847 |
+ * from the AWAIT_FINGER_ON state.
|
|
|
73b847 |
*/
|
|
|
73b847 |
if (action != FP_DEVICE_ACTION_ENROLL)
|
|
|
73b847 |
fp_image_device_deactivate (device);
|
|
|
73b847 |
else
|
|
|
73b847 |
- fp_image_device_change_state (self, FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON);
|
|
|
73b847 |
+ fp_image_device_enroll_maybe_await_finger_on (self);
|
|
|
73b847 |
}
|
|
|
73b847 |
}
|
|
|
73b847 |
|
|
|
73b847 |
--
|
|
|
73b847 |
2.24.1
|
|
|
73b847 |
|