debian/patches: Fix vfs301 verification using device pointer on callbacks

LP: #1905597
This commit is contained in:
Marco Trevisan (Treviño)
2020-11-25 18:13:11 +01:00
parent 576beb1ff5
commit 3c35c01af9
4 changed files with 1210 additions and 0 deletions
+3
View File
@@ -7,3 +7,6 @@ usb-transfer-Work-around-libgusb-cancellation-issue.patch
aes3k-Re-send-some-commands-for-each-capture.patch aes3k-Re-send-some-commands-for-each-capture.patch
synaptics-add-support-to-pid-0xF9-0xFC-0xC2.patch synaptics-add-support-to-pid-0xF9-0xFC-0xC2.patch
synaptics-Fix-missing-reference-to-interrupt-transfer.patch synaptics-Fix-missing-reference-to-interrupt-transfer.patch
vfs301-Fix-device-pointer-handling-in-callback.patch
vfs301-Start-capture-only-on-state-change-to-AWAIT_FINGER.patch
tests-Add-a-new-test-for-vfs301.patch
File diff suppressed because one or more lines are too long
@@ -0,0 +1,57 @@
From: Benjamin Berg <bberg@redhat.com>
Date: Fri, 23 Oct 2020 18:42:55 +0200
Subject: vfs301: Fix device pointer handling in callback
When porting the driver to the new libfprint 1.90.0 a mistake was made
where the device was not passed through user_data anymore but it was
still read from there. Stop using user_data in the callback to fix this.
See: #320
Origin: https://gitlab.freedesktop.org/libfprint/libfprint/-/commit/d3076039d
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libfprint/+bug/1905597
---
libfprint/drivers/vfs301_proto.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libfprint/drivers/vfs301_proto.c b/libfprint/drivers/vfs301_proto.c
index bcd09e9..8270780 100644
--- a/libfprint/drivers/vfs301_proto.c
+++ b/libfprint/drivers/vfs301_proto.c
@@ -508,30 +508,30 @@ vfs301_proto_process_event_cb (FpiUsbTransfer *transfer,
FpDevice *device,
gpointer user_data, GError *error)
{
- FpDeviceVfs301 *dev = user_data;
+ FpDeviceVfs301 *self = FPI_DEVICE_VFS301 (device);
if (error)
{
g_warning ("Error receiving data: %s", error->message);
g_error_free (error);
- dev->recv_progress = VFS301_FAILURE;
+ self->recv_progress = VFS301_FAILURE;
return;
}
else if (transfer->actual_length < transfer->length)
{
/* TODO: process the data anyway? */
- dev->recv_progress = VFS301_ENDED;
+ self->recv_progress = VFS301_ENDED;
return;
}
else
{
FpiUsbTransfer *new;
- if (!vfs301_proto_process_data (dev,
+ if (!vfs301_proto_process_data (self,
transfer->length == VFS301_FP_RECV_LEN_1,
transfer->buffer,
transfer->actual_length))
{
- dev->recv_progress = VFS301_ENDED;
+ self->recv_progress = VFS301_ENDED;
return;
}
@@ -0,0 +1,87 @@
From: Benjamin Berg <bberg@redhat.com>
Date: Wed, 4 Nov 2020 14:08:10 +0100
Subject: vfs301: Start capture only on state change to AWAIT_FINGER_ON
Start the capture when the state changes to AWAIT_FINGER_ON instead of
assuming that the device should always be active.
Closes: #320
Origin: https://gitlab.freedesktop.org/libfprint/libfprint/-/commit/e5fa54e8
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libfprint/+bug/1905597
---
libfprint/drivers/vfs301.c | 38 ++++++++++++++------------------------
1 file changed, 14 insertions(+), 24 deletions(-)
diff --git a/libfprint/drivers/vfs301.c b/libfprint/drivers/vfs301.c
index f912a36..fffd31a 100644
--- a/libfprint/drivers/vfs301.c
+++ b/libfprint/drivers/vfs301.c
@@ -147,18 +147,6 @@ m_loop_state (FpiSsm *ssm, FpDevice *_dev)
}
}
-/* Complete loop sequential state machine */
-static void
-m_loop_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
-{
- if (error)
- {
- g_warning ("State machine completed with an error: %s", error->message);
- g_error_free (error);
- }
- /* Free sequential state machine */
-}
-
/* Exec init sequential state machine */
static void
m_init_state (FpiSsm *ssm, FpDevice *_dev)
@@ -176,19 +164,7 @@ m_init_state (FpiSsm *ssm, FpDevice *_dev)
static void
m_init_complete (FpiSsm *ssm, FpDevice *dev, GError *error)
{
- FpiSsm *ssm_loop;
-
fpi_image_device_activate_complete (FP_IMAGE_DEVICE (dev), error);
- if (!error)
- {
- /* Notify activate complete */
-
- /* Start loop ssm */
- ssm_loop = fpi_ssm_new (dev, m_loop_state, M_LOOP_NUM_STATES);
- fpi_ssm_start (ssm_loop, m_loop_complete);
- }
-
- /* Free sequential state machine */
}
/* Activate device */
@@ -213,6 +189,19 @@ dev_deactivate (FpImageDevice *dev)
fpi_image_device_deactivate_complete (dev, NULL);
}
+static void
+dev_change_state (FpImageDevice *dev, FpiImageDeviceState state)
+{
+ FpiSsm *ssm_loop;
+
+ if (state != FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON)
+ return;
+
+ /* Start a capture operation. */
+ ssm_loop = fpi_ssm_new (FP_DEVICE (dev), m_loop_state, M_LOOP_NUM_STATES);
+ fpi_ssm_start (ssm_loop, NULL);
+}
+
static void
dev_open (FpImageDevice *dev)
{
@@ -273,6 +262,7 @@ fpi_device_vfs301_class_init (FpDeviceVfs301Class *klass)
img_class->img_close = dev_close;
img_class->activate = dev_activate;
img_class->deactivate = dev_deactivate;
+ img_class->change_state = dev_change_state;
img_class->bz3_threshold = 24;