summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2024-02-19 16:34:33 +0100
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2024-02-19 17:21:58 +0100
commitadc66edd8dfb95a3ff2fbc02704580fa0504283d (patch)
tree5968bf0fe72be2c536ed1751222d3579dae6c22c
parent9af211cc89841353ad7d522f816686e6ce0b7c30 (diff)
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.
-rw-r--r--libfprint/drivers/egismoc/egismoc.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/libfprint/drivers/egismoc/egismoc.c b/libfprint/drivers/egismoc/egismoc.c
index 3bc46b6..811a817 100644
--- a/libfprint/drivers/egismoc/egismoc.c
+++ b/libfprint/drivers/egismoc/egismoc.c
@@ -1495,6 +1495,16 @@ egismoc_cancel (FpDevice *device)
}
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)
{
fp_dbg ("Closing 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;