From dccb5b3ab2751947b9aca81f16dad91ce27b2378 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Wed, 4 Dec 2019 14:28:08 +0100 Subject: [PATCH] elan: Fix internal state machine to ensure correct deactivation During calibration, the internal state was stored as INACTIVE. This is not true though, the device is actively running state machines. Move the state update to the start of the operation, therefore ensuring we don't deactivate without completing the SSM. Note that this will prevent a crash, but the driver still does not behave quite correctly when such a state change does happen. However, this is just a safety measure as the state change should not happen in the first place. See: #203 --- libfprint/drivers/elan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libfprint/drivers/elan.c b/libfprint/drivers/elan.c index 90a0306..9495a48 100644 --- a/libfprint/drivers/elan.c +++ b/libfprint/drivers/elan.c @@ -776,7 +776,6 @@ calibrate_complete (FpiSsm *ssm, FpDevice *dev, GError *error) } else { - self->dev_state = FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON; elan_capture (dev); } @@ -966,6 +965,7 @@ elan_change_state (FpImageDevice *idev) { case FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON: /* activation completed or another enroll stage started */ + self->dev_state = FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON; elan_calibrate (dev); break;