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
This commit is contained in:
Benjamin Berg 2019-12-04 14:28:08 +01:00 committed by Benjamin Berg
parent 2fcc2deb43
commit dccb5b3ab2

View file

@ -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;