From 8be666bb0561d04288cc6be390315c60b4ea341a Mon Sep 17 00:00:00 2001 From: Matthew Mirvish Date: Mon, 21 Jun 2021 14:24:27 -0400 Subject: [PATCH] elanspi: Permit running in emulated environment This removes the HID reset, which we cannot emulate currently and also disabes the line timeout to as simulation might run too slowly at times. --- libfprint/drivers/elanspi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libfprint/drivers/elanspi.c b/libfprint/drivers/elanspi.c index d03361d..fab958b 100644 --- a/libfprint/drivers/elanspi.c +++ b/libfprint/drivers/elanspi.c @@ -93,6 +93,10 @@ G_DEFINE_TYPE (FpiDeviceElanSpi, fpi_device_elanspi, FP_TYPE_IMAGE_DEVICE); static void elanspi_do_hwreset (FpiDeviceElanSpi *self, GError **err) { + /* Skip in emulation mode, since we don't mock hid devices */ + if (g_strcmp0 (g_getenv ("FP_DEVICE_EMULATION"), "1") == 0) + return; + /* * TODO: Make this also work with the non-HID cases */ @@ -474,8 +478,8 @@ elanspi_capture_old_handler (FpiSsm *ssm, FpDevice *dev) /* is the sensor ready? */ if (!(self->sensor_status & 4)) { - /* has the timeout expired? */ - if (g_get_monotonic_time () > self->capture_timeout) + /* has the timeout expired? -- disabled in testing since valgrind is very slow */ + if (g_get_monotonic_time () > self->capture_timeout && g_strcmp0 (g_getenv ("FP_DEVICE_EMULATION"), "1") != 0) { /* end with a timeout */ fpi_ssm_mark_failed (ssm, g_error_new (G_IO_ERROR, G_IO_ERROR_TIMED_OUT, "timed out waiting for new line"));