From 1dae6796f7e7d76cf1837f800ca4ba97bef43097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 25 Jan 2021 23:36:00 +0100 Subject: [PATCH] virtual-device: Report finger presency when we receive a 'SCAN' event --- libfprint/drivers/virtual-device-storage.c | 4 ++++ libfprint/drivers/virtual-device.c | 23 +++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/libfprint/drivers/virtual-device-storage.c b/libfprint/drivers/virtual-device-storage.c index 654a171..ba12253 100644 --- a/libfprint/drivers/virtual-device-storage.c +++ b/libfprint/drivers/virtual-device-storage.c @@ -79,6 +79,10 @@ dev_identify (FpDevice *dev) fpi_device_identify_report (dev, NULL, NULL, g_steal_pointer (&error)); } + fpi_device_report_finger_status_changes (FP_DEVICE (self), + FP_FINGER_STATUS_NONE, + FP_FINGER_STATUS_PRESENT); + fpi_device_identify_complete (dev, g_steal_pointer (&error)); } diff --git a/libfprint/drivers/virtual-device.c b/libfprint/drivers/virtual-device.c index 1365415..9105a4b 100644 --- a/libfprint/drivers/virtual-device.c +++ b/libfprint/drivers/virtual-device.c @@ -383,6 +383,10 @@ start_scan_command (FpDeviceVirtualDevice *self, if (local_error) g_propagate_error (error, g_steal_pointer (&local_error)); + else + fpi_device_report_finger_status_changes (FP_DEVICE (self), + FP_FINGER_STATUS_PRESENT, + FP_FINGER_STATUS_NONE); return g_steal_pointer (&scan_id); } @@ -428,6 +432,10 @@ dev_verify (FpDevice *dev) g_debug ("Virtual device scan failed with error: %s", error->message); } + fpi_device_report_finger_status_changes (FP_DEVICE (self), + FP_FINGER_STATUS_NONE, + FP_FINGER_STATUS_PRESENT); + if (error && error->domain == FP_DEVICE_RETRY) fpi_device_verify_report (dev, FPI_MATCH_ERROR, NULL, g_steal_pointer (&error)); @@ -451,6 +459,7 @@ dev_enroll (FpDevice *dev) if (id) { GVariant *data; + gboolean completed; if (self->enroll_stages_passed == 0) { @@ -475,8 +484,16 @@ dev_enroll (FpDevice *dev) } self->enroll_stages_passed++; + completed = self->enroll_stages_passed == fp_device_get_nr_enroll_stages (FP_DEVICE (self)); + fpi_device_report_finger_status_changes (FP_DEVICE (self), + completed ? + FP_FINGER_STATUS_NEEDED : + FP_FINGER_STATUS_NONE, + FP_FINGER_STATUS_PRESENT); + fpi_device_enroll_progress (dev, self->enroll_stages_passed, print, NULL); - if (self->enroll_stages_passed == fp_device_get_nr_enroll_stages (FP_DEVICE (self))) + + if (completed) { if (self->prints_storage) { @@ -490,6 +507,10 @@ dev_enroll (FpDevice *dev) } else { + fpi_device_report_finger_status_changes (FP_DEVICE (self), + FP_FINGER_STATUS_NONE, + FP_FINGER_STATUS_PRESENT); + if (error && error->domain == FP_DEVICE_RETRY) { fpi_device_enroll_progress (dev, self->enroll_stages_passed, NULL, g_steal_pointer (&error));