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