egismoc: Implement suspension properly

In case of suspension we can't just cancel the operations but
also return when completed, and this may not happen immediately
if there are ongoing operations.

This is automagically handled by libfprint internals, but in order
to make it happen, we need to cancel the ongoing operations and then
mark it completed. libfprint will then wait for the task completion
before actually marking the device as suspended.
This commit is contained in:
Marco Trevisan (Treviño)
2024-02-19 16:34:33 +01:00
parent 9af211cc89
commit adc66edd8d

View File

@@ -1494,6 +1494,16 @@ egismoc_cancel (FpDevice *device)
self->interrupt_cancellable = g_cancellable_new ();
}
static void
egismoc_suspend (FpDevice *device)
{
fp_dbg ("Suspend");
egismoc_cancel (device);
g_cancellable_cancel (fpi_device_get_cancellable (device));
fpi_device_suspend_complete (device, NULL);
}
static void
egismoc_close (FpDevice *device)
{
@@ -1532,7 +1542,7 @@ fpi_device_egismoc_class_init (FpiDeviceEgisMocClass *klass)
dev_class->open = egismoc_open;
dev_class->cancel = egismoc_cancel;
dev_class->suspend = egismoc_cancel;
dev_class->suspend = egismoc_suspend;
dev_class->close = egismoc_close;
dev_class->identify = egismoc_identify_verify;
dev_class->verify = egismoc_identify_verify;