diff --git a/libfprint/fp-device.c b/libfprint/fp-device.c index 0d79fae1..17178d19 100644 --- a/libfprint/fp-device.c +++ b/libfprint/fp-device.c @@ -1172,10 +1172,6 @@ fp_device_enroll (FpDevice *device, } } - priv->current_action = FPI_DEVICE_ACTION_ENROLL; - priv->current_task = g_steal_pointer (&task); - setup_task_cancellable (device); - fpi_device_update_temp (device, TRUE); if (priv->temp_current == FP_TEMPERATURE_HOT) { @@ -1184,6 +1180,10 @@ fp_device_enroll (FpDevice *device, return; } + priv->current_action = FPI_DEVICE_ACTION_ENROLL; + priv->current_task = g_steal_pointer (&task); + setup_task_cancellable (device); + data = g_new0 (FpEnrollData, 1); data->print = g_object_ref_sink (template_print); data->enroll_progress_cb = progress_cb; @@ -1273,10 +1273,6 @@ fp_device_verify (FpDevice *device, return; } - priv->current_action = FPI_DEVICE_ACTION_VERIFY; - priv->current_task = g_steal_pointer (&task); - setup_task_cancellable (device); - fpi_device_update_temp (device, TRUE); if (priv->temp_current == FP_TEMPERATURE_HOT) { @@ -1285,6 +1281,10 @@ fp_device_verify (FpDevice *device, return; } + priv->current_action = FPI_DEVICE_ACTION_VERIFY; + priv->current_task = g_steal_pointer (&task); + setup_task_cancellable (device); + data = g_new0 (FpMatchData, 1); data->enrolled_print = g_object_ref (enrolled_print); data->match_cb = match_cb; @@ -1408,10 +1408,6 @@ fp_device_identify (FpDevice *device, return; } - priv->current_action = FPI_DEVICE_ACTION_IDENTIFY; - priv->current_task = g_steal_pointer (&task); - setup_task_cancellable (device); - fpi_device_update_temp (device, TRUE); if (priv->temp_current == FP_TEMPERATURE_HOT) { @@ -1420,6 +1416,10 @@ fp_device_identify (FpDevice *device, return; } + priv->current_action = FPI_DEVICE_ACTION_IDENTIFY; + priv->current_task = g_steal_pointer (&task); + setup_task_cancellable (device); + data = g_new0 (FpMatchData, 1); /* We cannot store the gallery directly, because the ptr array may not own * a reference to each print. Also, the caller could in principle modify the @@ -1533,10 +1533,6 @@ fp_device_capture (FpDevice *device, return; } - priv->current_action = FPI_DEVICE_ACTION_CAPTURE; - priv->current_task = g_steal_pointer (&task); - setup_task_cancellable (device); - fpi_device_update_temp (device, TRUE); if (priv->temp_current == FP_TEMPERATURE_HOT) { @@ -1545,6 +1541,10 @@ fp_device_capture (FpDevice *device, return; } + priv->current_action = FPI_DEVICE_ACTION_CAPTURE; + priv->current_task = g_steal_pointer (&task); + setup_task_cancellable (device); + priv->wait_for_finger = wait_for_finger; cls->capture (device); diff --git a/tests/test-fpi-device.c b/tests/test-fpi-device.c index 2b5a9dc1..f778eaa8 100644 --- a/tests/test-fpi-device.c +++ b/tests/test-fpi-device.c @@ -2388,6 +2388,11 @@ test_driver_identify_warmup_cooldown (void) g_assert_true (identify_data->called); g_assert_error (identify_data->error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_TOO_HOT); + /* Try to identify again, and ensure that we fail early */ + fp_device_identify_sync (device, prints, NULL, NULL, NULL, NULL, NULL, &error); + g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_TOO_HOT); + g_clear_error (&error); + /* Now, wait for it to cool down again; * WARM should be reached after about 2s * COLD after 5s but give it some more slack. */