synaptics: fix enroll_identify problem after user reset database

This commit is contained in:
Vincent Huang
2023-07-04 15:45:36 +08:00
committed by Marco Trevisan
parent af3dca9003
commit 206e92218c
2 changed files with 15 additions and 9 deletions

View File

@@ -106,7 +106,11 @@ cmd_receive_cb (FpiUsbTransfer *transfer,
if (self->cmd_complete_on_removal) if (self->cmd_complete_on_removal)
{ {
fpi_ssm_mark_completed (transfer->ssm); if (self->delay_error)
fpi_ssm_mark_failed (transfer->ssm,
g_steal_pointer (&self->delay_error));
else
fpi_ssm_mark_completed (transfer->ssm);
return; return;
} }
} }
@@ -641,18 +645,20 @@ verify (FpDevice *device)
} }
static void static void
identify_complete_after_finger_removal (FpiDeviceSynaptics *self) identify_complete_after_finger_removal (FpiDeviceSynaptics *self, GError *error)
{ {
FpDevice *device = FP_DEVICE (self); FpDevice *device = FP_DEVICE (self);
if (self->finger_on_sensor) if (self->finger_on_sensor)
{ {
fp_dbg ("delaying identify report until after finger removal!"); fp_dbg ("delaying identify report until after finger removal!");
g_propagate_error (&self->delay_error, error);
self->cmd_complete_on_removal = TRUE; self->cmd_complete_on_removal = TRUE;
} }
else else
{ {
fpi_device_identify_complete (device, NULL); fpi_device_identify_complete (device, error);
} }
} }
@@ -702,19 +708,18 @@ identify_msg_cb (FpiDeviceSynaptics *self,
fp_info ("Match error occurred"); fp_info ("Match error occurred");
fpi_device_identify_report (device, NULL, NULL, fpi_device_identify_report (device, NULL, NULL,
fpi_device_retry_new (FP_DEVICE_RETRY_GENERAL)); fpi_device_retry_new (FP_DEVICE_RETRY_GENERAL));
identify_complete_after_finger_removal (self); identify_complete_after_finger_removal (self, NULL);
} }
else if (resp->result == BMKT_FP_NO_MATCH) else if (resp->result == BMKT_FP_NO_MATCH)
{ {
fp_info ("Print didn't match"); fp_info ("Print didn't match");
fpi_device_identify_report (device, NULL, NULL, NULL); fpi_device_identify_report (device, NULL, NULL, NULL);
identify_complete_after_finger_removal (self); identify_complete_after_finger_removal (self, NULL);
} }
else if (resp->result == BMKT_FP_DATABASE_NO_RECORD_EXISTS) else if (resp->result == BMKT_FP_DATABASE_NO_RECORD_EXISTS || resp->result == BMKT_FP_DATABASE_EMPTY)
{ {
fp_info ("Print is not in database"); fp_info ("Print is not in database");
fpi_device_identify_complete (device, identify_complete_after_finger_removal (self, fpi_device_error_new (FP_DEVICE_ERROR_DATA_NOT_FOUND));
fpi_device_error_new (FP_DEVICE_ERROR_DATA_NOT_FOUND));
} }
else else
{ {
@@ -750,7 +755,7 @@ identify_msg_cb (FpiDeviceSynaptics *self,
else else
fpi_device_identify_report (device, NULL, print, NULL); fpi_device_identify_report (device, NULL, print, NULL);
identify_complete_after_finger_removal (self); identify_complete_after_finger_removal (self, NULL);
} }
} }
} }

View File

@@ -127,4 +127,5 @@ struct _FpiDeviceSynaptics
struct syna_enroll_resp_data enroll_resp_data; struct syna_enroll_resp_data enroll_resp_data;
syna_state_t state; syna_state_t state;
GError *delay_error;
}; };