|
|
73b847 |
From 57203198c5d777fedd50b4509b765dfa08b73992 Mon Sep 17 00:00:00 2001
|
|
|
73b847 |
From: Benjamin Berg <bberg@redhat.com>
|
|
|
73b847 |
Date: Wed, 4 Dec 2019 19:56:54 +0100
|
|
|
73b847 |
Subject: [PATCH 095/181] virtual-image: Allow fine control over the finger
|
|
|
73b847 |
state
|
|
|
73b847 |
|
|
|
73b847 |
Add commands to disable automatic finger reporting for images and to
|
|
|
73b847 |
send a specific finger report. This is useful to test more code paths
|
|
|
73b847 |
inside the image-device code.
|
|
|
73b847 |
---
|
|
|
73b847 |
libfprint/drivers/virtual-image.c | 19 +++++++++++++++++--
|
|
|
73b847 |
1 file changed, 17 insertions(+), 2 deletions(-)
|
|
|
73b847 |
|
|
|
73b847 |
diff --git a/libfprint/drivers/virtual-image.c b/libfprint/drivers/virtual-image.c
|
|
|
73b847 |
index 07a631f..33f322e 100644
|
|
|
73b847 |
--- a/libfprint/drivers/virtual-image.c
|
|
|
73b847 |
+++ b/libfprint/drivers/virtual-image.c
|
|
|
73b847 |
@@ -47,6 +47,7 @@ struct _FpDeviceVirtualImage
|
|
|
73b847 |
gint socket_fd;
|
|
|
73b847 |
gint client_fd;
|
|
|
73b847 |
|
|
|
73b847 |
+ gboolean automatic_finger;
|
|
|
73b847 |
FpImage *recv_img;
|
|
|
73b847 |
gint recv_img_hdr[2];
|
|
|
73b847 |
};
|
|
|
73b847 |
@@ -89,9 +90,11 @@ recv_image_img_recv_cb (GObject *source_object,
|
|
|
73b847 |
self = FPI_DEVICE_VIRTUAL_IMAGE (user_data);
|
|
|
73b847 |
device = FP_IMAGE_DEVICE (self);
|
|
|
73b847 |
|
|
|
73b847 |
- fpi_image_device_report_finger_status (device, TRUE);
|
|
|
73b847 |
+ if (self->automatic_finger)
|
|
|
73b847 |
+ fpi_image_device_report_finger_status (device, TRUE);
|
|
|
73b847 |
fpi_image_device_image_captured (device, g_steal_pointer (&self->recv_img));
|
|
|
73b847 |
- fpi_image_device_report_finger_status (device, FALSE);
|
|
|
73b847 |
+ if (self->automatic_finger)
|
|
|
73b847 |
+ fpi_image_device_report_finger_status (device, FALSE);
|
|
|
73b847 |
|
|
|
73b847 |
/* And, listen for more images from the same client. */
|
|
|
73b847 |
recv_image (self, G_INPUT_STREAM (source_object));
|
|
|
73b847 |
@@ -148,6 +151,17 @@ recv_image_hdr_recv_cb (GObject *source_object,
|
|
|
73b847 |
fpi_device_error_new (self->recv_img_hdr[1]));
|
|
|
73b847 |
break;
|
|
|
73b847 |
|
|
|
73b847 |
+ case -3:
|
|
|
73b847 |
+ /* -3 sets/clears automatic finger detection for images */
|
|
|
73b847 |
+ self->automatic_finger = !!self->recv_img_hdr[1];
|
|
|
73b847 |
+ break;
|
|
|
73b847 |
+
|
|
|
73b847 |
+ case -4:
|
|
|
73b847 |
+ /* -4 submits a finger detection report */
|
|
|
73b847 |
+ fpi_image_device_report_finger_status (FP_IMAGE_DEVICE (self),
|
|
|
73b847 |
+ !!self->recv_img_hdr[1]);
|
|
|
73b847 |
+ break;
|
|
|
73b847 |
+
|
|
|
73b847 |
default:
|
|
|
73b847 |
/* disconnect client, it didn't play fair */
|
|
|
73b847 |
g_io_stream_close (G_IO_STREAM (self->connection), NULL, NULL);
|
|
|
73b847 |
@@ -214,6 +228,7 @@ new_connection_cb (GObject *source_object, GAsyncResult *res, gpointer user_data
|
|
|
73b847 |
}
|
|
|
73b847 |
|
|
|
73b847 |
dev->connection = connection;
|
|
|
73b847 |
+ dev->automatic_finger = TRUE;
|
|
|
73b847 |
stream = g_io_stream_get_input_stream (G_IO_STREAM (connection));
|
|
|
73b847 |
|
|
|
73b847 |
recv_image (dev, stream);
|
|
|
73b847 |
--
|
|
|
73b847 |
2.24.1
|
|
|
73b847 |
|