|
|
73b847 |
From dfef13a3eb14ded653a0f1226eb5903e0b81b772 Mon Sep 17 00:00:00 2001
|
|
|
73b847 |
From: Benjamin Berg <bberg@redhat.com>
|
|
|
73b847 |
Date: Wed, 4 Dec 2019 19:54:07 +0100
|
|
|
73b847 |
Subject: [PATCH 093/181] image-device: Print warning for incorrect
|
|
|
73b847 |
deactivation
|
|
|
73b847 |
|
|
|
73b847 |
Drivers may not handle deactivation properly when they are awaiting a
|
|
|
73b847 |
finger. This should be prevented by the internal FpImageDevice state
|
|
|
73b847 |
machine.
|
|
|
73b847 |
---
|
|
|
73b847 |
libfprint/fp-image-device.c | 7 +++++++
|
|
|
73b847 |
1 file changed, 7 insertions(+)
|
|
|
73b847 |
|
|
|
73b847 |
diff --git a/libfprint/fp-image-device.c b/libfprint/fp-image-device.c
|
|
|
73b847 |
index 26c3cb0..252f414 100644
|
|
|
73b847 |
--- a/libfprint/fp-image-device.c
|
|
|
73b847 |
+++ b/libfprint/fp-image-device.c
|
|
|
73b847 |
@@ -50,6 +50,7 @@ typedef struct
|
|
|
73b847 |
{
|
|
|
73b847 |
FpImageDeviceState state;
|
|
|
73b847 |
gboolean active;
|
|
|
73b847 |
+ gboolean cancelling;
|
|
|
73b847 |
|
|
|
73b847 |
gboolean enroll_await_on_pending;
|
|
|
73b847 |
gint enroll_stage;
|
|
|
73b847 |
@@ -140,6 +141,9 @@ fp_image_device_deactivate (FpDevice *device)
|
|
|
73b847 |
fp_dbg ("Already deactivated, ignoring request.");
|
|
|
73b847 |
return;
|
|
|
73b847 |
}
|
|
|
73b847 |
+ if (!priv->cancelling && priv->state == FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON)
|
|
|
73b847 |
+ g_warning ("Deactivating image device while waiting for finger, this should not happen.");
|
|
|
73b847 |
+
|
|
|
73b847 |
priv->state = FP_IMAGE_DEVICE_STATE_INACTIVE;
|
|
|
73b847 |
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FPI_STATE]);
|
|
|
73b847 |
|
|
|
73b847 |
@@ -203,6 +207,7 @@ static void
|
|
|
73b847 |
fp_image_device_cancel_action (FpDevice *device)
|
|
|
73b847 |
{
|
|
|
73b847 |
FpImageDevice *self = FP_IMAGE_DEVICE (device);
|
|
|
73b847 |
+ FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
|
|
|
73b847 |
FpDeviceAction action;
|
|
|
73b847 |
|
|
|
73b847 |
action = fpi_device_get_current_action (device);
|
|
|
73b847 |
@@ -214,7 +219,9 @@ fp_image_device_cancel_action (FpDevice *device)
|
|
|
73b847 |
action == FP_DEVICE_ACTION_IDENTIFY ||
|
|
|
73b847 |
action == FP_DEVICE_ACTION_CAPTURE)
|
|
|
73b847 |
{
|
|
|
73b847 |
+ priv->cancelling = TRUE;
|
|
|
73b847 |
fp_image_device_deactivate (FP_DEVICE (self));
|
|
|
73b847 |
+ priv->cancelling = FALSE;
|
|
|
73b847 |
|
|
|
73b847 |
/* XXX: Some nicer way of doing this would be good. */
|
|
|
73b847 |
fpi_device_action_error (FP_DEVICE (self),
|
|
|
73b847 |
--
|
|
|
73b847 |
2.24.1
|
|
|
73b847 |
|