synaptics: Use critical section API
This is more for demonstration purposes. The only functional change here would be that the delete command cannot be cancelled.
This commit is contained in:
parent
ff6caca2e3
commit
d547c000fc
2 changed files with 32 additions and 0 deletions
|
@ -510,6 +510,12 @@ verify_msg_cb (FpiDeviceSynaptics *self,
|
||||||
FpDevice *device = FP_DEVICE (self);
|
FpDevice *device = FP_DEVICE (self);
|
||||||
bmkt_verify_resp_t *verify_resp;
|
bmkt_verify_resp_t *verify_resp;
|
||||||
|
|
||||||
|
if (self->action_starting)
|
||||||
|
{
|
||||||
|
fpi_device_critical_leave (device);
|
||||||
|
self->action_starting = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
fpi_device_verify_complete (device, error);
|
fpi_device_verify_complete (device, error);
|
||||||
|
@ -602,6 +608,8 @@ verify (FpDevice *device)
|
||||||
|
|
||||||
G_DEBUG_HERE ();
|
G_DEBUG_HERE ();
|
||||||
|
|
||||||
|
self->action_starting = TRUE;
|
||||||
|
fpi_device_critical_enter (device);
|
||||||
synaptics_sensor_cmd (self, 0, BMKT_CMD_VERIFY_USER, user_id, user_id_len, verify_msg_cb);
|
synaptics_sensor_cmd (self, 0, BMKT_CMD_VERIFY_USER, user_id, user_id_len, verify_msg_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -629,6 +637,12 @@ identify_msg_cb (FpiDeviceSynaptics *self,
|
||||||
{
|
{
|
||||||
FpDevice *device = FP_DEVICE (self);
|
FpDevice *device = FP_DEVICE (self);
|
||||||
|
|
||||||
|
if (self->action_starting)
|
||||||
|
{
|
||||||
|
fpi_device_critical_leave (device);
|
||||||
|
self->action_starting = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
fpi_device_identify_complete (device, error);
|
fpi_device_identify_complete (device, error);
|
||||||
|
@ -718,6 +732,7 @@ static void
|
||||||
identify (FpDevice *device)
|
identify (FpDevice *device)
|
||||||
{
|
{
|
||||||
GPtrArray *prints = NULL;
|
GPtrArray *prints = NULL;
|
||||||
|
FpiDeviceSynaptics *self = FPI_DEVICE_SYNAPTICS (device);
|
||||||
|
|
||||||
fpi_device_get_identify_data (device, &prints);
|
fpi_device_get_identify_data (device, &prints);
|
||||||
|
|
||||||
|
@ -732,6 +747,9 @@ identify (FpDevice *device)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self->action_starting = TRUE;
|
||||||
|
fpi_device_critical_enter (device);
|
||||||
|
|
||||||
init_identify_msg (device);
|
init_identify_msg (device);
|
||||||
compose_and_send_identify_msg (device);
|
compose_and_send_identify_msg (device);
|
||||||
}
|
}
|
||||||
|
@ -834,6 +852,12 @@ enroll_msg_cb (FpiDeviceSynaptics *self,
|
||||||
FpDevice *device = FP_DEVICE (self);
|
FpDevice *device = FP_DEVICE (self);
|
||||||
bmkt_enroll_resp_t *enroll_resp;
|
bmkt_enroll_resp_t *enroll_resp;
|
||||||
|
|
||||||
|
if (self->action_starting)
|
||||||
|
{
|
||||||
|
fpi_device_critical_leave (device);
|
||||||
|
self->action_starting = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
fpi_device_enroll_complete (device, NULL, error);
|
fpi_device_enroll_complete (device, NULL, error);
|
||||||
|
@ -980,6 +1004,9 @@ enroll (FpDevice *device)
|
||||||
payload[1] = finger;
|
payload[1] = finger;
|
||||||
memcpy (payload + 2, user_id, user_id_len);
|
memcpy (payload + 2, user_id, user_id_len);
|
||||||
|
|
||||||
|
self->action_starting = TRUE;
|
||||||
|
fpi_device_critical_enter (device);
|
||||||
|
|
||||||
synaptics_sensor_cmd (self, 0, BMKT_CMD_ENROLL_USER, payload, user_id_len + 2, enroll_msg_cb);
|
synaptics_sensor_cmd (self, 0, BMKT_CMD_ENROLL_USER, payload, user_id_len + 2, enroll_msg_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -993,6 +1020,7 @@ delete_msg_cb (FpiDeviceSynaptics *self,
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
|
fpi_device_critical_leave (device);
|
||||||
fpi_device_delete_complete (device, error);
|
fpi_device_delete_complete (device, error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1007,6 +1035,7 @@ delete_msg_cb (FpiDeviceSynaptics *self,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BMKT_RSP_DEL_USER_FP_FAIL:
|
case BMKT_RSP_DEL_USER_FP_FAIL:
|
||||||
|
fpi_device_critical_leave (device);
|
||||||
if (resp->result == BMKT_FP_DATABASE_NO_RECORD_EXISTS ||
|
if (resp->result == BMKT_FP_DATABASE_NO_RECORD_EXISTS ||
|
||||||
resp->result == BMKT_FP_DATABASE_EMPTY)
|
resp->result == BMKT_FP_DATABASE_EMPTY)
|
||||||
{
|
{
|
||||||
|
@ -1023,6 +1052,7 @@ delete_msg_cb (FpiDeviceSynaptics *self,
|
||||||
|
|
||||||
case BMKT_RSP_DEL_USER_FP_OK:
|
case BMKT_RSP_DEL_USER_FP_OK:
|
||||||
fp_info ("Successfully deleted enrolled user");
|
fp_info ("Successfully deleted enrolled user");
|
||||||
|
fpi_device_critical_leave (device);
|
||||||
fpi_device_delete_complete (device, NULL);
|
fpi_device_delete_complete (device, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1057,6 +1087,7 @@ delete_print (FpDevice *device)
|
||||||
payload[0] = finger;
|
payload[0] = finger;
|
||||||
memcpy (payload + 1, user_id, user_id_len);
|
memcpy (payload + 1, user_id, user_id_len);
|
||||||
|
|
||||||
|
fpi_device_critical_enter (device);
|
||||||
synaptics_sensor_cmd (self, 0, BMKT_CMD_DEL_USER_FP, payload, user_id_len + 1, delete_msg_cb);
|
synaptics_sensor_cmd (self, 0, BMKT_CMD_DEL_USER_FP, payload, user_id_len + 1, delete_msg_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,7 @@ struct _FpiDeviceSynaptics
|
||||||
|
|
||||||
bmkt_sensor_version_t mis_version;
|
bmkt_sensor_version_t mis_version;
|
||||||
|
|
||||||
|
gboolean action_starting;
|
||||||
GCancellable *interrupt_cancellable;
|
GCancellable *interrupt_cancellable;
|
||||||
|
|
||||||
gint enroll_stage;
|
gint enroll_stage;
|
||||||
|
|
Loading…
Reference in a new issue