mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2026-09-10 13:00:08 +00:00
mafpmoc: Ignore prints not enrolled by FPrint when listing them
This commit is contained in:
@@ -492,7 +492,7 @@ mafp_template_from_print (FpPrint *print)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static FpPrint *
|
static FpPrint *
|
||||||
mafp_print_from_template (FpiDeviceMafpmoc *self, mafp_template_t template)
|
mafp_print_from_template (FpiDeviceMafpmoc *self, mafp_template_t *template)
|
||||||
{
|
{
|
||||||
FpPrint *print;
|
FpPrint *print;
|
||||||
GVariant *data;
|
GVariant *data;
|
||||||
@@ -503,22 +503,22 @@ mafp_print_from_template (FpiDeviceMafpmoc *self, mafp_template_t template)
|
|||||||
|
|
||||||
print = fp_print_new (FP_DEVICE (self));
|
print = fp_print_new (FP_DEVICE (self));
|
||||||
|
|
||||||
user_id_len = strlen (template.uid);
|
user_id_len = strlen (template->uid);
|
||||||
user_id_len = MIN (TEMPLATE_UID_SIZE, user_id_len);
|
user_id_len = MIN (TEMPLATE_UID_SIZE, user_id_len);
|
||||||
uid = g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE, template.uid, user_id_len, 1);
|
uid = g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE, template->uid, user_id_len, 1);
|
||||||
|
|
||||||
serial_num_len = strlen (self->serial_number);
|
serial_num_len = strlen (self->serial_number);
|
||||||
dev_sn = g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE, self->serial_number, serial_num_len, 1);
|
dev_sn = g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE, self->serial_number, serial_num_len, 1);
|
||||||
fp_dbg ("print: %d/%s/%s", template.id, template.uid, self->serial_number);
|
fp_dbg ("print: %d/%s/%s", template->id, template->uid, self->serial_number);
|
||||||
|
|
||||||
data = g_variant_new ("(q@ay@ay)", template.id, uid, dev_sn);
|
data = g_variant_new ("(q@ay@ay)", template->id, uid, dev_sn);
|
||||||
|
|
||||||
fpi_print_set_type (print, FPI_PRINT_RAW);
|
fpi_print_set_type (print, FPI_PRINT_RAW);
|
||||||
fpi_print_set_device_stored (print, true);
|
fpi_print_set_device_stored (print, true);
|
||||||
g_object_set (print, "description", template.uid, NULL);
|
g_object_set (print, "description", template->uid, NULL);
|
||||||
g_object_set (print, "fpi-data", data, NULL);
|
g_object_set (print, "fpi-data", data, NULL);
|
||||||
|
|
||||||
fpi_print_fill_from_user_id (print, template.uid);
|
fpi_print_fill_from_user_id (print, template->uid);
|
||||||
|
|
||||||
return print;
|
return print;
|
||||||
}
|
}
|
||||||
@@ -844,8 +844,6 @@ fp_enroll_get_tpl_info_cb (FpiDeviceMafpmoc *self,
|
|||||||
GError *error)
|
GError *error)
|
||||||
{
|
{
|
||||||
FpDevice *dev = FP_DEVICE (self);
|
FpDevice *dev = FP_DEVICE (self);
|
||||||
mafp_template_t tpl;
|
|
||||||
FpPrint *print;
|
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
@@ -858,9 +856,13 @@ fp_enroll_get_tpl_info_cb (FpiDeviceMafpmoc *self,
|
|||||||
{
|
{
|
||||||
if (resp->tpl_info.uid[0] == 'F' && resp->tpl_info.uid[1] == 'P')
|
if (resp->tpl_info.uid[0] == 'F' && resp->tpl_info.uid[1] == 'P')
|
||||||
{
|
{
|
||||||
|
g_autoptr(FpPrint) print = NULL;
|
||||||
|
mafp_template_t tpl;
|
||||||
|
|
||||||
tpl.id = self->search_id;
|
tpl.id = self->search_id;
|
||||||
memcpy (tpl.uid, resp->tpl_info.uid, sizeof (resp->tpl_info.uid));
|
memcpy (tpl.uid, resp->tpl_info.uid, sizeof (resp->tpl_info.uid));
|
||||||
print = mafp_print_from_template (self, tpl);
|
print = mafp_print_from_template (self, &tpl);
|
||||||
|
|
||||||
mafp_mark_failed (dev, self->task_ssm, FP_DEVICE_ERROR_DATA_DUPLICATE,
|
mafp_mark_failed (dev, self->task_ssm, FP_DEVICE_ERROR_DATA_DUPLICATE,
|
||||||
"Finger was already enrolled as '%s'",
|
"Finger was already enrolled as '%s'",
|
||||||
fp_print_get_description (print));
|
fp_print_get_description (print));
|
||||||
@@ -1499,7 +1501,6 @@ fp_verify_get_tpl_info_cb (FpiDeviceMafpmoc *self,
|
|||||||
FpDevice *dev = FP_DEVICE (self);
|
FpDevice *dev = FP_DEVICE (self);
|
||||||
FpPrint *new_scan = NULL;
|
FpPrint *new_scan = NULL;
|
||||||
FpPrint *matching = NULL;
|
FpPrint *matching = NULL;
|
||||||
mafp_template_t tpl;
|
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
@@ -1523,9 +1524,11 @@ fp_verify_get_tpl_info_cb (FpiDeviceMafpmoc *self,
|
|||||||
{
|
{
|
||||||
if (resp->tpl_info.uid[0] == 'F' && resp->tpl_info.uid[1] == 'P')
|
if (resp->tpl_info.uid[0] == 'F' && resp->tpl_info.uid[1] == 'P')
|
||||||
{
|
{
|
||||||
|
mafp_template_t tpl;
|
||||||
|
|
||||||
tpl.id = self->search_id;
|
tpl.id = self->search_id;
|
||||||
memcpy (tpl.uid, resp->tpl_info.uid, sizeof (resp->tpl_info.uid));
|
memcpy (tpl.uid, resp->tpl_info.uid, sizeof (resp->tpl_info.uid));
|
||||||
new_scan = mafp_print_from_template (self, tpl);
|
new_scan = mafp_print_from_template (self, &tpl);
|
||||||
}
|
}
|
||||||
if (new_scan != NULL)
|
if (new_scan != NULL)
|
||||||
{
|
{
|
||||||
@@ -1929,14 +1932,18 @@ fp_list_get_tpl_info_cb (FpiDeviceMafpmoc *self,
|
|||||||
|
|
||||||
if (resp->result == MAFP_SUCCESS)
|
if (resp->result == MAFP_SUCCESS)
|
||||||
{
|
{
|
||||||
memcpy (self->templates->total_list[self->templates->index].uid,
|
fp_dbg ("tpl_info: %s", resp->tpl_info.uid);
|
||||||
resp->tpl_info.uid, sizeof (resp->tpl_info.uid));
|
|
||||||
|
|
||||||
FpPrint *print = mafp_print_from_template (self,
|
if (resp->tpl_info.uid[0] == 'F' && resp->tpl_info.uid[1] == 'P')
|
||||||
self->templates->total_list[self->templates->index]);
|
{
|
||||||
|
FpPrint *print;
|
||||||
|
mafp_template_t *template = &self->templates->total_list[self->templates->index];
|
||||||
|
|
||||||
|
memcpy (template->uid, resp->tpl_info.uid, sizeof (resp->tpl_info.uid));
|
||||||
|
print = mafp_print_from_template (self, template);
|
||||||
g_ptr_array_add (self->templates->list, g_object_ref_sink (print));
|
g_ptr_array_add (self->templates->list, g_object_ref_sink (print));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (++self->templates->index < self->templates->total_num)
|
if (++self->templates->index < self->templates->total_num)
|
||||||
{
|
{
|
||||||
fpi_ssm_jump_to_state (self->task_ssm, FP_LIST_GET_TEMPLATE_INFO);
|
fpi_ssm_jump_to_state (self->task_ssm, FP_LIST_GET_TEMPLATE_INFO);
|
||||||
@@ -2003,6 +2010,7 @@ fp_delete_tpl_table_cb (FpiDeviceMafpmoc *self,
|
|||||||
mafp_load_enrolled_ids (self, resp);
|
mafp_load_enrolled_ids (self, resp);
|
||||||
fpi_device_get_delete_data (dev, &print);
|
fpi_device_get_delete_data (dev, &print);
|
||||||
mafp_template_t tpl = mafp_template_from_print (print);
|
mafp_template_t tpl = mafp_template_from_print (print);
|
||||||
|
|
||||||
for (int i = 0; i < self->templates->total_num; i++)
|
for (int i = 0; i < self->templates->total_num; i++)
|
||||||
{
|
{
|
||||||
if (self->templates->total_list[i].id == tpl.id)
|
if (self->templates->total_list[i].id == tpl.id)
|
||||||
|
|||||||
Reference in New Issue
Block a user