From 4b83f8bfd97075be09712b8a0ff8c87c7166b76f Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Wed, 13 May 2020 17:26:34 +0200 Subject: [PATCH] vfs0050: Accept zero bytes read instead of timeout for emulation This allows us to replace non-emulateable timeout conditions into zero byte replies in the recording. --- libfprint/drivers/vfs0050.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libfprint/drivers/vfs0050.c b/libfprint/drivers/vfs0050.c index fcde96f..5ad8b46 100644 --- a/libfprint/drivers/vfs0050.c +++ b/libfprint/drivers/vfs0050.c @@ -117,9 +117,10 @@ async_abort_callback (FpiUsbTransfer *transfer, FpDevice *device, int ep = transfer->endpoint; /* In normal case endpoint is empty */ - if (g_error_matches (error, G_USB_DEVICE_ERROR, G_USB_DEVICE_ERROR_TIMED_OUT)) + if (g_error_matches (error, G_USB_DEVICE_ERROR, G_USB_DEVICE_ERROR_TIMED_OUT) || + (g_strcmp0 (g_getenv ("FP_DEVICE_EMULATION"), "1") == 0 && transfer->actual_length == 0)) { - g_error_free (error); + g_clear_error (&error); fpi_ssm_next_state (transfer->ssm); return; }