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.
This commit is contained in:
parent
a64ac2296b
commit
702255b182
1 changed files with 7 additions and 0 deletions
|
@ -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),
|
||||
|
|
Loading…
Reference in a new issue