import libfprint-1.90.7-1.el8
This commit is contained in:
parent
e4a65ba3ae
commit
eea2b50b04
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
||||
SOURCES/libfprint-1.90.0.tar.xz
|
||||
SOURCES/libfprint-v1.90.7.tar.gz
|
||||
|
@ -1 +1 @@
|
||||
fdd9097da91c66cfe4875fdf15e7f4d3ea30e5c7 SOURCES/libfprint-1.90.0.tar.xz
|
||||
1980a7ba38bb2f4fa1f5b79f52f2d613ea923681 SOURCES/libfprint-v1.90.7.tar.gz
|
||||
|
@ -1,30 +0,0 @@
|
||||
From 1dbd421bd6cc3db07ed6a8482346755fcbeae9ef Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Mon, 20 Jan 2020 13:30:33 +0100
|
||||
Subject: [PATCH] tests: Add missing NULL terminator to g_object_new
|
||||
|
||||
The g_object_new call had a NULL argument for a property. This meant
|
||||
that the compiler could not warn about the lack of NULL termination for
|
||||
the argument list.
|
||||
|
||||
Add the missing NULL termination.
|
||||
---
|
||||
tests/test-fpi-device.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tests/test-fpi-device.c b/tests/test-fpi-device.c
|
||||
index 3d1e81c..7dcff20 100644
|
||||
--- a/tests/test-fpi-device.c
|
||||
+++ b/tests/test-fpi-device.c
|
||||
@@ -240,7 +240,7 @@ test_driver_get_usb_device (void)
|
||||
g_autoptr(FpDevice) device = NULL;
|
||||
|
||||
dev_class->type = FP_DEVICE_TYPE_USB;
|
||||
- device = g_object_new (FPI_TYPE_DEVICE_FAKE, "fpi-usb-device", NULL);
|
||||
+ device = g_object_new (FPI_TYPE_DEVICE_FAKE, "fpi-usb-device", NULL, NULL);
|
||||
g_assert_null (fpi_device_get_usb_device (device));
|
||||
|
||||
g_clear_object (&device);
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,26 +0,0 @@
|
||||
From 7a4dd9640668a258383e8e14ce5ae230d33927e0 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Fri, 22 Nov 2019 17:07:56 +0100
|
||||
Subject: [PATCH 001/181] udev-rules: Remove debug spew from udev rules
|
||||
|
||||
Some debug output was ending up inside the udev rules. Remove it again.
|
||||
---
|
||||
libfprint/fprint-list-udev-rules.c | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
diff --git a/libfprint/fprint-list-udev-rules.c b/libfprint/fprint-list-udev-rules.c
|
||||
index 0c1b059..c0a3337 100644
|
||||
--- a/libfprint/fprint-list-udev-rules.c
|
||||
+++ b/libfprint/fprint-list-udev-rules.c
|
||||
@@ -99,8 +99,6 @@ main (int argc, char **argv)
|
||||
g_autoptr(GArray) drivers = g_array_new (FALSE, FALSE, sizeof (GType));
|
||||
guint i;
|
||||
|
||||
- g_print ("%p\n", drivers);
|
||||
- g_print ("%p\n", fpi_get_driver_types);
|
||||
fpi_get_driver_types (drivers);
|
||||
|
||||
printed = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,25 +0,0 @@
|
||||
From 8b28133beee5122c2a26c361cf2f2095888be2c2 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Mon, 25 Nov 2019 18:34:16 +0100
|
||||
Subject: [PATCH 002/181] elan: Fix potential leak of dark frame
|
||||
|
||||
Dark frames would be leaked, add an explicit free to avoid this.
|
||||
---
|
||||
libfprint/drivers/elan.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/libfprint/drivers/elan.c b/libfprint/drivers/elan.c
|
||||
index b417a41..6e9107e 100644
|
||||
--- a/libfprint/drivers/elan.c
|
||||
+++ b/libfprint/drivers/elan.c
|
||||
@@ -223,6 +223,7 @@ elan_save_img_frame (FpiDeviceElan *elandev)
|
||||
{
|
||||
fp_dbg
|
||||
("frame darker than background; finger present during calibration?");
|
||||
+ g_free (frame);
|
||||
return -1;
|
||||
}
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,39 +0,0 @@
|
||||
From b16245ad588bf7467a3580726184f48af328414d Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Mon, 25 Nov 2019 18:34:55 +0100
|
||||
Subject: [PATCH 003/181] elan: Fix switch in change_state
|
||||
|
||||
The switch in change_state had a useless break and a useless if clause.
|
||||
Remove both.
|
||||
---
|
||||
libfprint/drivers/elan.c | 7 ++-----
|
||||
1 file changed, 2 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/elan.c b/libfprint/drivers/elan.c
|
||||
index 6e9107e..961366e 100644
|
||||
--- a/libfprint/drivers/elan.c
|
||||
+++ b/libfprint/drivers/elan.c
|
||||
@@ -975,8 +975,6 @@ elan_change_state (FpImageDevice *idev)
|
||||
|
||||
switch (next_state)
|
||||
{
|
||||
- break;
|
||||
-
|
||||
case FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON:
|
||||
/* activation completed or another enroll stage started */
|
||||
elan_calibrate (dev);
|
||||
@@ -988,9 +986,8 @@ elan_change_state (FpImageDevice *idev)
|
||||
|
||||
case FP_IMAGE_DEVICE_STATE_INACTIVE:
|
||||
case FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF:
|
||||
- if (self->dev_state != FP_IMAGE_DEVICE_STATE_INACTIVE ||
|
||||
- self->dev_state != FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF)
|
||||
- elan_stop_capture (dev);
|
||||
+ elan_stop_capture (dev);
|
||||
+ break;
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,36 +0,0 @@
|
||||
From ada5d488fa769b4818a17a7042b8aa94ceea1519 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Mon, 25 Nov 2019 18:35:50 +0100
|
||||
Subject: [PATCH 004/181] synaptics: Correctly unref pointer array
|
||||
|
||||
The pointer arrays were unref'ed using g_ptr_array_free rather than
|
||||
g_ptr_array_unref from g_clear_pointer. Switch to the correct function.
|
||||
---
|
||||
libfprint/drivers/synaptics/synaptics.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/synaptics/synaptics.c b/libfprint/drivers/synaptics/synaptics.c
|
||||
index b1d7365..4bac934 100644
|
||||
--- a/libfprint/drivers/synaptics/synaptics.c
|
||||
+++ b/libfprint/drivers/synaptics/synaptics.c
|
||||
@@ -447,7 +447,7 @@ list_msg_cb (FpiDeviceSynaptics *self,
|
||||
|
||||
if (error)
|
||||
{
|
||||
- g_clear_pointer (&self->list_result, g_ptr_array_free);
|
||||
+ g_clear_pointer (&self->list_result, g_ptr_array_unref);
|
||||
fpi_device_list_complete (FP_DEVICE (self), NULL, error);
|
||||
return;
|
||||
}
|
||||
@@ -468,7 +468,7 @@ list_msg_cb (FpiDeviceSynaptics *self,
|
||||
else
|
||||
{
|
||||
fp_info ("Failed to query enrolled users: %d", resp->result);
|
||||
- g_clear_pointer (&self->list_result, g_ptr_array_free);
|
||||
+ g_clear_pointer (&self->list_result, g_ptr_array_unref);
|
||||
fpi_device_list_complete (FP_DEVICE (self),
|
||||
NULL,
|
||||
fpi_device_error_new_msg (FP_DEVICE_ERROR_GENERAL,
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,27 +0,0 @@
|
||||
From 8ba6f4dad2d9c04217153f32c11ac69967ddec00 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Mon, 25 Nov 2019 18:37:12 +0100
|
||||
Subject: [PATCH 005/181] synaptics: Add an explicit assert on the response
|
||||
|
||||
The response must be non-NULL in the function. Add an explicit assert to
|
||||
appease to static code analysis tools.
|
||||
---
|
||||
libfprint/drivers/synaptics/synaptics.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/libfprint/drivers/synaptics/synaptics.c b/libfprint/drivers/synaptics/synaptics.c
|
||||
index 4bac934..8eba852 100644
|
||||
--- a/libfprint/drivers/synaptics/synaptics.c
|
||||
+++ b/libfprint/drivers/synaptics/synaptics.c
|
||||
@@ -604,6 +604,8 @@ verify_msg_cb (FpiDeviceSynaptics *self,
|
||||
return;
|
||||
}
|
||||
|
||||
+ g_assert (resp != NULL);
|
||||
+
|
||||
verify_resp = &resp->response.verify_resp;
|
||||
|
||||
switch (resp->response_id)
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,58 +0,0 @@
|
||||
From 2f0824ab8843ddb8bb46f000f802e641a9252d6d Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Mon, 25 Nov 2019 18:38:32 +0100
|
||||
Subject: [PATCH 006/181] upeksonly: Add default clauses to switch statements
|
||||
|
||||
This effectively only annotates the code to make it clear that variables
|
||||
set in the switch are always initialized.
|
||||
---
|
||||
libfprint/drivers/upeksonly.c | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/libfprint/drivers/upeksonly.c b/libfprint/drivers/upeksonly.c
|
||||
index 76ba4e2..ec81375 100644
|
||||
--- a/libfprint/drivers/upeksonly.c
|
||||
+++ b/libfprint/drivers/upeksonly.c
|
||||
@@ -1249,6 +1249,9 @@ loopsm_run_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
awfsm_1000_run_state,
|
||||
AWFSM_1000_NUM_STATES);
|
||||
break;
|
||||
+
|
||||
+ default:
|
||||
+ g_assert_not_reached ();
|
||||
}
|
||||
fpi_ssm_start_subsm (ssm, awfsm);
|
||||
}
|
||||
@@ -1290,6 +1293,9 @@ loopsm_run_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
capsm_1001_run_state,
|
||||
CAPSM_1001_NUM_STATES);
|
||||
break;
|
||||
+
|
||||
+ default:
|
||||
+ g_assert_not_reached ();
|
||||
}
|
||||
fpi_ssm_start_subsm (ssm, capsm);
|
||||
break;
|
||||
@@ -1318,6 +1324,9 @@ loopsm_run_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
deinitsm_1001_run_state,
|
||||
DEINITSM_1001_NUM_STATES);
|
||||
break;
|
||||
+
|
||||
+ default:
|
||||
+ g_assert_not_reached ();
|
||||
}
|
||||
self->capturing = FALSE;
|
||||
fpi_ssm_start_subsm (ssm, deinitsm);
|
||||
@@ -1441,6 +1450,9 @@ dev_activate (FpImageDevice *dev)
|
||||
ssm = fpi_ssm_new (FP_DEVICE (dev), initsm_1001_run_state,
|
||||
INITSM_1001_NUM_STATES);
|
||||
break;
|
||||
+
|
||||
+ default:
|
||||
+ g_assert_not_reached ();
|
||||
}
|
||||
fpi_ssm_start (ssm, initsm_complete);
|
||||
}
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,28 +0,0 @@
|
||||
From 25bc89a4f57a3d414134ac5e66d28b377b3b1914 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Mon, 25 Nov 2019 18:40:21 +0100
|
||||
Subject: [PATCH 007/181] image-device: Remove unused
|
||||
fpi_device_get_current_action call
|
||||
|
||||
There is a later call in the function which is sufficient. Simply remove
|
||||
the first call.
|
||||
---
|
||||
libfprint/fp-image-device.c | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
diff --git a/libfprint/fp-image-device.c b/libfprint/fp-image-device.c
|
||||
index 8524e06..65cca16 100644
|
||||
--- a/libfprint/fp-image-device.c
|
||||
+++ b/libfprint/fp-image-device.c
|
||||
@@ -493,8 +493,6 @@ fpi_image_device_report_finger_status (FpImageDevice *self,
|
||||
FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
|
||||
FpDeviceAction action;
|
||||
|
||||
- action = fpi_device_get_current_action (device);
|
||||
-
|
||||
if (priv->state == FP_IMAGE_DEVICE_STATE_INACTIVE)
|
||||
{
|
||||
/* Do we really want to always ignore such reports? We could
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,25 +0,0 @@
|
||||
From 14a41bdd485d484146a0a102d142239c2cb8a245 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Mon, 25 Nov 2019 18:40:59 +0100
|
||||
Subject: [PATCH 008/181] print: Free temporary col variable
|
||||
|
||||
The variable was leaked during serialization. Free it.
|
||||
---
|
||||
libfprint/fp-print.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/libfprint/fp-print.c b/libfprint/fp-print.c
|
||||
index 644370d..592be14 100644
|
||||
--- a/libfprint/fp-print.c
|
||||
+++ b/libfprint/fp-print.c
|
||||
@@ -921,6 +921,7 @@ fp_print_serialize (FpPrint *print,
|
||||
xyt->nrows,
|
||||
sizeof (col[0])));
|
||||
g_variant_builder_close (&nested);
|
||||
+ g_free (col);
|
||||
}
|
||||
|
||||
g_variant_builder_close (&nested);
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,37 +0,0 @@
|
||||
From 9b48864c5b41111e1c6f40c1623b0f2393c3cc58 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Mon, 25 Nov 2019 18:41:44 +0100
|
||||
Subject: [PATCH 009/181] print: Ensure xyt struct is not leaked during
|
||||
deserialization
|
||||
|
||||
In the unlikely event of an error, the variable may have been leaked.
|
||||
Fix this by using g_autoptr combined with a g_steal_pointer.
|
||||
---
|
||||
libfprint/fp-print.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libfprint/fp-print.c b/libfprint/fp-print.c
|
||||
index 592be14..1a6a70f 100644
|
||||
--- a/libfprint/fp-print.c
|
||||
+++ b/libfprint/fp-print.c
|
||||
@@ -1047,7 +1047,7 @@ fp_print_deserialize (const guchar *data,
|
||||
fpi_print_set_type (result, FP_PRINT_NBIS);
|
||||
for (i = 0; i < g_variant_n_children (prints); i++)
|
||||
{
|
||||
- struct xyt_struct *xyt = g_new0 (struct xyt_struct, 1);
|
||||
+ g_autofree struct xyt_struct *xyt = g_new0 (struct xyt_struct, 1);
|
||||
const gint32 *xcol, *ycol, *thetacol;
|
||||
gsize xlen, ylen, thetalen;
|
||||
g_autoptr(GVariant) xyt_data = NULL;
|
||||
@@ -1078,7 +1078,7 @@ fp_print_deserialize (const guchar *data,
|
||||
memcpy (xyt->ycol, ycol, sizeof (xcol[0]) * xlen);
|
||||
memcpy (xyt->thetacol, thetacol, sizeof (xcol[0]) * xlen);
|
||||
|
||||
- g_ptr_array_add (result->prints, xyt);
|
||||
+ g_ptr_array_add (result->prints, g_steal_pointer (&xyt));
|
||||
}
|
||||
}
|
||||
else if (type == FP_PRINT_RAW)
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,26 +0,0 @@
|
||||
From 76dd4066f328ed76794e834b797abcd588650736 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Fri, 22 Nov 2019 17:31:50 +0100
|
||||
Subject: [PATCH 010/181] verify: Ensure we set set the autoptr value to NULL
|
||||
at definition
|
||||
|
||||
---
|
||||
examples/verify.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/examples/verify.c b/examples/verify.c
|
||||
index 89a9b2c..4e1c988 100644
|
||||
--- a/examples/verify.c
|
||||
+++ b/examples/verify.c
|
||||
@@ -182,7 +182,7 @@ start_verification (FpDevice *dev, VerifyData *verify_data)
|
||||
{
|
||||
g_print ("Loading previously enrolled %s finger data...\n",
|
||||
finger_to_string (verify_data->finger));
|
||||
- g_autoptr(FpPrint) verify_print;
|
||||
+ g_autoptr(FpPrint) verify_print = NULL;
|
||||
|
||||
verify_print = print_data_load (dev, verify_data->finger);
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,50 +0,0 @@
|
||||
From d8efa336e5f82b15d467163c5c5cdcec4ed51b28 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Thu, 21 Nov 2019 20:25:36 +0100
|
||||
Subject: [PATCH 011/181] fpi-ssm, fp-device: Add missing copyright
|
||||
|
||||
---
|
||||
libfprint/fp-device.c | 1 +
|
||||
libfprint/fpi-ssm.c | 1 +
|
||||
libfprint/fpi-ssm.h | 1 +
|
||||
3 files changed, 3 insertions(+)
|
||||
|
||||
diff --git a/libfprint/fp-device.c b/libfprint/fp-device.c
|
||||
index f9ccb3c..480d5cf 100644
|
||||
--- a/libfprint/fp-device.c
|
||||
+++ b/libfprint/fp-device.c
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* FpDevice - A fingerprint reader device
|
||||
* Copyright (C) 2019 Benjamin Berg <bberg@redhat.com>
|
||||
+ * Copyright (C) 2019 Marco Trevisan <marco.trevisan@canonical.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
diff --git a/libfprint/fpi-ssm.c b/libfprint/fpi-ssm.c
|
||||
index 6b63e1a..f00af81 100644
|
||||
--- a/libfprint/fpi-ssm.c
|
||||
+++ b/libfprint/fpi-ssm.c
|
||||
@@ -2,6 +2,7 @@
|
||||
* Functions to assist with asynchronous driver <---> library communications
|
||||
* Copyright (C) 2007-2008 Daniel Drake <dsd@gentoo.org>
|
||||
* Copyright (C) 2019 Benjamin Berg <bberg@redhat.com>
|
||||
+ * Copyright (C) 2019 Marco Trevisan <marco.trevisan@canonical.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
diff --git a/libfprint/fpi-ssm.h b/libfprint/fpi-ssm.h
|
||||
index 31a33e5..8d45162 100644
|
||||
--- a/libfprint/fpi-ssm.h
|
||||
+++ b/libfprint/fpi-ssm.h
|
||||
@@ -2,6 +2,7 @@
|
||||
* Copyright (C) 2007-2008 Daniel Drake <dsd@gentoo.org>
|
||||
* Copyright (C) 2018 Bastien Nocera <hadess@hadess.net>
|
||||
* Copyright (C) 2019 Benjamin Berg <bberg@redhat.com>
|
||||
+ * Copyright (C) 2019 Marco Trevisan <marco.trevisan@canonical.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,48 +0,0 @@
|
||||
From dd7d1baeceba8b2c8964b367797103f24a19adc6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Thu, 21 Nov 2019 20:24:29 +0100
|
||||
Subject: [PATCH 012/181] meson: Use multiline-array for default dirvers
|
||||
listing
|
||||
|
||||
It will make reviews and diffs nicer to handle when adding new drivers.
|
||||
---
|
||||
meson.build | 23 ++++++++++++++++++++++-
|
||||
1 file changed, 22 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 8d06d45..a499a38 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -51,7 +51,28 @@ mathlib_dep = cc.find_library('m', required: false)
|
||||
# Drivers
|
||||
drivers = get_option('drivers').split(',')
|
||||
virtual_drivers = [ 'virtual_image' ]
|
||||
-default_drivers = [ 'upektc_img', 'vfs5011', 'aes3500', 'aes4000', 'aes1610', 'aes1660', 'aes2660', 'aes2501', 'aes2550', 'vfs101', 'vfs301', 'vfs0050', 'etes603', 'vcom5s', 'synaptics', 'elan', 'uru4000', 'upektc', 'upeksonly', 'upekts' ]
|
||||
+default_drivers = [
|
||||
+ 'upektc_img',
|
||||
+ 'vfs5011',
|
||||
+ 'aes3500',
|
||||
+ 'aes4000',
|
||||
+ 'aes1610',
|
||||
+ 'aes1660',
|
||||
+ 'aes2660',
|
||||
+ 'aes2501',
|
||||
+ 'aes2550',
|
||||
+ 'vfs101',
|
||||
+ 'vfs301',
|
||||
+ 'vfs0050',
|
||||
+ 'etes603',
|
||||
+ 'vcom5s',
|
||||
+ 'synaptics',
|
||||
+ 'elan',
|
||||
+ 'uru4000',
|
||||
+ 'upektc',
|
||||
+ 'upeksonly',
|
||||
+ 'upekts',
|
||||
+]
|
||||
|
||||
all_drivers = default_drivers + virtual_drivers
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,384 +0,0 @@
|
||||
From 099fa9f005d22aa6d9c7ee79b9a11a088499994c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Thu, 21 Nov 2019 20:37:17 +0100
|
||||
Subject: [PATCH 013/181] meson: Use preferred syntax everywhere
|
||||
|
||||
Meson files are normally using 4-spaces to indent and functions use first
|
||||
parameter on the same line while others at next indentation level, not
|
||||
following the parenthesis indentation.
|
||||
|
||||
So adapt libfprint to follow the meson standard.
|
||||
---
|
||||
demo/meson.build | 27 +++++++------
|
||||
doc/meson.build | 48 +++++++++++------------
|
||||
doc/xml/meson.build | 4 +-
|
||||
examples/meson.build | 24 ++++++------
|
||||
libfprint/meson.build | 89 +++++++++++++++++++++----------------------
|
||||
meson.build | 31 ++++++++-------
|
||||
tests/meson.build | 9 ++---
|
||||
7 files changed, 116 insertions(+), 116 deletions(-)
|
||||
|
||||
diff --git a/demo/meson.build b/demo/meson.build
|
||||
index ceca56d..bf7a7ee 100644
|
||||
--- a/demo/meson.build
|
||||
+++ b/demo/meson.build
|
||||
@@ -1,21 +1,24 @@
|
||||
-gtk_test_resources = gnome.compile_resources('gtk-test-resources', 'gtk-libfprint-test.gresource.xml',
|
||||
- source_dir : '.',
|
||||
- c_name : 'gtk_test')
|
||||
+gtk_test_resources = gnome.compile_resources('gtk-test-resources',
|
||||
+ 'gtk-libfprint-test.gresource.xml',
|
||||
+ source_dir : '.',
|
||||
+ c_name : 'gtk_test')
|
||||
|
||||
prefix = get_option('prefix')
|
||||
bindir = join_paths(prefix, get_option('bindir'))
|
||||
datadir = join_paths(prefix, get_option('datadir'))
|
||||
|
||||
executable('gtk-libfprint-test',
|
||||
- [ 'gtk-libfprint-test.c', gtk_test_resources ],
|
||||
- dependencies: [ libfprint_dep, gtk_dep ],
|
||||
- include_directories: [
|
||||
- root_inc,
|
||||
- ],
|
||||
- c_args: [ common_cflags,
|
||||
- '-DPACKAGE_VERSION="' + meson.project_version() + '"' ],
|
||||
- install: true,
|
||||
- install_dir: bindir)
|
||||
+ [ 'gtk-libfprint-test.c', gtk_test_resources ],
|
||||
+ dependencies: [ libfprint_dep, gtk_dep ],
|
||||
+ include_directories: [
|
||||
+ root_inc,
|
||||
+ ],
|
||||
+ c_args: [
|
||||
+ common_cflags,
|
||||
+ '-DPACKAGE_VERSION="' + meson.project_version() + '"'
|
||||
+ ],
|
||||
+ install: true,
|
||||
+ install_dir: bindir)
|
||||
|
||||
appdata = 'org.freedesktop.libfprint.Demo.appdata.xml'
|
||||
install_data(appdata,
|
||||
diff --git a/doc/meson.build b/doc/meson.build
|
||||
index 5418667..407413a 100644
|
||||
--- a/doc/meson.build
|
||||
+++ b/doc/meson.build
|
||||
@@ -1,14 +1,14 @@
|
||||
subdir('xml')
|
||||
|
||||
private_headers = [
|
||||
- 'config.h',
|
||||
- 'nbis-helpers.h',
|
||||
- 'fprint.h',
|
||||
- 'fp_internal.h',
|
||||
+ 'config.h',
|
||||
+ 'nbis-helpers.h',
|
||||
+ 'fprint.h',
|
||||
+ 'fp_internal.h',
|
||||
|
||||
- # Subdirectories to ignore
|
||||
- 'drivers',
|
||||
- 'nbis',
|
||||
+ # Subdirectories to ignore
|
||||
+ 'drivers',
|
||||
+ 'nbis',
|
||||
]
|
||||
|
||||
html_images = [
|
||||
@@ -25,20 +25,20 @@ glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
|
||||
docpath = join_paths(get_option('datadir'), 'gtk-doc', 'html')
|
||||
|
||||
gnome.gtkdoc('libfprint',
|
||||
- main_xml: 'libfprint-docs.xml',
|
||||
- src_dir: join_paths(meson.source_root(), 'libfprint'),
|
||||
- dependencies: libfprint_dep,
|
||||
- content_files: content_files,
|
||||
- expand_content_files: expand_content_files,
|
||||
- scan_args: [
|
||||
- #'--rebuild-sections',
|
||||
- '--ignore-decorators=API_EXPORTED',
|
||||
- '--ignore-headers=' + ' '.join(private_headers),
|
||||
- ],
|
||||
- fixxref_args: [
|
||||
- '--html-dir=@0@'.format(docpath),
|
||||
- '--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
|
||||
- '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
|
||||
- ],
|
||||
- html_assets: html_images,
|
||||
- install: true)
|
||||
+ main_xml: 'libfprint-docs.xml',
|
||||
+ src_dir: join_paths(meson.source_root(), 'libfprint'),
|
||||
+ dependencies: libfprint_dep,
|
||||
+ content_files: content_files,
|
||||
+ expand_content_files: expand_content_files,
|
||||
+ scan_args: [
|
||||
+ #'--rebuild-sections',
|
||||
+ '--ignore-decorators=API_EXPORTED',
|
||||
+ '--ignore-headers=' + ' '.join(private_headers),
|
||||
+ ],
|
||||
+ fixxref_args: [
|
||||
+ '--html-dir=@0@'.format(docpath),
|
||||
+ '--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
|
||||
+ '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
|
||||
+ ],
|
||||
+ html_assets: html_images,
|
||||
+ install: true)
|
||||
diff --git a/doc/xml/meson.build b/doc/xml/meson.build
|
||||
index e35f7ee..2ca1100 100644
|
||||
--- a/doc/xml/meson.build
|
||||
+++ b/doc/xml/meson.build
|
||||
@@ -7,4 +7,6 @@ ent_conf.set('PACKAGE_TARNAME', 'libfprint-' + meson.project_version())
|
||||
ent_conf.set('PACKAGE_URL', 'https://fprint.freedesktop.org/')
|
||||
ent_conf.set('PACKAGE_VERSION', meson.project_version())
|
||||
ent_conf.set('PACKAGE_API_VERSION', '1.0')
|
||||
-configure_file(input: 'gtkdocentities.ent.in', output: 'gtkdocentities.ent', configuration: ent_conf)
|
||||
+configure_file(input: 'gtkdocentities.ent.in',
|
||||
+ output: 'gtkdocentities.ent',
|
||||
+ configuration: ent_conf)
|
||||
diff --git a/examples/meson.build b/examples/meson.build
|
||||
index 5cd3d83..ff03ac6 100644
|
||||
--- a/examples/meson.build
|
||||
+++ b/examples/meson.build
|
||||
@@ -2,18 +2,18 @@
|
||||
examples = [ 'enroll', 'verify', 'manage-prints' ]
|
||||
foreach example: examples
|
||||
executable(example,
|
||||
- [example + '.c', 'storage.c', 'utilities.c'],
|
||||
- dependencies: [libfprint_dep, glib_dep],
|
||||
- include_directories: [
|
||||
- root_inc,
|
||||
- ],
|
||||
- c_args: common_cflags)
|
||||
+ [ example + '.c', 'storage.c', 'utilities.c' ],
|
||||
+ dependencies: [ libfprint_dep, glib_dep ],
|
||||
+ include_directories: [
|
||||
+ root_inc,
|
||||
+ ],
|
||||
+ c_args: common_cflags)
|
||||
endforeach
|
||||
|
||||
executable('cpp-test',
|
||||
- 'cpp-test.cpp',
|
||||
- dependencies: libfprint_dep,
|
||||
- include_directories: [
|
||||
- root_inc,
|
||||
- ],
|
||||
- c_args: common_cflags)
|
||||
+ 'cpp-test.cpp',
|
||||
+ dependencies: libfprint_dep,
|
||||
+ include_directories: [
|
||||
+ root_inc,
|
||||
+ ],
|
||||
+ c_args: common_cflags)
|
||||
diff --git a/libfprint/meson.build b/libfprint/meson.build
|
||||
index af2fe84..f77965a 100644
|
||||
--- a/libfprint/meson.build
|
||||
+++ b/libfprint/meson.build
|
||||
@@ -162,73 +162,73 @@ endif
|
||||
other_sources = []
|
||||
|
||||
fp_enums = gnome.mkenums_simple('fp-enums',
|
||||
- sources: libfprint_public_headers,
|
||||
- install_header : true)
|
||||
+ sources: libfprint_public_headers,
|
||||
+ install_header : true)
|
||||
fp_enums_h = fp_enums[1]
|
||||
|
||||
fpi_enums = gnome.mkenums_simple('fpi-enums',
|
||||
- sources: libfprint_private_headers,
|
||||
- install_header : true)
|
||||
+ sources: libfprint_private_headers,
|
||||
+ install_header : true)
|
||||
fpi_enums_h = fpi_enums[1]
|
||||
|
||||
drivers_sources += configure_file(input: 'empty_file',
|
||||
- output: 'fp-drivers.c',
|
||||
- capture: true,
|
||||
- command: [
|
||||
- 'echo',
|
||||
- drivers_type_list + '\n\n' + drivers_type_func
|
||||
- ])
|
||||
+ output: 'fp-drivers.c',
|
||||
+ capture: true,
|
||||
+ command: [
|
||||
+ 'echo',
|
||||
+ drivers_type_list + '\n\n' + drivers_type_func
|
||||
+ ])
|
||||
|
||||
mapfile = 'libfprint.ver'
|
||||
vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile)
|
||||
|
||||
deps = [ mathlib_dep, glib_dep, gusb_dep, nss_dep, imaging_dep, gio_dep ]
|
||||
libfprint = library('fprint',
|
||||
- libfprint_sources + fp_enums + fpi_enums +
|
||||
- drivers_sources + nbis_sources + other_sources,
|
||||
- soversion: soversion,
|
||||
- version: libversion,
|
||||
- c_args: common_cflags + drivers_cflags,
|
||||
- include_directories: [
|
||||
- root_inc,
|
||||
- include_directories('nbis/include'),
|
||||
- ],
|
||||
- link_args : vflag,
|
||||
- link_depends : mapfile,
|
||||
- dependencies: deps,
|
||||
- install: true)
|
||||
+ libfprint_sources + fp_enums + fpi_enums +
|
||||
+ drivers_sources + nbis_sources + other_sources,
|
||||
+ soversion: soversion,
|
||||
+ version: libversion,
|
||||
+ c_args: common_cflags + drivers_cflags,
|
||||
+ include_directories: [
|
||||
+ root_inc,
|
||||
+ include_directories('nbis/include'),
|
||||
+ ],
|
||||
+ link_args : vflag,
|
||||
+ link_depends : mapfile,
|
||||
+ dependencies: deps,
|
||||
+ install: true)
|
||||
|
||||
libfprint_dep = declare_dependency(link_with: libfprint,
|
||||
- sources: [ fp_enums_h ],
|
||||
- include_directories: root_inc,
|
||||
- dependencies: [glib_dep, gusb_dep, gio_dep])
|
||||
+ sources: [ fp_enums_h ],
|
||||
+ include_directories: root_inc,
|
||||
+ dependencies: [ glib_dep, gusb_dep, gio_dep ])
|
||||
|
||||
install_headers(['fprint.h'] + libfprint_public_headers, subdir: 'libfprint')
|
||||
|
||||
udev_rules = executable('fprint-list-udev-rules',
|
||||
- 'fprint-list-udev-rules.c',
|
||||
- include_directories: [
|
||||
- root_inc,
|
||||
- ],
|
||||
- dependencies: [ deps, libfprint_dep ],
|
||||
- install: false)
|
||||
+ 'fprint-list-udev-rules.c',
|
||||
+ include_directories: [
|
||||
+ root_inc,
|
||||
+ ],
|
||||
+ dependencies: [ deps, libfprint_dep ],
|
||||
+ install: false)
|
||||
|
||||
if get_option('udev_rules')
|
||||
custom_target('udev-rules',
|
||||
- output: '60-fprint-autosuspend.rules',
|
||||
- capture: true,
|
||||
- command: [ udev_rules ],
|
||||
- install: true,
|
||||
- install_dir: udev_rules_dir)
|
||||
+ output: '60-fprint-autosuspend.rules',
|
||||
+ capture: true,
|
||||
+ command: [ udev_rules ],
|
||||
+ install: true,
|
||||
+ install_dir: udev_rules_dir)
|
||||
endif
|
||||
|
||||
supported_devices = executable('fprint-list-supported-devices',
|
||||
- 'fprint-list-supported-devices.c',
|
||||
- include_directories: [
|
||||
- root_inc,
|
||||
- ],
|
||||
- dependencies: [ deps, libfprint_dep ],
|
||||
- install: false)
|
||||
+ 'fprint-list-supported-devices.c',
|
||||
+ include_directories: [
|
||||
+ root_inc,
|
||||
+ ],
|
||||
+ dependencies: [ deps, libfprint_dep ],
|
||||
+ install: false)
|
||||
|
||||
|
||||
if get_option('introspection')
|
||||
@@ -256,8 +256,7 @@ if get_option('introspection')
|
||||
'GObject-2.0',
|
||||
'GUsb-1.0',
|
||||
],
|
||||
- install : true
|
||||
- )
|
||||
+ install : true)
|
||||
libfprint_gir = libfprint_girtarget[0]
|
||||
libfprint_typelib = libfprint_girtarget[1]
|
||||
endif
|
||||
diff --git a/meson.build b/meson.build
|
||||
index a499a38..158a2a0 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -1,12 +1,12 @@
|
||||
project('libfprint', [ 'c', 'cpp' ],
|
||||
- version: '1.90.0',
|
||||
- license: 'LGPLv2.1+',
|
||||
- default_options: [
|
||||
- 'buildtype=debugoptimized',
|
||||
- 'warning_level=1',
|
||||
- 'c_std=c99',
|
||||
- ],
|
||||
- meson_version: '>= 0.46.0')
|
||||
+ version: '1.90.0',
|
||||
+ license: 'LGPLv2.1+',
|
||||
+ default_options: [
|
||||
+ 'buildtype=debugoptimized',
|
||||
+ 'warning_level=1',
|
||||
+ 'c_std=c99',
|
||||
+ ],
|
||||
+ meson_version: '>= 0.46.0')
|
||||
|
||||
gnome = import('gnome')
|
||||
|
||||
@@ -160,11 +160,10 @@ endif
|
||||
|
||||
pkgconfig = import('pkgconfig')
|
||||
pkgconfig.generate(
|
||||
- name: 'libfprint',
|
||||
- description: 'Generic C API for fingerprint reader access',
|
||||
- version: meson.project_version(),
|
||||
- libraries: libfprint,
|
||||
- subdirs: 'libfprint',
|
||||
- filebase: 'libfprint2',
|
||||
- install_dir: join_paths(get_option('libdir'), 'pkgconfig'),
|
||||
-)
|
||||
+ name: 'libfprint',
|
||||
+ description: 'Generic C API for fingerprint reader access',
|
||||
+ version: meson.project_version(),
|
||||
+ libraries: libfprint,
|
||||
+ subdirs: 'libfprint',
|
||||
+ filebase: 'libfprint2',
|
||||
+ install_dir: join_paths(get_option('libdir'), 'pkgconfig'))
|
||||
diff --git a/tests/meson.build b/tests/meson.build
|
||||
index d02b05a..7987692 100644
|
||||
--- a/tests/meson.build
|
||||
+++ b/tests/meson.build
|
||||
@@ -16,8 +16,7 @@ envs.set('NO_AT_BRIDGE', '1')
|
||||
|
||||
if get_option('introspection')
|
||||
if 'virtual_image' in drivers
|
||||
- test(
|
||||
- 'virtual-image',
|
||||
+ test('virtual-image',
|
||||
find_program('virtual-image.py'),
|
||||
args: '--verbose',
|
||||
env: envs,
|
||||
@@ -26,8 +25,7 @@ if get_option('introspection')
|
||||
endif
|
||||
|
||||
if 'vfs5011' in drivers
|
||||
- test(
|
||||
- 'vfs5011',
|
||||
+ test('vfs5011',
|
||||
find_program('umockdev-test.py'),
|
||||
args: join_paths(meson.current_source_dir(), 'vfs5011'),
|
||||
env: envs,
|
||||
@@ -37,8 +35,7 @@ if get_option('introspection')
|
||||
endif
|
||||
|
||||
if 'synaptics' in drivers
|
||||
- test(
|
||||
- 'synaptics',
|
||||
+ test('synaptics',
|
||||
find_program('umockdev-test.py'),
|
||||
args: join_paths(meson.current_source_dir(), 'synaptics'),
|
||||
env: envs,
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,54 +0,0 @@
|
||||
From ceb62d7617a01de49d8e1580f14359972cd545d8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Fri, 22 Nov 2019 14:09:51 +0100
|
||||
Subject: [PATCH 014/181] meson: Avoid repeating the needed glib version
|
||||
multiple times
|
||||
|
||||
Just define once and modify its syntax when needed.
|
||||
Use a more verbose definition for the min/max version (instead of just
|
||||
join the split version) so that in case we may depend on a specifc glib
|
||||
micro release during development.
|
||||
---
|
||||
meson.build | 11 +++++++----
|
||||
1 file changed, 7 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 158a2a0..cf277f5 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -18,7 +18,10 @@ libfprint_conf = configuration_data()
|
||||
cc = meson.get_compiler('c')
|
||||
cpp = meson.get_compiler('cpp')
|
||||
host_system = host_machine.system()
|
||||
+glib_min_version = '2.50'
|
||||
|
||||
+glib_version_def = 'GLIB_VERSION_@0@_@1@'.format(
|
||||
+ glib_min_version.split('.')[0], glib_min_version.split('.')[1])
|
||||
common_cflags = cc.get_supported_arguments([
|
||||
'-fgnu89-inline',
|
||||
'-std=gnu99',
|
||||
@@ -30,8 +33,8 @@ common_cflags = cc.get_supported_arguments([
|
||||
'-Werror-implicit-function-declaration',
|
||||
'-Wno-pointer-sign',
|
||||
'-Wshadow',
|
||||
- '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_50',
|
||||
- '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_50',
|
||||
+ '-DGLIB_VERSION_MIN_REQUIRED=' + glib_version_def,
|
||||
+ '-DGLIB_VERSION_MAX_ALLOWED=' + glib_version_def,
|
||||
])
|
||||
|
||||
# maintaining compatibility with the previous libtool versioning
|
||||
@@ -43,8 +46,8 @@ revision = 0
|
||||
libversion = '@0@.@1@.@2@'.format(soversion, current, revision)
|
||||
|
||||
# Dependencies
|
||||
-glib_dep = dependency('glib-2.0', version: '>= 2.50')
|
||||
-gio_dep = dependency('gio-unix-2.0', version: '>= 2.44.0')
|
||||
+glib_dep = dependency('glib-2.0', version: '>=' + glib_min_version)
|
||||
+gio_dep = dependency('gio-unix-2.0', version: '>=' + glib_min_version)
|
||||
gusb_dep = dependency('gusb', version: '>= 0.3.0')
|
||||
mathlib_dep = cc.find_library('m', required: false)
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,58 +0,0 @@
|
||||
From 8b270141f32411a02dffa1833564a8dafe6c1fd3 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Fri, 22 Nov 2019 13:06:08 +0100
|
||||
Subject: [PATCH 015/181] image-device: Use g_clear_handle_id for timeouts
|
||||
|
||||
As per this depend on glib 2.56: it has been released almost 2 years ago,
|
||||
I suppose we're fine with that.
|
||||
---
|
||||
libfprint/fp-image-device.c | 12 ++----------
|
||||
meson.build | 2 +-
|
||||
2 files changed, 3 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/libfprint/fp-image-device.c b/libfprint/fp-image-device.c
|
||||
index 65cca16..44de578 100644
|
||||
--- a/libfprint/fp-image-device.c
|
||||
+++ b/libfprint/fp-image-device.c
|
||||
@@ -80,11 +80,7 @@ fp_image_device_change_state (FpImageDevice *self, FpImageDeviceState state)
|
||||
|
||||
/* We might have been waiting for the finger to go OFF to start the
|
||||
* next operation. */
|
||||
- if (priv->pending_activation_timeout_id)
|
||||
- {
|
||||
- g_source_remove (priv->pending_activation_timeout_id);
|
||||
- priv->pending_activation_timeout_id = 0;
|
||||
- }
|
||||
+ g_clear_handle_id (&priv->pending_activation_timeout_id, g_source_remove);
|
||||
|
||||
fp_dbg ("Image device internal state change from %d to %d\n", priv->state, state);
|
||||
|
||||
@@ -110,11 +106,7 @@ fp_image_device_activate (FpImageDevice *self)
|
||||
|
||||
/* We might have been waiting for deactivation to finish before
|
||||
* starting the next operation. */
|
||||
- if (priv->pending_activation_timeout_id)
|
||||
- {
|
||||
- g_source_remove (priv->pending_activation_timeout_id);
|
||||
- priv->pending_activation_timeout_id = 0;
|
||||
- }
|
||||
+ g_clear_handle_id (&priv->pending_activation_timeout_id, g_source_remove);
|
||||
|
||||
fp_dbg ("Activating image device\n");
|
||||
cls->activate (self);
|
||||
diff --git a/meson.build b/meson.build
|
||||
index cf277f5..ef352ba 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -18,7 +18,7 @@ libfprint_conf = configuration_data()
|
||||
cc = meson.get_compiler('c')
|
||||
cpp = meson.get_compiler('cpp')
|
||||
host_system = host_machine.system()
|
||||
-glib_min_version = '2.50'
|
||||
+glib_min_version = '2.56'
|
||||
|
||||
glib_version_def = 'GLIB_VERSION_@0@_@1@'.format(
|
||||
glib_min_version.split('.')[0], glib_min_version.split('.')[1])
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,32 +0,0 @@
|
||||
From 201b5a9614afdc39f6cef08072834d59ab63ff65 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Fri, 22 Nov 2019 14:19:10 +0100
|
||||
Subject: [PATCH 016/181] fp-print: Use g_date_copy
|
||||
|
||||
As per previous commit we depend on glib 2.56, we can use this utility
|
||||
function as well.
|
||||
---
|
||||
libfprint/fp-print.c | 7 ++-----
|
||||
1 file changed, 2 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/libfprint/fp-print.c b/libfprint/fp-print.c
|
||||
index 1a6a70f..39c5c0a 100644
|
||||
--- a/libfprint/fp-print.c
|
||||
+++ b/libfprint/fp-print.c
|
||||
@@ -534,11 +534,8 @@ fp_print_set_enroll_date (FpPrint *print,
|
||||
|
||||
g_clear_pointer (&print->enroll_date, g_date_free);
|
||||
if (enroll_date)
|
||||
- {
|
||||
- /* XXX: Should use g_date_copy, but that is new in 2.56. */
|
||||
- print->enroll_date = g_date_new ();
|
||||
- *print->enroll_date = *enroll_date;
|
||||
- }
|
||||
+ print->enroll_date = g_date_copy (enroll_date);
|
||||
+
|
||||
g_object_notify_by_pspec (G_OBJECT (print), properties[PROP_ENROLL_DATE]);
|
||||
}
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,25 +0,0 @@
|
||||
From 60ad1ab9e3e5ecc1fe7bf390a2cec2e662dfd567 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Fri, 22 Nov 2019 13:08:33 +0100
|
||||
Subject: [PATCH 017/181] fp-image-device: Clear the pending activation timeout
|
||||
on finalize
|
||||
|
||||
---
|
||||
libfprint/fp-image-device.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/libfprint/fp-image-device.c b/libfprint/fp-image-device.c
|
||||
index 44de578..9aa9e1f 100644
|
||||
--- a/libfprint/fp-image-device.c
|
||||
+++ b/libfprint/fp-image-device.c
|
||||
@@ -278,6 +278,7 @@ fp_image_device_finalize (GObject *object)
|
||||
FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
|
||||
|
||||
g_assert (priv->active == FALSE);
|
||||
+ g_clear_handle_id (&priv->pending_activation_timeout_id, g_source_remove);
|
||||
|
||||
G_OBJECT_CLASS (fp_image_device_parent_class)->finalize (object);
|
||||
}
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,34 +0,0 @@
|
||||
From ea4da08af014343bffa6254d78514c2f3076575b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Fri, 22 Nov 2019 13:19:03 +0100
|
||||
Subject: [PATCH 018/181] fp-image-device: Reactivate in idle on deactivation
|
||||
completed
|
||||
|
||||
This is the same logic we apply to fp-device by default: any completed
|
||||
action should trigger the subsequent one when it is finished.
|
||||
So in case we want reactivate after a deactivation, let's do it in an idle,
|
||||
after removing the current pending timeout.
|
||||
---
|
||||
libfprint/fp-image-device.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libfprint/fp-image-device.c b/libfprint/fp-image-device.c
|
||||
index 9aa9e1f..84b1bb0 100644
|
||||
--- a/libfprint/fp-image-device.c
|
||||
+++ b/libfprint/fp-image-device.c
|
||||
@@ -732,7 +732,11 @@ fpi_image_device_deactivate_complete (FpImageDevice *self, GError *error)
|
||||
|
||||
/* We might be waiting to be able to activate again. */
|
||||
if (priv->pending_activation_timeout_id)
|
||||
- fp_image_device_activate (self);
|
||||
+ {
|
||||
+ g_clear_handle_id (&priv->pending_activation_timeout_id, g_source_remove);
|
||||
+ priv->pending_activation_timeout_id =
|
||||
+ g_idle_add ((GSourceFunc) fp_image_device_activate, self);
|
||||
+ }
|
||||
}
|
||||
|
||||
/**
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,132 +0,0 @@
|
||||
From be367988ae4fc4d91d5cad7c9f7d47f67a878540 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Fri, 22 Nov 2019 13:51:16 +0100
|
||||
Subject: [PATCH 019/181] fp-image-device: Add private "fp-image-device-state"
|
||||
property
|
||||
|
||||
In this way drivers may get this without having to keep a copy of it
|
||||
---
|
||||
libfprint/fp-image-device.c | 44 +++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 44 insertions(+)
|
||||
|
||||
diff --git a/libfprint/fp-image-device.c b/libfprint/fp-image-device.c
|
||||
index 84b1bb0..3565b90 100644
|
||||
--- a/libfprint/fp-image-device.c
|
||||
+++ b/libfprint/fp-image-device.c
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "fpi-log.h"
|
||||
|
||||
#include "fpi-image-device.h"
|
||||
+#include "fpi-enums.h"
|
||||
#include "fpi-print.h"
|
||||
#include "fpi-image.h"
|
||||
|
||||
@@ -60,6 +61,13 @@ typedef struct
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (FpImageDevice, fp_image_device, FP_TYPE_DEVICE)
|
||||
|
||||
+enum {
|
||||
+ PROP_0,
|
||||
+ PROP_FPI_STATE,
|
||||
+ N_PROPS
|
||||
+};
|
||||
+
|
||||
+static GParamSpec *properties[N_PROPS];
|
||||
|
||||
/*******************************************************/
|
||||
|
||||
@@ -85,6 +93,7 @@ fp_image_device_change_state (FpImageDevice *self, FpImageDeviceState state)
|
||||
fp_dbg ("Image device internal state change from %d to %d\n", priv->state, state);
|
||||
|
||||
priv->state = state;
|
||||
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FPI_STATE]);
|
||||
|
||||
/* change_state is the only callback which is optional and does not
|
||||
* have a default implementation. */
|
||||
@@ -103,6 +112,7 @@ fp_image_device_activate (FpImageDevice *self)
|
||||
/* We don't have a neutral ACTIVE state, but we always will
|
||||
* go into WAIT_FINGER_ON afterwards. */
|
||||
priv->state = FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON;
|
||||
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FPI_STATE]);
|
||||
|
||||
/* We might have been waiting for deactivation to finish before
|
||||
* starting the next operation. */
|
||||
@@ -127,6 +137,7 @@ fp_image_device_deactivate (FpDevice *device)
|
||||
return;
|
||||
}
|
||||
priv->state = FP_IMAGE_DEVICE_STATE_INACTIVE;
|
||||
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FPI_STATE]);
|
||||
|
||||
fp_dbg ("Deactivating image device\n");
|
||||
cls->deactivate (self);
|
||||
@@ -295,6 +306,26 @@ fp_image_device_default_deactivate (FpImageDevice *self)
|
||||
fpi_image_device_deactivate_complete (self, NULL);
|
||||
}
|
||||
|
||||
+static void
|
||||
+fp_image_device_get_property (GObject *object,
|
||||
+ guint prop_id,
|
||||
+ GValue *value,
|
||||
+ GParamSpec *pspec)
|
||||
+{
|
||||
+ FpImageDevice *self = FP_IMAGE_DEVICE (object);
|
||||
+ FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
|
||||
+
|
||||
+ switch (prop_id)
|
||||
+ {
|
||||
+ case PROP_FPI_STATE:
|
||||
+ g_value_set_enum (value, priv->state);
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void
|
||||
fp_image_device_class_init (FpImageDeviceClass *klass)
|
||||
{
|
||||
@@ -302,6 +333,7 @@ fp_image_device_class_init (FpImageDeviceClass *klass)
|
||||
FpDeviceClass *fp_device_class = FP_DEVICE_CLASS (klass);
|
||||
|
||||
object_class->finalize = fp_image_device_finalize;
|
||||
+ object_class->get_property = fp_image_device_get_property;
|
||||
|
||||
fp_device_class->open = fp_image_device_open;
|
||||
fp_device_class->close = fp_image_device_close;
|
||||
@@ -315,6 +347,16 @@ fp_image_device_class_init (FpImageDeviceClass *klass)
|
||||
/* Default implementations */
|
||||
klass->activate = fp_image_device_default_activate;
|
||||
klass->deactivate = fp_image_device_default_deactivate;
|
||||
+
|
||||
+ properties[PROP_FPI_STATE] =
|
||||
+ g_param_spec_enum ("fp-image-device-state",
|
||||
+ "Image Device State",
|
||||
+ "Private: The state of the image device",
|
||||
+ FP_TYPE_IMAGE_DEVICE_STATE,
|
||||
+ FP_IMAGE_DEVICE_STATE_INACTIVE,
|
||||
+ G_PARAM_STATIC_STRINGS | G_PARAM_READABLE);
|
||||
+
|
||||
+ g_object_class_install_properties (object_class, N_PROPS, properties);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -760,6 +802,7 @@ fpi_image_device_open_complete (FpImageDevice *self, GError *error)
|
||||
g_debug ("Image device open completed");
|
||||
|
||||
priv->state = FP_IMAGE_DEVICE_STATE_INACTIVE;
|
||||
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FPI_STATE]);
|
||||
|
||||
fpi_device_open_complete (FP_DEVICE (self), error);
|
||||
}
|
||||
@@ -785,6 +828,7 @@ fpi_image_device_close_complete (FpImageDevice *self, GError *error)
|
||||
g_return_if_fail (action == FP_DEVICE_ACTION_CLOSE);
|
||||
|
||||
priv->state = FP_IMAGE_DEVICE_STATE_INACTIVE;
|
||||
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FPI_STATE]);
|
||||
|
||||
fpi_device_close_complete (FP_DEVICE (self), error);
|
||||
}
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,70 +0,0 @@
|
||||
From cca6d3b04b74558e12df3aa43761faaa574c5ff9 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Fri, 22 Nov 2019 14:50:48 +0100
|
||||
Subject: [PATCH 020/181] fp-image-device: Use a GObject signal to notify image
|
||||
state changed
|
||||
|
||||
This is more GObject-friendly and we have the automatic call of the vfunc if
|
||||
one is set.
|
||||
---
|
||||
libfprint/fp-image-device.c | 23 +++++++++++++++++------
|
||||
1 file changed, 17 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/libfprint/fp-image-device.c b/libfprint/fp-image-device.c
|
||||
index 3565b90..692727b 100644
|
||||
--- a/libfprint/fp-image-device.c
|
||||
+++ b/libfprint/fp-image-device.c
|
||||
@@ -69,6 +69,14 @@ enum {
|
||||
|
||||
static GParamSpec *properties[N_PROPS];
|
||||
|
||||
+enum {
|
||||
+ FPI_STATE_CHANGED,
|
||||
+
|
||||
+ LAST_SIGNAL
|
||||
+};
|
||||
+
|
||||
+static guint signals[LAST_SIGNAL] = { 0 };
|
||||
+
|
||||
/*******************************************************/
|
||||
|
||||
/* TODO:
|
||||
@@ -81,7 +89,6 @@ static void
|
||||
fp_image_device_change_state (FpImageDevice *self, FpImageDeviceState state)
|
||||
{
|
||||
FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
|
||||
- FpImageDeviceClass *cls = FP_IMAGE_DEVICE_GET_CLASS (self);
|
||||
|
||||
/* Cannot change to inactive using this function. */
|
||||
g_assert (state != FP_IMAGE_DEVICE_STATE_INACTIVE);
|
||||
@@ -94,11 +101,7 @@ fp_image_device_change_state (FpImageDevice *self, FpImageDeviceState state)
|
||||
|
||||
priv->state = state;
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FPI_STATE]);
|
||||
-
|
||||
- /* change_state is the only callback which is optional and does not
|
||||
- * have a default implementation. */
|
||||
- if (cls->change_state)
|
||||
- cls->change_state (self, state);
|
||||
+ g_signal_emit (self, signals[FPI_STATE_CHANGED], 0, priv->state);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -356,6 +359,14 @@ fp_image_device_class_init (FpImageDeviceClass *klass)
|
||||
FP_IMAGE_DEVICE_STATE_INACTIVE,
|
||||
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE);
|
||||
|
||||
+ signals[FPI_STATE_CHANGED] =
|
||||
+ g_signal_new ("fp-image-device-state-changed",
|
||||
+ G_TYPE_FROM_CLASS (object_class),
|
||||
+ G_SIGNAL_RUN_FIRST,
|
||||
+ G_STRUCT_OFFSET (FpImageDeviceClass, change_state),
|
||||
+ NULL, NULL, NULL,
|
||||
+ G_TYPE_NONE, 1, FP_TYPE_IMAGE_DEVICE_STATE);
|
||||
+
|
||||
g_object_class_install_properties (object_class, N_PROPS, properties);
|
||||
}
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,32 +0,0 @@
|
||||
From 0a08a248966b3ecc9c30c0654ed1326f64a8b0cc Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Fri, 22 Nov 2019 16:27:18 +0100
|
||||
Subject: [PATCH 021/181] fpi-ssm: Remove any reference to fpi_timeout_add()
|
||||
|
||||
This doesn't exist anymore, while fpi_device_add_timeout does exists.
|
||||
---
|
||||
libfprint/fpi-ssm.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libfprint/fpi-ssm.c b/libfprint/fpi-ssm.c
|
||||
index f00af81..1569be8 100644
|
||||
--- a/libfprint/fpi-ssm.c
|
||||
+++ b/libfprint/fpi-ssm.c
|
||||
@@ -367,11 +367,11 @@ fpi_ssm_dup_error (FpiSsm *machine)
|
||||
* @data: a pointer to an #FpiSsm state machine
|
||||
*
|
||||
* Same as fpi_ssm_next_state(), but to be used as a callback
|
||||
- * for an fpi_timeout_add() callback, when the state change needs
|
||||
- * to happen after a timeout.
|
||||
+ * for an fpi_device_add_timeout() callback, when the state
|
||||
+ * change needs to happen after a timeout.
|
||||
*
|
||||
* Make sure to pass the #FpiSsm as the `ssm_data` argument
|
||||
- * for that fpi_timeout_add() call.
|
||||
+ * for that fpi_device_add_timeout() call.
|
||||
*/
|
||||
void
|
||||
fpi_ssm_next_state_timeout_cb (FpDevice *dev,
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,30 +0,0 @@
|
||||
From 15d218a112728c9ded518f55a985223861f79cda Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Fri, 22 Nov 2019 17:56:24 +0100
|
||||
Subject: [PATCH 022/181] fpi-log: Set fp_error as equal to g_critical
|
||||
|
||||
---
|
||||
libfprint/fpi-log.h | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libfprint/fpi-log.h b/libfprint/fpi-log.h
|
||||
index 1c3d5ad..8f2f6a1 100644
|
||||
--- a/libfprint/fpi-log.h
|
||||
+++ b/libfprint/fpi-log.h
|
||||
@@ -68,11 +68,11 @@
|
||||
/**
|
||||
* fp_err:
|
||||
*
|
||||
- * Same as g_warning(). In the future, this might be changed to a
|
||||
+ * Same as g_critical(). In the future, this might be changed to a
|
||||
* g_assert() instead, so bear this in mind when adding those calls
|
||||
* to your driver.
|
||||
*/
|
||||
-#define fp_err g_warning
|
||||
+#define fp_err g_critical
|
||||
|
||||
/**
|
||||
* BUG_ON:
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,80 +0,0 @@
|
||||
From 555fa2dc485b455faa730406faf57acd4d954197 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Mon, 25 Nov 2019 21:22:47 +0100
|
||||
Subject: [PATCH 023/181] fp-device: Support variadic arguments to error
|
||||
functions
|
||||
|
||||
Make possible to generate a formatted message when creating an error from
|
||||
a device, without having save it first.
|
||||
---
|
||||
libfprint/fp-device.c | 26 ++++++++++++++++++++++----
|
||||
libfprint/fpi-device.h | 6 ++++--
|
||||
2 files changed, 26 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/libfprint/fp-device.c b/libfprint/fp-device.c
|
||||
index 480d5cf..13f1b5a 100644
|
||||
--- a/libfprint/fp-device.c
|
||||
+++ b/libfprint/fp-device.c
|
||||
@@ -243,9 +243,18 @@ fpi_device_error_new (FpDeviceError error)
|
||||
* and similar calls.
|
||||
*/
|
||||
GError *
|
||||
-fpi_device_retry_new_msg (FpDeviceRetry error, const gchar *msg)
|
||||
+fpi_device_retry_new_msg (FpDeviceRetry device_error,
|
||||
+ const gchar *msg,
|
||||
+ ...)
|
||||
{
|
||||
- return g_error_new_literal (FP_DEVICE_RETRY, error, msg);
|
||||
+ GError *error;
|
||||
+ va_list args;
|
||||
+
|
||||
+ va_start (args, msg);
|
||||
+ error = g_error_new_valist (FP_DEVICE_RETRY, device_error, msg, args);
|
||||
+ va_end (args);
|
||||
+
|
||||
+ return error;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -257,9 +266,18 @@ fpi_device_retry_new_msg (FpDeviceRetry error, const gchar *msg)
|
||||
* and similar calls.
|
||||
*/
|
||||
GError *
|
||||
-fpi_device_error_new_msg (FpDeviceError error, const gchar *msg)
|
||||
+fpi_device_error_new_msg (FpDeviceError device_error,
|
||||
+ const gchar *msg,
|
||||
+ ...)
|
||||
{
|
||||
- return g_error_new_literal (FP_DEVICE_ERROR, error, msg);
|
||||
+ GError *error;
|
||||
+ va_list args;
|
||||
+
|
||||
+ va_start (args, msg);
|
||||
+ error = g_error_new_valist (FP_DEVICE_ERROR, device_error, msg, args);
|
||||
+ va_end (args);
|
||||
+
|
||||
+ return error;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
diff --git a/libfprint/fpi-device.h b/libfprint/fpi-device.h
|
||||
index a206798..d83a5a3 100644
|
||||
--- a/libfprint/fpi-device.h
|
||||
+++ b/libfprint/fpi-device.h
|
||||
@@ -181,9 +181,11 @@ GError * fpi_device_retry_new (FpDeviceRetry error);
|
||||
GError * fpi_device_error_new (FpDeviceError error);
|
||||
|
||||
GError * fpi_device_retry_new_msg (FpDeviceRetry error,
|
||||
- const gchar *msg);
|
||||
+ const gchar *msg,
|
||||
+ ...) G_GNUC_PRINTF (2, 3);
|
||||
GError * fpi_device_error_new_msg (FpDeviceError error,
|
||||
- const gchar *msg);
|
||||
+ const gchar *msg,
|
||||
+ ...) G_GNUC_PRINTF (2, 3);
|
||||
|
||||
guint64 fpi_device_get_driver_data (FpDevice *device);
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,158 +0,0 @@
|
||||
From d830d88463dc9ecdb1943662910692fd4cb7bdf3 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Mon, 25 Nov 2019 21:23:31 +0100
|
||||
Subject: [PATCH 024/181] drivers: Use clearer messages using parameters
|
||||
|
||||
---
|
||||
libfprint/drivers/aesx660.c | 16 +++++++++++-----
|
||||
libfprint/drivers/synaptics/synaptics.c | 17 ++++++++++++-----
|
||||
libfprint/drivers/upekts.c | 8 +++++---
|
||||
3 files changed, 28 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/aesx660.c b/libfprint/drivers/aesx660.c
|
||||
index 8540a06..8ad4c63 100644
|
||||
--- a/libfprint/drivers/aesx660.c
|
||||
+++ b/libfprint/drivers/aesx660.c
|
||||
@@ -131,7 +131,9 @@ aesX660_read_calibrate_data_cb (FpiUsbTransfer *transfer,
|
||||
fp_dbg ("Bogus calibrate response: %.2x\n", data[0]);
|
||||
fpi_ssm_mark_failed (transfer->ssm,
|
||||
fpi_device_error_new_msg (FP_DEVICE_ERROR_PROTO,
|
||||
- "Bogus calibrate response"));
|
||||
+ "Bogus calibrate "
|
||||
+ "response: %.2x",
|
||||
+ data[0]));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -175,7 +177,8 @@ finger_det_read_fd_data_cb (FpiUsbTransfer *transfer,
|
||||
fp_dbg ("Bogus FD response: %.2x\n", data[0]);
|
||||
fpi_ssm_mark_failed (transfer->ssm,
|
||||
fpi_device_error_new_msg (FP_DEVICE_ERROR_PROTO,
|
||||
- "Bogus FD response"));
|
||||
+ "Bogus FD response %.2x",
|
||||
+ data[0]));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -538,7 +541,8 @@ activate_read_id_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
fp_dbg ("Bogus read ID response: %.2x\n", data[AESX660_RESPONSE_TYPE_OFFSET]);
|
||||
fpi_ssm_mark_failed (transfer->ssm,
|
||||
fpi_device_error_new_msg (FP_DEVICE_ERROR_PROTO,
|
||||
- "Bogus read ID response"));
|
||||
+ "Bogus read ID response %.2x",
|
||||
+ data[AESX660_RESPONSE_TYPE_OFFSET]));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -565,7 +569,8 @@ activate_read_id_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
fp_dbg ("Failed to init device! init status: %.2x\n", data[7]);
|
||||
fpi_ssm_mark_failed (transfer->ssm,
|
||||
fpi_device_error_new_msg (FP_DEVICE_ERROR_PROTO,
|
||||
- "Failed to init device"));
|
||||
+ "Failed to init device %.2x",
|
||||
+ data[7]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -594,7 +599,8 @@ activate_read_init_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
data[3]);
|
||||
fpi_ssm_mark_failed (transfer->ssm,
|
||||
fpi_device_error_new_msg (FP_DEVICE_ERROR_PROTO,
|
||||
- "Bogus read init response"));
|
||||
+ "Bogus read init response: "
|
||||
+ "%.2x %.2x", data[0], data[3]));
|
||||
return;
|
||||
}
|
||||
priv->init_cmd_idx++;
|
||||
diff --git a/libfprint/drivers/synaptics/synaptics.c b/libfprint/drivers/synaptics/synaptics.c
|
||||
index 8eba852..f6faf11 100644
|
||||
--- a/libfprint/drivers/synaptics/synaptics.c
|
||||
+++ b/libfprint/drivers/synaptics/synaptics.c
|
||||
@@ -137,7 +137,8 @@ cmd_recieve_cb (FpiUsbTransfer *transfer,
|
||||
fp_warn ("Received General Error %d from the sensor", (guint) err);
|
||||
fpi_ssm_mark_failed (transfer->ssm,
|
||||
fpi_device_error_new_msg (FP_DEVICE_ERROR_PROTO,
|
||||
- "Received general error from device"));
|
||||
+ "Received general error %u from device",
|
||||
+ (guint) err));
|
||||
//fpi_ssm_jump_to_state (transfer->ssm, fpi_ssm_get_cur_state (transfer->ssm));
|
||||
return;
|
||||
}
|
||||
@@ -472,7 +473,8 @@ list_msg_cb (FpiDeviceSynaptics *self,
|
||||
fpi_device_list_complete (FP_DEVICE (self),
|
||||
NULL,
|
||||
fpi_device_error_new_msg (FP_DEVICE_ERROR_GENERAL,
|
||||
- "Failed to query enrolled users"));
|
||||
+ "Failed to query enrolled users: %d",
|
||||
+ resp->result));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -770,7 +772,8 @@ enroll_msg_cb (FpiDeviceSynaptics *self,
|
||||
fpi_device_enroll_complete (device,
|
||||
NULL,
|
||||
fpi_device_error_new_msg (FP_DEVICE_ERROR_GENERAL,
|
||||
- "Enrollment failed"));
|
||||
+ "Enrollment failed (%d)",
|
||||
+ resp->result));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1052,7 +1055,11 @@ dev_probe (FpDevice *device)
|
||||
self->mis_version.build_num);
|
||||
|
||||
error = fpi_device_error_new_msg (FP_DEVICE_ERROR_GENERAL,
|
||||
- "Unsupported firmware version");
|
||||
+ "Unsupported firmware version "
|
||||
+ "(%d.%d with build number %d)",
|
||||
+ self->mis_version.version_major,
|
||||
+ self->mis_version.version_minor,
|
||||
+ self->mis_version.build_num);
|
||||
goto err_close;
|
||||
}
|
||||
|
||||
@@ -1120,7 +1127,7 @@ fps_deinit_cb (FpiDeviceSynaptics *self,
|
||||
case BMKT_RSP_POWER_DOWN_FAIL:
|
||||
fp_info ("Failed to go to power down mode: %d", resp->result);
|
||||
error = fpi_device_error_new_msg (FP_DEVICE_ERROR_GENERAL,
|
||||
- "Power down failed");
|
||||
+ "Power down failed: %d", resp->result);
|
||||
|
||||
break;
|
||||
}
|
||||
diff --git a/libfprint/drivers/upekts.c b/libfprint/drivers/upekts.c
|
||||
index 2426907..b3481aa 100644
|
||||
--- a/libfprint/drivers/upekts.c
|
||||
+++ b/libfprint/drivers/upekts.c
|
||||
@@ -288,7 +288,7 @@ __handle_incoming_msg (FpDevice *device,
|
||||
{
|
||||
fp_warn ("cmd response too short (%d)", len);
|
||||
error = fpi_device_error_new_msg (FP_DEVICE_ERROR_PROTO,
|
||||
- "CMD response too short");
|
||||
+ "CMD response too short (%d)", len);
|
||||
goto err;
|
||||
}
|
||||
if (innerbuf[0] != 0x28)
|
||||
@@ -371,7 +371,8 @@ read_msg_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
fp_err ("async msg read too short (%d)",
|
||||
(gint) transfer->actual_length);
|
||||
error = fpi_device_error_new_msg (FP_DEVICE_ERROR_PROTO,
|
||||
- "Packet from device was too short");
|
||||
+ "Packet from device was too short (%lu)",
|
||||
+ transfer->actual_length);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -798,7 +799,8 @@ read_msg01_cb (FpDevice *dev, enum read_msg_type type,
|
||||
{
|
||||
fp_err ("expected seq=1, got %x", seq);
|
||||
fpi_ssm_mark_failed (ssm, fpi_device_error_new_msg (FP_DEVICE_ERROR_PROTO,
|
||||
- "Got wrong sequence number"));
|
||||
+ "Got wrong sequence number (%x)",
|
||||
+ seq));
|
||||
return;
|
||||
}
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,40 +0,0 @@
|
||||
From af26f2e307abde413d3f876c16eee93f5f9413fe Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 27 Nov 2019 16:50:54 +0100
|
||||
Subject: [PATCH 025/181] synaptics: Use GDate getters to retrieve the DMY
|
||||
values
|
||||
|
||||
As per commit 201b5a961 we use g_date_copy() to copy the date, however the
|
||||
GLib implementation is done assuming that the GDate getters are always used
|
||||
as the copy function doesn't preserve the original format of the date
|
||||
(whether is using julian days or dmy), and the synaptics driver access to
|
||||
the dmy values directly, without using the getter that would recompute the
|
||||
proper values.
|
||||
Causing a read error of unset values.
|
||||
|
||||
So, to avoid this, just use the g_date_get_* getters to retrieve the day
|
||||
month and year for for defining the print enroll id.
|
||||
---
|
||||
libfprint/drivers/synaptics/synaptics.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/synaptics/synaptics.c b/libfprint/drivers/synaptics/synaptics.c
|
||||
index f6faf11..9ecc682 100644
|
||||
--- a/libfprint/drivers/synaptics/synaptics.c
|
||||
+++ b/libfprint/drivers/synaptics/synaptics.c
|
||||
@@ -817,9 +817,9 @@ enroll (FpDevice *device)
|
||||
date = fp_print_get_enroll_date (print);
|
||||
if (date && g_date_valid (date))
|
||||
{
|
||||
- y = date->year;
|
||||
- m = date->month;
|
||||
- d = date->day;
|
||||
+ y = g_date_get_year (date);
|
||||
+ m = g_date_get_month (date);
|
||||
+ d = g_date_get_day (date);
|
||||
}
|
||||
else
|
||||
{
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,25 +0,0 @@
|
||||
From e39685ce0ce539763aa555442eb5f168e0ebd07d Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 27 Nov 2019 16:59:23 +0100
|
||||
Subject: [PATCH 026/181] synaptics: Initialize user_id autoptr to NULL
|
||||
|
||||
---
|
||||
libfprint/drivers/synaptics/synaptics.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libfprint/drivers/synaptics/synaptics.c b/libfprint/drivers/synaptics/synaptics.c
|
||||
index 9ecc682..a2286b2 100644
|
||||
--- a/libfprint/drivers/synaptics/synaptics.c
|
||||
+++ b/libfprint/drivers/synaptics/synaptics.c
|
||||
@@ -803,7 +803,7 @@ enroll (FpDevice *device)
|
||||
GVariant *uid = NULL;
|
||||
const gchar *username;
|
||||
guint finger;
|
||||
- g_autofree gchar *user_id;
|
||||
+ g_autofree gchar *user_id = NULL;
|
||||
gssize user_id_len;
|
||||
g_autofree guint8 *payload = NULL;
|
||||
const GDate *date;
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,66 +0,0 @@
|
||||
From 4c0a89257c713587bf570298a9cefdb6f5f0e302 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 27 Nov 2019 19:14:35 +0100
|
||||
Subject: [PATCH 027/181] examples: Handle the cases where the print date is
|
||||
not set
|
||||
|
||||
---
|
||||
examples/manage-prints.c | 17 +++++++++++------
|
||||
examples/verify.c | 11 ++++++++---
|
||||
2 files changed, 19 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/examples/manage-prints.c b/examples/manage-prints.c
|
||||
index b865af7..7bbbc5e 100644
|
||||
--- a/examples/manage-prints.c
|
||||
+++ b/examples/manage-prints.c
|
||||
@@ -153,14 +153,19 @@ on_list_completed (FpDevice *dev,
|
||||
for (i = 0; i < prints->len; ++i)
|
||||
{
|
||||
FpPrint * print = prints->pdata[i];
|
||||
+ const GDate *date = fp_print_get_enroll_date (print);
|
||||
|
||||
- g_date_strftime (buf, G_N_ELEMENTS (buf), "%Y-%m-%d",
|
||||
- fp_print_get_enroll_date (print));
|
||||
- g_print ("[%d] Print of %s finger for username %s, enrolled "
|
||||
- "on %s. Description: %s\n", i + 1,
|
||||
+ g_print ("[%d] Print of %s finger for username %s", i + 1,
|
||||
finger_to_string (fp_print_get_finger (print)),
|
||||
- fp_print_get_username (print), buf,
|
||||
- fp_print_get_description (print));
|
||||
+ fp_print_get_username (print));
|
||||
+
|
||||
+ if (date)
|
||||
+ {
|
||||
+ g_date_strftime (buf, G_N_ELEMENTS (buf), "%Y-%m-%d\0", date);
|
||||
+ g_print (", enrolled on %s", buf);
|
||||
+ }
|
||||
+
|
||||
+ g_print (". Description: %s\n", fp_print_get_description (print));
|
||||
}
|
||||
|
||||
if (prints->len)
|
||||
diff --git a/examples/verify.c b/examples/verify.c
|
||||
index 4e1c988..1249dce 100644
|
||||
--- a/examples/verify.c
|
||||
+++ b/examples/verify.c
|
||||
@@ -127,9 +127,14 @@ on_list_completed (FpDevice *dev, GAsyncResult *res, gpointer user_data)
|
||||
if (fp_print_get_finger (print) == verify_data->finger &&
|
||||
g_strcmp0 (fp_print_get_username (print), g_get_user_name ()) == 0)
|
||||
{
|
||||
- if (!verify_print ||
|
||||
- (g_date_compare (fp_print_get_enroll_date (print),
|
||||
- fp_print_get_enroll_date (verify_print)) >= 0))
|
||||
+ const GDate *verify_print_date = NULL;
|
||||
+ const GDate *print_date = fp_print_get_enroll_date (print);
|
||||
+
|
||||
+ if (verify_print)
|
||||
+ verify_print_date = fp_print_get_enroll_date (verify_print);
|
||||
+
|
||||
+ if (!verify_print || !print_date || !verify_print_date ||
|
||||
+ g_date_compare (print_date, verify_print_date) >= 0)
|
||||
verify_print = print;
|
||||
}
|
||||
}
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,509 +0,0 @@
|
||||
From 70d7ad5047544c5b66a280c1e6a2da1dcc3eb5f8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Tue, 26 Nov 2019 16:18:14 +0100
|
||||
Subject: [PATCH 028/181] fpi-ssm: Take ownership of the SSM when completing it
|
||||
|
||||
When a machine is completed, we automatically free it since we can't
|
||||
consider it valid anymore since this point.
|
||||
|
||||
Update the drivers not to free the SSM on completion callback anymore.
|
||||
---
|
||||
libfprint/drivers/aes1610.c | 2 --
|
||||
libfprint/drivers/aes2501.c | 2 --
|
||||
libfprint/drivers/aes2550.c | 2 --
|
||||
libfprint/drivers/aesx660.c | 3 ---
|
||||
libfprint/drivers/elan.c | 4 ----
|
||||
libfprint/drivers/etes603.c | 6 ------
|
||||
libfprint/drivers/synaptics/synaptics.c | 1 -
|
||||
libfprint/drivers/upeksonly.c | 2 --
|
||||
libfprint/drivers/upektc.c | 2 --
|
||||
libfprint/drivers/upektc_img.c | 3 ---
|
||||
libfprint/drivers/upekts.c | 4 ----
|
||||
libfprint/drivers/uru4000.c | 1 -
|
||||
libfprint/drivers/vcom5s.c | 1 -
|
||||
libfprint/drivers/vfs0050.c | 2 --
|
||||
libfprint/drivers/vfs101.c | 2 --
|
||||
libfprint/drivers/vfs301.c | 2 --
|
||||
libfprint/drivers/vfs5011.c | 2 --
|
||||
libfprint/fpi-ssm.c | 15 +++++++++++----
|
||||
18 files changed, 11 insertions(+), 45 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/aes1610.c b/libfprint/drivers/aes1610.c
|
||||
index c9742e9..0326565 100644
|
||||
--- a/libfprint/drivers/aes1610.c
|
||||
+++ b/libfprint/drivers/aes1610.c
|
||||
@@ -710,7 +710,6 @@ capture_sm_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
|
||||
{
|
||||
start_finger_detection (dev);
|
||||
}
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -774,7 +773,6 @@ activate_sm_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
|
||||
|
||||
if (!error)
|
||||
start_finger_detection (dev);
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/libfprint/drivers/aes2501.c b/libfprint/drivers/aes2501.c
|
||||
index fad0218..1b59c56 100644
|
||||
--- a/libfprint/drivers/aes2501.c
|
||||
+++ b/libfprint/drivers/aes2501.c
|
||||
@@ -575,7 +575,6 @@ capture_sm_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
|
||||
{
|
||||
start_finger_detection (dev);
|
||||
}
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -806,7 +805,6 @@ activate_sm_complete (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
|
||||
if (!error)
|
||||
start_finger_detection (FP_IMAGE_DEVICE (dev));
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/libfprint/drivers/aes2550.c b/libfprint/drivers/aes2550.c
|
||||
index 2abcf76..b95b053 100644
|
||||
--- a/libfprint/drivers/aes2550.c
|
||||
+++ b/libfprint/drivers/aes2550.c
|
||||
@@ -391,7 +391,6 @@ capture_sm_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
|
||||
{
|
||||
start_finger_detection (dev);
|
||||
}
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -537,7 +536,6 @@ activate_sm_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
|
||||
|
||||
if (!error)
|
||||
start_finger_detection (dev);
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/libfprint/drivers/aesx660.c b/libfprint/drivers/aesx660.c
|
||||
index 8ad4c63..3f13252 100644
|
||||
--- a/libfprint/drivers/aesx660.c
|
||||
+++ b/libfprint/drivers/aesx660.c
|
||||
@@ -215,7 +215,6 @@ finger_det_sm_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
|
||||
|
||||
fp_dbg ("Finger detection completed");
|
||||
fpi_image_device_report_finger_status (dev, TRUE);
|
||||
- fpi_ssm_free (ssm);
|
||||
|
||||
if (priv->deactivating)
|
||||
{
|
||||
@@ -466,7 +465,6 @@ capture_sm_complete (FpiSsm *ssm, FpDevice *device, GError *error)
|
||||
FpiDeviceAesX660Private *priv = fpi_device_aes_x660_get_instance_private (self);
|
||||
|
||||
fp_dbg ("Capture completed");
|
||||
- fpi_ssm_free (ssm);
|
||||
|
||||
if (priv->deactivating)
|
||||
{
|
||||
@@ -672,7 +670,6 @@ static void
|
||||
activate_sm_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
|
||||
{
|
||||
fpi_image_device_activate_complete (FP_IMAGE_DEVICE (_dev), error);
|
||||
- fpi_ssm_free (ssm);
|
||||
|
||||
if (!error)
|
||||
start_finger_detection (FP_IMAGE_DEVICE (_dev));
|
||||
diff --git a/libfprint/drivers/elan.c b/libfprint/drivers/elan.c
|
||||
index 961366e..5e80be5 100644
|
||||
--- a/libfprint/drivers/elan.c
|
||||
+++ b/libfprint/drivers/elan.c
|
||||
@@ -479,7 +479,6 @@ stop_capture_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
|
||||
|
||||
G_DEBUG_HERE ();
|
||||
|
||||
- fpi_ssm_free (ssm);
|
||||
|
||||
/* The device is inactive at this point. */
|
||||
self->dev_state = FP_IMAGE_DEVICE_STATE_INACTIVE;
|
||||
@@ -606,7 +605,6 @@ capture_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
|
||||
fpi_image_device_session_error (dev, error);
|
||||
}
|
||||
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -789,7 +787,6 @@ calibrate_complete (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
elan_capture (dev);
|
||||
}
|
||||
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -886,7 +883,6 @@ activate_complete (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
|
||||
fpi_image_device_activate_complete (idev, error);
|
||||
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/libfprint/drivers/etes603.c b/libfprint/drivers/etes603.c
|
||||
index 5c990da..55f0139 100644
|
||||
--- a/libfprint/drivers/etes603.c
|
||||
+++ b/libfprint/drivers/etes603.c
|
||||
@@ -789,7 +789,6 @@ m_exit_complete (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
else
|
||||
fp_dbg ("The device is now in idle state");
|
||||
fpi_image_device_deactivate_complete (idev, error);
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -911,7 +910,6 @@ m_capture_complete (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
- fpi_ssm_free (ssm);
|
||||
|
||||
if (self->is_active == TRUE)
|
||||
{
|
||||
@@ -1061,7 +1059,6 @@ m_finger_complete (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
self->is_active = FALSE;
|
||||
}
|
||||
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1265,7 +1262,6 @@ m_tunevrb_complete (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
if (!self->is_active)
|
||||
m_exit_start (idev);
|
||||
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1409,7 +1405,6 @@ m_tunedc_complete (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
if (!self->is_active)
|
||||
m_exit_start (idev);
|
||||
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1543,7 +1538,6 @@ m_init_complete (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
reset_param (FPI_DEVICE_ETES603 (dev));
|
||||
fpi_image_device_session_error (idev, error);
|
||||
}
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/libfprint/drivers/synaptics/synaptics.c b/libfprint/drivers/synaptics/synaptics.c
|
||||
index a2286b2..4932d01 100644
|
||||
--- a/libfprint/drivers/synaptics/synaptics.c
|
||||
+++ b/libfprint/drivers/synaptics/synaptics.c
|
||||
@@ -290,7 +290,6 @@ cmd_ssm_done (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
}
|
||||
self->cmd_complete_on_removal = FALSE;
|
||||
g_clear_pointer (&self->cmd_complete_error, g_error_free);
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/libfprint/drivers/upeksonly.c b/libfprint/drivers/upeksonly.c
|
||||
index ec81375..e1cd7e5 100644
|
||||
--- a/libfprint/drivers/upeksonly.c
|
||||
+++ b/libfprint/drivers/upeksonly.c
|
||||
@@ -1380,7 +1380,6 @@ loopsm_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
|
||||
FpImageDevice *dev = FP_IMAGE_DEVICE (_dev);
|
||||
FpiDeviceUpeksonly *self = FPI_DEVICE_UPEKSONLY (_dev);
|
||||
|
||||
- fpi_ssm_free (ssm);
|
||||
|
||||
if (self->deactivating)
|
||||
{
|
||||
@@ -1401,7 +1400,6 @@ initsm_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
|
||||
FpImageDevice *dev = FP_IMAGE_DEVICE (_dev);
|
||||
FpiDeviceUpeksonly *self = FPI_DEVICE_UPEKSONLY (_dev);
|
||||
|
||||
- fpi_ssm_free (ssm);
|
||||
fpi_image_device_activate_complete (dev, error);
|
||||
if (error)
|
||||
return;
|
||||
diff --git a/libfprint/drivers/upektc.c b/libfprint/drivers/upektc.c
|
||||
index ff5b49b..e1254ce 100644
|
||||
--- a/libfprint/drivers/upektc.c
|
||||
+++ b/libfprint/drivers/upektc.c
|
||||
@@ -157,7 +157,6 @@ activate_sm_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
|
||||
|
||||
if (!error)
|
||||
start_finger_detection (dev);
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
|
||||
@@ -345,7 +344,6 @@ capture_sm_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
|
||||
else
|
||||
start_finger_detection (dev);
|
||||
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/libfprint/drivers/upektc_img.c b/libfprint/drivers/upektc_img.c
|
||||
index 1e06b90..28a709f 100644
|
||||
--- a/libfprint/drivers/upektc_img.c
|
||||
+++ b/libfprint/drivers/upektc_img.c
|
||||
@@ -389,7 +389,6 @@ capture_sm_complete (FpiSsm *ssm, FpDevice *_dev, GError *error_arg)
|
||||
|
||||
g_autoptr(GError) error = error_arg;
|
||||
|
||||
- fpi_ssm_free (ssm);
|
||||
|
||||
/* Note: We assume that the error is a cancellation in the deactivation case */
|
||||
if (self->deactivating)
|
||||
@@ -470,7 +469,6 @@ deactivate_sm_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
|
||||
FpiDeviceUpektcImg *self = FPI_DEVICE_UPEKTC_IMG (_dev);
|
||||
|
||||
fp_dbg ("Deactivate completed");
|
||||
- fpi_ssm_free (ssm);
|
||||
|
||||
self->deactivating = FALSE;
|
||||
fpi_image_device_deactivate_complete (dev, error);
|
||||
@@ -601,7 +599,6 @@ activate_sm_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
|
||||
{
|
||||
FpImageDevice *dev = FP_IMAGE_DEVICE (_dev);
|
||||
|
||||
- fpi_ssm_free (ssm);
|
||||
fpi_image_device_activate_complete (dev, error);
|
||||
|
||||
if (!error)
|
||||
diff --git a/libfprint/drivers/upekts.c b/libfprint/drivers/upekts.c
|
||||
index b3481aa..4bc6556 100644
|
||||
--- a/libfprint/drivers/upekts.c
|
||||
+++ b/libfprint/drivers/upekts.c
|
||||
@@ -990,7 +990,6 @@ enroll_stop_deinit_cb (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
fp_warn ("Error deinitializing: %s", error->message);
|
||||
|
||||
fpi_device_enroll_complete (dev, data->print, data->error);
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1217,7 +1216,6 @@ enroll_started (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
else
|
||||
enroll_iterate (dev);
|
||||
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1256,7 +1254,6 @@ verify_stop_deinit_cb (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
fp_warn ("Error deinitializing: %s", error->message);
|
||||
|
||||
fpi_device_verify_complete (dev, data->res, NULL, data->error);
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1540,7 +1537,6 @@ verify_started (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
upekdev->first_verify_iteration = TRUE;
|
||||
verify_iterate (dev);
|
||||
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/libfprint/drivers/uru4000.c b/libfprint/drivers/uru4000.c
|
||||
index f248411..89328d0 100644
|
||||
--- a/libfprint/drivers/uru4000.c
|
||||
+++ b/libfprint/drivers/uru4000.c
|
||||
@@ -789,7 +789,6 @@ imaging_complete (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
{
|
||||
FpiDeviceUru4000 *self = FPI_DEVICE_URU4000 (dev);
|
||||
|
||||
- fpi_ssm_free (ssm);
|
||||
|
||||
/* Report error before exiting imaging loop - the error handler
|
||||
* can request state change, which needs to be postponed to end of
|
||||
diff --git a/libfprint/drivers/vcom5s.c b/libfprint/drivers/vcom5s.c
|
||||
index 0e10252..edd2dd4 100644
|
||||
--- a/libfprint/drivers/vcom5s.c
|
||||
+++ b/libfprint/drivers/vcom5s.c
|
||||
@@ -301,7 +301,6 @@ loopsm_complete (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
FpImageDevice *imgdev = FP_IMAGE_DEVICE (dev);
|
||||
FpDeviceVcom5s *self = FPI_DEVICE_VCOM5S (dev);
|
||||
|
||||
- fpi_ssm_free (ssm);
|
||||
g_object_unref (self->capture_img);
|
||||
self->capture_img = NULL;
|
||||
self->loop_running = FALSE;
|
||||
diff --git a/libfprint/drivers/vfs0050.c b/libfprint/drivers/vfs0050.c
|
||||
index 4dc6782..1be272b 100644
|
||||
--- a/libfprint/drivers/vfs0050.c
|
||||
+++ b/libfprint/drivers/vfs0050.c
|
||||
@@ -669,7 +669,6 @@ dev_activate_callback (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
/* Activate device */
|
||||
@@ -710,7 +709,6 @@ dev_open_callback (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
{
|
||||
/* Notify open complete */
|
||||
fpi_image_device_open_complete (FP_IMAGE_DEVICE (dev), error);
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
/* Open device */
|
||||
diff --git a/libfprint/drivers/vfs101.c b/libfprint/drivers/vfs101.c
|
||||
index 37e083c..9ca1b0a 100644
|
||||
--- a/libfprint/drivers/vfs101.c
|
||||
+++ b/libfprint/drivers/vfs101.c
|
||||
@@ -960,7 +960,6 @@ m_loop_complete (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
|
||||
self->active = FALSE;
|
||||
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
/* Init ssm states */
|
||||
@@ -1268,7 +1267,6 @@ m_init_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
|
||||
}
|
||||
|
||||
/* Free sequential state machine */
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
/* Activate device */
|
||||
diff --git a/libfprint/drivers/vfs301.c b/libfprint/drivers/vfs301.c
|
||||
index 8fdac7c..7219792 100644
|
||||
--- a/libfprint/drivers/vfs301.c
|
||||
+++ b/libfprint/drivers/vfs301.c
|
||||
@@ -168,7 +168,6 @@ m_loop_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
|
||||
g_error_free (error);
|
||||
}
|
||||
/* Free sequential state machine */
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
/* Exec init sequential state machine */
|
||||
@@ -201,7 +200,6 @@ m_init_complete (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
}
|
||||
|
||||
/* Free sequential state machine */
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
/* Activate device */
|
||||
diff --git a/libfprint/drivers/vfs5011.c b/libfprint/drivers/vfs5011.c
|
||||
index 9eddca7..007e486 100644
|
||||
--- a/libfprint/drivers/vfs5011.c
|
||||
+++ b/libfprint/drivers/vfs5011.c
|
||||
@@ -745,7 +745,6 @@ activate_loop_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
|
||||
submit_image (ssm, self, dev);
|
||||
fpi_image_device_report_finger_status (dev, FALSE);
|
||||
}
|
||||
- fpi_ssm_free (ssm);
|
||||
|
||||
self->loop_running = FALSE;
|
||||
|
||||
@@ -793,7 +792,6 @@ open_loop_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
|
||||
self->init_sequence.receive_buf = NULL;
|
||||
|
||||
fpi_image_device_open_complete (dev, error);
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/libfprint/fpi-ssm.c b/libfprint/fpi-ssm.c
|
||||
index 1569be8..a614860 100644
|
||||
--- a/libfprint/fpi-ssm.c
|
||||
+++ b/libfprint/fpi-ssm.c
|
||||
@@ -51,6 +51,7 @@
|
||||
*
|
||||
* To start a ssm, you pass in a completion callback function to fpi_ssm_start()
|
||||
* which gets called when the ssm completes (both on error and on failure).
|
||||
+ * Starting a ssm also takes ownership of it.
|
||||
*
|
||||
* To iterate to the next state, call fpi_ssm_next_state(). It is legal to
|
||||
* attempt to iterate beyond the final state - this is equivalent to marking
|
||||
@@ -58,6 +59,7 @@
|
||||
*
|
||||
* To mark successful completion of a SSM, either iterate beyond the final
|
||||
* state or call fpi_ssm_mark_completed() from any state.
|
||||
+ * This will also invalidate the machine, freeing it.
|
||||
*
|
||||
* To mark failed completion of a SSM, call fpi_ssm_mark_failed() from any
|
||||
* state. You must pass a non-zero error code.
|
||||
@@ -125,7 +127,6 @@ fpi_ssm_new (FpDevice *dev,
|
||||
* @ssm_data_destroy: (nullable): #GDestroyNotify for @ssm_data
|
||||
*
|
||||
* Sets @machine's data (freeing the existing data, if any).
|
||||
- *
|
||||
*/
|
||||
void
|
||||
fpi_ssm_set_data (FpiSsm *machine,
|
||||
@@ -182,12 +183,16 @@ __ssm_call_handler (FpiSsm *machine)
|
||||
|
||||
/**
|
||||
* fpi_ssm_start:
|
||||
- * @ssm: an #FpiSsm state machine
|
||||
+ * @ssm: (transfer full): an #FpiSsm state machine
|
||||
* @callback: the #FpiSsmCompletedCallback callback to call on completion
|
||||
*
|
||||
* Starts a state machine. You can also use this function to restart
|
||||
* a completed or failed state machine. The @callback will be called
|
||||
* on completion.
|
||||
+ *
|
||||
+ * Note that @ssm will be stolen when this function is called.
|
||||
+ * So that all associated data will be free'ed automatically, after the
|
||||
+ * @callback is ran.
|
||||
*/
|
||||
void
|
||||
fpi_ssm_start (FpiSsm *ssm, FpiSsmCompletedCallback callback)
|
||||
@@ -210,7 +215,6 @@ __subsm_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
|
||||
fpi_ssm_mark_failed (parent, error);
|
||||
else
|
||||
fpi_ssm_next_state (parent);
|
||||
- fpi_ssm_free (ssm);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -253,6 +257,7 @@ fpi_ssm_mark_completed (FpiSsm *machine)
|
||||
|
||||
machine->callback (machine, machine->dev, error);
|
||||
}
|
||||
+ fpi_ssm_free (machine);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -260,7 +265,7 @@ fpi_ssm_mark_completed (FpiSsm *machine)
|
||||
* @machine: an #FpiSsm state machine
|
||||
* @error: a #GError
|
||||
*
|
||||
- * Mark a state machine as failed with @error as the error code.
|
||||
+ * Mark a state machine as failed with @error as the error code, completing it.
|
||||
*/
|
||||
void
|
||||
fpi_ssm_mark_failed (FpiSsm *machine, GError *error)
|
||||
@@ -305,6 +310,8 @@ fpi_ssm_next_state (FpiSsm *machine)
|
||||
* @state: the state to jump to
|
||||
*
|
||||
* Jump to the @state state, bypassing intermediary states.
|
||||
+ * If @state is the last state, the machine won't be completed unless
|
||||
+ * fpi_ssm_mark_completed() isn't explicitly called.
|
||||
*/
|
||||
void
|
||||
fpi_ssm_jump_to_state (FpiSsm *machine, int state)
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,759 +0,0 @@
|
||||
From b789fda58d5ddf9bc8b6f2830e6fc93d222e6c34 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Tue, 26 Nov 2019 21:23:42 +0100
|
||||
Subject: [PATCH 029/181] fpi-usb-transfer: Take ownership of the transfer when
|
||||
submitting it
|
||||
|
||||
When a transfer is completed, we automatically unref it since we can't
|
||||
consider it valid anymore since this point.
|
||||
|
||||
Update the drivers not to free the transfer after submitting anymore.
|
||||
---
|
||||
libfprint/drivers/aes1610.c | 3 ---
|
||||
libfprint/drivers/aes2501.c | 4 ----
|
||||
libfprint/drivers/aes2550.c | 9 ---------
|
||||
libfprint/drivers/aes3k.c | 1 -
|
||||
libfprint/drivers/aeslib.c | 1 -
|
||||
libfprint/drivers/aesx660.c | 2 --
|
||||
libfprint/drivers/elan.c | 2 --
|
||||
libfprint/drivers/etes603.c | 1 -
|
||||
libfprint/drivers/synaptics/synaptics.c | 8 +++-----
|
||||
libfprint/drivers/upeksonly.c | 5 -----
|
||||
libfprint/drivers/upektc.c | 6 ------
|
||||
libfprint/drivers/upektc_img.c | 3 ---
|
||||
libfprint/drivers/upekts.c | 11 -----------
|
||||
libfprint/drivers/uru4000.c | 3 ---
|
||||
libfprint/drivers/vcom5s.c | 3 ---
|
||||
libfprint/drivers/vfs0050.c | 5 -----
|
||||
libfprint/drivers/vfs101.c | 3 ---
|
||||
libfprint/drivers/vfs301_proto.c | 10 +++-------
|
||||
libfprint/drivers/vfs5011.c | 3 ---
|
||||
libfprint/fpi-usb-transfer.c | 14 ++++----------
|
||||
20 files changed, 10 insertions(+), 87 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/aes1610.c b/libfprint/drivers/aes1610.c
|
||||
index 0326565..4261b05 100644
|
||||
--- a/libfprint/drivers/aes1610.c
|
||||
+++ b/libfprint/drivers/aes1610.c
|
||||
@@ -155,7 +155,6 @@ generic_read_ignore_data (FpiSsm *ssm, FpDevice *dev,
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
generic_ignore_data_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
/****** FINGER PRESENCE DETECTION ******/
|
||||
@@ -238,7 +237,6 @@ finger_det_reqs_cb (FpImageDevice *dev, GError *error,
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
finger_det_data_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -683,7 +681,6 @@ capture_run_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
capture_read_strip_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
break;
|
||||
}
|
||||
;
|
||||
diff --git a/libfprint/drivers/aes2501.c b/libfprint/drivers/aes2501.c
|
||||
index 1b59c56..e18b4fe 100644
|
||||
--- a/libfprint/drivers/aes2501.c
|
||||
+++ b/libfprint/drivers/aes2501.c
|
||||
@@ -126,7 +126,6 @@ read_regs_rq_cb (FpImageDevice *dev, GError *error, void *user_data)
|
||||
fpi_usb_transfer_fill_bulk (transfer, EP_IN, READ_REGS_LEN);
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
read_regs_data_cb, rdata);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -210,7 +209,6 @@ generic_read_ignore_data (FpiSsm *ssm, FpDevice *dev,
|
||||
fpi_usb_transfer_fill_bulk (transfer, EP_IN, bytes);
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
generic_ignore_data_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
/****** IMAGE PROCESSING ******/
|
||||
@@ -315,7 +313,6 @@ finger_det_reqs_cb (FpImageDevice *dev, GError *error,
|
||||
fpi_usb_transfer_fill_bulk (transfer, EP_IN, FINGER_DETECTION_LEN);
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
finger_det_data_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -547,7 +544,6 @@ capture_run_state (FpiSsm *ssm, FpDevice *device)
|
||||
fpi_usb_transfer_fill_bulk (transfer, EP_IN, STRIP_CAPTURE_LEN);
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
capture_read_strip_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
diff --git a/libfprint/drivers/aes2550.c b/libfprint/drivers/aes2550.c
|
||||
index b95b053..f3f51d6 100644
|
||||
--- a/libfprint/drivers/aes2550.c
|
||||
+++ b/libfprint/drivers/aes2550.c
|
||||
@@ -134,7 +134,6 @@ finger_det_reqs_cb (FpiUsbTransfer *t, FpDevice *device,
|
||||
fpi_usb_transfer_fill_bulk (transfer, EP_IN, AES2550_EP_IN_BUF_SIZE);
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
finger_det_data_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -157,7 +156,6 @@ start_finger_detection (FpImageDevice *dev)
|
||||
sizeof (finger_det_reqs), NULL);
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
finger_det_reqs_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
/****** CAPTURE ******/
|
||||
@@ -335,7 +333,6 @@ capture_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
capture_reqs_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -347,7 +344,6 @@ capture_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
transfer->ssm = ssm;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
capture_read_data_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -363,7 +359,6 @@ capture_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
capture_set_idle_reqs_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -482,7 +477,6 @@ activate_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
init_reqs_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -494,7 +488,6 @@ activate_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
transfer->ssm = ssm;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
init_read_data_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -509,7 +502,6 @@ activate_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
init_reqs_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -521,7 +513,6 @@ activate_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
transfer->ssm = ssm;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
calibrate_read_data_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
break;
|
||||
}
|
||||
diff --git a/libfprint/drivers/aes3k.c b/libfprint/drivers/aes3k.c
|
||||
index f73ac02..da3b6a3 100644
|
||||
--- a/libfprint/drivers/aes3k.c
|
||||
+++ b/libfprint/drivers/aes3k.c
|
||||
@@ -142,7 +142,6 @@ do_capture (FpImageDevice *dev)
|
||||
fpi_usb_transfer_submit (priv->img_trf, 0,
|
||||
fpi_device_get_cancellable (FP_DEVICE (dev)),
|
||||
img_cb, NULL);
|
||||
- fpi_usb_transfer_unref (priv->img_trf);
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/libfprint/drivers/aeslib.c b/libfprint/drivers/aeslib.c
|
||||
index 8f92d87..4839c62 100644
|
||||
--- a/libfprint/drivers/aeslib.c
|
||||
+++ b/libfprint/drivers/aeslib.c
|
||||
@@ -88,7 +88,6 @@ do_write_regv (FpImageDevice *dev, struct write_regv_data *wdata, int upper_boun
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
write_regv_trf_complete, wdata);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
/* write the next batch of registers to be written, or if there are no more,
|
||||
diff --git a/libfprint/drivers/aesx660.c b/libfprint/drivers/aesx660.c
|
||||
index 3f13252..b4d8603 100644
|
||||
--- a/libfprint/drivers/aesx660.c
|
||||
+++ b/libfprint/drivers/aesx660.c
|
||||
@@ -68,7 +68,6 @@ aesX660_send_cmd_timeout (FpiSsm *ssm,
|
||||
cmd_len, NULL);
|
||||
transfer->ssm = ssm;
|
||||
fpi_usb_transfer_submit (transfer, timeout, NULL, callback, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -100,7 +99,6 @@ aesX660_read_response (FpiSsm *ssm,
|
||||
transfer->ssm = ssm;
|
||||
transfer->short_is_error = short_is_error;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, cancel, callback, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/libfprint/drivers/elan.c b/libfprint/drivers/elan.c
|
||||
index 5e80be5..e2767dd 100644
|
||||
--- a/libfprint/drivers/elan.c
|
||||
+++ b/libfprint/drivers/elan.c
|
||||
@@ -406,7 +406,6 @@ elan_cmd_read (FpiSsm *ssm, FpDevice *dev)
|
||||
cancellable = fpi_device_get_cancellable (dev);
|
||||
|
||||
fpi_usb_transfer_submit (transfer, self->cmd_timeout, cancellable, elan_cmd_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -449,7 +448,6 @@ elan_run_cmd (FpiSsm *ssm,
|
||||
cancellable,
|
||||
elan_cmd_cb,
|
||||
NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
enum stop_capture_states {
|
||||
diff --git a/libfprint/drivers/etes603.c b/libfprint/drivers/etes603.c
|
||||
index 55f0139..5cd7f0b 100644
|
||||
--- a/libfprint/drivers/etes603.c
|
||||
+++ b/libfprint/drivers/etes603.c
|
||||
@@ -710,7 +710,6 @@ async_tx (FpDevice *dev, unsigned int ep, void *cb,
|
||||
transfer->ssm = ssm;
|
||||
fpi_usb_transfer_fill_bulk_full (transfer, ep, buffer, length, NULL);
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL, cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
|
||||
diff --git a/libfprint/drivers/synaptics/synaptics.c b/libfprint/drivers/synaptics/synaptics.c
|
||||
index 4932d01..ccaf60e 100644
|
||||
--- a/libfprint/drivers/synaptics/synaptics.c
|
||||
+++ b/libfprint/drivers/synaptics/synaptics.c
|
||||
@@ -205,7 +205,7 @@ static void
|
||||
synaptics_cmd_run_state (FpiSsm *ssm,
|
||||
FpDevice *dev)
|
||||
{
|
||||
- g_autoptr(FpiUsbTransfer) transfer = NULL;
|
||||
+ FpiUsbTransfer *transfer;
|
||||
FpiDeviceSynaptics *self = FPI_DEVICE_SYNAPTICS (dev);
|
||||
|
||||
switch (fpi_ssm_get_cur_state (ssm))
|
||||
@@ -219,7 +219,7 @@ synaptics_cmd_run_state (FpiSsm *ssm,
|
||||
NULL,
|
||||
fpi_ssm_usb_transfer_cb,
|
||||
NULL);
|
||||
- g_clear_pointer (&self->cmd_pending_transfer, fpi_usb_transfer_unref);
|
||||
+ self->cmd_pending_transfer = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -317,7 +317,7 @@ synaptics_sensor_cmd (FpiDeviceSynaptics *self,
|
||||
gssize payload_len,
|
||||
SynCmdMsgCallback callback)
|
||||
{
|
||||
- g_autoptr(FpiUsbTransfer) transfer = NULL;
|
||||
+ FpiUsbTransfer *transfer;
|
||||
guint8 real_seq_num;
|
||||
gint msg_len;
|
||||
gint res;
|
||||
@@ -984,7 +984,6 @@ dev_probe (FpDevice *device)
|
||||
transfer->buffer[0] = SENSOR_CMD_GET_VERSION;
|
||||
if (!fpi_usb_transfer_submit_sync (transfer, 1000, &error))
|
||||
goto err_close;
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
|
||||
|
||||
transfer = fpi_usb_transfer_new (device);
|
||||
@@ -1039,7 +1038,6 @@ dev_probe (FpDevice *device)
|
||||
fp_dbg ("Target: %d", self->mis_version.target);
|
||||
fp_dbg ("Product: %d", self->mis_version.product);
|
||||
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
|
||||
/* We need at least firmware version 10.1, and for 10.1 build 2989158 */
|
||||
if (self->mis_version.version_major < 10 ||
|
||||
diff --git a/libfprint/drivers/upeksonly.c b/libfprint/drivers/upeksonly.c
|
||||
index e1cd7e5..f477b83 100644
|
||||
--- a/libfprint/drivers/upeksonly.c
|
||||
+++ b/libfprint/drivers/upeksonly.c
|
||||
@@ -635,7 +635,6 @@ write_regs_iterate (struct write_regs_data *wrdata)
|
||||
transfer->short_is_error = TRUE;
|
||||
transfer->ssm = wrdata->ssm;
|
||||
fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL, write_regs_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
|
||||
transfer->buffer[0] = regwrite->value;
|
||||
}
|
||||
@@ -688,7 +687,6 @@ sm_write_reg (FpiSsm *ssm,
|
||||
transfer->short_is_error = TRUE;
|
||||
transfer->ssm = ssm;
|
||||
fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL, sm_write_reg_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
|
||||
transfer->buffer[0] = value;
|
||||
}
|
||||
@@ -737,7 +735,6 @@ sm_read_reg (FpiSsm *ssm,
|
||||
NULL,
|
||||
sm_read_reg_cb,
|
||||
NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -782,7 +779,6 @@ sm_await_intr (FpiSsm *ssm,
|
||||
fpi_device_get_cancellable (FP_DEVICE (dev)),
|
||||
sm_await_intr_cb,
|
||||
NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
/***** AWAIT FINGER *****/
|
||||
@@ -1419,7 +1415,6 @@ dev_activate (FpImageDevice *dev)
|
||||
self->deactivating = FALSE;
|
||||
self->capturing = FALSE;
|
||||
|
||||
- self->img_transfers = g_ptr_array_new_full (NUM_BULK_TRANSFERS, (GDestroyNotify) fpi_usb_transfer_unref);
|
||||
self->num_flying = 0;
|
||||
|
||||
for (i = 0; i < self->img_transfers->len; i++)
|
||||
diff --git a/libfprint/drivers/upektc.c b/libfprint/drivers/upektc.c
|
||||
index e1254ce..92b1930 100644
|
||||
--- a/libfprint/drivers/upektc.c
|
||||
+++ b/libfprint/drivers/upektc.c
|
||||
@@ -128,7 +128,6 @@ activate_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
write_init_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -142,7 +141,6 @@ activate_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
transfer->ssm = ssm;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
read_init_data_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -225,7 +223,6 @@ finger_det_cmd_cb (FpiUsbTransfer *t, FpDevice *device,
|
||||
IMAGE_SIZE);
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
finger_det_data_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -249,7 +246,6 @@ start_finger_detection (FpImageDevice *dev)
|
||||
UPEKTC_CMD_LEN, NULL);
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
finger_det_cmd_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
/****** CAPTURE ******/
|
||||
@@ -309,7 +305,6 @@ capture_run_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
capture_cmd_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -323,7 +318,6 @@ capture_run_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
capture_read_data_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
break;
|
||||
}
|
||||
diff --git a/libfprint/drivers/upektc_img.c b/libfprint/drivers/upektc_img.c
|
||||
index 28a709f..b9724c1 100644
|
||||
--- a/libfprint/drivers/upektc_img.c
|
||||
+++ b/libfprint/drivers/upektc_img.c
|
||||
@@ -100,7 +100,6 @@ upektc_img_submit_req (FpiSsm *ssm,
|
||||
transfer->ssm = ssm;
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL, cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -120,7 +119,6 @@ upektc_img_read_data (FpiSsm *ssm,
|
||||
NULL);
|
||||
transfer->ssm = ssm;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL, cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
/****** CAPTURE ******/
|
||||
@@ -557,7 +555,6 @@ activate_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
transfer->ssm = ssm;
|
||||
fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL,
|
||||
init_reqs_ctrl_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
break;
|
||||
|
||||
diff --git a/libfprint/drivers/upekts.c b/libfprint/drivers/upekts.c
|
||||
index 4bc6556..05cd9c5 100644
|
||||
--- a/libfprint/drivers/upekts.c
|
||||
+++ b/libfprint/drivers/upekts.c
|
||||
@@ -226,7 +226,6 @@ busy_ack_retry_read (FpDevice *device, struct read_msg_data *udata)
|
||||
transfer->short_is_error = TRUE;
|
||||
|
||||
fpi_usb_transfer_submit (transfer, TIMEOUT, NULL, busy_ack_sent_cb, udata);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
/* Returns 0 if message was handled, 1 if it was a device-busy message, and
|
||||
@@ -416,7 +415,6 @@ read_msg_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
fpi_usb_transfer_submit (etransfer, TIMEOUT,
|
||||
NULL,
|
||||
read_msg_extend_cb, udata);
|
||||
- fpi_usb_transfer_unref (etransfer);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -442,7 +440,6 @@ __read_msg_async (FpDevice *device, struct read_msg_data *udata)
|
||||
|
||||
fpi_usb_transfer_fill_bulk_full (transfer, EP_IN, udata->buffer, udata->buflen, NULL);
|
||||
fpi_usb_transfer_submit (transfer, TIMEOUT, NULL, read_msg_cb, udata);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -676,7 +673,6 @@ initsm_send_msg28_handler (FpiSsm *ssm,
|
||||
transfer->ssm = ssm;
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, TIMEOUT, NULL, fpi_ssm_usb_transfer_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -697,7 +693,6 @@ initsm_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
transfer->ssm = ssm;
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, TIMEOUT, NULL, fpi_ssm_usb_transfer_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
break;
|
||||
|
||||
case READ_MSG03:
|
||||
@@ -709,7 +704,6 @@ initsm_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
transfer->ssm = ssm;
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, TIMEOUT, NULL, fpi_ssm_usb_transfer_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
break;
|
||||
|
||||
case READ_MSG05:
|
||||
@@ -820,7 +814,6 @@ deinitsm_state_handler (FpiSsm *ssm, FpDevice *dev)
|
||||
transfer->short_is_error = TRUE;
|
||||
transfer->ssm = ssm;
|
||||
fpi_usb_transfer_submit (transfer, TIMEOUT, NULL, fpi_ssm_usb_transfer_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
break;
|
||||
|
||||
case READ_MSG01:;
|
||||
@@ -953,7 +946,6 @@ enroll_start_sm_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
transfer->ssm = ssm;
|
||||
|
||||
fpi_usb_transfer_submit (transfer, TIMEOUT, NULL, fpi_ssm_usb_transfer_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
break;
|
||||
|
||||
case READ_ENROLL_MSG28:;
|
||||
@@ -1205,7 +1197,6 @@ enroll_iterate (FpDevice *dev)
|
||||
transfer->short_is_error = TRUE;
|
||||
|
||||
fpi_usb_transfer_submit (transfer, TIMEOUT, NULL, enroll_iterate_cmd_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1319,7 +1310,6 @@ verify_start_sm_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
transfer->short_is_error = TRUE;
|
||||
transfer->ssm = ssm;
|
||||
fpi_usb_transfer_submit (transfer, TIMEOUT, NULL, fpi_ssm_usb_transfer_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -1519,7 +1509,6 @@ verify_iterate (FpDevice *dev)
|
||||
transfer->short_is_error = TRUE;
|
||||
|
||||
fpi_usb_transfer_submit (transfer, TIMEOUT, NULL, verify_wr2800_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/libfprint/drivers/uru4000.c b/libfprint/drivers/uru4000.c
|
||||
index 89328d0..7e28724 100644
|
||||
--- a/libfprint/drivers/uru4000.c
|
||||
+++ b/libfprint/drivers/uru4000.c
|
||||
@@ -181,7 +181,6 @@ write_regs (FpImageDevice *dev, uint16_t first_reg,
|
||||
num_regs);
|
||||
memcpy (transfer->buffer, values, num_regs);
|
||||
fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL, callback, user_data);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -207,7 +206,6 @@ read_regs (FpImageDevice *dev, uint16_t first_reg,
|
||||
G_USB_DEVICE_RECIPIENT_DEVICE,
|
||||
USB_RQ, first_reg, 0, num_regs);
|
||||
fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL, callback, user_data);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -365,7 +363,6 @@ start_irq_handler (FpImageDevice *dev)
|
||||
EP_INTR,
|
||||
IRQ_LENGTH);
|
||||
fpi_usb_transfer_submit (transfer, 0, self->irq_cancellable, irq_handler, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/libfprint/drivers/vcom5s.c b/libfprint/drivers/vcom5s.c
|
||||
index edd2dd4..1a2b795 100644
|
||||
--- a/libfprint/drivers/vcom5s.c
|
||||
+++ b/libfprint/drivers/vcom5s.c
|
||||
@@ -103,7 +103,6 @@ sm_write_reg (FpiSsm *ssm,
|
||||
transfer->ssm = ssm;
|
||||
fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL, sm_write_reg_cb,
|
||||
NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -133,7 +132,6 @@ sm_exec_cmd (FpiSsm *ssm,
|
||||
transfer->ssm = ssm;
|
||||
fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL, sm_exec_cmd_cb,
|
||||
NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
/***** FINGER DETECTION *****/
|
||||
@@ -227,7 +225,6 @@ capture_iterate (FpiSsm *ssm,
|
||||
NULL);
|
||||
|
||||
fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL, capture_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
|
||||
diff --git a/libfprint/drivers/vfs0050.c b/libfprint/drivers/vfs0050.c
|
||||
index 1be272b..43252c0 100644
|
||||
--- a/libfprint/drivers/vfs0050.c
|
||||
+++ b/libfprint/drivers/vfs0050.c
|
||||
@@ -56,7 +56,6 @@ async_write (FpiSsm *ssm,
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, VFS_USB_TIMEOUT, NULL,
|
||||
async_write_callback, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
/* Callback for async_read */
|
||||
@@ -108,7 +107,6 @@ async_read (FpiSsm *ssm,
|
||||
|
||||
fpi_usb_transfer_submit (transfer, VFS_USB_TIMEOUT, NULL,
|
||||
async_read_callback, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
/* Callback for async_abort */
|
||||
@@ -160,7 +158,6 @@ async_abort (FpDevice *dev, FpiSsm *ssm, int ep)
|
||||
|
||||
fpi_usb_transfer_submit (transfer, VFS_USB_ABORT_TIMEOUT, NULL,
|
||||
async_abort_callback, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
/* Image processing functions */
|
||||
@@ -564,7 +561,6 @@ activate_ssm (FpiSsm *ssm, FpDevice *dev)
|
||||
0,
|
||||
fpi_device_get_cancellable (dev),
|
||||
interrupt_callback, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
|
||||
/* I've put it here to be sure that data is cleared */
|
||||
clear_data (self);
|
||||
@@ -614,7 +610,6 @@ activate_ssm (FpiSsm *ssm, FpDevice *dev)
|
||||
transfer->ssm = ssm;
|
||||
fpi_usb_transfer_submit (transfer, VFS_USB_TIMEOUT, NULL,
|
||||
receive_callback, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
break;
|
||||
}
|
||||
|
||||
diff --git a/libfprint/drivers/vfs101.c b/libfprint/drivers/vfs101.c
|
||||
index 9ca1b0a..5dedab7 100644
|
||||
--- a/libfprint/drivers/vfs101.c
|
||||
+++ b/libfprint/drivers/vfs101.c
|
||||
@@ -219,7 +219,6 @@ async_send (FpiSsm *ssm,
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
async_send_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
/* Callback of asynchronous recv */
|
||||
@@ -282,7 +281,6 @@ async_recv (FpiSsm *ssm,
|
||||
transfer->ssm = ssm;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
async_recv_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
static void async_load (FpiSsm *ssm,
|
||||
@@ -369,7 +367,6 @@ async_load (FpiSsm *ssm,
|
||||
transfer->ssm = ssm;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
async_load_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
/* Submit asynchronous sleep */
|
||||
diff --git a/libfprint/drivers/vfs301_proto.c b/libfprint/drivers/vfs301_proto.c
|
||||
index 5d02597..103e890 100644
|
||||
--- a/libfprint/drivers/vfs301_proto.c
|
||||
+++ b/libfprint/drivers/vfs301_proto.c
|
||||
@@ -67,8 +67,7 @@ static void
|
||||
usb_recv (FpDeviceVfs301 *dev, guint8 endpoint, int max_bytes, FpiUsbTransfer **out, GError **error)
|
||||
{
|
||||
GError *err = NULL;
|
||||
-
|
||||
- g_autoptr(FpiUsbTransfer) transfer = NULL;
|
||||
+ FpiUsbTransfer *transfer;
|
||||
|
||||
/* XXX: This function swallows any transfer errors, that is obviously
|
||||
* quite bad (it used to assert on no-error)! */
|
||||
@@ -98,8 +97,7 @@ static void
|
||||
usb_send (FpDeviceVfs301 *dev, const guint8 *data, gssize length, GError **error)
|
||||
{
|
||||
GError *err = NULL;
|
||||
-
|
||||
- g_autoptr(FpiUsbTransfer) transfer = NULL;
|
||||
+ FpiUsbTransfer *transfer = NULL;
|
||||
|
||||
/* XXX: This function swallows any transfer errors, that is obviously
|
||||
* quite bad (it used to assert on no-error)! */
|
||||
@@ -471,7 +469,7 @@ int
|
||||
vfs301_proto_peek_event (FpDeviceVfs301 *dev)
|
||||
{
|
||||
g_autoptr(GError) error = NULL;
|
||||
- g_autoptr(FpiUsbTransfer) transfer = NULL;
|
||||
+ FpiUsbTransfer *transfer;
|
||||
|
||||
const char no_event[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
const char got_event[] = {0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00};
|
||||
@@ -540,7 +538,6 @@ vfs301_proto_process_event_cb (FpiUsbTransfer *transfer,
|
||||
fpi_usb_transfer_fill_bulk (new, VFS301_RECEIVE_ENDPOINT_DATA, VFS301_FP_RECV_LEN_2);
|
||||
fpi_usb_transfer_submit (new, VFS301_FP_RECV_TIMEOUT, NULL,
|
||||
vfs301_proto_process_event_cb, NULL);
|
||||
- fpi_usb_transfer_unref (new);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -580,7 +577,6 @@ vfs301_proto_process_event_start (FpDeviceVfs301 *dev)
|
||||
fpi_usb_transfer_fill_bulk (transfer, VFS301_RECEIVE_ENDPOINT_DATA, VFS301_FP_RECV_LEN_1);
|
||||
fpi_usb_transfer_submit (transfer, VFS301_FP_RECV_TIMEOUT, NULL,
|
||||
vfs301_proto_process_event_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
int
|
||||
diff --git a/libfprint/drivers/vfs5011.c b/libfprint/drivers/vfs5011.c
|
||||
index 007e486..dbf8276 100644
|
||||
--- a/libfprint/drivers/vfs5011.c
|
||||
+++ b/libfprint/drivers/vfs5011.c
|
||||
@@ -168,7 +168,6 @@ usbexchange_loop (FpiSsm *ssm, FpDevice *_dev)
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, data->timeout, NULL,
|
||||
async_send_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
break;
|
||||
|
||||
case ACTION_RECEIVE:
|
||||
@@ -180,7 +179,6 @@ usbexchange_loop (FpiSsm *ssm, FpDevice *_dev)
|
||||
transfer->ssm = ssm;
|
||||
fpi_usb_transfer_submit (transfer, data->timeout, NULL,
|
||||
async_recv_cb, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -466,7 +464,6 @@ capture_chunk_async (FpDeviceVfs5011 *self,
|
||||
transfer->ssm = ssm;
|
||||
fpi_usb_transfer_submit (transfer, timeout, fpi_device_get_cancellable (FP_DEVICE (self)),
|
||||
chunk_capture_callback, NULL);
|
||||
- fpi_usb_transfer_unref (transfer);
|
||||
}
|
||||
|
||||
/*
|
||||
diff --git a/libfprint/fpi-usb-transfer.c b/libfprint/fpi-usb-transfer.c
|
||||
index 6b29621..64d706f 100644
|
||||
--- a/libfprint/fpi-usb-transfer.c
|
||||
+++ b/libfprint/fpi-usb-transfer.c
|
||||
@@ -356,7 +356,7 @@ transfer_finish_cb (GObject *source_object, GAsyncResult *res, gpointer user_dat
|
||||
|
||||
/**
|
||||
* fpi_usb_transfer_submit:
|
||||
- * @transfer: The transfer to submit, must have been filled.
|
||||
+ * @transfer: (transfer full): The transfer to submit, must have been filled.
|
||||
* @timeout_ms: Timeout for the transfer in ms
|
||||
* @cancellable: Cancellable to use, e.g. fpi_device_get_cancellable()
|
||||
* @callback: Callback on completion or error
|
||||
@@ -364,10 +364,9 @@ transfer_finish_cb (GObject *source_object, GAsyncResult *res, gpointer user_dat
|
||||
*
|
||||
* Submit a USB transfer with a specific timeout and callback functions.
|
||||
*
|
||||
- * Note that #FpiUsbTransfer is owned by the user. In most cases, you
|
||||
- * should call fpi_usb_transfer_unref() just after calling this function.
|
||||
- * Doing so means that all associated data will be free'ed automatically
|
||||
- * after the callback ran.
|
||||
+ * Note that #FpiUsbTransfer will be stolen when this function is called.
|
||||
+ * So that all associated data will be free'ed automatically, after the
|
||||
+ * callback ran unless fpi_usb_transfer_ref() is explictly called.
|
||||
*/
|
||||
void
|
||||
fpi_usb_transfer_submit (FpiUsbTransfer *transfer,
|
||||
@@ -385,11 +384,6 @@ fpi_usb_transfer_submit (FpiUsbTransfer *transfer,
|
||||
transfer->callback = callback;
|
||||
transfer->user_data = user_data;
|
||||
|
||||
- /* Grab a reference, this means that one can simply unref after submit and
|
||||
- * trust for the data to disappear without explicit management by the callback
|
||||
- * function. */
|
||||
- fpi_usb_transfer_ref (transfer);
|
||||
-
|
||||
log_transfer (transfer, TRUE, NULL);
|
||||
|
||||
switch (transfer->type)
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,71 +0,0 @@
|
||||
From 9902e2c4224914dc611eb2326db7322aa57ec2a2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 27 Nov 2019 19:36:24 +0100
|
||||
Subject: [PATCH 030/181] fpi-ssm: Add a usb transfer callback with data as
|
||||
weak pointer
|
||||
|
||||
Allow to pass a double-pointer to be nullified as the transfer data in order
|
||||
to mark it as NULL when the transfer is done.
|
||||
|
||||
This is useful if we're keeping the transfer around in order to check that
|
||||
no one is currently running.
|
||||
---
|
||||
libfprint/fpi-ssm.c | 29 +++++++++++++++++++++++++++++
|
||||
libfprint/fpi-ssm.h | 6 +++++-
|
||||
2 files changed, 34 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libfprint/fpi-ssm.c b/libfprint/fpi-ssm.c
|
||||
index a614860..6a02a2c 100644
|
||||
--- a/libfprint/fpi-ssm.c
|
||||
+++ b/libfprint/fpi-ssm.c
|
||||
@@ -413,3 +413,32 @@ fpi_ssm_usb_transfer_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
else
|
||||
fpi_ssm_next_state (transfer->ssm);
|
||||
}
|
||||
+
|
||||
+/**
|
||||
+ * fpi_ssm_usb_transfer_with_weak_pointer_cb:
|
||||
+ * @transfer: a #FpiUsbTransfer
|
||||
+ * @device: a #FpDevice
|
||||
+ * @weak_ptr: A #gpointer pointer to nullify. You can pass a pointer to any
|
||||
+ * #gpointer to nullify when the callback is completed. I.e a
|
||||
+ * pointer to the current #FpiUsbTransfer.
|
||||
+ * @error: The #GError or %NULL
|
||||
+ *
|
||||
+ * Can be used in as a #FpiUsbTransfer callback handler to automatically
|
||||
+ * advance or fail a statemachine on transfer completion.
|
||||
+ * Passing a #gpointer* as @weak_ptr permits to nullify it once we're done
|
||||
+ * with the transfer.
|
||||
+ *
|
||||
+ * Make sure to set the #FpiSsm on the transfer.
|
||||
+ */
|
||||
+void
|
||||
+fpi_ssm_usb_transfer_with_weak_pointer_cb (FpiUsbTransfer *transfer,
|
||||
+ FpDevice *device, gpointer weak_ptr,
|
||||
+ GError *error)
|
||||
+{
|
||||
+ g_return_if_fail (transfer->ssm);
|
||||
+
|
||||
+ if (weak_ptr)
|
||||
+ g_nullify_pointer ((gpointer *) weak_ptr);
|
||||
+
|
||||
+ fpi_ssm_usb_transfer_cb (transfer, device, weak_ptr, error);
|
||||
+}
|
||||
diff --git a/libfprint/fpi-ssm.h b/libfprint/fpi-ssm.h
|
||||
index 8d45162..704271d 100644
|
||||
--- a/libfprint/fpi-ssm.h
|
||||
+++ b/libfprint/fpi-ssm.h
|
||||
@@ -91,5 +91,9 @@ void fpi_ssm_next_state_timeout_cb (FpDevice *dev,
|
||||
void *data);
|
||||
void fpi_ssm_usb_transfer_cb (FpiUsbTransfer *transfer,
|
||||
FpDevice *device,
|
||||
- gpointer user_data,
|
||||
+ gpointer user_date,
|
||||
GError *error);
|
||||
+void fpi_ssm_usb_transfer_with_weak_pointer_cb (FpiUsbTransfer *transfer,
|
||||
+ FpDevice *device,
|
||||
+ gpointer weak_ptr,
|
||||
+ GError *error);
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,414 +0,0 @@
|
||||
From 99be9c6ef80eb1ca873e4363c404b51acdfb9807 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 27 Nov 2019 20:07:02 +0100
|
||||
Subject: [PATCH 031/181] drivers: Use more fpi_ssm_usb_transfer_cb when
|
||||
possible
|
||||
|
||||
Replace all the transfer callbacks where we just switch to the next state or
|
||||
fail with fpi_ssm_usb_transfer_cb.
|
||||
---
|
||||
libfprint/drivers/aes1610.c | 14 +----------
|
||||
libfprint/drivers/aes2501.c | 15 +-----------
|
||||
libfprint/drivers/aes2550.c | 43 ++++------------------------------
|
||||
libfprint/drivers/aesx660.c | 26 +++++++-------------
|
||||
libfprint/drivers/upeksonly.c | 14 ++---------
|
||||
libfprint/drivers/upektc.c | 12 +---------
|
||||
libfprint/drivers/upektc_img.c | 12 +---------
|
||||
libfprint/drivers/vcom5s.c | 28 ++++------------------
|
||||
8 files changed, 23 insertions(+), 141 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/aes1610.c b/libfprint/drivers/aes1610.c
|
||||
index 4261b05..bc39b24 100644
|
||||
--- a/libfprint/drivers/aes1610.c
|
||||
+++ b/libfprint/drivers/aes1610.c
|
||||
@@ -116,18 +116,6 @@ stub_capture_stop_cb (FpImageDevice *dev, GError *error,
|
||||
}
|
||||
}
|
||||
|
||||
-
|
||||
-/* check that read succeeded but ignore all data */
|
||||
-static void
|
||||
-generic_ignore_data_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
- gpointer user_data, GError *error)
|
||||
-{
|
||||
- if (error)
|
||||
- fpi_ssm_mark_failed (transfer->ssm, error);
|
||||
- else
|
||||
- fpi_ssm_next_state (transfer->ssm);
|
||||
-}
|
||||
-
|
||||
static void
|
||||
generic_write_regv_cb (FpImageDevice *dev, GError *error,
|
||||
void *user_data)
|
||||
@@ -154,7 +142,7 @@ generic_read_ignore_data (FpiSsm *ssm, FpDevice *dev,
|
||||
transfer->ssm = ssm;
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
- generic_ignore_data_cb, NULL);
|
||||
+ fpi_ssm_usb_transfer_cb, NULL);
|
||||
}
|
||||
|
||||
/****** FINGER PRESENCE DETECTION ******/
|
||||
diff --git a/libfprint/drivers/aes2501.c b/libfprint/drivers/aes2501.c
|
||||
index e18b4fe..1aa0538 100644
|
||||
--- a/libfprint/drivers/aes2501.c
|
||||
+++ b/libfprint/drivers/aes2501.c
|
||||
@@ -182,19 +182,6 @@ generic_write_regv_cb (FpImageDevice *dev, GError *error,
|
||||
fpi_ssm_mark_failed (ssm, error);
|
||||
}
|
||||
|
||||
-/* check that read succeeded but ignore all data */
|
||||
-static void
|
||||
-generic_ignore_data_cb (FpiUsbTransfer *transfer, FpDevice *dev,
|
||||
- gpointer user_data, GError *error)
|
||||
-{
|
||||
- FpiSsm *ssm = transfer->ssm;
|
||||
-
|
||||
- if (error)
|
||||
- fpi_ssm_mark_failed (ssm, error);
|
||||
- else
|
||||
- fpi_ssm_next_state (ssm);
|
||||
-}
|
||||
-
|
||||
/* read the specified number of bytes from the IN endpoint but throw them
|
||||
* away, then increment the SSM */
|
||||
static void
|
||||
@@ -208,7 +195,7 @@ generic_read_ignore_data (FpiSsm *ssm, FpDevice *dev,
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_fill_bulk (transfer, EP_IN, bytes);
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
- generic_ignore_data_cb, NULL);
|
||||
+ fpi_ssm_usb_transfer_cb, NULL);
|
||||
}
|
||||
|
||||
/****** IMAGE PROCESSING ******/
|
||||
diff --git a/libfprint/drivers/aes2550.c b/libfprint/drivers/aes2550.c
|
||||
index f3f51d6..1ebf933 100644
|
||||
--- a/libfprint/drivers/aes2550.c
|
||||
+++ b/libfprint/drivers/aes2550.c
|
||||
@@ -216,16 +216,6 @@ process_strip_data (FpiSsm *ssm, FpImageDevice *dev,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
-static void
|
||||
-capture_reqs_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
- gpointer user_data, GError *error)
|
||||
-{
|
||||
- if (!error)
|
||||
- fpi_ssm_next_state (transfer->ssm);
|
||||
- else
|
||||
- fpi_ssm_mark_failed (transfer->ssm, error);
|
||||
-}
|
||||
-
|
||||
static void
|
||||
capture_set_idle_reqs_cb (FpiUsbTransfer *transfer,
|
||||
FpDevice *device, gpointer user_data,
|
||||
@@ -332,7 +322,7 @@ capture_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
transfer->ssm = ssm;
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
- capture_reqs_cb, NULL);
|
||||
+ fpi_ssm_usb_transfer_cb, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -430,36 +420,13 @@ enum activate_states {
|
||||
ACTIVATE_NUM_STATES,
|
||||
};
|
||||
|
||||
-static void
|
||||
-init_reqs_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
- gpointer user_data, GError *error)
|
||||
-{
|
||||
- if (!error)
|
||||
- fpi_ssm_next_state (transfer->ssm);
|
||||
- else
|
||||
- fpi_ssm_mark_failed (transfer->ssm, error);
|
||||
-}
|
||||
-
|
||||
-static void
|
||||
-init_read_data_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
- gpointer user_data, GError *error)
|
||||
-{
|
||||
- if (!error)
|
||||
- fpi_ssm_next_state (transfer->ssm);
|
||||
- else
|
||||
- fpi_ssm_mark_failed (transfer->ssm, error);
|
||||
-}
|
||||
-
|
||||
/* TODO: use calibration table, datasheet is rather terse on that
|
||||
* need more info for implementation */
|
||||
static void
|
||||
calibrate_read_data_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
gpointer user_data, GError *error)
|
||||
{
|
||||
- if (!error)
|
||||
- fpi_ssm_next_state (transfer->ssm);
|
||||
- else
|
||||
- fpi_ssm_mark_failed (transfer->ssm, error);
|
||||
+ fpi_ssm_usb_transfer_cb (transfer, device, user_data, error);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -476,7 +443,7 @@ activate_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
transfer->ssm = ssm;
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
- init_reqs_cb, NULL);
|
||||
+ fpi_ssm_usb_transfer_cb, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -487,7 +454,7 @@ activate_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
fpi_usb_transfer_fill_bulk (transfer, EP_IN, AES2550_EP_IN_BUF_SIZE);
|
||||
transfer->ssm = ssm;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
- init_read_data_cb, NULL);
|
||||
+ fpi_ssm_usb_transfer_cb, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -501,7 +468,7 @@ activate_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
transfer->ssm = ssm;
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
- init_reqs_cb, NULL);
|
||||
+ fpi_ssm_usb_transfer_cb, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
diff --git a/libfprint/drivers/aesx660.c b/libfprint/drivers/aesx660.c
|
||||
index b4d8603..0781606 100644
|
||||
--- a/libfprint/drivers/aesx660.c
|
||||
+++ b/libfprint/drivers/aesx660.c
|
||||
@@ -101,16 +101,6 @@ aesX660_read_response (FpiSsm *ssm,
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, cancel, callback, NULL);
|
||||
}
|
||||
|
||||
-static void
|
||||
-aesX660_send_cmd_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
- gpointer user_data, GError *error)
|
||||
-{
|
||||
- if (!error)
|
||||
- fpi_ssm_next_state (transfer->ssm);
|
||||
- else
|
||||
- fpi_ssm_mark_failed (transfer->ssm, error);
|
||||
-}
|
||||
-
|
||||
static void
|
||||
aesX660_read_calibrate_data_cb (FpiUsbTransfer *transfer,
|
||||
FpDevice *device,
|
||||
@@ -238,12 +228,12 @@ finger_det_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
{
|
||||
case FINGER_DET_SEND_LED_CMD:
|
||||
aesX660_send_cmd (ssm, dev, led_blink_cmd, sizeof (led_blink_cmd),
|
||||
- aesX660_send_cmd_cb);
|
||||
+ fpi_ssm_usb_transfer_cb);
|
||||
break;
|
||||
|
||||
case FINGER_DET_SEND_FD_CMD:
|
||||
aesX660_send_cmd_timeout (ssm, dev, wait_for_finger_cmd, sizeof (wait_for_finger_cmd),
|
||||
- aesX660_send_cmd_cb, 0);
|
||||
+ fpi_ssm_usb_transfer_cb, 0);
|
||||
break;
|
||||
|
||||
case FINGER_DET_READ_FD_DATA:
|
||||
@@ -433,14 +423,14 @@ capture_run_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
{
|
||||
case CAPTURE_SEND_LED_CMD:
|
||||
aesX660_send_cmd (ssm, _dev, led_solid_cmd, sizeof (led_solid_cmd),
|
||||
- aesX660_send_cmd_cb);
|
||||
+ fpi_ssm_usb_transfer_cb);
|
||||
break;
|
||||
|
||||
case CAPTURE_SEND_CAPTURE_CMD:
|
||||
g_byte_array_set_size (priv->stripe_packet, 0);
|
||||
aesX660_send_cmd (ssm, _dev, cls->start_imaging_cmd,
|
||||
cls->start_imaging_cmd_len,
|
||||
- aesX660_send_cmd_cb);
|
||||
+ fpi_ssm_usb_transfer_cb);
|
||||
break;
|
||||
|
||||
case CAPTURE_READ_STRIPE_DATA:
|
||||
@@ -625,13 +615,13 @@ activate_run_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
priv->init_seq_idx = 0;
|
||||
fp_dbg ("Activate: set idle\n");
|
||||
aesX660_send_cmd (ssm, _dev, set_idle_cmd, sizeof (set_idle_cmd),
|
||||
- aesX660_send_cmd_cb);
|
||||
+ fpi_ssm_usb_transfer_cb);
|
||||
break;
|
||||
|
||||
case ACTIVATE_SEND_READ_ID_CMD:
|
||||
fp_dbg ("Activate: read ID\n");
|
||||
aesX660_send_cmd (ssm, _dev, read_id_cmd, sizeof (read_id_cmd),
|
||||
- aesX660_send_cmd_cb);
|
||||
+ fpi_ssm_usb_transfer_cb);
|
||||
break;
|
||||
|
||||
case ACTIVATE_READ_ID:
|
||||
@@ -645,7 +635,7 @@ activate_run_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
aesX660_send_cmd (ssm, _dev,
|
||||
priv->init_seq[priv->init_cmd_idx].cmd,
|
||||
priv->init_seq[priv->init_cmd_idx].len,
|
||||
- aesX660_send_cmd_cb);
|
||||
+ fpi_ssm_usb_transfer_cb);
|
||||
break;
|
||||
|
||||
case ACTIVATE_READ_INIT_RESPONSE:
|
||||
@@ -655,7 +645,7 @@ activate_run_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
|
||||
case ACTIVATE_SEND_CALIBRATE_CMD:
|
||||
aesX660_send_cmd (ssm, _dev, calibrate_cmd, sizeof (calibrate_cmd),
|
||||
- aesX660_send_cmd_cb);
|
||||
+ fpi_ssm_usb_transfer_cb);
|
||||
break;
|
||||
|
||||
case ACTIVATE_READ_CALIBRATE_DATA:
|
||||
diff --git a/libfprint/drivers/upeksonly.c b/libfprint/drivers/upeksonly.c
|
||||
index f477b83..9dd3104 100644
|
||||
--- a/libfprint/drivers/upeksonly.c
|
||||
+++ b/libfprint/drivers/upeksonly.c
|
||||
@@ -656,17 +656,6 @@ sm_write_regs (FpiSsm *ssm,
|
||||
write_regs_iterate (wrdata);
|
||||
}
|
||||
|
||||
-static void
|
||||
-sm_write_reg_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
- gpointer user_data, GError *error)
|
||||
-{
|
||||
- if (error)
|
||||
- fpi_ssm_mark_failed (transfer->ssm, error);
|
||||
- else
|
||||
- fpi_ssm_next_state (transfer->ssm);
|
||||
-
|
||||
-}
|
||||
-
|
||||
static void
|
||||
sm_write_reg (FpiSsm *ssm,
|
||||
FpImageDevice *dev,
|
||||
@@ -686,7 +675,8 @@ sm_write_reg (FpiSsm *ssm,
|
||||
1);
|
||||
transfer->short_is_error = TRUE;
|
||||
transfer->ssm = ssm;
|
||||
- fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL, sm_write_reg_cb, NULL);
|
||||
+ fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL,
|
||||
+ fpi_ssm_usb_transfer_cb, NULL);
|
||||
|
||||
transfer->buffer[0] = value;
|
||||
}
|
||||
diff --git a/libfprint/drivers/upektc.c b/libfprint/drivers/upektc.c
|
||||
index 92b1930..d0c97af 100644
|
||||
--- a/libfprint/drivers/upektc.c
|
||||
+++ b/libfprint/drivers/upektc.c
|
||||
@@ -256,16 +256,6 @@ enum capture_states {
|
||||
CAPTURE_NUM_STATES,
|
||||
};
|
||||
|
||||
-static void
|
||||
-capture_cmd_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
- gpointer user_data, GError *error)
|
||||
-{
|
||||
- if (!error)
|
||||
- fpi_ssm_next_state (transfer->ssm);
|
||||
- else
|
||||
- fpi_ssm_mark_failed (transfer->ssm, error);
|
||||
-}
|
||||
-
|
||||
static void
|
||||
capture_read_data_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
gpointer user_data, GError *error)
|
||||
@@ -304,7 +294,7 @@ capture_run_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
transfer->ssm = ssm;
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
||||
- capture_cmd_cb, NULL);
|
||||
+ fpi_ssm_usb_transfer_cb, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
diff --git a/libfprint/drivers/upektc_img.c b/libfprint/drivers/upektc_img.c
|
||||
index b9724c1..d5aaf72 100644
|
||||
--- a/libfprint/drivers/upektc_img.c
|
||||
+++ b/libfprint/drivers/upektc_img.c
|
||||
@@ -501,16 +501,6 @@ enum activate_states {
|
||||
ACTIVATE_NUM_STATES,
|
||||
};
|
||||
|
||||
-static void
|
||||
-init_reqs_ctrl_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
- gpointer user_data, GError *error)
|
||||
-{
|
||||
- if (!error)
|
||||
- fpi_ssm_next_state (transfer->ssm);
|
||||
- else
|
||||
- fpi_ssm_mark_failed (transfer->ssm, error);
|
||||
-}
|
||||
-
|
||||
static void
|
||||
init_reqs_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
gpointer user_data, GError *error)
|
||||
@@ -554,7 +544,7 @@ activate_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
transfer->buffer[0] = '\0';
|
||||
transfer->ssm = ssm;
|
||||
fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL,
|
||||
- init_reqs_ctrl_cb, NULL);
|
||||
+ fpi_ssm_usb_transfer_cb, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
diff --git a/libfprint/drivers/vcom5s.c b/libfprint/drivers/vcom5s.c
|
||||
index 1a2b795..e1875c3 100644
|
||||
--- a/libfprint/drivers/vcom5s.c
|
||||
+++ b/libfprint/drivers/vcom5s.c
|
||||
@@ -76,16 +76,6 @@ enum v5s_cmd {
|
||||
|
||||
/***** REGISTER I/O *****/
|
||||
|
||||
-static void
|
||||
-sm_write_reg_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
- gpointer user_data, GError *error)
|
||||
-{
|
||||
- if (error)
|
||||
- fpi_ssm_mark_failed (transfer->ssm, error);
|
||||
- else
|
||||
- fpi_ssm_next_state (transfer->ssm);
|
||||
-}
|
||||
-
|
||||
static void
|
||||
sm_write_reg (FpiSsm *ssm,
|
||||
FpDevice *dev,
|
||||
@@ -101,18 +91,8 @@ sm_write_reg (FpiSsm *ssm,
|
||||
G_USB_DEVICE_RECIPIENT_DEVICE,
|
||||
reg, value, 0, 0);
|
||||
transfer->ssm = ssm;
|
||||
- fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL, sm_write_reg_cb,
|
||||
- NULL);
|
||||
-}
|
||||
-
|
||||
-static void
|
||||
-sm_exec_cmd_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
- gpointer user_data, GError *error)
|
||||
-{
|
||||
- if (error)
|
||||
- fpi_ssm_mark_failed (transfer->ssm, error);
|
||||
- else
|
||||
- fpi_ssm_next_state (transfer->ssm);
|
||||
+ fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL,
|
||||
+ fpi_ssm_usb_transfer_cb, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -130,8 +110,8 @@ sm_exec_cmd (FpiSsm *ssm,
|
||||
G_USB_DEVICE_RECIPIENT_DEVICE,
|
||||
cmd, param, 0, 0);
|
||||
transfer->ssm = ssm;
|
||||
- fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL, sm_exec_cmd_cb,
|
||||
- NULL);
|
||||
+ fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL,
|
||||
+ fpi_ssm_usb_transfer_cb, NULL);
|
||||
}
|
||||
|
||||
/***** FINGER DETECTION *****/
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,49 +0,0 @@
|
||||
From 9615d13f9783503da7060ec95be1ba70aba40f5f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 27 Nov 2019 20:19:54 +0100
|
||||
Subject: [PATCH 032/181] fpi-ssm: Make clearer that data is unused in
|
||||
fpi_ssm_usb_transfer_cb
|
||||
|
||||
---
|
||||
libfprint/fpi-ssm.c | 4 ++--
|
||||
libfprint/fpi-ssm.h | 2 +-
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libfprint/fpi-ssm.c b/libfprint/fpi-ssm.c
|
||||
index 6a02a2c..5367e32 100644
|
||||
--- a/libfprint/fpi-ssm.c
|
||||
+++ b/libfprint/fpi-ssm.c
|
||||
@@ -394,7 +394,7 @@ fpi_ssm_next_state_timeout_cb (FpDevice *dev,
|
||||
* fpi_ssm_usb_transfer_cb:
|
||||
* @transfer: a #FpiUsbTransfer
|
||||
* @device: a #FpDevice
|
||||
- * @ssm_data: User data (unused)
|
||||
+ * @unused_data: User data (unused)
|
||||
* @error: The #GError or %NULL
|
||||
*
|
||||
* Can be used in as a #FpiUsbTransfer callback handler to automatically
|
||||
@@ -404,7 +404,7 @@ fpi_ssm_next_state_timeout_cb (FpDevice *dev,
|
||||
*/
|
||||
void
|
||||
fpi_ssm_usb_transfer_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
- gpointer ssm_data, GError *error)
|
||||
+ gpointer unused_data, GError *error)
|
||||
{
|
||||
g_return_if_fail (transfer->ssm);
|
||||
|
||||
diff --git a/libfprint/fpi-ssm.h b/libfprint/fpi-ssm.h
|
||||
index 704271d..57e7d10 100644
|
||||
--- a/libfprint/fpi-ssm.h
|
||||
+++ b/libfprint/fpi-ssm.h
|
||||
@@ -91,7 +91,7 @@ void fpi_ssm_next_state_timeout_cb (FpDevice *dev,
|
||||
void *data);
|
||||
void fpi_ssm_usb_transfer_cb (FpiUsbTransfer *transfer,
|
||||
FpDevice *device,
|
||||
- gpointer user_date,
|
||||
+ gpointer unused_data,
|
||||
GError *error);
|
||||
void fpi_ssm_usb_transfer_with_weak_pointer_cb (FpiUsbTransfer *transfer,
|
||||
FpDevice *device,
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,68 +0,0 @@
|
||||
From 2803498d804fedc6de37ceb52f5f28072ace247a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Tue, 26 Nov 2019 18:39:09 +0100
|
||||
Subject: [PATCH 033/181] umockdev-test: Make possible to use a wrapper to run
|
||||
tests
|
||||
|
||||
Support LIBFPRINT_TEST_WRAPPER env variable to run tests with a wrapper.
|
||||
---
|
||||
tests/umockdev-test.py | 31 ++++++++++++++-----------------
|
||||
1 file changed, 14 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/tests/umockdev-test.py b/tests/umockdev-test.py
|
||||
index f1387d6..d91fcb9 100755
|
||||
--- a/tests/umockdev-test.py
|
||||
+++ b/tests/umockdev-test.py
|
||||
@@ -50,18 +50,23 @@ def cmp_pngs(png_a, png_b):
|
||||
for y in range(img_a.get_height()):
|
||||
assert(data_a[y * stride + x * 4] == data_b[y * stride + x * 4])
|
||||
|
||||
-def capture():
|
||||
- ioctl = os.path.join(ddir, "capture.ioctl")
|
||||
+def get_umockdev_runner(ioctl_basename):
|
||||
+ ioctl = os.path.join(ddir, "{}.ioctl".format(ioctl_basename))
|
||||
device = os.path.join(ddir, "device")
|
||||
dev = open(ioctl).readline().strip()
|
||||
assert dev.startswith('@DEV ')
|
||||
dev = dev[5:]
|
||||
|
||||
- subprocess.check_call(['umockdev-run', '-d', device,
|
||||
- '-i', "%s=%s" % (dev, ioctl),
|
||||
- '--',
|
||||
- '%s' % os.path.join(edir, "capture.py"),
|
||||
- '%s' % os.path.join(tmpdir, "capture.png")])
|
||||
+ umockdev = ['umockdev-run', '-d', device,
|
||||
+ '-i', "%s=%s" % (dev, ioctl),
|
||||
+ '--']
|
||||
+ wrapper = os.getenv('LIBFPRINT_TEST_WRAPPER')
|
||||
+ return umockdev + (wrapper.split(' ') if wrapper else []) + [sys.executable]
|
||||
+
|
||||
+def capture():
|
||||
+ subprocess.check_call(get_umockdev_runner("capture") +
|
||||
+ ['%s' % os.path.join(edir, "capture.py"),
|
||||
+ '%s' % os.path.join(tmpdir, "capture.png")])
|
||||
|
||||
assert os.path.isfile(os.path.join(tmpdir, "capture.png"))
|
||||
if os.path.isfile(os.path.join(ddir, "capture.png")):
|
||||
@@ -69,16 +74,8 @@ def capture():
|
||||
cmp_pngs(os.path.join(tmpdir, "capture.png"), os.path.join(ddir, "capture.png"))
|
||||
|
||||
def custom():
|
||||
- ioctl = os.path.join(ddir, "custom.ioctl")
|
||||
- device = os.path.join(ddir, "device")
|
||||
- dev = open(ioctl).readline().strip()
|
||||
- assert dev.startswith('@DEV ')
|
||||
- dev = dev[5:]
|
||||
-
|
||||
- subprocess.check_call(['umockdev-run', '-d', device,
|
||||
- '-i', "%s=%s" % (dev, ioctl),
|
||||
- '--',
|
||||
- '%s' % os.path.join(ddir, "custom.py")])
|
||||
+ subprocess.check_call(get_umockdev_runner("custom") +
|
||||
+ ['%s' % os.path.join(ddir, "custom.py")])
|
||||
|
||||
try:
|
||||
if os.path.exists(os.path.join(ddir, "capture.ioctl")):
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,48 +0,0 @@
|
||||
From 68c3cf97c87d331843ff7899652c31943b58c6d3 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Tue, 26 Nov 2019 19:37:55 +0100
|
||||
Subject: [PATCH 034/181] virtual-image: Re-run the test using the defined
|
||||
wrapper if any
|
||||
|
||||
In case a LIBFPRINT_TEST_WRAPPER is defined, execute again the script using
|
||||
the same python processor but using the passed wrapper command.
|
||||
---
|
||||
tests/virtual-image.py | 10 +++++++++-
|
||||
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tests/virtual-image.py b/tests/virtual-image.py
|
||||
index a9fe8f5..363219a 100755
|
||||
--- a/tests/virtual-image.py
|
||||
+++ b/tests/virtual-image.py
|
||||
@@ -10,11 +10,20 @@ import sys
|
||||
import unittest
|
||||
import socket
|
||||
import struct
|
||||
+import subprocess
|
||||
import shutil
|
||||
import glob
|
||||
import cairo
|
||||
import tempfile
|
||||
|
||||
+# Re-run the test with the passed wrapper if set
|
||||
+wrapper = os.getenv('LIBFPRINT_TEST_WRAPPER')
|
||||
+if wrapper:
|
||||
+ wrap_cmd = wrapper.split(' ') + [sys.executable, os.path.abspath(__file__)] + \
|
||||
+ sys.argv[1:]
|
||||
+ os.unsetenv('LIBFPRINT_TEST_WRAPPER')
|
||||
+ sys.exit(subprocess.check_call(wrap_cmd))
|
||||
+
|
||||
class Connection:
|
||||
|
||||
def __init__(self, addr):
|
||||
@@ -274,7 +283,6 @@ class VirtualImage(unittest.TestCase):
|
||||
ctx.iteration(True)
|
||||
assert(not self._verify_match)
|
||||
|
||||
-
|
||||
# avoid writing to stderr
|
||||
unittest.main(testRunner=unittest.TextTestRunner(stream=sys.stdout, verbosity=2))
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,32 +0,0 @@
|
||||
From 923fc9e108a352a1fa4cad98a361cf4cdc233d25 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Tue, 26 Nov 2019 18:45:31 +0100
|
||||
Subject: [PATCH 035/181] tests: Add 'gdb' setup to run tests using gdb
|
||||
|
||||
When using --setup=gdb the tests will be running using gdb, however this
|
||||
as per meson limitation allows only running a test when using verbose mode.
|
||||
---
|
||||
tests/meson.build | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/tests/meson.build b/tests/meson.build
|
||||
index 7987692..1645028 100644
|
||||
--- a/tests/meson.build
|
||||
+++ b/tests/meson.build
|
||||
@@ -44,3 +44,13 @@ if get_option('introspection')
|
||||
)
|
||||
endif
|
||||
endif
|
||||
+
|
||||
+gdb = find_program('gdb', required: false)
|
||||
+if gdb.found()
|
||||
+ add_test_setup('gdb',
|
||||
+ timeout_multiplier: 1000,
|
||||
+ env: [
|
||||
+ 'LIBFPRINT_TEST_WRAPPER=@0@ --args'.format(
|
||||
+ gdb.path())
|
||||
+ ])
|
||||
+endif
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,101 +0,0 @@
|
||||
From 47cb10a9c1e15b2782f1efd4b7d27bd0481324b6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Tue, 26 Nov 2019 18:50:18 +0100
|
||||
Subject: [PATCH 036/181] tests: Add setup mode to run tests using valgrind
|
||||
|
||||
In such case we need to ignore the python errors, so including a suppression
|
||||
file when using --setup=valgrind.
|
||||
---
|
||||
tests/meson.build | 16 +++++++++++
|
||||
tests/valgrind-python.supp | 55 ++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 71 insertions(+)
|
||||
create mode 100644 tests/valgrind-python.supp
|
||||
|
||||
diff --git a/tests/meson.build b/tests/meson.build
|
||||
index 1645028..0fe8096 100644
|
||||
--- a/tests/meson.build
|
||||
+++ b/tests/meson.build
|
||||
@@ -54,3 +54,19 @@ if gdb.found()
|
||||
gdb.path())
|
||||
])
|
||||
endif
|
||||
+
|
||||
+valgrind = find_program('valgrind', required: false)
|
||||
+if valgrind.found()
|
||||
+ glib_share = glib_dep.get_pkgconfig_variable('prefix') / 'share' / glib_dep.name()
|
||||
+ glib_suppressions = glib_share + '/valgrind/glib.supp'
|
||||
+ python_suppressions = '@0@/@1@'.format(meson.source_root(),
|
||||
+ files('valgrind-python.supp')[0])
|
||||
+ add_test_setup('valgrind',
|
||||
+ timeout_multiplier: 10,
|
||||
+ env: [
|
||||
+ 'G_SLICE=always-malloc',
|
||||
+ ('LIBFPRINT_TEST_WRAPPER=@0@ --tool=memcheck --leak-check=full ' +
|
||||
+ '--suppressions=@1@ --suppressions=@2@').format(
|
||||
+ valgrind.path(), glib_suppressions, python_suppressions)
|
||||
+ ])
|
||||
+endif
|
||||
diff --git a/tests/valgrind-python.supp b/tests/valgrind-python.supp
|
||||
new file mode 100644
|
||||
index 0000000..395e801
|
||||
--- /dev/null
|
||||
+++ b/tests/valgrind-python.supp
|
||||
@@ -0,0 +1,55 @@
|
||||
+{
|
||||
+ ignore_py_cond
|
||||
+ Memcheck:Cond
|
||||
+ ...
|
||||
+ fun:Py*
|
||||
+}
|
||||
+
|
||||
+{
|
||||
+ ignore__py_cond
|
||||
+ Memcheck:Cond
|
||||
+ ...
|
||||
+ fun:_Py*
|
||||
+}
|
||||
+
|
||||
+{
|
||||
+ ignore_py_value8
|
||||
+ Memcheck:Value8
|
||||
+ ...
|
||||
+ fun:Py*
|
||||
+}
|
||||
+
|
||||
+{
|
||||
+ ignore__py_value8
|
||||
+ Memcheck:Value8
|
||||
+ ...
|
||||
+ fun:_Py*
|
||||
+}
|
||||
+
|
||||
+{
|
||||
+ ignore_py_addr4
|
||||
+ Memcheck:Addr4
|
||||
+ ...
|
||||
+ fun:Py*
|
||||
+}
|
||||
+
|
||||
+{
|
||||
+ ignore__py_addr4
|
||||
+ Memcheck:Addr4
|
||||
+ ...
|
||||
+ fun:_Py*
|
||||
+}
|
||||
+
|
||||
+{
|
||||
+ ignore_py_leaks
|
||||
+ Memcheck:Leak
|
||||
+ ...
|
||||
+ fun:Py*
|
||||
+}
|
||||
+
|
||||
+{
|
||||
+ ignore__py_leaks
|
||||
+ Memcheck:Leak
|
||||
+ ...
|
||||
+ fun:_Py*
|
||||
+}
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,28 +0,0 @@
|
||||
From 36f45003414530868e93c220ea474a3e7e602ca7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Tue, 26 Nov 2019 19:07:26 +0100
|
||||
Subject: [PATCH 037/181] fp-device: Unref the usb device on finalize
|
||||
|
||||
Each device adds a ref to the underlying usb device, but it doesn't remove
|
||||
the reference on finalization.
|
||||
|
||||
So clear the object to fix the leak
|
||||
---
|
||||
libfprint/fp-device.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/libfprint/fp-device.c b/libfprint/fp-device.c
|
||||
index 13f1b5a..b2190bd 100644
|
||||
--- a/libfprint/fp-device.c
|
||||
+++ b/libfprint/fp-device.c
|
||||
@@ -382,6 +382,7 @@ fp_device_finalize (GObject *object)
|
||||
|
||||
g_clear_pointer (&priv->device_id, g_free);
|
||||
g_clear_pointer (&priv->device_name, g_free);
|
||||
+ g_clear_object (&priv->usb_device);
|
||||
|
||||
G_OBJECT_CLASS (fp_device_parent_class)->finalize (object);
|
||||
}
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,28 +0,0 @@
|
||||
From e2419698d6c87a5d5a822acf4d5891a464f68317 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Tue, 26 Nov 2019 19:16:07 +0100
|
||||
Subject: [PATCH 038/181] fp-context: Run dispose on the usb context to deal
|
||||
with circular refs
|
||||
|
||||
Ensure that we dispose the USB context before unreffing it, so that it will
|
||||
release any reference it has and destroy the internal libusb context.
|
||||
---
|
||||
libfprint/fp-context.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/libfprint/fp-context.c b/libfprint/fp-context.c
|
||||
index 74dda51..eed7847 100644
|
||||
--- a/libfprint/fp-context.c
|
||||
+++ b/libfprint/fp-context.c
|
||||
@@ -186,6 +186,8 @@ fp_context_finalize (GObject *object)
|
||||
g_cancellable_cancel (priv->cancellable);
|
||||
g_clear_object (&priv->cancellable);
|
||||
g_clear_pointer (&priv->drivers, g_array_unref);
|
||||
+
|
||||
+ g_object_run_dispose (G_OBJECT (priv->usb_ctx));
|
||||
g_clear_object (&priv->usb_ctx);
|
||||
|
||||
G_OBJECT_CLASS (fp_context_parent_class)->finalize (object);
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,24 +0,0 @@
|
||||
From 39f9257773aef96b5be544795c07ff9b355de08f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Tue, 26 Nov 2019 20:33:56 +0100
|
||||
Subject: [PATCH 039/181] fp-print: Unref the prints on finalize
|
||||
|
||||
---
|
||||
libfprint/fp-print.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/libfprint/fp-print.c b/libfprint/fp-print.c
|
||||
index 39c5c0a..776fc71 100644
|
||||
--- a/libfprint/fp-print.c
|
||||
+++ b/libfprint/fp-print.c
|
||||
@@ -101,6 +101,7 @@ fp_print_finalize (GObject *object)
|
||||
g_clear_pointer (&self->description, g_free);
|
||||
g_clear_pointer (&self->enroll_date, g_date_free);
|
||||
g_clear_pointer (&self->data, g_variant_unref);
|
||||
+ g_clear_pointer (&self->prints, g_ptr_array_unref);
|
||||
|
||||
G_OBJECT_CLASS (fp_print_parent_class)->finalize (object);
|
||||
}
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,29 +0,0 @@
|
||||
From 13dba87820f10d606e70541514195c3cd029c7c1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 27 Nov 2019 19:25:34 +0100
|
||||
Subject: [PATCH 040/181] fp-print: Assert the prints aren't set when
|
||||
initialized
|
||||
|
||||
---
|
||||
libfprint/fp-print.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libfprint/fp-print.c b/libfprint/fp-print.c
|
||||
index 776fc71..ff7927a 100644
|
||||
--- a/libfprint/fp-print.c
|
||||
+++ b/libfprint/fp-print.c
|
||||
@@ -580,7 +580,10 @@ fpi_print_set_type (FpPrint *print,
|
||||
|
||||
print->type = type;
|
||||
if (print->type == FP_PRINT_NBIS)
|
||||
- print->prints = g_ptr_array_new_with_free_func (g_free);
|
||||
+ {
|
||||
+ g_assert_null (print->prints);
|
||||
+ print->prints = g_ptr_array_new_with_free_func (g_free);
|
||||
+ }
|
||||
g_object_notify_by_pspec (G_OBJECT (print), properties[PROP_FPI_TYPE]);
|
||||
}
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,42 +0,0 @@
|
||||
From ba337ffcf3312d23884fd153c3f244350ced1b34 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Tue, 26 Nov 2019 20:35:39 +0100
|
||||
Subject: [PATCH 041/181] fp-print: Unref print data and get static strings
|
||||
when deserializing
|
||||
|
||||
---
|
||||
libfprint/fp-print.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libfprint/fp-print.c b/libfprint/fp-print.c
|
||||
index ff7927a..7777db2 100644
|
||||
--- a/libfprint/fp-print.c
|
||||
+++ b/libfprint/fp-print.c
|
||||
@@ -978,6 +978,7 @@ fp_print_deserialize (const guchar *data,
|
||||
g_autoptr(FpPrint) result = NULL;
|
||||
g_autoptr(GVariant) raw_value = NULL;
|
||||
g_autoptr(GVariant) value = NULL;
|
||||
+ g_autoptr(GVariant) print_data = NULL;
|
||||
guchar *aligned_data = NULL;
|
||||
GDate *date = NULL;
|
||||
guint8 finger_int8;
|
||||
@@ -989,7 +990,6 @@ fp_print_deserialize (const guchar *data,
|
||||
const gchar *driver;
|
||||
const gchar *device_id;
|
||||
gboolean device_stored;
|
||||
- GVariant *print_data;
|
||||
|
||||
g_assert (data);
|
||||
g_assert (length > 3);
|
||||
@@ -1020,7 +1020,7 @@ fp_print_deserialize (const guchar *data,
|
||||
value = g_variant_get_normal_form (raw_value);
|
||||
|
||||
g_variant_get (value,
|
||||
- "(issbymsmsi@a{sv}v)",
|
||||
+ "(i&s&sbymsmsi@a{sv}v)",
|
||||
&type,
|
||||
&driver,
|
||||
&device_id,
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,63 +0,0 @@
|
||||
From 74b297a9a50e19c97a71bc6e317bc8e4bdf2a0a7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Tue, 26 Nov 2019 20:36:44 +0100
|
||||
Subject: [PATCH 042/181] virtual-image: Also unref the object when closing a
|
||||
the stream
|
||||
|
||||
While a stream is closed when completely unreffed, the other way around
|
||||
isn't true, so always unref the object.
|
||||
---
|
||||
libfprint/drivers/virtual-image.c | 9 +++++----
|
||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/virtual-image.c b/libfprint/drivers/virtual-image.c
|
||||
index 6fdd3db..612863d 100644
|
||||
--- a/libfprint/drivers/virtual-image.c
|
||||
+++ b/libfprint/drivers/virtual-image.c
|
||||
@@ -81,7 +81,7 @@ recv_image_img_recv_cb (GObject *source_object,
|
||||
|
||||
self = FPI_DEVICE_VIRTUAL_IMAGE (user_data);
|
||||
g_io_stream_close (G_IO_STREAM (self->connection), NULL, NULL);
|
||||
- self->connection = NULL;
|
||||
+ g_clear_object (&self->connection);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ recv_image_hdr_recv_cb (GObject *source_object,
|
||||
|
||||
self = FPI_DEVICE_VIRTUAL_IMAGE (user_data);
|
||||
g_io_stream_close (G_IO_STREAM (self->connection), NULL, NULL);
|
||||
- self->connection = NULL;
|
||||
+ g_clear_object (&self->connection);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ recv_image_hdr_recv_cb (GObject *source_object,
|
||||
{
|
||||
g_warning ("Image header suggests an unrealistically large image, disconnecting client.");
|
||||
g_io_stream_close (G_IO_STREAM (self->connection), NULL, NULL);
|
||||
- self->connection = NULL;
|
||||
+ g_clear_object (&self->connection);
|
||||
}
|
||||
|
||||
if (self->recv_img_hdr[0] < 0 || self->recv_img_hdr[1] < 0)
|
||||
@@ -148,7 +148,7 @@ recv_image_hdr_recv_cb (GObject *source_object,
|
||||
default:
|
||||
/* disconnect client, it didn't play fair */
|
||||
g_io_stream_close (G_IO_STREAM (self->connection), NULL, NULL);
|
||||
- self->connection = NULL;
|
||||
+ g_clear_object (&self->connection);
|
||||
}
|
||||
|
||||
/* And, listen for more images from the same client. */
|
||||
@@ -206,6 +206,7 @@ new_connection_cb (GObject *source_object, GAsyncResult *res, gpointer user_data
|
||||
if (dev->connection)
|
||||
{
|
||||
g_io_stream_close (G_IO_STREAM (connection), NULL, NULL);
|
||||
+ g_object_unref (connection);
|
||||
return;
|
||||
}
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,57 +0,0 @@
|
||||
From b7a62c3e2558abb69a8cad0983e30daf511f00d0 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Tue, 26 Nov 2019 20:38:16 +0100
|
||||
Subject: [PATCH 043/181] fp-device: Use an autopointer and steal the print
|
||||
when passed
|
||||
|
||||
Make it clearer that we're stealing the print when passing it away, instead
|
||||
of just doing this silently.
|
||||
---
|
||||
libfprint/fp-image-device.c | 9 +++++----
|
||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/libfprint/fp-image-device.c b/libfprint/fp-image-device.c
|
||||
index 692727b..e45b6a9 100644
|
||||
--- a/libfprint/fp-image-device.c
|
||||
+++ b/libfprint/fp-image-device.c
|
||||
@@ -389,8 +389,8 @@ static void
|
||||
fpi_image_device_minutiae_detected (GObject *source_object, GAsyncResult *res, gpointer user_data)
|
||||
{
|
||||
g_autoptr(FpImage) image = FP_IMAGE (source_object);
|
||||
+ g_autoptr(FpPrint) print = NULL;
|
||||
GError *error = NULL;
|
||||
- FpPrint *print = NULL;
|
||||
FpDevice *device = FP_DEVICE (user_data);
|
||||
FpImageDevicePrivate *priv;
|
||||
FpDeviceAction action;
|
||||
@@ -443,7 +443,8 @@ fpi_image_device_minutiae_detected (GObject *source_object, GAsyncResult *res, g
|
||||
priv->enroll_stage += 1;
|
||||
}
|
||||
|
||||
- fpi_device_enroll_progress (device, priv->enroll_stage, print, error);
|
||||
+ fpi_device_enroll_progress (device, priv->enroll_stage,
|
||||
+ g_steal_pointer (&print), error);
|
||||
|
||||
if (priv->enroll_stage == IMG_ENROLL_STAGES)
|
||||
{
|
||||
@@ -462,7 +463,7 @@ fpi_image_device_minutiae_detected (GObject *source_object, GAsyncResult *res, g
|
||||
else
|
||||
result = FPI_MATCH_ERROR;
|
||||
|
||||
- fpi_device_verify_complete (device, result, print, error);
|
||||
+ fpi_device_verify_complete (device, result, g_steal_pointer (&print), error);
|
||||
fp_image_device_deactivate (device);
|
||||
}
|
||||
else if (action == FP_DEVICE_ACTION_IDENTIFY)
|
||||
@@ -483,7 +484,7 @@ fpi_image_device_minutiae_detected (GObject *source_object, GAsyncResult *res, g
|
||||
}
|
||||
}
|
||||
|
||||
- fpi_device_identify_complete (device, result, print, error);
|
||||
+ fpi_device_identify_complete (device, result, g_steal_pointer (&print), error);
|
||||
fp_image_device_deactivate (device);
|
||||
}
|
||||
else
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,48 +0,0 @@
|
||||
From 364dd9f3de7f027723bceaa68584cceb66b6d15d Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Tue, 26 Nov 2019 20:43:33 +0100
|
||||
Subject: [PATCH 044/181] fp-device: Unref the print once we've notified the
|
||||
progress
|
||||
|
||||
When we notify the enroll progress with a print, this needs to be unreffed
|
||||
once we're done, but this only was happening in case of error.
|
||||
|
||||
Since it's not up to the callback function to free it, let's do it at the
|
||||
end of the function.
|
||||
|
||||
As per this, clarify the docs for FpEnrollProgress marking it as transfer
|
||||
none.
|
||||
---
|
||||
libfprint/fp-device.c | 2 ++
|
||||
libfprint/fp-device.h | 2 +-
|
||||
2 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libfprint/fp-device.c b/libfprint/fp-device.c
|
||||
index b2190bd..c9d1b89 100644
|
||||
--- a/libfprint/fp-device.c
|
||||
+++ b/libfprint/fp-device.c
|
||||
@@ -2344,6 +2344,8 @@ fpi_device_enroll_progress (FpDevice *device,
|
||||
}
|
||||
if (error)
|
||||
g_error_free (error);
|
||||
+
|
||||
+ g_clear_object (&print);
|
||||
}
|
||||
|
||||
|
||||
diff --git a/libfprint/fp-device.h b/libfprint/fp-device.h
|
||||
index 821514d..4785064 100644
|
||||
--- a/libfprint/fp-device.h
|
||||
+++ b/libfprint/fp-device.h
|
||||
@@ -113,7 +113,7 @@ GQuark fp_device_error_quark (void);
|
||||
* FpEnrollProgress:
|
||||
* @device: a #FpDevice
|
||||
* @completed_stages: Number of completed stages
|
||||
- * @print: (nullable): The last scaned print
|
||||
+ * @print: (nullable) (transfer none): The last scaned print
|
||||
* @user_data: (nullable): User provided data
|
||||
* @error: (nullable) (transfer none): #GError or %NULL
|
||||
*
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,28 +0,0 @@
|
||||
From 2036734844f806e2781ce4bd1a5d355cc6d2b0ba Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 27 Nov 2019 21:39:53 +0100
|
||||
Subject: [PATCH 045/181] fp-device: Mark user data in FpEnrollProgress as
|
||||
transfer none
|
||||
|
||||
The data has its own DestroyNotify set, so while no generic DestroyNotify
|
||||
exists for generic data, let's make it clear.
|
||||
---
|
||||
libfprint/fp-device.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libfprint/fp-device.h b/libfprint/fp-device.h
|
||||
index 4785064..a15fc30 100644
|
||||
--- a/libfprint/fp-device.h
|
||||
+++ b/libfprint/fp-device.h
|
||||
@@ -114,7 +114,7 @@ GQuark fp_device_error_quark (void);
|
||||
* @device: a #FpDevice
|
||||
* @completed_stages: Number of completed stages
|
||||
* @print: (nullable) (transfer none): The last scaned print
|
||||
- * @user_data: (nullable): User provided data
|
||||
+ * @user_data: (nullable) (transfer none): User provided data
|
||||
* @error: (nullable) (transfer none): #GError or %NULL
|
||||
*
|
||||
* The passed error is guaranteed to be of type %FP_DEVICE_RETRY if set.
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,27 +0,0 @@
|
||||
From 25bfa5a0681d6b7eb88a98b229fc309465257358 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Tue, 26 Nov 2019 20:44:15 +0100
|
||||
Subject: [PATCH 046/181] fp-device: Use g_clear_error instead of check + free
|
||||
|
||||
---
|
||||
libfprint/fp-device.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libfprint/fp-device.c b/libfprint/fp-device.c
|
||||
index c9d1b89..0a1f8de 100644
|
||||
--- a/libfprint/fp-device.c
|
||||
+++ b/libfprint/fp-device.c
|
||||
@@ -2342,9 +2342,8 @@ fpi_device_enroll_progress (FpDevice *device,
|
||||
data->enroll_progress_data,
|
||||
error);
|
||||
}
|
||||
- if (error)
|
||||
- g_error_free (error);
|
||||
|
||||
+ g_clear_error (&error);
|
||||
g_clear_object (&print);
|
||||
}
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,53 +0,0 @@
|
||||
From e164796705693d0fae8d21ffbc24fbb4ba1a3fed Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Tue, 26 Nov 2019 20:59:09 +0100
|
||||
Subject: [PATCH 047/181] tests: Use a loop for generating drivers tests and
|
||||
use suites
|
||||
|
||||
So we can just run drivers tests with --suite=drivers
|
||||
---
|
||||
tests/meson.build | 22 +++++++++-------------
|
||||
1 file changed, 9 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/tests/meson.build b/tests/meson.build
|
||||
index 0fe8096..d6196be 100644
|
||||
--- a/tests/meson.build
|
||||
+++ b/tests/meson.build
|
||||
@@ -24,25 +24,21 @@ if get_option('introspection')
|
||||
)
|
||||
endif
|
||||
|
||||
- if 'vfs5011' in drivers
|
||||
- test('vfs5011',
|
||||
- find_program('umockdev-test.py'),
|
||||
- args: join_paths(meson.current_source_dir(), 'vfs5011'),
|
||||
- env: envs,
|
||||
- timeout: 10,
|
||||
- depends: libfprint_typelib,
|
||||
- )
|
||||
- endif
|
||||
+ drivers_tests = [
|
||||
+ 'vfs5011',
|
||||
+ 'synaptics',
|
||||
+ ]
|
||||
|
||||
- if 'synaptics' in drivers
|
||||
- test('synaptics',
|
||||
+ foreach driver_test: drivers_tests
|
||||
+ test(driver_test,
|
||||
find_program('umockdev-test.py'),
|
||||
- args: join_paths(meson.current_source_dir(), 'synaptics'),
|
||||
+ args: join_paths(meson.current_source_dir(), driver_test),
|
||||
env: envs,
|
||||
+ suite: ['drivers'],
|
||||
timeout: 10,
|
||||
depends: libfprint_typelib,
|
||||
)
|
||||
- endif
|
||||
+ endforeach
|
||||
endif
|
||||
|
||||
gdb = find_program('gdb', required: false)
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,31 +0,0 @@
|
||||
From 2a335a89a622dcc0428fcd32dbed7841dec5b25f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Thu, 28 Nov 2019 21:30:17 +0100
|
||||
Subject: [PATCH 048/181] fp-print: Set the aligned_data as the data used by
|
||||
the cleanup function
|
||||
|
||||
g_variant_new_from_data() allows to destroy some other user_data passed as
|
||||
parameter that might be different from the aligned_data itself.
|
||||
|
||||
But since in this case they match, pass it to be set as g_free parameter
|
||||
or it won't be free'd.
|
||||
---
|
||||
libfprint/fp-print.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libfprint/fp-print.c b/libfprint/fp-print.c
|
||||
index 7777db2..ddf8747 100644
|
||||
--- a/libfprint/fp-print.c
|
||||
+++ b/libfprint/fp-print.c
|
||||
@@ -1009,7 +1009,7 @@ fp_print_deserialize (const guchar *data,
|
||||
memcpy (aligned_data, data + 3, length - 3);
|
||||
raw_value = g_variant_new_from_data (FP_PRINT_VARIANT_TYPE,
|
||||
aligned_data, length - 3,
|
||||
- FALSE, g_free, NULL);
|
||||
+ FALSE, g_free, aligned_data);
|
||||
|
||||
if (!raw_value)
|
||||
goto invalid_format;
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,33 +0,0 @@
|
||||
From a916f33535177a3032822d7b47ab199d6249b989 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Thu, 28 Nov 2019 11:37:33 +0100
|
||||
Subject: [PATCH 049/181] tests: Fix endianness issue in test suite
|
||||
|
||||
The test suite needs to compare greyscale images and was picking an
|
||||
undefined byte in the pixel data on big-endian. Select a byte that works
|
||||
on any endian instead.
|
||||
|
||||
See: #200
|
||||
---
|
||||
tests/umockdev-test.py | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tests/umockdev-test.py b/tests/umockdev-test.py
|
||||
index d91fcb9..1b556e1 100755
|
||||
--- a/tests/umockdev-test.py
|
||||
+++ b/tests/umockdev-test.py
|
||||
@@ -48,7 +48,10 @@ def cmp_pngs(png_a, png_b):
|
||||
|
||||
for x in range(img_a.get_width()):
|
||||
for y in range(img_a.get_height()):
|
||||
- assert(data_a[y * stride + x * 4] == data_b[y * stride + x * 4])
|
||||
+ # RGB24 format is endian dependent, using +1 means we test either
|
||||
+ # the G or B component, which works on any endian for the greyscale
|
||||
+ # test.
|
||||
+ assert(data_a[y * stride + x * 4 + 1] == data_b[y * stride + x * 4 + 1])
|
||||
|
||||
def get_umockdev_runner(ioctl_basename):
|
||||
ioctl = os.path.join(ddir, "{}.ioctl".format(ioctl_basename))
|
||||
--
|
||||
2.24.1
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,44 +0,0 @@
|
||||
From d1bf2cc0c69210bf8c835399edb3578c4c69c4a6 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Mon, 2 Dec 2019 17:02:07 +0100
|
||||
Subject: [PATCH 051/181] Fix indentation issues using newer uncrustify
|
||||
|
||||
Seems like the older uncrustify versions did not find these indentation
|
||||
issues. Fix them.
|
||||
|
||||
Old versions of uncrustify will leave things as is, so this is not a
|
||||
problem if developers are using an old version of uncrustify.
|
||||
---
|
||||
libfprint/drivers/vfs301_proto.c | 2 +-
|
||||
libfprint/fpi-print.h | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/vfs301_proto.c b/libfprint/drivers/vfs301_proto.c
|
||||
index 103e890..84e2318 100644
|
||||
--- a/libfprint/drivers/vfs301_proto.c
|
||||
+++ b/libfprint/drivers/vfs301_proto.c
|
||||
@@ -498,7 +498,7 @@ vfs301_proto_peek_event (FpDeviceVfs301 *dev)
|
||||
usb_recv (dev, e1, l1, NULL, &error); \
|
||||
usb_recv (dev, e2, l2, NULL, NULL); \
|
||||
if (g_error_matches (error, G_USB_DEVICE_ERROR, G_USB_DEVICE_ERROR_TIMED_OUT)) \
|
||||
- usb_recv(dev, e1, l1, NULL, NULL); \
|
||||
+ usb_recv (dev, e1, l1, NULL, NULL); \
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/libfprint/fpi-print.h b/libfprint/fpi-print.h
|
||||
index fe07c26..94670a0 100644
|
||||
--- a/libfprint/fpi-print.h
|
||||
+++ b/libfprint/fpi-print.h
|
||||
@@ -43,7 +43,7 @@ gboolean fpi_print_add_from_image (FpPrint *print,
|
||||
GError **error);
|
||||
|
||||
FpiMatchResult fpi_print_bz3_match (FpPrint * template,
|
||||
- FpPrint *print,
|
||||
+ FpPrint * print,
|
||||
gint bz3_threshold,
|
||||
GError **error);
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,99 +0,0 @@
|
||||
From 61851ea1f0a1e23c9f6f05245aa2d4d0303d1a88 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Mon, 2 Dec 2019 16:48:04 +0100
|
||||
Subject: [PATCH 052/181] virtual-image: Fix driver reading insufficient data
|
||||
|
||||
In rare occasions it could happen that the driver was reading
|
||||
insufficient data. Fix this by using g_input_stream_read_all_async
|
||||
which will ensure that incomplete data will not be misinterpreted.
|
||||
|
||||
This fixes rare test failures seen in fprintd.
|
||||
---
|
||||
libfprint/drivers/virtual-image.c | 46 ++++++++++++++++---------------
|
||||
1 file changed, 24 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/virtual-image.c b/libfprint/drivers/virtual-image.c
|
||||
index 612863d..c271c7a 100644
|
||||
--- a/libfprint/drivers/virtual-image.c
|
||||
+++ b/libfprint/drivers/virtual-image.c
|
||||
@@ -66,13 +66,14 @@ recv_image_img_recv_cb (GObject *source_object,
|
||||
g_autoptr(GError) error = NULL;
|
||||
FpDeviceVirtualImage *self;
|
||||
FpImageDevice *device;
|
||||
- gssize bytes;
|
||||
+ gboolean success;
|
||||
+ gsize bytes = 0;
|
||||
|
||||
- bytes = g_input_stream_read_finish (G_INPUT_STREAM (source_object), res, &error);
|
||||
+ success = g_input_stream_read_all_finish (G_INPUT_STREAM (source_object), res, &bytes, &error);
|
||||
|
||||
- if (bytes <= 0)
|
||||
+ if (!success || bytes == 0)
|
||||
{
|
||||
- if (bytes < 0)
|
||||
+ if (!success)
|
||||
{
|
||||
g_warning ("Error receiving header for image data: %s", error->message);
|
||||
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
||||
@@ -103,13 +104,14 @@ recv_image_hdr_recv_cb (GObject *source_object,
|
||||
{
|
||||
g_autoptr(GError) error = NULL;
|
||||
FpDeviceVirtualImage *self;
|
||||
- gssize bytes;
|
||||
+ gboolean success;
|
||||
+ gsize bytes;
|
||||
|
||||
- bytes = g_input_stream_read_finish (G_INPUT_STREAM (source_object), res, &error);
|
||||
+ success = g_input_stream_read_all_finish (G_INPUT_STREAM (source_object), res, &bytes, &error);
|
||||
|
||||
- if (bytes <= 0)
|
||||
+ if (!success || bytes == 0)
|
||||
{
|
||||
- if (bytes < 0)
|
||||
+ if (!success)
|
||||
{
|
||||
g_warning ("Error receiving header for image data: %s", error->message);
|
||||
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
||||
@@ -158,25 +160,25 @@ recv_image_hdr_recv_cb (GObject *source_object,
|
||||
|
||||
self->recv_img = fp_image_new (self->recv_img_hdr[0], self->recv_img_hdr[1]);
|
||||
g_debug ("image data: %p", self->recv_img->data);
|
||||
- g_input_stream_read_async (G_INPUT_STREAM (source_object),
|
||||
- (guint8 *) self->recv_img->data,
|
||||
- self->recv_img->width * self->recv_img->height,
|
||||
- G_PRIORITY_DEFAULT,
|
||||
- self->cancellable,
|
||||
- recv_image_img_recv_cb,
|
||||
- self);
|
||||
+ g_input_stream_read_all_async (G_INPUT_STREAM (source_object),
|
||||
+ (guint8 *) self->recv_img->data,
|
||||
+ self->recv_img->width * self->recv_img->height,
|
||||
+ G_PRIORITY_DEFAULT,
|
||||
+ self->cancellable,
|
||||
+ recv_image_img_recv_cb,
|
||||
+ self);
|
||||
}
|
||||
|
||||
static void
|
||||
recv_image (FpDeviceVirtualImage *dev, GInputStream *stream)
|
||||
{
|
||||
- g_input_stream_read_async (stream,
|
||||
- dev->recv_img_hdr,
|
||||
- sizeof (dev->recv_img_hdr),
|
||||
- G_PRIORITY_DEFAULT,
|
||||
- dev->cancellable,
|
||||
- recv_image_hdr_recv_cb,
|
||||
- dev);
|
||||
+ g_input_stream_read_all_async (stream,
|
||||
+ dev->recv_img_hdr,
|
||||
+ sizeof (dev->recv_img_hdr),
|
||||
+ G_PRIORITY_DEFAULT,
|
||||
+ dev->cancellable,
|
||||
+ recv_image_hdr_recv_cb,
|
||||
+ dev);
|
||||
}
|
||||
|
||||
static void
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,39 +0,0 @@
|
||||
From b5d9916157d5b215224ba799c1a2b707fd435554 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Thu, 28 Nov 2019 20:34:20 +0100
|
||||
Subject: [PATCH 053/181] synaptics: Use an autoptr to handle the
|
||||
FpiUsbTransfer sync transfers
|
||||
|
||||
When using fpi_usb_transfer_submit_sync we still need to unref the transfer
|
||||
once done with it, so let's use an auto pointer so we free it also on
|
||||
errors and early returns without having to handle this manually.
|
||||
---
|
||||
libfprint/drivers/synaptics/synaptics.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/synaptics/synaptics.c b/libfprint/drivers/synaptics/synaptics.c
|
||||
index ccaf60e..284973c 100644
|
||||
--- a/libfprint/drivers/synaptics/synaptics.c
|
||||
+++ b/libfprint/drivers/synaptics/synaptics.c
|
||||
@@ -950,7 +950,8 @@ dev_probe (FpDevice *device)
|
||||
{
|
||||
FpiDeviceSynaptics *self = FPI_DEVICE_SYNAPTICS (device);
|
||||
GUsbDevice *usb_dev;
|
||||
- FpiUsbTransfer *transfer;
|
||||
+
|
||||
+ g_autoptr(FpiUsbTransfer) transfer = NULL;
|
||||
FpiByteReader reader;
|
||||
GError *error = NULL;
|
||||
guint16 status;
|
||||
@@ -985,7 +986,7 @@ dev_probe (FpDevice *device)
|
||||
if (!fpi_usb_transfer_submit_sync (transfer, 1000, &error))
|
||||
goto err_close;
|
||||
|
||||
-
|
||||
+ g_clear_pointer (&transfer, fpi_usb_transfer_unref);
|
||||
transfer = fpi_usb_transfer_new (device);
|
||||
fpi_usb_transfer_fill_bulk (transfer, USB_EP_REPLY, 40);
|
||||
if (!fpi_usb_transfer_submit_sync (transfer, 1000, &error))
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,30 +0,0 @@
|
||||
From e26a788fd6e4c71cfdbd3c62df4a5ebeba81b31b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Thu, 28 Nov 2019 20:35:33 +0100
|
||||
Subject: [PATCH 054/181] synaptics: Close the usb device if reset failed
|
||||
|
||||
If reseting the device failed, we still need to close the usb device before
|
||||
returning.
|
||||
---
|
||||
libfprint/drivers/synaptics/synaptics.c | 5 +----
|
||||
1 file changed, 1 insertion(+), 4 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/synaptics/synaptics.c b/libfprint/drivers/synaptics/synaptics.c
|
||||
index 284973c..1524c45 100644
|
||||
--- a/libfprint/drivers/synaptics/synaptics.c
|
||||
+++ b/libfprint/drivers/synaptics/synaptics.c
|
||||
@@ -970,10 +970,7 @@ dev_probe (FpDevice *device)
|
||||
}
|
||||
|
||||
if (!g_usb_device_reset (fpi_device_get_usb_device (device), &error))
|
||||
- {
|
||||
- fpi_device_probe_complete (device, NULL, NULL, error);
|
||||
- return;
|
||||
- }
|
||||
+ goto err_close;
|
||||
|
||||
if (!g_usb_device_claim_interface (fpi_device_get_usb_device (device), 0, 0, &error))
|
||||
goto err_close;
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,47 +0,0 @@
|
||||
From b82bcc0fc55035d04ac10143a909cc3a20bfcedf Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Thu, 28 Nov 2019 20:40:32 +0100
|
||||
Subject: [PATCH 055/181] vfs301: Use a transfer autopointer to cleanup it on
|
||||
sync submission
|
||||
|
||||
Partially revert commit a855c0cc7, since the driver uses a sync transfer
|
||||
and in such case the caller still keeps the ownership.
|
||||
---
|
||||
libfprint/drivers/vfs301_proto.c | 7 ++++---
|
||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/vfs301_proto.c b/libfprint/drivers/vfs301_proto.c
|
||||
index 84e2318..2bf8bbd 100644
|
||||
--- a/libfprint/drivers/vfs301_proto.c
|
||||
+++ b/libfprint/drivers/vfs301_proto.c
|
||||
@@ -67,7 +67,8 @@ static void
|
||||
usb_recv (FpDeviceVfs301 *dev, guint8 endpoint, int max_bytes, FpiUsbTransfer **out, GError **error)
|
||||
{
|
||||
GError *err = NULL;
|
||||
- FpiUsbTransfer *transfer;
|
||||
+
|
||||
+ g_autoptr(FpiUsbTransfer) transfer = NULL;
|
||||
|
||||
/* XXX: This function swallows any transfer errors, that is obviously
|
||||
* quite bad (it used to assert on no-error)! */
|
||||
@@ -78,7 +79,6 @@ usb_recv (FpDeviceVfs301 *dev, guint8 endpoint, int max_bytes, FpiUsbTransfer **
|
||||
|
||||
fpi_usb_transfer_submit_sync (transfer, VFS301_DEFAULT_WAIT_TIMEOUT, &err);
|
||||
|
||||
-
|
||||
#ifdef DEBUG
|
||||
usb_print_packet (0, err, transfer->buffer, transfer->actual_length);
|
||||
#endif
|
||||
@@ -97,7 +97,8 @@ static void
|
||||
usb_send (FpDeviceVfs301 *dev, const guint8 *data, gssize length, GError **error)
|
||||
{
|
||||
GError *err = NULL;
|
||||
- FpiUsbTransfer *transfer = NULL;
|
||||
+
|
||||
+ g_autoptr(FpiUsbTransfer) transfer = NULL;
|
||||
|
||||
/* XXX: This function swallows any transfer errors, that is obviously
|
||||
* quite bad (it used to assert on no-error)! */
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,26 +0,0 @@
|
||||
From 66b6a2598b599afe874efe15bec4cdcb34f7ee79 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Fri, 22 Nov 2019 18:03:08 +0100
|
||||
Subject: [PATCH 056/181] fpi-ssm: Also bug-on negative state value
|
||||
|
||||
Being an integer, anything could happen.
|
||||
---
|
||||
libfprint/fpi-ssm.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libfprint/fpi-ssm.c b/libfprint/fpi-ssm.c
|
||||
index 5367e32..5299e2d 100644
|
||||
--- a/libfprint/fpi-ssm.c
|
||||
+++ b/libfprint/fpi-ssm.c
|
||||
@@ -317,7 +317,7 @@ void
|
||||
fpi_ssm_jump_to_state (FpiSsm *machine, int state)
|
||||
{
|
||||
BUG_ON (machine->completed);
|
||||
- BUG_ON (state >= machine->nr_states);
|
||||
+ BUG_ON (state < 0 || state >= machine->nr_states);
|
||||
machine->cur_state = state;
|
||||
__ssm_call_handler (machine);
|
||||
}
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,206 +0,0 @@
|
||||
From 9f9a94d7a0c18dd62794f0172d3a306d2f38c4fd Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Fri, 22 Nov 2019 17:11:29 +0100
|
||||
Subject: [PATCH 057/181] fpi-device: Make possible to set a DestroyNotify for
|
||||
timeout data
|
||||
|
||||
Since GSource data can be automatically cleaned up on source destruction, we
|
||||
can mimic this for the devices timeout easily as well.
|
||||
|
||||
Add an extra parameter, and let's use this cocci file to adapt all the
|
||||
drivers like magic:
|
||||
|
||||
@@
|
||||
expression e1, e2, e3, e4;
|
||||
@@
|
||||
fpi_device_add_timeout (e1, e2, e3, e4
|
||||
+ , NULL
|
||||
)
|
||||
---
|
||||
libfprint/drivers/elan.c | 4 ++--
|
||||
libfprint/drivers/uru4000.c | 6 +++---
|
||||
libfprint/drivers/vfs0050.c | 4 ++--
|
||||
libfprint/drivers/vfs101.c | 2 +-
|
||||
libfprint/drivers/vfs301.c | 2 +-
|
||||
libfprint/drivers/vfs5011.c | 2 +-
|
||||
libfprint/fp-device.c | 14 ++++++++------
|
||||
libfprint/fpi-device.h | 10 +++++-----
|
||||
8 files changed, 23 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/elan.c b/libfprint/drivers/elan.c
|
||||
index e2767dd..f9e8763 100644
|
||||
--- a/libfprint/drivers/elan.c
|
||||
+++ b/libfprint/drivers/elan.c
|
||||
@@ -756,7 +756,7 @@ calibrate_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
self->calib_status = 0x01;
|
||||
timeout = fpi_device_add_timeout (dev, 50,
|
||||
fpi_ssm_next_state_timeout_cb,
|
||||
- ssm);
|
||||
+ ssm, NULL);
|
||||
g_source_set_name (timeout, "calibrate_run_state");
|
||||
}
|
||||
break;
|
||||
@@ -1020,7 +1020,7 @@ dev_change_state (FpImageDevice *dev, FpImageDeviceState state)
|
||||
self->dev_state_next = state;
|
||||
timeout = fpi_device_add_timeout (FP_DEVICE (dev), 10,
|
||||
elan_change_state_async,
|
||||
- NULL);
|
||||
+ NULL, NULL);
|
||||
|
||||
name = g_strdup_printf ("dev_change_state to %d", state);
|
||||
g_source_set_name (timeout, name);
|
||||
diff --git a/libfprint/drivers/uru4000.c b/libfprint/drivers/uru4000.c
|
||||
index 7e28724..1deadd3 100644
|
||||
--- a/libfprint/drivers/uru4000.c
|
||||
+++ b/libfprint/drivers/uru4000.c
|
||||
@@ -875,7 +875,7 @@ rebootpwr_run_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
break;
|
||||
|
||||
case REBOOTPWR_PAUSE:
|
||||
- fpi_device_add_timeout (_dev, 10, rebootpwr_pause_cb, ssm);
|
||||
+ fpi_device_add_timeout (_dev, 10, rebootpwr_pause_cb, ssm, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -971,7 +971,7 @@ powerup_run_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
break;
|
||||
|
||||
case POWERUP_PAUSE:
|
||||
- fpi_device_add_timeout (_dev, 10, powerup_pause_cb, ssm);
|
||||
+ fpi_device_add_timeout (_dev, 10, powerup_pause_cb, ssm, NULL);
|
||||
break;
|
||||
|
||||
case POWERUP_CHALLENGE_RESPONSE:
|
||||
@@ -1130,7 +1130,7 @@ init_run_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
self->scanpwr_irq_timeout = fpi_device_add_timeout (_dev,
|
||||
300,
|
||||
init_scanpwr_timeout,
|
||||
- ssm);
|
||||
+ ssm, NULL);
|
||||
break;
|
||||
|
||||
case INIT_DONE:
|
||||
diff --git a/libfprint/drivers/vfs0050.c b/libfprint/drivers/vfs0050.c
|
||||
index 43252c0..6377639 100644
|
||||
--- a/libfprint/drivers/vfs0050.c
|
||||
+++ b/libfprint/drivers/vfs0050.c
|
||||
@@ -619,7 +619,7 @@ activate_ssm (FpiSsm *ssm, FpDevice *dev)
|
||||
|
||||
/* Wait for probable vdev->active changing */
|
||||
fpi_device_add_timeout (dev, VFS_SSM_TIMEOUT,
|
||||
- fpi_ssm_next_state_timeout_cb, ssm);
|
||||
+ fpi_ssm_next_state_timeout_cb, ssm, NULL);
|
||||
break;
|
||||
|
||||
case SSM_NEXT_RECEIVE:
|
||||
@@ -639,7 +639,7 @@ activate_ssm (FpiSsm *ssm, FpDevice *dev)
|
||||
case SSM_WAIT_ANOTHER_SCAN:
|
||||
/* Orange light is on now */
|
||||
fpi_device_add_timeout (dev, VFS_SSM_ORANGE_TIMEOUT,
|
||||
- another_scan, ssm);
|
||||
+ another_scan, ssm, NULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
diff --git a/libfprint/drivers/vfs101.c b/libfprint/drivers/vfs101.c
|
||||
index 5dedab7..0df9b73 100644
|
||||
--- a/libfprint/drivers/vfs101.c
|
||||
+++ b/libfprint/drivers/vfs101.c
|
||||
@@ -376,7 +376,7 @@ async_sleep (unsigned int msec,
|
||||
FpImageDevice *dev)
|
||||
{
|
||||
fpi_device_add_timeout (FP_DEVICE (dev), msec,
|
||||
- fpi_ssm_next_state_timeout_cb, ssm);
|
||||
+ fpi_ssm_next_state_timeout_cb, ssm, NULL);
|
||||
}
|
||||
|
||||
/* Swap ssm states */
|
||||
diff --git a/libfprint/drivers/vfs301.c b/libfprint/drivers/vfs301.c
|
||||
index 7219792..1d0f066 100644
|
||||
--- a/libfprint/drivers/vfs301.c
|
||||
+++ b/libfprint/drivers/vfs301.c
|
||||
@@ -36,7 +36,7 @@ async_sleep (unsigned int msec,
|
||||
{
|
||||
/* Add timeout */
|
||||
fpi_device_add_timeout (FP_DEVICE (dev), msec,
|
||||
- fpi_ssm_next_state_timeout_cb, ssm);
|
||||
+ fpi_ssm_next_state_timeout_cb, ssm, NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
diff --git a/libfprint/drivers/vfs5011.c b/libfprint/drivers/vfs5011.c
|
||||
index dbf8276..4fac03c 100644
|
||||
--- a/libfprint/drivers/vfs5011.c
|
||||
+++ b/libfprint/drivers/vfs5011.c
|
||||
@@ -706,7 +706,7 @@ activate_loop (FpiSsm *ssm, FpDevice *_dev)
|
||||
case DEV_ACTIVATE_DATA_COMPLETE:
|
||||
fpi_device_add_timeout (_dev, 1,
|
||||
fpi_ssm_next_state_timeout_cb,
|
||||
- ssm);
|
||||
+ ssm, NULL);
|
||||
|
||||
break;
|
||||
|
||||
diff --git a/libfprint/fp-device.c b/libfprint/fp-device.c
|
||||
index 0a1f8de..182be51 100644
|
||||
--- a/libfprint/fp-device.c
|
||||
+++ b/libfprint/fp-device.c
|
||||
@@ -1475,7 +1475,8 @@ fpi_device_set_scan_type (FpDevice *device,
|
||||
* @device: The #FpDevice
|
||||
* @interval: The interval in milliseconds
|
||||
* @func: The #FpTimeoutFunc to call on timeout
|
||||
- * @user_data: User data to pass to the callback
|
||||
+ * @user_data: (nullable): User data to pass to the callback
|
||||
+ * @destroy_notify: (nullable): #GDestroyNotify for @user_data
|
||||
*
|
||||
* Register a timeout to run. Drivers should always make sure that timers are
|
||||
* cancelled when appropriate.
|
||||
@@ -1483,10 +1484,11 @@ fpi_device_set_scan_type (FpDevice *device,
|
||||
* Returns: (transfer none): A newly created and attached #GSource
|
||||
*/
|
||||
GSource *
|
||||
-fpi_device_add_timeout (FpDevice *device,
|
||||
- gint interval,
|
||||
- FpTimeoutFunc func,
|
||||
- gpointer user_data)
|
||||
+fpi_device_add_timeout (FpDevice *device,
|
||||
+ gint interval,
|
||||
+ FpTimeoutFunc func,
|
||||
+ gpointer user_data,
|
||||
+ GDestroyNotify destroy_notify)
|
||||
{
|
||||
FpDevicePrivate *priv = fp_device_get_instance_private (device);
|
||||
FpDeviceTimeoutSource *source;
|
||||
@@ -1497,7 +1499,7 @@ fpi_device_add_timeout (FpDevice *device,
|
||||
source->user_data = user_data;
|
||||
|
||||
g_source_attach (&source->source, NULL);
|
||||
- g_source_set_callback (&source->source, (GSourceFunc) func, user_data, NULL);
|
||||
+ g_source_set_callback (&source->source, (GSourceFunc) func, user_data, destroy_notify);
|
||||
g_source_set_ready_time (&source->source,
|
||||
g_source_get_time (&source->source) + interval * (guint64) 1000);
|
||||
priv->sources = g_slist_prepend (priv->sources, source);
|
||||
diff --git a/libfprint/fpi-device.h b/libfprint/fpi-device.h
|
||||
index d83a5a3..2333ae2 100644
|
||||
--- a/libfprint/fpi-device.h
|
||||
+++ b/libfprint/fpi-device.h
|
||||
@@ -203,11 +203,11 @@ void fpi_device_get_delete_data (FpDevice *device,
|
||||
GCancellable *fpi_device_get_cancellable (FpDevice *device);
|
||||
|
||||
|
||||
-
|
||||
-GSource * fpi_device_add_timeout (FpDevice *device,
|
||||
- gint interval,
|
||||
- FpTimeoutFunc func,
|
||||
- gpointer user_data);
|
||||
+GSource * fpi_device_add_timeout (FpDevice *device,
|
||||
+ gint interval,
|
||||
+ FpTimeoutFunc func,
|
||||
+ gpointer user_data,
|
||||
+ GDestroyNotify destroy_notify);
|
||||
|
||||
void fpi_device_set_nr_enroll_stages (FpDevice *device,
|
||||
gint enroll_stages);
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,227 +0,0 @@
|
||||
From d35cadd5fd81067bfc5bf6f5595b98d4227ad190 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Fri, 22 Nov 2019 17:19:27 +0100
|
||||
Subject: [PATCH 058/181] fpi-ssm: Add possibility to jump to a state (or next
|
||||
one) with delay
|
||||
|
||||
This allows to have an automatic cleanup of the timeout source when the
|
||||
the callback is reached and to avoid to do further state changes in the
|
||||
middle.
|
||||
---
|
||||
doc/libfprint-sections.txt | 3 +
|
||||
libfprint/fpi-ssm.c | 118 +++++++++++++++++++++++++++++++++++++
|
||||
libfprint/fpi-ssm.h | 6 ++
|
||||
3 files changed, 127 insertions(+)
|
||||
|
||||
diff --git a/doc/libfprint-sections.txt b/doc/libfprint-sections.txt
|
||||
index 0abe584..9fb01bd 100644
|
||||
--- a/doc/libfprint-sections.txt
|
||||
+++ b/doc/libfprint-sections.txt
|
||||
@@ -215,7 +215,10 @@ fpi_ssm_free
|
||||
fpi_ssm_start
|
||||
fpi_ssm_start_subsm
|
||||
fpi_ssm_next_state
|
||||
+fpi_ssm_next_state_delayed
|
||||
fpi_ssm_jump_to_state
|
||||
+fpi_ssm_jump_to_state_delayed
|
||||
+fpi_ssm_cancel_delayed_state_change
|
||||
fpi_ssm_mark_completed
|
||||
fpi_ssm_mark_failed
|
||||
fpi_ssm_set_data
|
||||
diff --git a/libfprint/fpi-ssm.c b/libfprint/fpi-ssm.c
|
||||
index 5299e2d..38186d2 100644
|
||||
--- a/libfprint/fpi-ssm.c
|
||||
+++ b/libfprint/fpi-ssm.c
|
||||
@@ -87,6 +87,7 @@ struct _FpiSsm
|
||||
int nr_states;
|
||||
int cur_state;
|
||||
gboolean completed;
|
||||
+ GSource *timeout;
|
||||
GError *error;
|
||||
FpiSsmCompletedCallback callback;
|
||||
FpiSsmHandlerCallback handler;
|
||||
@@ -170,6 +171,7 @@ fpi_ssm_free (FpiSsm *machine)
|
||||
if (machine->ssm_data_destroy)
|
||||
g_clear_pointer (&machine->ssm_data, machine->ssm_data_destroy);
|
||||
g_clear_pointer (&machine->error, g_error_free);
|
||||
+ g_clear_pointer (&machine->timeout, g_source_destroy);
|
||||
g_free (machine);
|
||||
}
|
||||
|
||||
@@ -231,7 +233,9 @@ __subsm_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
|
||||
void
|
||||
fpi_ssm_start_subsm (FpiSsm *parent, FpiSsm *child)
|
||||
{
|
||||
+ BUG_ON (parent->timeout);
|
||||
child->parentsm = parent;
|
||||
+ g_clear_pointer (&parent->timeout, g_source_destroy);
|
||||
fpi_ssm_start (child, __subsm_complete);
|
||||
}
|
||||
|
||||
@@ -246,7 +250,12 @@ void
|
||||
fpi_ssm_mark_completed (FpiSsm *machine)
|
||||
{
|
||||
BUG_ON (machine->completed);
|
||||
+ BUG_ON (machine->timeout);
|
||||
+ BUG_ON (machine->timeout != NULL);
|
||||
+
|
||||
+ g_clear_pointer (&machine->timeout, g_source_destroy);
|
||||
machine->completed = TRUE;
|
||||
+
|
||||
if (machine->error)
|
||||
fp_dbg ("%p completed with error: %s", machine, machine->error->message);
|
||||
else
|
||||
@@ -297,6 +306,10 @@ fpi_ssm_next_state (FpiSsm *machine)
|
||||
g_return_if_fail (machine != NULL);
|
||||
|
||||
BUG_ON (machine->completed);
|
||||
+ BUG_ON (machine->timeout != NULL);
|
||||
+
|
||||
+ g_clear_pointer (&machine->timeout, g_source_destroy);
|
||||
+
|
||||
machine->cur_state++;
|
||||
if (machine->cur_state == machine->nr_states)
|
||||
fpi_ssm_mark_completed (machine);
|
||||
@@ -304,6 +317,56 @@ fpi_ssm_next_state (FpiSsm *machine)
|
||||
__ssm_call_handler (machine);
|
||||
}
|
||||
|
||||
+void
|
||||
+fpi_ssm_cancel_delayed_state_change (FpiSsm *machine)
|
||||
+{
|
||||
+ g_return_if_fail (machine);
|
||||
+ BUG_ON (machine->completed);
|
||||
+ BUG_ON (machine->timeout == NULL);
|
||||
+
|
||||
+ g_clear_pointer (&machine->timeout, g_source_destroy);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+on_device_timeout_next_state (FpDevice *dev,
|
||||
+ gpointer user_data)
|
||||
+{
|
||||
+ FpiSsm *machine = user_data;
|
||||
+
|
||||
+ machine->timeout = NULL;
|
||||
+ fpi_ssm_next_state (machine);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * fpi_ssm_next_state_delayed:
|
||||
+ * @machine: an #FpiSsm state machine
|
||||
+ * @delay: the milliseconds to wait before switching to the next state
|
||||
+ *
|
||||
+ * Iterate to next state of a state machine with a delay of @delay ms. If the
|
||||
+ * current state is the last state, then the state machine will be marked as
|
||||
+ * completed, as if calling fpi_ssm_mark_completed().
|
||||
+ */
|
||||
+void
|
||||
+fpi_ssm_next_state_delayed (FpiSsm *machine,
|
||||
+ int delay)
|
||||
+{
|
||||
+ g_autofree char *source_name = NULL;
|
||||
+
|
||||
+ g_return_if_fail (machine != NULL);
|
||||
+ BUG_ON (machine->completed);
|
||||
+ BUG_ON (machine->timeout != NULL);
|
||||
+
|
||||
+ g_clear_pointer (&machine->timeout, g_source_destroy);
|
||||
+ machine->timeout = fpi_device_add_timeout (machine->dev, delay,
|
||||
+ on_device_timeout_next_state,
|
||||
+ machine);
|
||||
+
|
||||
+ source_name = g_strdup_printf ("[%s] ssm %p jump to next state %d",
|
||||
+ fp_device_get_device_id (machine->dev),
|
||||
+ machine, machine->cur_state + 1);
|
||||
+ g_source_set_name (machine->timeout, source_name);
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* fpi_ssm_jump_to_state:
|
||||
* @machine: an #FpiSsm state machine
|
||||
@@ -318,10 +381,65 @@ fpi_ssm_jump_to_state (FpiSsm *machine, int state)
|
||||
{
|
||||
BUG_ON (machine->completed);
|
||||
BUG_ON (state < 0 || state >= machine->nr_states);
|
||||
+ BUG_ON (machine->timeout != NULL);
|
||||
+
|
||||
+ g_clear_pointer (&machine->timeout, g_source_destroy);
|
||||
machine->cur_state = state;
|
||||
__ssm_call_handler (machine);
|
||||
}
|
||||
|
||||
+typedef struct
|
||||
+{
|
||||
+ FpiSsm *machine;
|
||||
+ int next_state;
|
||||
+} FpiSsmJumpToStateDelayedData;
|
||||
+
|
||||
+static void
|
||||
+on_device_timeout_jump_to_state (FpDevice *dev,
|
||||
+ gpointer user_data)
|
||||
+{
|
||||
+ FpiSsmJumpToStateDelayedData *data = user_data;
|
||||
+
|
||||
+ data->machine->timeout = NULL;
|
||||
+ fpi_ssm_jump_to_state (data->machine, data->next_state);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * fpi_ssm_jump_to_state_delayed:
|
||||
+ * @machine: an #FpiSsm state machine
|
||||
+ * @state: the state to jump to
|
||||
+ * @delay: the milliseconds to wait before switching to @state state
|
||||
+ *
|
||||
+ * Jump to the @state state with a delay of @delay milliseconds, bypassing
|
||||
+ * intermediary states.
|
||||
+ */
|
||||
+void
|
||||
+fpi_ssm_jump_to_state_delayed (FpiSsm *machine,
|
||||
+ int state,
|
||||
+ int delay)
|
||||
+{
|
||||
+ FpiSsmJumpToStateDelayedData *data;
|
||||
+ g_autofree char *source_name = NULL;
|
||||
+
|
||||
+ g_return_if_fail (machine != NULL);
|
||||
+ BUG_ON (machine->completed);
|
||||
+ BUG_ON (machine->timeout != NULL);
|
||||
+
|
||||
+ data = g_new0 (FpiSsmJumpToStateDelayedData, 1);
|
||||
+ data->machine = machine;
|
||||
+ data->next_state = state;
|
||||
+
|
||||
+ g_clear_pointer (&machine->timeout, g_source_destroy);
|
||||
+ machine->timeout = fpi_device_add_timeout_full (machine->dev, delay,
|
||||
+ on_device_timeout_jump_to_state,
|
||||
+ data, g_free);
|
||||
+
|
||||
+ source_name = g_strdup_printf ("[%s] ssm %p jump to state %d",
|
||||
+ fp_device_get_device_id (machine->dev),
|
||||
+ machine, state);
|
||||
+ g_source_set_name (machine->timeout, source_name);
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* fpi_ssm_get_cur_state:
|
||||
* @machine: an #FpiSsm state machine
|
||||
diff --git a/libfprint/fpi-ssm.h b/libfprint/fpi-ssm.h
|
||||
index 57e7d10..05e6cf0 100644
|
||||
--- a/libfprint/fpi-ssm.h
|
||||
+++ b/libfprint/fpi-ssm.h
|
||||
@@ -73,6 +73,12 @@ void fpi_ssm_start_subsm (FpiSsm *parent,
|
||||
void fpi_ssm_next_state (FpiSsm *machine);
|
||||
void fpi_ssm_jump_to_state (FpiSsm *machine,
|
||||
int state);
|
||||
+void fpi_ssm_next_state_delayed (FpiSsm *machine,
|
||||
+ int delay);
|
||||
+void fpi_ssm_jump_to_state_delayed (FpiSsm *machine,
|
||||
+ int state,
|
||||
+ int delay);
|
||||
+void fpi_ssm_cancel_delayed_state_change (FpiSsm *machine);
|
||||
void fpi_ssm_mark_completed (FpiSsm *machine);
|
||||
void fpi_ssm_mark_failed (FpiSsm *machine,
|
||||
GError *error);
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,263 +0,0 @@
|
||||
From 4a98d79f9f4dc64d568b31f801f47cbbca3e5711 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Fri, 22 Nov 2019 18:22:50 +0100
|
||||
Subject: [PATCH 059/181] drivers: Use fpi_ssm_next_state_delayed instead of
|
||||
custom callbacks
|
||||
|
||||
As per this fpi_ssm_next_state_timeout_cb can be removed
|
||||
---
|
||||
libfprint/drivers/elan.c | 7 +------
|
||||
libfprint/drivers/vfs0050.c | 3 +--
|
||||
libfprint/drivers/vfs101.c | 24 +++++++-----------------
|
||||
libfprint/drivers/vfs301.c | 15 ++-------------
|
||||
libfprint/drivers/vfs5011.c | 5 +----
|
||||
libfprint/fpi-ssm.c | 30 ++++--------------------------
|
||||
libfprint/fpi-ssm.h | 2 --
|
||||
7 files changed, 16 insertions(+), 70 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/elan.c b/libfprint/drivers/elan.c
|
||||
index f9e8763..f622988 100644
|
||||
--- a/libfprint/drivers/elan.c
|
||||
+++ b/libfprint/drivers/elan.c
|
||||
@@ -749,15 +749,10 @@ calibrate_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
}
|
||||
else
|
||||
{
|
||||
- GSource *timeout;
|
||||
-
|
||||
if (self->calib_status == 0x00 &&
|
||||
self->last_read[0] == 0x01)
|
||||
self->calib_status = 0x01;
|
||||
- timeout = fpi_device_add_timeout (dev, 50,
|
||||
- fpi_ssm_next_state_timeout_cb,
|
||||
- ssm, NULL);
|
||||
- g_source_set_name (timeout, "calibrate_run_state");
|
||||
+ fpi_ssm_next_state_delayed (ssm, 50);
|
||||
}
|
||||
break;
|
||||
|
||||
diff --git a/libfprint/drivers/vfs0050.c b/libfprint/drivers/vfs0050.c
|
||||
index 6377639..af70db5 100644
|
||||
--- a/libfprint/drivers/vfs0050.c
|
||||
+++ b/libfprint/drivers/vfs0050.c
|
||||
@@ -618,8 +618,7 @@ activate_ssm (FpiSsm *ssm, FpDevice *dev)
|
||||
clear_data (self);
|
||||
|
||||
/* Wait for probable vdev->active changing */
|
||||
- fpi_device_add_timeout (dev, VFS_SSM_TIMEOUT,
|
||||
- fpi_ssm_next_state_timeout_cb, ssm, NULL);
|
||||
+ fpi_ssm_next_state_delayed (ssm, VFS_SSM_TIMEOUT);
|
||||
break;
|
||||
|
||||
case SSM_NEXT_RECEIVE:
|
||||
diff --git a/libfprint/drivers/vfs101.c b/libfprint/drivers/vfs101.c
|
||||
index 0df9b73..7020726 100644
|
||||
--- a/libfprint/drivers/vfs101.c
|
||||
+++ b/libfprint/drivers/vfs101.c
|
||||
@@ -369,16 +369,6 @@ async_load (FpiSsm *ssm,
|
||||
async_load_cb, NULL);
|
||||
}
|
||||
|
||||
-/* Submit asynchronous sleep */
|
||||
-static void
|
||||
-async_sleep (unsigned int msec,
|
||||
- FpiSsm *ssm,
|
||||
- FpImageDevice *dev)
|
||||
-{
|
||||
- fpi_device_add_timeout (FP_DEVICE (dev), msec,
|
||||
- fpi_ssm_next_state_timeout_cb, ssm, NULL);
|
||||
-}
|
||||
-
|
||||
/* Swap ssm states */
|
||||
enum {
|
||||
M_SWAP_SEND,
|
||||
@@ -795,7 +785,7 @@ m_loop_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
|
||||
case M_LOOP_0_SLEEP:
|
||||
/* Wait fingerprint scanning */
|
||||
- async_sleep (50, ssm, dev);
|
||||
+ fpi_ssm_next_state_delayed (ssm, 50);
|
||||
break;
|
||||
|
||||
case M_LOOP_0_GET_STATE:
|
||||
@@ -838,7 +828,7 @@ m_loop_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
img_extract (ssm, dev);
|
||||
|
||||
/* Wait handling image */
|
||||
- async_sleep (10, ssm, dev);
|
||||
+ fpi_ssm_next_state_delayed (ssm, 10);
|
||||
break;
|
||||
|
||||
case M_LOOP_0_CHECK_ACTION:
|
||||
@@ -861,7 +851,7 @@ m_loop_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
if (vfs_finger_state (self) == VFS_FINGER_PRESENT)
|
||||
{
|
||||
fpi_image_device_report_finger_status (dev, TRUE);
|
||||
- async_sleep (250, ssm, dev);
|
||||
+ fpi_ssm_next_state_delayed (ssm, 250);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -891,7 +881,7 @@ m_loop_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
|
||||
case M_LOOP_1_SLEEP:
|
||||
/* Wait fingerprint scanning */
|
||||
- async_sleep (10, ssm, dev);
|
||||
+ fpi_ssm_next_state_delayed (ssm, 10);
|
||||
break;
|
||||
|
||||
case M_LOOP_2_ABORT_PRINT:
|
||||
@@ -927,7 +917,7 @@ m_loop_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
{
|
||||
/* Wait aborting */
|
||||
self->counter++;
|
||||
- async_sleep (100, ssm, dev);
|
||||
+ fpi_ssm_next_state_delayed (ssm, 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1065,7 +1055,7 @@ m_init_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
{
|
||||
/* Wait aborting */
|
||||
self->counter++;
|
||||
- async_sleep (100, ssm, dev);
|
||||
+ fpi_ssm_next_state_delayed (ssm, 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1094,7 +1084,7 @@ m_init_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
{
|
||||
/* Wait removing finger */
|
||||
self->counter++;
|
||||
- async_sleep (250, ssm, dev);
|
||||
+ fpi_ssm_next_state_delayed (ssm, 250);
|
||||
}
|
||||
else
|
||||
{
|
||||
diff --git a/libfprint/drivers/vfs301.c b/libfprint/drivers/vfs301.c
|
||||
index 1d0f066..3870879 100644
|
||||
--- a/libfprint/drivers/vfs301.c
|
||||
+++ b/libfprint/drivers/vfs301.c
|
||||
@@ -28,17 +28,6 @@ G_DEFINE_TYPE (FpDeviceVfs301, fpi_device_vfs301, FP_TYPE_IMAGE_DEVICE)
|
||||
|
||||
/************************** GENERIC STUFF *************************************/
|
||||
|
||||
-/* Submit asynchronous sleep */
|
||||
-static void
|
||||
-async_sleep (unsigned int msec,
|
||||
- FpiSsm *ssm,
|
||||
- FpImageDevice *dev)
|
||||
-{
|
||||
- /* Add timeout */
|
||||
- fpi_device_add_timeout (FP_DEVICE (dev), msec,
|
||||
- fpi_ssm_next_state_timeout_cb, ssm, NULL);
|
||||
-}
|
||||
-
|
||||
static int
|
||||
submit_image (FpiSsm *ssm,
|
||||
FpImageDevice *dev)
|
||||
@@ -108,7 +97,7 @@ m_loop_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
|
||||
case M_WAIT_PRINT:
|
||||
/* Wait fingerprint scanning */
|
||||
- async_sleep (200, ssm, dev);
|
||||
+ fpi_ssm_next_state_delayed (ssm, 200);
|
||||
break;
|
||||
|
||||
case M_CHECK_PRINT:
|
||||
@@ -126,7 +115,7 @@ m_loop_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
|
||||
case M_READ_PRINT_WAIT:
|
||||
/* Wait fingerprint scanning */
|
||||
- async_sleep (200, ssm, dev);
|
||||
+ fpi_ssm_next_state_delayed (ssm, 200);
|
||||
break;
|
||||
|
||||
case M_READ_PRINT_POLL:
|
||||
diff --git a/libfprint/drivers/vfs5011.c b/libfprint/drivers/vfs5011.c
|
||||
index 4fac03c..b769e31 100644
|
||||
--- a/libfprint/drivers/vfs5011.c
|
||||
+++ b/libfprint/drivers/vfs5011.c
|
||||
@@ -704,10 +704,7 @@ activate_loop (FpiSsm *ssm, FpDevice *_dev)
|
||||
break;
|
||||
|
||||
case DEV_ACTIVATE_DATA_COMPLETE:
|
||||
- fpi_device_add_timeout (_dev, 1,
|
||||
- fpi_ssm_next_state_timeout_cb,
|
||||
- ssm, NULL);
|
||||
-
|
||||
+ fpi_ssm_next_state_delayed (ssm, 1);
|
||||
break;
|
||||
|
||||
case DEV_ACTIVATE_PREPARE_NEXT_CAPTURE:
|
||||
diff --git a/libfprint/fpi-ssm.c b/libfprint/fpi-ssm.c
|
||||
index 38186d2..931c8fe 100644
|
||||
--- a/libfprint/fpi-ssm.c
|
||||
+++ b/libfprint/fpi-ssm.c
|
||||
@@ -359,7 +359,7 @@ fpi_ssm_next_state_delayed (FpiSsm *machine,
|
||||
g_clear_pointer (&machine->timeout, g_source_destroy);
|
||||
machine->timeout = fpi_device_add_timeout (machine->dev, delay,
|
||||
on_device_timeout_next_state,
|
||||
- machine);
|
||||
+ machine, NULL);
|
||||
|
||||
source_name = g_strdup_printf ("[%s] ssm %p jump to next state %d",
|
||||
fp_device_get_device_id (machine->dev),
|
||||
@@ -430,9 +430,9 @@ fpi_ssm_jump_to_state_delayed (FpiSsm *machine,
|
||||
data->next_state = state;
|
||||
|
||||
g_clear_pointer (&machine->timeout, g_source_destroy);
|
||||
- machine->timeout = fpi_device_add_timeout_full (machine->dev, delay,
|
||||
- on_device_timeout_jump_to_state,
|
||||
- data, g_free);
|
||||
+ machine->timeout = fpi_device_add_timeout (machine->dev, delay,
|
||||
+ on_device_timeout_jump_to_state,
|
||||
+ data, g_free);
|
||||
|
||||
source_name = g_strdup_printf ("[%s] ssm %p jump to state %d",
|
||||
fp_device_get_device_id (machine->dev),
|
||||
@@ -486,28 +486,6 @@ fpi_ssm_dup_error (FpiSsm *machine)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-/**
|
||||
- * fpi_ssm_next_state_timeout_cb:
|
||||
- * @dev: a struct #fp_dev
|
||||
- * @data: a pointer to an #FpiSsm state machine
|
||||
- *
|
||||
- * Same as fpi_ssm_next_state(), but to be used as a callback
|
||||
- * for an fpi_device_add_timeout() callback, when the state
|
||||
- * change needs to happen after a timeout.
|
||||
- *
|
||||
- * Make sure to pass the #FpiSsm as the `ssm_data` argument
|
||||
- * for that fpi_device_add_timeout() call.
|
||||
- */
|
||||
-void
|
||||
-fpi_ssm_next_state_timeout_cb (FpDevice *dev,
|
||||
- void *data)
|
||||
-{
|
||||
- g_return_if_fail (dev != NULL);
|
||||
- g_return_if_fail (data != NULL);
|
||||
-
|
||||
- fpi_ssm_next_state (data);
|
||||
-}
|
||||
-
|
||||
/**
|
||||
* fpi_ssm_usb_transfer_cb:
|
||||
* @transfer: a #FpiUsbTransfer
|
||||
diff --git a/libfprint/fpi-ssm.h b/libfprint/fpi-ssm.h
|
||||
index 05e6cf0..b426fff 100644
|
||||
--- a/libfprint/fpi-ssm.h
|
||||
+++ b/libfprint/fpi-ssm.h
|
||||
@@ -93,8 +93,6 @@ int fpi_ssm_get_cur_state (FpiSsm *machine);
|
||||
/* Callbacks to be used by the driver instead of implementing their own
|
||||
* logic.
|
||||
*/
|
||||
-void fpi_ssm_next_state_timeout_cb (FpDevice *dev,
|
||||
- void *data);
|
||||
void fpi_ssm_usb_transfer_cb (FpiUsbTransfer *transfer,
|
||||
FpDevice *device,
|
||||
gpointer unused_data,
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,35 +0,0 @@
|
||||
From a2ca701133742744edafb09d5ea5245ca1d3b621 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Fri, 22 Nov 2019 18:25:59 +0100
|
||||
Subject: [PATCH 060/181] fpi-ssm: Clarify the ownership of error in
|
||||
fpi_ssm_mark_failed
|
||||
|
||||
---
|
||||
libfprint/fpi-ssm.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libfprint/fpi-ssm.c b/libfprint/fpi-ssm.c
|
||||
index 931c8fe..e2cb48a 100644
|
||||
--- a/libfprint/fpi-ssm.c
|
||||
+++ b/libfprint/fpi-ssm.c
|
||||
@@ -272,7 +272,7 @@ fpi_ssm_mark_completed (FpiSsm *machine)
|
||||
/**
|
||||
* fpi_ssm_mark_failed:
|
||||
* @machine: an #FpiSsm state machine
|
||||
- * @error: a #GError
|
||||
+ * @error: (transfer full): a #GError
|
||||
*
|
||||
* Mark a state machine as failed with @error as the error code, completing it.
|
||||
*/
|
||||
@@ -288,7 +288,7 @@ fpi_ssm_mark_failed (FpiSsm *machine, GError *error)
|
||||
}
|
||||
|
||||
fp_dbg ("SSM failed in state %d with error: %s", machine->cur_state, error->message);
|
||||
- machine->error = error;
|
||||
+ machine->error = g_steal_pointer (&error);
|
||||
fpi_ssm_mark_completed (machine);
|
||||
}
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,170 +0,0 @@
|
||||
From 651cc37ee0409af767447f626f6a90db50c016b0 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Fri, 22 Nov 2019 18:39:02 +0100
|
||||
Subject: [PATCH 061/181] drivers: Use SSM delayed actions when possible
|
||||
|
||||
---
|
||||
libfprint/drivers/uru4000.c | 72 ++++++++++++++-----------------------
|
||||
libfprint/drivers/vfs0050.c | 13 +------
|
||||
libfprint/fpi-ssm.c | 3 +-
|
||||
3 files changed, 29 insertions(+), 59 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/uru4000.c b/libfprint/drivers/uru4000.c
|
||||
index 1deadd3..e15f1ca 100644
|
||||
--- a/libfprint/drivers/uru4000.c
|
||||
+++ b/libfprint/drivers/uru4000.c
|
||||
@@ -829,26 +829,6 @@ enum rebootpwr_states {
|
||||
REBOOTPWR_NUM_STATES,
|
||||
};
|
||||
|
||||
-static void
|
||||
-rebootpwr_pause_cb (FpDevice *dev,
|
||||
- void *data)
|
||||
-{
|
||||
- FpiSsm *ssm = data;
|
||||
- FpiDeviceUru4000 *self = FPI_DEVICE_URU4000 (dev);
|
||||
-
|
||||
- if (!--self->rebootpwr_ctr)
|
||||
- {
|
||||
- fp_err ("could not reboot device power");
|
||||
- fpi_ssm_mark_failed (ssm,
|
||||
- fpi_device_error_new_msg (FP_DEVICE_ERROR,
|
||||
- "Could not reboot device"));
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- fpi_ssm_jump_to_state (ssm, REBOOTPWR_GET_HWSTAT);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
static void
|
||||
rebootpwr_run_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
{
|
||||
@@ -875,7 +855,17 @@ rebootpwr_run_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
break;
|
||||
|
||||
case REBOOTPWR_PAUSE:
|
||||
- fpi_device_add_timeout (_dev, 10, rebootpwr_pause_cb, ssm, NULL);
|
||||
+ if (!--self->rebootpwr_ctr)
|
||||
+ {
|
||||
+ fp_err ("could not reboot device power");
|
||||
+ fpi_ssm_mark_failed (ssm,
|
||||
+ fpi_device_error_new_msg (FP_DEVICE_ERROR,
|
||||
+ "Could not reboot device"));
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ fpi_ssm_jump_to_state_delayed (ssm, 10, REBOOTPWR_GET_HWSTAT);
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -916,30 +906,6 @@ enum powerup_states {
|
||||
POWERUP_NUM_STATES,
|
||||
};
|
||||
|
||||
-static void
|
||||
-powerup_pause_cb (FpDevice *dev,
|
||||
- void *data)
|
||||
-{
|
||||
- FpiSsm *ssm = data;
|
||||
- FpiDeviceUru4000 *self = FPI_DEVICE_URU4000 (dev);
|
||||
-
|
||||
- if (!--self->powerup_ctr)
|
||||
- {
|
||||
- fp_err ("could not power device up");
|
||||
- fpi_ssm_mark_failed (ssm,
|
||||
- fpi_device_error_new_msg (FP_DEVICE_ERROR_GENERAL,
|
||||
- "could not power device up"));
|
||||
- }
|
||||
- else if (!self->profile->auth_cr)
|
||||
- {
|
||||
- fpi_ssm_jump_to_state (ssm, POWERUP_SET_HWSTAT);
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- fpi_ssm_next_state (ssm);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
static void
|
||||
powerup_run_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
{
|
||||
@@ -971,7 +937,21 @@ powerup_run_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
break;
|
||||
|
||||
case POWERUP_PAUSE:
|
||||
- fpi_device_add_timeout (_dev, 10, powerup_pause_cb, ssm, NULL);
|
||||
+ if (!--self->powerup_ctr)
|
||||
+ {
|
||||
+ fp_err ("could not power device up");
|
||||
+ fpi_ssm_mark_failed (ssm,
|
||||
+ fpi_device_error_new_msg (FP_DEVICE_ERROR_GENERAL,
|
||||
+ "could not power device up"));
|
||||
+ }
|
||||
+ else if (!self->profile->auth_cr)
|
||||
+ {
|
||||
+ fpi_ssm_jump_to_state_delayed (ssm, POWERUP_SET_HWSTAT, 10);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ fpi_ssm_next_state_delayed (ssm, 10);
|
||||
+ }
|
||||
break;
|
||||
|
||||
case POWERUP_CHALLENGE_RESPONSE:
|
||||
diff --git a/libfprint/drivers/vfs0050.c b/libfprint/drivers/vfs0050.c
|
||||
index af70db5..22e9ae9 100644
|
||||
--- a/libfprint/drivers/vfs0050.c
|
||||
+++ b/libfprint/drivers/vfs0050.c
|
||||
@@ -479,16 +479,6 @@ receive_callback (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
}
|
||||
}
|
||||
|
||||
-/* SSM stub to prepare device to another scan after orange light was on */
|
||||
-static void
|
||||
-another_scan (FpDevice *dev,
|
||||
- void *data)
|
||||
-{
|
||||
- FpiSsm *ssm = data;
|
||||
-
|
||||
- fpi_ssm_jump_to_state (ssm, SSM_TURN_ON);
|
||||
-}
|
||||
-
|
||||
/* Main SSM loop */
|
||||
static void
|
||||
activate_ssm (FpiSsm *ssm, FpDevice *dev)
|
||||
@@ -637,8 +627,7 @@ activate_ssm (FpiSsm *ssm, FpDevice *dev)
|
||||
|
||||
case SSM_WAIT_ANOTHER_SCAN:
|
||||
/* Orange light is on now */
|
||||
- fpi_device_add_timeout (dev, VFS_SSM_ORANGE_TIMEOUT,
|
||||
- another_scan, ssm, NULL);
|
||||
+ fpi_ssm_jump_to_state_delayed (ssm, SSM_TURN_ON, VFS_SSM_ORANGE_TIMEOUT);
|
||||
break;
|
||||
|
||||
default:
|
||||
diff --git a/libfprint/fpi-ssm.c b/libfprint/fpi-ssm.c
|
||||
index e2cb48a..19712ef 100644
|
||||
--- a/libfprint/fpi-ssm.c
|
||||
+++ b/libfprint/fpi-ssm.c
|
||||
@@ -168,6 +168,8 @@ fpi_ssm_free (FpiSsm *machine)
|
||||
if (!machine)
|
||||
return;
|
||||
|
||||
+ BUG_ON (machine->timeout != NULL);
|
||||
+
|
||||
if (machine->ssm_data_destroy)
|
||||
g_clear_pointer (&machine->ssm_data, machine->ssm_data_destroy);
|
||||
g_clear_pointer (&machine->error, g_error_free);
|
||||
@@ -250,7 +252,6 @@ void
|
||||
fpi_ssm_mark_completed (FpiSsm *machine)
|
||||
{
|
||||
BUG_ON (machine->completed);
|
||||
- BUG_ON (machine->timeout);
|
||||
BUG_ON (machine->timeout != NULL);
|
||||
|
||||
g_clear_pointer (&machine->timeout, g_source_destroy);
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,424 +0,0 @@
|
||||
From 37a007317e5de27eb68a667bace42961c5c73b33 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Thu, 28 Nov 2019 19:24:55 +0100
|
||||
Subject: [PATCH 062/181] fpi-ssm: Make delayed actions cancellable
|
||||
|
||||
Add a GCancellable parameter to fpi_ssm_nex_state_delayed and
|
||||
fpi_ssm_jump_to_state_delayed() so that it's possible to cancel an action
|
||||
from the caller and in case the driver wants to cancel a delayed operation
|
||||
when a device action has been cancelled.
|
||||
---
|
||||
libfprint/drivers/elan.c | 2 +-
|
||||
libfprint/drivers/uru4000.c | 6 +-
|
||||
libfprint/drivers/vfs0050.c | 5 +-
|
||||
libfprint/drivers/vfs101.c | 14 ++--
|
||||
libfprint/drivers/vfs301.c | 4 +-
|
||||
libfprint/drivers/vfs5011.c | 2 +-
|
||||
libfprint/fpi-ssm.c | 123 ++++++++++++++++++++++++++++++------
|
||||
libfprint/fpi-ssm.h | 12 ++--
|
||||
8 files changed, 127 insertions(+), 41 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/elan.c b/libfprint/drivers/elan.c
|
||||
index f622988..7c7fb26 100644
|
||||
--- a/libfprint/drivers/elan.c
|
||||
+++ b/libfprint/drivers/elan.c
|
||||
@@ -752,7 +752,7 @@ calibrate_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
if (self->calib_status == 0x00 &&
|
||||
self->last_read[0] == 0x01)
|
||||
self->calib_status = 0x01;
|
||||
- fpi_ssm_next_state_delayed (ssm, 50);
|
||||
+ fpi_ssm_next_state_delayed (ssm, 50, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
diff --git a/libfprint/drivers/uru4000.c b/libfprint/drivers/uru4000.c
|
||||
index e15f1ca..122544d 100644
|
||||
--- a/libfprint/drivers/uru4000.c
|
||||
+++ b/libfprint/drivers/uru4000.c
|
||||
@@ -864,7 +864,7 @@ rebootpwr_run_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
}
|
||||
else
|
||||
{
|
||||
- fpi_ssm_jump_to_state_delayed (ssm, 10, REBOOTPWR_GET_HWSTAT);
|
||||
+ fpi_ssm_jump_to_state_delayed (ssm, 10, REBOOTPWR_GET_HWSTAT, NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -946,11 +946,11 @@ powerup_run_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
}
|
||||
else if (!self->profile->auth_cr)
|
||||
{
|
||||
- fpi_ssm_jump_to_state_delayed (ssm, POWERUP_SET_HWSTAT, 10);
|
||||
+ fpi_ssm_jump_to_state_delayed (ssm, POWERUP_SET_HWSTAT, 10, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
- fpi_ssm_next_state_delayed (ssm, 10);
|
||||
+ fpi_ssm_next_state_delayed (ssm, 10, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
diff --git a/libfprint/drivers/vfs0050.c b/libfprint/drivers/vfs0050.c
|
||||
index 22e9ae9..9b99dc3 100644
|
||||
--- a/libfprint/drivers/vfs0050.c
|
||||
+++ b/libfprint/drivers/vfs0050.c
|
||||
@@ -608,7 +608,7 @@ activate_ssm (FpiSsm *ssm, FpDevice *dev)
|
||||
clear_data (self);
|
||||
|
||||
/* Wait for probable vdev->active changing */
|
||||
- fpi_ssm_next_state_delayed (ssm, VFS_SSM_TIMEOUT);
|
||||
+ fpi_ssm_next_state_delayed (ssm, VFS_SSM_TIMEOUT, NULL);
|
||||
break;
|
||||
|
||||
case SSM_NEXT_RECEIVE:
|
||||
@@ -627,7 +627,8 @@ activate_ssm (FpiSsm *ssm, FpDevice *dev)
|
||||
|
||||
case SSM_WAIT_ANOTHER_SCAN:
|
||||
/* Orange light is on now */
|
||||
- fpi_ssm_jump_to_state_delayed (ssm, SSM_TURN_ON, VFS_SSM_ORANGE_TIMEOUT);
|
||||
+ fpi_ssm_jump_to_state_delayed (ssm, SSM_TURN_ON, VFS_SSM_ORANGE_TIMEOUT,
|
||||
+ NULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
diff --git a/libfprint/drivers/vfs101.c b/libfprint/drivers/vfs101.c
|
||||
index 7020726..ccce7db 100644
|
||||
--- a/libfprint/drivers/vfs101.c
|
||||
+++ b/libfprint/drivers/vfs101.c
|
||||
@@ -785,7 +785,7 @@ m_loop_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
|
||||
case M_LOOP_0_SLEEP:
|
||||
/* Wait fingerprint scanning */
|
||||
- fpi_ssm_next_state_delayed (ssm, 50);
|
||||
+ fpi_ssm_next_state_delayed (ssm, 50, NULL);
|
||||
break;
|
||||
|
||||
case M_LOOP_0_GET_STATE:
|
||||
@@ -828,7 +828,7 @@ m_loop_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
img_extract (ssm, dev);
|
||||
|
||||
/* Wait handling image */
|
||||
- fpi_ssm_next_state_delayed (ssm, 10);
|
||||
+ fpi_ssm_next_state_delayed (ssm, 10, NULL);
|
||||
break;
|
||||
|
||||
case M_LOOP_0_CHECK_ACTION:
|
||||
@@ -851,7 +851,7 @@ m_loop_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
if (vfs_finger_state (self) == VFS_FINGER_PRESENT)
|
||||
{
|
||||
fpi_image_device_report_finger_status (dev, TRUE);
|
||||
- fpi_ssm_next_state_delayed (ssm, 250);
|
||||
+ fpi_ssm_next_state_delayed (ssm, 250, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -881,7 +881,7 @@ m_loop_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
|
||||
case M_LOOP_1_SLEEP:
|
||||
/* Wait fingerprint scanning */
|
||||
- fpi_ssm_next_state_delayed (ssm, 10);
|
||||
+ fpi_ssm_next_state_delayed (ssm, 10, NULL);
|
||||
break;
|
||||
|
||||
case M_LOOP_2_ABORT_PRINT:
|
||||
@@ -917,7 +917,7 @@ m_loop_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
{
|
||||
/* Wait aborting */
|
||||
self->counter++;
|
||||
- fpi_ssm_next_state_delayed (ssm, 100);
|
||||
+ fpi_ssm_next_state_delayed (ssm, 100, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1055,7 +1055,7 @@ m_init_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
{
|
||||
/* Wait aborting */
|
||||
self->counter++;
|
||||
- fpi_ssm_next_state_delayed (ssm, 100);
|
||||
+ fpi_ssm_next_state_delayed (ssm, 100, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1084,7 +1084,7 @@ m_init_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
{
|
||||
/* Wait removing finger */
|
||||
self->counter++;
|
||||
- fpi_ssm_next_state_delayed (ssm, 250);
|
||||
+ fpi_ssm_next_state_delayed (ssm, 250, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
diff --git a/libfprint/drivers/vfs301.c b/libfprint/drivers/vfs301.c
|
||||
index 3870879..f912a36 100644
|
||||
--- a/libfprint/drivers/vfs301.c
|
||||
+++ b/libfprint/drivers/vfs301.c
|
||||
@@ -97,7 +97,7 @@ m_loop_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
|
||||
case M_WAIT_PRINT:
|
||||
/* Wait fingerprint scanning */
|
||||
- fpi_ssm_next_state_delayed (ssm, 200);
|
||||
+ fpi_ssm_next_state_delayed (ssm, 200, NULL);
|
||||
break;
|
||||
|
||||
case M_CHECK_PRINT:
|
||||
@@ -115,7 +115,7 @@ m_loop_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
|
||||
case M_READ_PRINT_WAIT:
|
||||
/* Wait fingerprint scanning */
|
||||
- fpi_ssm_next_state_delayed (ssm, 200);
|
||||
+ fpi_ssm_next_state_delayed (ssm, 200, NULL);
|
||||
break;
|
||||
|
||||
case M_READ_PRINT_POLL:
|
||||
diff --git a/libfprint/drivers/vfs5011.c b/libfprint/drivers/vfs5011.c
|
||||
index b769e31..ef318f2 100644
|
||||
--- a/libfprint/drivers/vfs5011.c
|
||||
+++ b/libfprint/drivers/vfs5011.c
|
||||
@@ -704,7 +704,7 @@ activate_loop (FpiSsm *ssm, FpDevice *_dev)
|
||||
break;
|
||||
|
||||
case DEV_ACTIVATE_DATA_COMPLETE:
|
||||
- fpi_ssm_next_state_delayed (ssm, 1);
|
||||
+ fpi_ssm_next_state_delayed (ssm, 1, NULL);
|
||||
break;
|
||||
|
||||
case DEV_ACTIVATE_PREPARE_NEXT_CAPTURE:
|
||||
diff --git a/libfprint/fpi-ssm.c b/libfprint/fpi-ssm.c
|
||||
index 19712ef..0f54b1d 100644
|
||||
--- a/libfprint/fpi-ssm.c
|
||||
+++ b/libfprint/fpi-ssm.c
|
||||
@@ -88,6 +88,8 @@ struct _FpiSsm
|
||||
int cur_state;
|
||||
gboolean completed;
|
||||
GSource *timeout;
|
||||
+ GCancellable *cancellable;
|
||||
+ gulong cancellable_id;
|
||||
GError *error;
|
||||
FpiSsmCompletedCallback callback;
|
||||
FpiSsmHandlerCallback handler;
|
||||
@@ -155,6 +157,81 @@ fpi_ssm_get_data (FpiSsm *machine)
|
||||
return machine->ssm_data;
|
||||
}
|
||||
|
||||
+static void
|
||||
+fpi_ssm_clear_delayed_action (FpiSsm *machine)
|
||||
+{
|
||||
+ if (machine->cancellable_id)
|
||||
+ {
|
||||
+ g_cancellable_disconnect (machine->cancellable, machine->cancellable_id);
|
||||
+ machine->cancellable_id = 0;
|
||||
+ }
|
||||
+
|
||||
+ g_clear_object (&machine->cancellable);
|
||||
+ g_clear_pointer (&machine->timeout, g_source_destroy);
|
||||
+}
|
||||
+
|
||||
+typedef struct _CancelledActionIdleData
|
||||
+{
|
||||
+ gulong cancellable_id;
|
||||
+ GCancellable *cancellable;
|
||||
+} CancelledActionIdleData;
|
||||
+
|
||||
+static gboolean
|
||||
+on_delayed_action_cancelled_idle (gpointer user_data)
|
||||
+{
|
||||
+ CancelledActionIdleData *data = user_data;
|
||||
+
|
||||
+ g_cancellable_disconnect (data->cancellable, data->cancellable_id);
|
||||
+ g_object_unref (data->cancellable);
|
||||
+ g_free (data);
|
||||
+
|
||||
+ return G_SOURCE_REMOVE;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+on_delayed_action_cancelled (GCancellable *cancellable,
|
||||
+ FpiSsm *machine)
|
||||
+{
|
||||
+ CancelledActionIdleData *data;
|
||||
+
|
||||
+ g_clear_pointer (&machine->timeout, g_source_destroy);
|
||||
+
|
||||
+ data = g_new0 (CancelledActionIdleData, 1);
|
||||
+ data->cancellable = g_steal_pointer (&machine->cancellable);
|
||||
+ data->cancellable_id = machine->cancellable_id;
|
||||
+ machine->cancellable_id = 0;
|
||||
+
|
||||
+ g_idle_add_full (G_PRIORITY_HIGH_IDLE, on_delayed_action_cancelled_idle,
|
||||
+ data, NULL);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+fpi_ssm_set_delayed_action_timeout (FpiSsm *machine,
|
||||
+ int delay,
|
||||
+ FpTimeoutFunc callback,
|
||||
+ GCancellable *cancellable,
|
||||
+ gpointer user_data,
|
||||
+ GDestroyNotify destroy_func)
|
||||
+{
|
||||
+ BUG_ON (machine->completed);
|
||||
+ BUG_ON (machine->timeout != NULL);
|
||||
+
|
||||
+ fpi_ssm_clear_delayed_action (machine);
|
||||
+
|
||||
+ if (cancellable != NULL)
|
||||
+ {
|
||||
+ g_set_object (&machine->cancellable, cancellable);
|
||||
+
|
||||
+ machine->cancellable_id =
|
||||
+ g_cancellable_connect (machine->cancellable,
|
||||
+ G_CALLBACK (on_delayed_action_cancelled),
|
||||
+ machine, NULL);
|
||||
+ }
|
||||
+
|
||||
+ machine->timeout = fpi_device_add_timeout (machine->dev, delay, callback,
|
||||
+ user_data, destroy_func);
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* fpi_ssm_free:
|
||||
* @machine: an #FpiSsm state machine
|
||||
@@ -173,7 +250,7 @@ fpi_ssm_free (FpiSsm *machine)
|
||||
if (machine->ssm_data_destroy)
|
||||
g_clear_pointer (&machine->ssm_data, machine->ssm_data_destroy);
|
||||
g_clear_pointer (&machine->error, g_error_free);
|
||||
- g_clear_pointer (&machine->timeout, g_source_destroy);
|
||||
+ fpi_ssm_clear_delayed_action (machine);
|
||||
g_free (machine);
|
||||
}
|
||||
|
||||
@@ -254,7 +331,8 @@ fpi_ssm_mark_completed (FpiSsm *machine)
|
||||
BUG_ON (machine->completed);
|
||||
BUG_ON (machine->timeout != NULL);
|
||||
|
||||
- g_clear_pointer (&machine->timeout, g_source_destroy);
|
||||
+ fpi_ssm_clear_delayed_action (machine);
|
||||
+
|
||||
machine->completed = TRUE;
|
||||
|
||||
if (machine->error)
|
||||
@@ -309,7 +387,7 @@ fpi_ssm_next_state (FpiSsm *machine)
|
||||
BUG_ON (machine->completed);
|
||||
BUG_ON (machine->timeout != NULL);
|
||||
|
||||
- g_clear_pointer (&machine->timeout, g_source_destroy);
|
||||
+ fpi_ssm_clear_delayed_action (machine);
|
||||
|
||||
machine->cur_state++;
|
||||
if (machine->cur_state == machine->nr_states)
|
||||
@@ -325,7 +403,7 @@ fpi_ssm_cancel_delayed_state_change (FpiSsm *machine)
|
||||
BUG_ON (machine->completed);
|
||||
BUG_ON (machine->timeout == NULL);
|
||||
|
||||
- g_clear_pointer (&machine->timeout, g_source_destroy);
|
||||
+ fpi_ssm_clear_delayed_action (machine);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -342,25 +420,26 @@ on_device_timeout_next_state (FpDevice *dev,
|
||||
* fpi_ssm_next_state_delayed:
|
||||
* @machine: an #FpiSsm state machine
|
||||
* @delay: the milliseconds to wait before switching to the next state
|
||||
+ * @cancellable: (nullable): a #GCancellable to cancel the delayed operation
|
||||
*
|
||||
* Iterate to next state of a state machine with a delay of @delay ms. If the
|
||||
* current state is the last state, then the state machine will be marked as
|
||||
* completed, as if calling fpi_ssm_mark_completed().
|
||||
+ * Passing a valid #GCancellable will cause the action to be cancelled when
|
||||
+ * @cancellable is.
|
||||
*/
|
||||
void
|
||||
-fpi_ssm_next_state_delayed (FpiSsm *machine,
|
||||
- int delay)
|
||||
+fpi_ssm_next_state_delayed (FpiSsm *machine,
|
||||
+ int delay,
|
||||
+ GCancellable *cancellable)
|
||||
{
|
||||
g_autofree char *source_name = NULL;
|
||||
|
||||
g_return_if_fail (machine != NULL);
|
||||
- BUG_ON (machine->completed);
|
||||
- BUG_ON (machine->timeout != NULL);
|
||||
|
||||
- g_clear_pointer (&machine->timeout, g_source_destroy);
|
||||
- machine->timeout = fpi_device_add_timeout (machine->dev, delay,
|
||||
- on_device_timeout_next_state,
|
||||
- machine, NULL);
|
||||
+ fpi_ssm_set_delayed_action_timeout (machine, delay,
|
||||
+ on_device_timeout_next_state, cancellable,
|
||||
+ machine, NULL);
|
||||
|
||||
source_name = g_strdup_printf ("[%s] ssm %p jump to next state %d",
|
||||
fp_device_get_device_id (machine->dev),
|
||||
@@ -384,7 +463,8 @@ fpi_ssm_jump_to_state (FpiSsm *machine, int state)
|
||||
BUG_ON (state < 0 || state >= machine->nr_states);
|
||||
BUG_ON (machine->timeout != NULL);
|
||||
|
||||
- g_clear_pointer (&machine->timeout, g_source_destroy);
|
||||
+ fpi_ssm_clear_delayed_action (machine);
|
||||
+
|
||||
machine->cur_state = state;
|
||||
__ssm_call_handler (machine);
|
||||
}
|
||||
@@ -410,14 +490,18 @@ on_device_timeout_jump_to_state (FpDevice *dev,
|
||||
* @machine: an #FpiSsm state machine
|
||||
* @state: the state to jump to
|
||||
* @delay: the milliseconds to wait before switching to @state state
|
||||
+ * @cancellable: (nullable): a #GCancellable to cancel the delayed operation
|
||||
*
|
||||
* Jump to the @state state with a delay of @delay milliseconds, bypassing
|
||||
* intermediary states.
|
||||
+ * Passing a valid #GCancellable will cause the action to be cancelled when
|
||||
+ * @cancellable is.
|
||||
*/
|
||||
void
|
||||
-fpi_ssm_jump_to_state_delayed (FpiSsm *machine,
|
||||
- int state,
|
||||
- int delay)
|
||||
+fpi_ssm_jump_to_state_delayed (FpiSsm *machine,
|
||||
+ int state,
|
||||
+ int delay,
|
||||
+ GCancellable *cancellable)
|
||||
{
|
||||
FpiSsmJumpToStateDelayedData *data;
|
||||
g_autofree char *source_name = NULL;
|
||||
@@ -430,10 +514,9 @@ fpi_ssm_jump_to_state_delayed (FpiSsm *machine,
|
||||
data->machine = machine;
|
||||
data->next_state = state;
|
||||
|
||||
- g_clear_pointer (&machine->timeout, g_source_destroy);
|
||||
- machine->timeout = fpi_device_add_timeout (machine->dev, delay,
|
||||
- on_device_timeout_jump_to_state,
|
||||
- data, g_free);
|
||||
+ fpi_ssm_set_delayed_action_timeout (machine, delay,
|
||||
+ on_device_timeout_jump_to_state,
|
||||
+ cancellable, data, g_free);
|
||||
|
||||
source_name = g_strdup_printf ("[%s] ssm %p jump to state %d",
|
||||
fp_device_get_device_id (machine->dev),
|
||||
diff --git a/libfprint/fpi-ssm.h b/libfprint/fpi-ssm.h
|
||||
index b426fff..8dff27d 100644
|
||||
--- a/libfprint/fpi-ssm.h
|
||||
+++ b/libfprint/fpi-ssm.h
|
||||
@@ -73,11 +73,13 @@ void fpi_ssm_start_subsm (FpiSsm *parent,
|
||||
void fpi_ssm_next_state (FpiSsm *machine);
|
||||
void fpi_ssm_jump_to_state (FpiSsm *machine,
|
||||
int state);
|
||||
-void fpi_ssm_next_state_delayed (FpiSsm *machine,
|
||||
- int delay);
|
||||
-void fpi_ssm_jump_to_state_delayed (FpiSsm *machine,
|
||||
- int state,
|
||||
- int delay);
|
||||
+void fpi_ssm_next_state_delayed (FpiSsm *machine,
|
||||
+ int delay,
|
||||
+ GCancellable *cancellable);
|
||||
+void fpi_ssm_jump_to_state_delayed (FpiSsm *machine,
|
||||
+ int state,
|
||||
+ int delay,
|
||||
+ GCancellable *cancellable);
|
||||
void fpi_ssm_cancel_delayed_state_change (FpiSsm *machine);
|
||||
void fpi_ssm_mark_completed (FpiSsm *machine);
|
||||
void fpi_ssm_mark_failed (FpiSsm *machine,
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,26 +0,0 @@
|
||||
From dac6c01df94333686d810a049dedfb32ee8b132b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Thu, 28 Nov 2019 20:15:21 +0100
|
||||
Subject: [PATCH 063/181] fpi-ssm: Bug on handler set to a NULL function
|
||||
|
||||
We would crash otherwise, while this is quite obvious there was no code
|
||||
enforcing this.
|
||||
---
|
||||
libfprint/fpi-ssm.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/libfprint/fpi-ssm.c b/libfprint/fpi-ssm.c
|
||||
index 0f54b1d..4498ce9 100644
|
||||
--- a/libfprint/fpi-ssm.c
|
||||
+++ b/libfprint/fpi-ssm.c
|
||||
@@ -114,6 +114,7 @@ fpi_ssm_new (FpDevice *dev,
|
||||
FpiSsm *machine;
|
||||
|
||||
BUG_ON (nr_states < 1);
|
||||
+ BUG_ON (handler == NULL);
|
||||
|
||||
machine = g_new0 (FpiSsm, 1);
|
||||
machine->handler = handler;
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,78 +0,0 @@
|
||||
From 370137b97f53cec46750d2c984a3861d306bcb9d Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Tue, 3 Dec 2019 17:22:20 +0100
|
||||
Subject: [PATCH 064/181] fpi-ssm: Mark a fpi-ssm completed on delay
|
||||
|
||||
---
|
||||
libfprint/fpi-ssm.c | 40 ++++++++++++++++++++++++++++++++++++++++
|
||||
libfprint/fpi-ssm.h | 3 +++
|
||||
2 files changed, 43 insertions(+)
|
||||
|
||||
diff --git a/libfprint/fpi-ssm.c b/libfprint/fpi-ssm.c
|
||||
index 4498ce9..09a31e3 100644
|
||||
--- a/libfprint/fpi-ssm.c
|
||||
+++ b/libfprint/fpi-ssm.c
|
||||
@@ -349,6 +349,46 @@ fpi_ssm_mark_completed (FpiSsm *machine)
|
||||
fpi_ssm_free (machine);
|
||||
}
|
||||
|
||||
+static void
|
||||
+on_device_timeout_complete (FpDevice *dev,
|
||||
+ gpointer user_data)
|
||||
+{
|
||||
+ FpiSsm *machine = user_data;
|
||||
+
|
||||
+ machine->timeout = NULL;
|
||||
+ fpi_ssm_mark_completed (machine);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * fpi_ssm_mark_completed_delayed:
|
||||
+ * @machine: an #FpiSsm state machine
|
||||
+ * @delay: the milliseconds to wait before switching to the next state
|
||||
+ * @cancellable: (nullable): a #GCancellable to cancel the delayed operation
|
||||
+ *
|
||||
+ * Mark a ssm as completed successfully with a delay of @delay ms.
|
||||
+ * The callback set when creating the state machine with fpi_ssm_new () will be
|
||||
+ * called when the timeout is over.
|
||||
+ * The request can be cancelled passing a #GCancellable as @cancellable.
|
||||
+ */
|
||||
+void
|
||||
+fpi_ssm_mark_completed_delayed (FpiSsm *machine,
|
||||
+ int delay,
|
||||
+ GCancellable *cancellable)
|
||||
+{
|
||||
+ g_autofree char *source_name = NULL;
|
||||
+
|
||||
+ g_return_if_fail (machine != NULL);
|
||||
+
|
||||
+ fpi_ssm_set_delayed_action_timeout (machine, delay,
|
||||
+ on_device_timeout_complete, cancellable,
|
||||
+ machine, NULL);
|
||||
+
|
||||
+ source_name = g_strdup_printf ("[%s] ssm %p complete %d",
|
||||
+ fp_device_get_device_id (machine->dev),
|
||||
+ machine, machine->cur_state + 1);
|
||||
+ g_source_set_name (machine->timeout, source_name);
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* fpi_ssm_mark_failed:
|
||||
* @machine: an #FpiSsm state machine
|
||||
diff --git a/libfprint/fpi-ssm.h b/libfprint/fpi-ssm.h
|
||||
index 8dff27d..3ef653e 100644
|
||||
--- a/libfprint/fpi-ssm.h
|
||||
+++ b/libfprint/fpi-ssm.h
|
||||
@@ -82,6 +82,9 @@ void fpi_ssm_jump_to_state_delayed (FpiSsm *machine,
|
||||
GCancellable *cancellable);
|
||||
void fpi_ssm_cancel_delayed_state_change (FpiSsm *machine);
|
||||
void fpi_ssm_mark_completed (FpiSsm *machine);
|
||||
+void fpi_ssm_mark_completed_delayed (FpiSsm *machine,
|
||||
+ int delay,
|
||||
+ GCancellable *cancellable);
|
||||
void fpi_ssm_mark_failed (FpiSsm *machine,
|
||||
GError *error);
|
||||
void fpi_ssm_set_data (FpiSsm *machine,
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,35 +0,0 @@
|
||||
From 1dc9e06987c3787c3e6177fd010e5b0d5eab2ad9 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Wed, 4 Dec 2019 13:21:11 +0100
|
||||
Subject: [PATCH 065/181] tests: Fix image writing on big endian
|
||||
|
||||
The code tried to only write the RGB bytes of FORMAT_RGB24, however, the
|
||||
in-memory layout is different on big-endian which would result in the
|
||||
wrong bytes being written.
|
||||
|
||||
Fix this by simply also writing the byte we do not care about.
|
||||
---
|
||||
tests/capture.py | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tests/capture.py b/tests/capture.py
|
||||
index 2ad9385..a7b7583 100755
|
||||
--- a/tests/capture.py
|
||||
+++ b/tests/capture.py
|
||||
@@ -36,10 +36,12 @@ c_buf = c_img.get_data()
|
||||
|
||||
for x in range(width):
|
||||
for y in range(height):
|
||||
+ # The upper byte is don't care, but the location depends on endianness,
|
||||
+ # so just set all of them.
|
||||
c_buf[y * c_rowstride + x * 4 + 0] = buf[y * width + x]
|
||||
c_buf[y * c_rowstride + x * 4 + 1] = buf[y * width + x]
|
||||
c_buf[y * c_rowstride + x * 4 + 2] = buf[y * width + x]
|
||||
- # Byte 4 is don't care
|
||||
+ c_buf[y * c_rowstride + x * 4 + 3] = buf[y * width + x]
|
||||
|
||||
c_img.mark_dirty()
|
||||
c_img.write_to_png(sys.argv[1])
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,64 +0,0 @@
|
||||
From 2af78ce8e06f513b96afb639a1406c116b77ecc2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Tue, 3 Dec 2019 19:34:58 +0100
|
||||
Subject: [PATCH 066/181] fpi-usb: Use unsigned length for USB async transfers
|
||||
|
||||
Properly follow function signature using a temporary gsize variable address
|
||||
to make the function use the same pointer type and avoid troubles at
|
||||
deferencing it, while use automatic-casting to switch to signed one if
|
||||
transfer succeeded.
|
||||
---
|
||||
libfprint/fpi-usb-transfer.c | 9 ++++++---
|
||||
1 file changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libfprint/fpi-usb-transfer.c b/libfprint/fpi-usb-transfer.c
|
||||
index 64d706f..08e75cb 100644
|
||||
--- a/libfprint/fpi-usb-transfer.c
|
||||
+++ b/libfprint/fpi-usb-transfer.c
|
||||
@@ -454,6 +454,7 @@ fpi_usb_transfer_submit_sync (FpiUsbTransfer *transfer,
|
||||
GError **error)
|
||||
{
|
||||
gboolean res;
|
||||
+ gsize actual_length;
|
||||
|
||||
g_return_val_if_fail (transfer, FALSE);
|
||||
|
||||
@@ -469,7 +470,7 @@ fpi_usb_transfer_submit_sync (FpiUsbTransfer *transfer,
|
||||
transfer->endpoint,
|
||||
transfer->buffer,
|
||||
transfer->length,
|
||||
- &transfer->actual_length,
|
||||
+ &actual_length,
|
||||
timeout_ms,
|
||||
NULL,
|
||||
error);
|
||||
@@ -485,7 +486,7 @@ fpi_usb_transfer_submit_sync (FpiUsbTransfer *transfer,
|
||||
transfer->idx,
|
||||
transfer->buffer,
|
||||
transfer->length,
|
||||
- &transfer->actual_length,
|
||||
+ &actual_length,
|
||||
timeout_ms,
|
||||
NULL,
|
||||
error);
|
||||
@@ -496,7 +497,7 @@ fpi_usb_transfer_submit_sync (FpiUsbTransfer *transfer,
|
||||
transfer->endpoint,
|
||||
transfer->buffer,
|
||||
transfer->length,
|
||||
- &transfer->actual_length,
|
||||
+ &actual_length,
|
||||
timeout_ms,
|
||||
NULL,
|
||||
error);
|
||||
@@ -511,6 +512,8 @@ fpi_usb_transfer_submit_sync (FpiUsbTransfer *transfer,
|
||||
|
||||
if (!res)
|
||||
transfer->actual_length = -1;
|
||||
+ else
|
||||
+ transfer->actual_length = actual_length;
|
||||
|
||||
return res;
|
||||
}
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,90 +0,0 @@
|
||||
From 34b61d11546e764b08bc97276b102560fb899959 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Tue, 3 Dec 2019 19:36:26 +0100
|
||||
Subject: [PATCH 067/181] drivers, examples: Don't use -Wno-pointer-sign and
|
||||
fix relative errors
|
||||
|
||||
---
|
||||
examples/storage.c | 2 +-
|
||||
libfprint/drivers/synaptics/synaptics.c | 4 ++--
|
||||
libfprint/drivers/upekts.c | 2 +-
|
||||
libfprint/drivers/vfs0050.c | 2 +-
|
||||
meson.build | 1 -
|
||||
5 files changed, 5 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/examples/storage.c b/examples/storage.c
|
||||
index 932163e..db35854 100644
|
||||
--- a/examples/storage.c
|
||||
+++ b/examples/storage.c
|
||||
@@ -57,7 +57,7 @@ load_data (void)
|
||||
GVariantDict *res;
|
||||
GVariant *var;
|
||||
g_autofree gchar *contents = NULL;
|
||||
- gssize length = 0;
|
||||
+ gsize length = 0;
|
||||
|
||||
if (!g_file_get_contents (STORAGE_FILE, &contents, &length, NULL))
|
||||
{
|
||||
diff --git a/libfprint/drivers/synaptics/synaptics.c b/libfprint/drivers/synaptics/synaptics.c
|
||||
index 1524c45..247b658 100644
|
||||
--- a/libfprint/drivers/synaptics/synaptics.c
|
||||
+++ b/libfprint/drivers/synaptics/synaptics.c
|
||||
@@ -407,7 +407,7 @@ static gboolean
|
||||
parse_print_data (GVariant *data,
|
||||
guint8 *finger,
|
||||
const guint8 **user_id,
|
||||
- gssize *user_id_len)
|
||||
+ gsize *user_id_len)
|
||||
{
|
||||
g_autoptr(GVariant) user_id_var = NULL;
|
||||
|
||||
@@ -506,7 +506,7 @@ list_msg_cb (FpiDeviceSynaptics *self,
|
||||
get_enroll_templates_resp->templates[n].user_id,
|
||||
get_enroll_templates_resp->templates[n].finger_id);
|
||||
|
||||
- userid = get_enroll_templates_resp->templates[n].user_id;
|
||||
+ userid = (gchar *) get_enroll_templates_resp->templates[n].user_id;
|
||||
|
||||
print = fp_print_new (FP_DEVICE (self));
|
||||
uid = g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE,
|
||||
diff --git a/libfprint/drivers/upekts.c b/libfprint/drivers/upekts.c
|
||||
index 05cd9c5..6ce8136 100644
|
||||
--- a/libfprint/drivers/upekts.c
|
||||
+++ b/libfprint/drivers/upekts.c
|
||||
@@ -375,7 +375,7 @@ read_msg_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
goto err;
|
||||
}
|
||||
|
||||
- if (strncmp (udata->buffer, "Ciao", 4) != 0)
|
||||
+ if (strncmp ((char *) udata->buffer, "Ciao", 4) != 0)
|
||||
{
|
||||
fp_err ("no Ciao for you!!");
|
||||
error = fpi_device_error_new_msg (FP_DEVICE_ERROR_PROTO,
|
||||
diff --git a/libfprint/drivers/vfs0050.c b/libfprint/drivers/vfs0050.c
|
||||
index 9b99dc3..bb6851f 100644
|
||||
--- a/libfprint/drivers/vfs0050.c
|
||||
+++ b/libfprint/drivers/vfs0050.c
|
||||
@@ -399,7 +399,7 @@ interrupt_callback (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
gpointer user_data, GError *error)
|
||||
{
|
||||
FpDeviceVfs0050 *self = FPI_DEVICE_VFS0050 (device);
|
||||
- char *interrupt = transfer->buffer;
|
||||
+ unsigned char *interrupt = transfer->buffer;
|
||||
|
||||
/* we expect a cancellation error when the device is deactivating
|
||||
* go into the SSM_CLEAR_EP2 state in that case. */
|
||||
diff --git a/meson.build b/meson.build
|
||||
index ef352ba..54761c4 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -31,7 +31,6 @@ common_cflags = cc.get_supported_arguments([
|
||||
'-Wunused',
|
||||
'-Wstrict-prototypes',
|
||||
'-Werror-implicit-function-declaration',
|
||||
- '-Wno-pointer-sign',
|
||||
'-Wshadow',
|
||||
'-DGLIB_VERSION_MIN_REQUIRED=' + glib_version_def,
|
||||
'-DGLIB_VERSION_MAX_ALLOWED=' + glib_version_def,
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,26 +0,0 @@
|
||||
From d8b15d9c655d329ccb91d0d6b31e6109651a1af6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Tue, 3 Dec 2019 19:53:19 +0100
|
||||
Subject: [PATCH 068/181] fp-print: Clear the data not the description when
|
||||
setting the property
|
||||
|
||||
---
|
||||
libfprint/fp-print.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libfprint/fp-print.c b/libfprint/fp-print.c
|
||||
index ddf8747..e7b119a 100644
|
||||
--- a/libfprint/fp-print.c
|
||||
+++ b/libfprint/fp-print.c
|
||||
@@ -207,7 +207,7 @@ fp_print_set_property (GObject *object,
|
||||
break;
|
||||
|
||||
case PROP_FPI_DATA:
|
||||
- g_clear_pointer (&self->description, g_variant_unref);
|
||||
+ g_clear_pointer (&self->data, g_variant_unref);
|
||||
self->data = g_value_dup_variant (value);
|
||||
break;
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,107 +0,0 @@
|
||||
From c23e2719bac6d5b1c832ce06d4bc2358f532eb19 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 4 Dec 2019 12:32:14 +0100
|
||||
Subject: [PATCH 069/181] meson: Use add_project_arguments for common cflags
|
||||
|
||||
We were passing around the common cflags and setting them for each library
|
||||
or executable, but this is just a repetition given we can just use
|
||||
add_project_arguments for this.
|
||||
---
|
||||
demo/meson.build | 5 +----
|
||||
examples/meson.build | 6 ++----
|
||||
libfprint/meson.build | 2 +-
|
||||
meson.build | 13 ++++++++-----
|
||||
4 files changed, 12 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/demo/meson.build b/demo/meson.build
|
||||
index bf7a7ee..279a43c 100644
|
||||
--- a/demo/meson.build
|
||||
+++ b/demo/meson.build
|
||||
@@ -13,10 +13,7 @@ executable('gtk-libfprint-test',
|
||||
include_directories: [
|
||||
root_inc,
|
||||
],
|
||||
- c_args: [
|
||||
- common_cflags,
|
||||
- '-DPACKAGE_VERSION="' + meson.project_version() + '"'
|
||||
- ],
|
||||
+ c_args: '-DPACKAGE_VERSION="' + meson.project_version() + '"',
|
||||
install: true,
|
||||
install_dir: bindir)
|
||||
|
||||
diff --git a/examples/meson.build b/examples/meson.build
|
||||
index ff03ac6..eef8c3f 100644
|
||||
--- a/examples/meson.build
|
||||
+++ b/examples/meson.build
|
||||
@@ -6,8 +6,7 @@ foreach example: examples
|
||||
dependencies: [ libfprint_dep, glib_dep ],
|
||||
include_directories: [
|
||||
root_inc,
|
||||
- ],
|
||||
- c_args: common_cflags)
|
||||
+ ])
|
||||
endforeach
|
||||
|
||||
executable('cpp-test',
|
||||
@@ -15,5 +14,4 @@ executable('cpp-test',
|
||||
dependencies: libfprint_dep,
|
||||
include_directories: [
|
||||
root_inc,
|
||||
- ],
|
||||
- c_args: common_cflags)
|
||||
+ ])
|
||||
diff --git a/libfprint/meson.build b/libfprint/meson.build
|
||||
index f77965a..964744e 100644
|
||||
--- a/libfprint/meson.build
|
||||
+++ b/libfprint/meson.build
|
||||
@@ -188,7 +188,7 @@ libfprint = library('fprint',
|
||||
drivers_sources + nbis_sources + other_sources,
|
||||
soversion: soversion,
|
||||
version: libversion,
|
||||
- c_args: common_cflags + drivers_cflags,
|
||||
+ c_args: drivers_cflags,
|
||||
include_directories: [
|
||||
root_inc,
|
||||
include_directories('nbis/include'),
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 54761c4..09abc1f 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -10,9 +10,6 @@ project('libfprint', [ 'c', 'cpp' ],
|
||||
|
||||
gnome = import('gnome')
|
||||
|
||||
-add_project_arguments([ '-D_GNU_SOURCE' ], language: 'c')
|
||||
-add_project_arguments([ '-DG_LOG_DOMAIN="libfprint"' ], language: 'c')
|
||||
-
|
||||
libfprint_conf = configuration_data()
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
@@ -23,8 +20,6 @@ glib_min_version = '2.56'
|
||||
glib_version_def = 'GLIB_VERSION_@0@_@1@'.format(
|
||||
glib_min_version.split('.')[0], glib_min_version.split('.')[1])
|
||||
common_cflags = cc.get_supported_arguments([
|
||||
- '-fgnu89-inline',
|
||||
- '-std=gnu99',
|
||||
'-Wall',
|
||||
'-Wtype-limits',
|
||||
'-Wundef',
|
||||
@@ -34,7 +29,15 @@ common_cflags = cc.get_supported_arguments([
|
||||
'-Wshadow',
|
||||
'-DGLIB_VERSION_MIN_REQUIRED=' + glib_version_def,
|
||||
'-DGLIB_VERSION_MAX_ALLOWED=' + glib_version_def,
|
||||
+ '-D_GNU_SOURCE',
|
||||
+ '-DG_LOG_DOMAIN="libfprint"',
|
||||
+])
|
||||
+c_cflags = cc.get_supported_arguments([
|
||||
+ '-fgnu89-inline',
|
||||
+ '-std=gnu99',
|
||||
])
|
||||
+add_project_arguments(common_cflags + c_cflags, language: 'c')
|
||||
+add_project_arguments(common_cflags, language: 'cpp')
|
||||
|
||||
# maintaining compatibility with the previous libtool versioning
|
||||
# current = binary - interface
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,31 +0,0 @@
|
||||
From a0f18b7200056d3250b0112dcfd46e7d7441606b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 4 Dec 2019 12:32:28 +0100
|
||||
Subject: [PATCH 070/181] cpp-test: Fix indentation
|
||||
|
||||
---
|
||||
examples/cpp-test.cpp | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/examples/cpp-test.cpp b/examples/cpp-test.cpp
|
||||
index a0eb2ed..99967e2 100644
|
||||
--- a/examples/cpp-test.cpp
|
||||
+++ b/examples/cpp-test.cpp
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
- FpContext *ctx;
|
||||
+ FpContext *ctx;
|
||||
|
||||
- ctx = fp_context_new ();
|
||||
- g_object_unref (ctx);
|
||||
+ ctx = fp_context_new ();
|
||||
+ g_object_unref (ctx);
|
||||
|
||||
- return 0;
|
||||
+ return 0;
|
||||
}
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,49 +0,0 @@
|
||||
From 051549311b5dd44a9b927b2e165cc539699616b2 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Wed, 4 Dec 2019 11:37:30 +0100
|
||||
Subject: [PATCH 071/181] meson: Build nbis separately to allow changing flags
|
||||
|
||||
As nbis is an external source bundle, it does not necessarily make sense
|
||||
to enable/fix all warnings to the extend we do for our own library code.
|
||||
|
||||
As such, separate the build process into multiple stages.
|
||||
---
|
||||
libfprint/meson.build | 13 ++++++++++++-
|
||||
1 file changed, 12 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libfprint/meson.build b/libfprint/meson.build
|
||||
index 964744e..7742ecc 100644
|
||||
--- a/libfprint/meson.build
|
||||
+++ b/libfprint/meson.build
|
||||
@@ -183,9 +183,19 @@ mapfile = 'libfprint.ver'
|
||||
vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile)
|
||||
|
||||
deps = [ mathlib_dep, glib_dep, gusb_dep, nss_dep, imaging_dep, gio_dep ]
|
||||
+
|
||||
+nbis_lib = static_library('nbis',
|
||||
+ nbis_sources,
|
||||
+ include_directories: [
|
||||
+ root_inc,
|
||||
+ include_directories('nbis/include'),
|
||||
+ ],
|
||||
+ dependencies: deps,
|
||||
+ install: false)
|
||||
+
|
||||
libfprint = library('fprint',
|
||||
libfprint_sources + fp_enums + fpi_enums +
|
||||
- drivers_sources + nbis_sources + other_sources,
|
||||
+ drivers_sources + other_sources,
|
||||
soversion: soversion,
|
||||
version: libversion,
|
||||
c_args: drivers_cflags,
|
||||
@@ -195,6 +205,7 @@ libfprint = library('fprint',
|
||||
],
|
||||
link_args : vflag,
|
||||
link_depends : mapfile,
|
||||
+ link_with: nbis_lib,
|
||||
dependencies: deps,
|
||||
install: true)
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,71 +0,0 @@
|
||||
From ec5ac320350aa9bc8d0a3ac8df26cb17c53f880b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 4 Dec 2019 12:43:12 +0100
|
||||
Subject: [PATCH 072/181] meson: Add the include directories to deps
|
||||
|
||||
So we don't have to repeat them everywhere.
|
||||
---
|
||||
libfprint/meson.build | 23 +++++++----------------
|
||||
1 file changed, 7 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/libfprint/meson.build b/libfprint/meson.build
|
||||
index 7742ecc..100865d 100644
|
||||
--- a/libfprint/meson.build
|
||||
+++ b/libfprint/meson.build
|
||||
@@ -184,12 +184,13 @@ vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfil
|
||||
|
||||
deps = [ mathlib_dep, glib_dep, gusb_dep, nss_dep, imaging_dep, gio_dep ]
|
||||
|
||||
-nbis_lib = static_library('nbis',
|
||||
+deps += declare_dependency(include_directories: [
|
||||
+ root_inc,
|
||||
+ include_directories('nbis/include'),
|
||||
+])
|
||||
+
|
||||
+libnbis = static_library('nbis',
|
||||
nbis_sources,
|
||||
- include_directories: [
|
||||
- root_inc,
|
||||
- include_directories('nbis/include'),
|
||||
- ],
|
||||
dependencies: deps,
|
||||
install: false)
|
||||
|
||||
@@ -199,13 +200,9 @@ libfprint = library('fprint',
|
||||
soversion: soversion,
|
||||
version: libversion,
|
||||
c_args: drivers_cflags,
|
||||
- include_directories: [
|
||||
- root_inc,
|
||||
- include_directories('nbis/include'),
|
||||
- ],
|
||||
link_args : vflag,
|
||||
link_depends : mapfile,
|
||||
- link_with: nbis_lib,
|
||||
+ link_with: libnbis,
|
||||
dependencies: deps,
|
||||
install: true)
|
||||
|
||||
@@ -218,9 +215,6 @@ install_headers(['fprint.h'] + libfprint_public_headers, subdir: 'libfprint')
|
||||
|
||||
udev_rules = executable('fprint-list-udev-rules',
|
||||
'fprint-list-udev-rules.c',
|
||||
- include_directories: [
|
||||
- root_inc,
|
||||
- ],
|
||||
dependencies: [ deps, libfprint_dep ],
|
||||
install: false)
|
||||
|
||||
@@ -235,9 +229,6 @@ endif
|
||||
|
||||
supported_devices = executable('fprint-list-supported-devices',
|
||||
'fprint-list-supported-devices.c',
|
||||
- include_directories: [
|
||||
- root_inc,
|
||||
- ],
|
||||
dependencies: [ deps, libfprint_dep ],
|
||||
install: false)
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,113 +0,0 @@
|
||||
From 228fda84601a9a9f3ba5b39bbea2302f73c2580c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 4 Dec 2019 13:12:52 +0100
|
||||
Subject: [PATCH 073/181] nbis: Add a global include file with all the
|
||||
definitions ignoring erros
|
||||
|
||||
The nbis headers are full of redundant declarations, we can't fix them all
|
||||
now, so in the mean time let's use an header using pragma to ignore such
|
||||
errors.
|
||||
|
||||
Add the error to nbis private include folder that should be used only by
|
||||
headers of libfprint-nbis.
|
||||
---
|
||||
libfprint/fp-image.c | 2 +-
|
||||
libfprint/fp-print.c | 3 +--
|
||||
libfprint/meson.build | 6 +++++
|
||||
libfprint/nbis/libfprint-include/nbis.h | 35 +++++++++++++++++++++++++
|
||||
4 files changed, 43 insertions(+), 3 deletions(-)
|
||||
create mode 100644 libfprint/nbis/libfprint-include/nbis.h
|
||||
|
||||
diff --git a/libfprint/fp-image.c b/libfprint/fp-image.c
|
||||
index 4b8b3cd..c66b010 100644
|
||||
--- a/libfprint/fp-image.c
|
||||
+++ b/libfprint/fp-image.c
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "fpi-image.h"
|
||||
|
||||
-#include "nbis/include/lfs.h"
|
||||
+#include <nbis.h>
|
||||
|
||||
#if HAVE_PIXMAN
|
||||
#include <pixman.h>
|
||||
diff --git a/libfprint/fp-print.c b/libfprint/fp-print.c
|
||||
index e7b119a..ed29ec1 100644
|
||||
--- a/libfprint/fp-print.c
|
||||
+++ b/libfprint/fp-print.c
|
||||
@@ -22,8 +22,7 @@
|
||||
#include "fpi-image.h"
|
||||
#include "fpi-device.h"
|
||||
|
||||
-#include "nbis/include/bozorth.h"
|
||||
-#include "nbis/include/lfs.h"
|
||||
+#include <nbis.h>
|
||||
|
||||
/**
|
||||
* SECTION: fp-print
|
||||
diff --git a/libfprint/meson.build b/libfprint/meson.build
|
||||
index 100865d..99ebf73 100644
|
||||
--- a/libfprint/meson.build
|
||||
+++ b/libfprint/meson.build
|
||||
@@ -187,11 +187,17 @@ deps = [ mathlib_dep, glib_dep, gusb_dep, nss_dep, imaging_dep, gio_dep ]
|
||||
deps += declare_dependency(include_directories: [
|
||||
root_inc,
|
||||
include_directories('nbis/include'),
|
||||
+ include_directories('nbis/libfprint-include'),
|
||||
])
|
||||
|
||||
libnbis = static_library('nbis',
|
||||
nbis_sources,
|
||||
dependencies: deps,
|
||||
+ c_args: cc.get_supported_arguments([
|
||||
+ '-Wno-error=redundant-decls',
|
||||
+ '-Wno-redundant-decls',
|
||||
+ '-Wno-discarded-qualifiers',
|
||||
+ ]),
|
||||
install: false)
|
||||
|
||||
libfprint = library('fprint',
|
||||
diff --git a/libfprint/nbis/libfprint-include/nbis.h b/libfprint/nbis/libfprint-include/nbis.h
|
||||
new file mode 100644
|
||||
index 0000000..e3f667f
|
||||
--- /dev/null
|
||||
+++ b/libfprint/nbis/libfprint-include/nbis.h
|
||||
@@ -0,0 +1,35 @@
|
||||
+/*
|
||||
+ * Example fingerprint device prints listing and deletion
|
||||
+ * Enrolls your right index finger and saves the print to disk
|
||||
+ * Copyright (C) 2019 Marco Trevisan <marco.trevisan@canonical.com>
|
||||
+ *
|
||||
+ * This library is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This library is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with this library; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+ */
|
||||
+
|
||||
+#pragma once
|
||||
+
|
||||
+#pragma GCC diagnostic push
|
||||
+#pragma GCC diagnostic ignored "-Wredundant-decls"
|
||||
+
|
||||
+#include <bozorth.h>
|
||||
+#include <bz_array.h>
|
||||
+#include <defs.h>
|
||||
+#include <lfs.h>
|
||||
+#include <log.h>
|
||||
+#include <morph.h>
|
||||
+#include <mytime.h>
|
||||
+#include <sunrast.h>
|
||||
+
|
||||
+#pragma GCC diagnostic pop
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,213 +0,0 @@
|
||||
From c5e8baac5bfb57c3c96f03c9534cc38002de3cca Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 4 Dec 2019 15:08:12 +0100
|
||||
Subject: [PATCH 074/181] cleanup: Don't make nbis depend on libfprint
|
||||
built-sources
|
||||
|
||||
Now that nbis is a static library it should be possible to compile it
|
||||
without any fprint-built dependency, although since it included fp_internal
|
||||
there was a compile-time dependency on the fp-enums that can be generated at
|
||||
later times.
|
||||
|
||||
So:
|
||||
- Move nbis-helpers to nbis includes (and remove inclusion in fp_internal)
|
||||
- Move the Minutiae definitions inside a standalone fpi-minutiae header
|
||||
- Include fpi-minutiae.h in fp_internal.h
|
||||
- Include nbis-hepers.h and fpi-minutiae.h in nbis' lfs.h
|
||||
- Adapt missing definitions in libfprint
|
||||
---
|
||||
libfprint/fp-image.c | 1 +
|
||||
libfprint/fp-print.c | 1 +
|
||||
libfprint/fp_internal.h | 35 ++-------------
|
||||
libfprint/fpi-minutiae.h | 45 +++++++++++++++++++
|
||||
libfprint/nbis/include/lfs.h | 3 +-
|
||||
libfprint/nbis/lfs.h.patch | 13 +++---
|
||||
.../libfprint-include}/nbis-helpers.h | 0
|
||||
7 files changed, 59 insertions(+), 39 deletions(-)
|
||||
create mode 100644 libfprint/fpi-minutiae.h
|
||||
rename libfprint/{ => nbis/libfprint-include}/nbis-helpers.h (100%)
|
||||
|
||||
diff --git a/libfprint/fp-image.c b/libfprint/fp-image.c
|
||||
index c66b010..16837a8 100644
|
||||
--- a/libfprint/fp-image.c
|
||||
+++ b/libfprint/fp-image.c
|
||||
@@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
#include "fpi-image.h"
|
||||
+#include "fpi-log.h"
|
||||
|
||||
#include <nbis.h>
|
||||
|
||||
diff --git a/libfprint/fp-print.c b/libfprint/fp-print.c
|
||||
index ed29ec1..f724c77 100644
|
||||
--- a/libfprint/fp-print.c
|
||||
+++ b/libfprint/fp-print.c
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "fpi-print.h"
|
||||
#include "fpi-image.h"
|
||||
+#include "fpi-log.h"
|
||||
#include "fpi-device.h"
|
||||
|
||||
#include <nbis.h>
|
||||
diff --git a/libfprint/fp_internal.h b/libfprint/fp_internal.h
|
||||
index 8147089..56ada18 100644
|
||||
--- a/libfprint/fp_internal.h
|
||||
+++ b/libfprint/fp_internal.h
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Internal/private definitions for libfprint
|
||||
- * Copyright (C) 2007-2008 Daniel Drake <dsd@gentoo.org>
|
||||
+ * Copyright (C) 2019 Marco Trevisan <marco.trevisan@canonical.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -17,38 +17,9 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
-#ifndef __FPRINT_INTERNAL_H__
|
||||
-#define __FPRINT_INTERNAL_H__
|
||||
+#pragma once
|
||||
|
||||
#include "fpi-log.h"
|
||||
-#include "nbis-helpers.h"
|
||||
#include "fpi-image.h"
|
||||
#include "fpi-image-device.h"
|
||||
-
|
||||
-/* fp_minutia structure definition */
|
||||
-struct fp_minutia
|
||||
-{
|
||||
- int x;
|
||||
- int y;
|
||||
- int ex;
|
||||
- int ey;
|
||||
- int direction;
|
||||
- double reliability;
|
||||
- int type;
|
||||
- int appearing;
|
||||
- int feature_id;
|
||||
- int *nbrs;
|
||||
- int *ridge_counts;
|
||||
- int num_nbrs;
|
||||
-};
|
||||
-
|
||||
-/* fp_minutiae structure definition */
|
||||
-struct fp_minutiae
|
||||
-{
|
||||
- int alloc;
|
||||
- int num;
|
||||
- struct fp_minutia **list;
|
||||
-};
|
||||
-
|
||||
-
|
||||
-#endif
|
||||
+#include "fpi-minutiae.h"
|
||||
diff --git a/libfprint/fpi-minutiae.h b/libfprint/fpi-minutiae.h
|
||||
new file mode 100644
|
||||
index 0000000..24dc761
|
||||
--- /dev/null
|
||||
+++ b/libfprint/fpi-minutiae.h
|
||||
@@ -0,0 +1,45 @@
|
||||
+/*
|
||||
+ * Internal/private definitions for libfprint
|
||||
+ * Copyright (C) 2007-2008 Daniel Drake <dsd@gentoo.org>
|
||||
+ *
|
||||
+ * This library is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This library is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with this library; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+ */
|
||||
+
|
||||
+#pragma once
|
||||
+
|
||||
+/* fp_minutia structure definition */
|
||||
+struct fp_minutia
|
||||
+{
|
||||
+ int x;
|
||||
+ int y;
|
||||
+ int ex;
|
||||
+ int ey;
|
||||
+ int direction;
|
||||
+ double reliability;
|
||||
+ int type;
|
||||
+ int appearing;
|
||||
+ int feature_id;
|
||||
+ int *nbrs;
|
||||
+ int *ridge_counts;
|
||||
+ int num_nbrs;
|
||||
+};
|
||||
+
|
||||
+/* fp_minutiae structure definition */
|
||||
+struct fp_minutiae
|
||||
+{
|
||||
+ int alloc;
|
||||
+ int num;
|
||||
+ struct fp_minutia **list;
|
||||
+};
|
||||
diff --git a/libfprint/nbis/include/lfs.h b/libfprint/nbis/include/lfs.h
|
||||
index ae7aee5..f4f38d7 100644
|
||||
--- a/libfprint/nbis/include/lfs.h
|
||||
+++ b/libfprint/nbis/include/lfs.h
|
||||
@@ -66,7 +66,8 @@ of the software.
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
-#include <fp_internal.h>
|
||||
+#include <nbis-helpers.h>
|
||||
+#include <fpi-minutiae.h>
|
||||
|
||||
/*************************************************************************/
|
||||
/* OUTPUT FILE EXTENSIONS */
|
||||
diff --git a/libfprint/nbis/lfs.h.patch b/libfprint/nbis/lfs.h.patch
|
||||
index 2be6ebf..3342bc5 100644
|
||||
--- a/libfprint/nbis/lfs.h.patch
|
||||
+++ b/libfprint/nbis/lfs.h.patch
|
||||
@@ -1,15 +1,16 @@
|
||||
---- include/lfs.h 2018-08-24 15:31:54.535579623 +0200
|
||||
-+++ include/lfs.h.orig 2018-08-24 15:31:48.781587933 +0200
|
||||
-@@ -66,7 +43,7 @@ of the software.
|
||||
+--- include/lfs.h
|
||||
++++ include/lfs.h
|
||||
+@@ -66,7 +66,8 @@ of the software.
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
-#include <an2k.h> /* Needed by to_type9.c */
|
||||
-+#include <fp_internal.h>
|
||||
++#include <nbis-helpers.h>
|
||||
++#include <fpi-minutiae.h>
|
||||
|
||||
/*************************************************************************/
|
||||
/* OUTPUT FILE EXTENSIONS */
|
||||
-@@ -154,26 +131,8 @@ typedef struct rotgrids{
|
||||
+@@ -154,26 +155,8 @@ typedef struct rotgrids{
|
||||
#define DISAPPEARING 0
|
||||
#define APPEARING 1
|
||||
|
||||
@@ -38,7 +39,7 @@
|
||||
|
||||
typedef struct feature_pattern{
|
||||
int type;
|
||||
-@@ -1185,17 +1185,6 @@ extern void bubble_sort_double_inc_2(double *, int *, const int);
|
||||
+@@ -1203,17 +1186,6 @@ extern void bubble_sort_double_inc_2(double *, int *, const int);
|
||||
extern void bubble_sort_double_dec_2(double *, int *, const int);
|
||||
extern void bubble_sort_int_inc(int *, const int);
|
||||
|
||||
diff --git a/libfprint/nbis-helpers.h b/libfprint/nbis/libfprint-include/nbis-helpers.h
|
||||
similarity index 100%
|
||||
rename from libfprint/nbis-helpers.h
|
||||
rename to libfprint/nbis/libfprint-include/nbis-helpers.h
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,55 +0,0 @@
|
||||
From e0344288b01f66bf4b600468692a1110c8abbe24 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 4 Dec 2019 13:13:14 +0100
|
||||
Subject: [PATCH 075/181] nbis/log: Don't use old-style function declarations
|
||||
|
||||
---
|
||||
libfprint/nbis/mindtct/log.c | 4 ++--
|
||||
libfprint/nbis/update-from-nbis.sh | 6 +++++-
|
||||
2 files changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libfprint/nbis/mindtct/log.c b/libfprint/nbis/mindtct/log.c
|
||||
index b1dcaad..dcd3db7 100644
|
||||
--- a/libfprint/nbis/mindtct/log.c
|
||||
+++ b/libfprint/nbis/mindtct/log.c
|
||||
@@ -66,7 +66,7 @@ of the software.
|
||||
|
||||
/***************************************************************************/
|
||||
/***************************************************************************/
|
||||
-int open_logfile()
|
||||
+int open_logfile(void)
|
||||
{
|
||||
#ifdef LOG_REPORT
|
||||
fprintf(stderr, "ERROR : open_logfile : fopen : %s\n", LOG_FILE);
|
||||
@@ -91,7 +91,7 @@ void print2log(char *fmt, ...)
|
||||
|
||||
/***************************************************************************/
|
||||
/***************************************************************************/
|
||||
-int close_logfile()
|
||||
+int close_logfile(void)
|
||||
{
|
||||
#ifdef LOG_REPORT
|
||||
fprintf(stderr, "ERROR : close_logfile : fclose : %s\n", LOG_FILE);
|
||||
diff --git a/libfprint/nbis/update-from-nbis.sh b/libfprint/nbis/update-from-nbis.sh
|
||||
index c8cde80..742c8cb 100755
|
||||
--- a/libfprint/nbis/update-from-nbis.sh
|
||||
+++ b/libfprint/nbis/update-from-nbis.sh
|
||||
@@ -179,9 +179,13 @@ sed -i 's/[ \t]*$//' `find -name "*.[ch]"`
|
||||
# Remove usebsd.h
|
||||
sed -i '/usebsd.h/d' `find -name "*.[ch]"`
|
||||
|
||||
+# Replace functions with empty parameters using (void)
|
||||
+sed -i 's/^\([[:space:]]*[[:alnum:]_]\+[\*[:space:]]\+'\
|
||||
+'[[:alnum:]_]\+[[:space:]]*\)([[:space:]]*)/\1(void)/g' `find -name "*.[ch]"`
|
||||
+
|
||||
# Use GLib memory management
|
||||
spatch --sp-file glib-memory.cocci --dir . --in-place
|
||||
|
||||
# The above leaves an unused variable around, triggering a warning
|
||||
# remove it.
|
||||
-patch -p0 < glib-mem-warning.patch
|
||||
\ No newline at end of file
|
||||
+patch -p0 < glib-mem-warning.patch
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,237 +0,0 @@
|
||||
From 9c3af4498e7e5898744c4598fe89a5b34e639b92 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 4 Dec 2019 14:22:07 +0100
|
||||
Subject: [PATCH 076/181] nbis: Make the extern global bozworth 'y' variable as
|
||||
bz_y
|
||||
|
||||
Othewise this could create issues with other 'y' variable definitions
|
||||
shadowing it.
|
||||
|
||||
Add a cocci file that performs the change automatically
|
||||
---
|
||||
libfprint/nbis/bozorth3/bozorth3.c | 34 ++++++++++++++--------------
|
||||
libfprint/nbis/bozorth3/bz_gbls.c | 4 ++--
|
||||
libfprint/nbis/include/bozorth.h | 2 +-
|
||||
libfprint/nbis/remove-global-y.cocci | 21 +++++++++++++++++
|
||||
libfprint/nbis/update-from-nbis.sh | 3 +++
|
||||
5 files changed, 44 insertions(+), 20 deletions(-)
|
||||
create mode 100644 libfprint/nbis/remove-global-y.cocci
|
||||
|
||||
diff --git a/libfprint/nbis/bozorth3/bozorth3.c b/libfprint/nbis/bozorth3/bozorth3.c
|
||||
index 0a8b0ff..e2e668f 100644
|
||||
--- a/libfprint/nbis/bozorth3/bozorth3.c
|
||||
+++ b/libfprint/nbis/bozorth3/bozorth3.c
|
||||
@@ -896,7 +896,7 @@ for ( k = 0; k < np - 1; k++ ) {
|
||||
for ( i = 0; i < tot; i++ ) {
|
||||
|
||||
|
||||
- int colp_value = colp[ y[i]-1 ][0];
|
||||
+ int colp_value = colp[ bz_y[i]-1 ][0];
|
||||
if ( colp_value < 0 ) {
|
||||
kk += colp_value;
|
||||
n++;
|
||||
@@ -933,7 +933,7 @@ for ( k = 0; k < np - 1; k++ ) {
|
||||
|
||||
kk = 0;
|
||||
for ( i = 0; i < tot; i++ ) {
|
||||
- int diff = colp[ y[i]-1 ][0] - jj;
|
||||
+ int diff = colp[ bz_y[i]-1 ][0] - jj;
|
||||
j = SQUARED( diff );
|
||||
|
||||
|
||||
@@ -942,7 +942,7 @@ for ( k = 0; k < np - 1; k++ ) {
|
||||
if ( j > TXS && j < CTXS )
|
||||
kk++;
|
||||
else
|
||||
- y[i-kk] = y[i];
|
||||
+ bz_y[i-kk] = bz_y[i];
|
||||
} /* END FOR i */
|
||||
|
||||
tot -= kk; /* Adjust the total edge pairs TOT based on # of edge pairs skipped */
|
||||
@@ -958,7 +958,7 @@ for ( k = 0; k < np - 1; k++ ) {
|
||||
|
||||
|
||||
for ( i = tot-1 ; i >= 0; i-- ) {
|
||||
- int idx = y[i] - 1;
|
||||
+ int idx = bz_y[i] - 1;
|
||||
if ( rk[idx] == 0 ) {
|
||||
sc[idx] = -1;
|
||||
} else {
|
||||
@@ -976,7 +976,7 @@ for ( k = 0; k < np - 1; k++ ) {
|
||||
int pd = 0;
|
||||
|
||||
for ( i = 0; i < tot; i++ ) {
|
||||
- int idx = y[i] - 1;
|
||||
+ int idx = bz_y[i] - 1;
|
||||
for ( ii = 1; ii < 4; ii++ ) {
|
||||
|
||||
|
||||
@@ -1476,7 +1476,7 @@ return match_score;
|
||||
/* extern int rk[ RK_SIZE ]; */
|
||||
/* extern int cp[ CP_SIZE ]; */
|
||||
/* extern int rp[ RP_SIZE ]; */
|
||||
-/* extern int y[ Y_SIZE ]; */
|
||||
+/* extern int bz_y[ Y_SIZE ]; */
|
||||
|
||||
void bz_sift(
|
||||
int * ww, /* INPUT and OUTPUT; endpoint groups index; *ww may be bumped by one or by two */
|
||||
@@ -1507,7 +1507,7 @@ if ( n == 0 && t == 0 ) {
|
||||
|
||||
|
||||
if ( sc[kx-1] != ftt ) {
|
||||
- y[ (*tot)++ ] = kx;
|
||||
+ bz_y[ (*tot)++ ] = kx;
|
||||
rk[kx-1] = sc[kx-1];
|
||||
sc[kx-1] = ftt;
|
||||
}
|
||||
@@ -1553,7 +1553,7 @@ if ( n == l ) {
|
||||
qq[*qh] = kz;
|
||||
zz[kz-1] = (*qh)++;
|
||||
}
|
||||
- y[(*tot)++] = kx;
|
||||
+ bz_y[(*tot)++] = kx;
|
||||
rk[kx-1] = sc[kx-1];
|
||||
sc[kx-1] = ftt;
|
||||
}
|
||||
@@ -1697,12 +1697,12 @@ for ( ii = 0; ii < tp; ii++ ) { /* For each index up to the current value of
|
||||
}
|
||||
|
||||
t = 0;
|
||||
- y[0] = lim;
|
||||
+ bz_y[0] = lim;
|
||||
cp[0] = 1;
|
||||
b = 0;
|
||||
n = 1;
|
||||
do { /* looping until T < 0 ... */
|
||||
- if ( y[t] - cp[t] > 1 ) {
|
||||
+ if (bz_y[t] - cp[t] > 1 ) {
|
||||
k = sct[cp[t]][t];
|
||||
j = ctt[k] + 1;
|
||||
for ( i = 0; i < j; i++ ) {
|
||||
@@ -1715,25 +1715,25 @@ for ( ii = 0; ii < tp; ii++ ) { /* For each index up to the current value of
|
||||
do {
|
||||
while ( rp[jj] < sct[kk][t] && jj < j )
|
||||
jj++;
|
||||
- while ( rp[jj] > sct[kk][t] && kk < y[t] )
|
||||
+ while ( rp[jj] > sct[kk][t] && kk < bz_y[t] )
|
||||
kk++;
|
||||
- while ( rp[jj] == sct[kk][t] && kk < y[t] && jj < j ) {
|
||||
+ while ( rp[jj] == sct[kk][t] && kk < bz_y[t] && jj < j ) {
|
||||
sct[k][t+1] = sct[kk][t];
|
||||
k++;
|
||||
kk++;
|
||||
jj++;
|
||||
}
|
||||
- } while ( kk < y[t] && jj < j );
|
||||
+ } while ( kk < bz_y[t] && jj < j );
|
||||
|
||||
t++;
|
||||
cp[t] = 1;
|
||||
- y[t] = k;
|
||||
+ bz_y[t] = k;
|
||||
b = t;
|
||||
n = 1;
|
||||
} else {
|
||||
int tot = 0;
|
||||
|
||||
- lim = y[t];
|
||||
+ lim = bz_y[t];
|
||||
for ( i = n-1; i < lim; i++ ) {
|
||||
tot += ct[ sct[i][t] ];
|
||||
}
|
||||
@@ -1750,7 +1750,7 @@ for ( ii = 0; ii < tp; ii++ ) { /* For each index up to the current value of
|
||||
|
||||
{
|
||||
int rk_index = b;
|
||||
- lim = y[t];
|
||||
+ lim = bz_y[t];
|
||||
for ( i = n-1; i < lim; ) {
|
||||
rk[ rk_index++ ] = sct[ i++ ][ t ];
|
||||
}
|
||||
@@ -1760,7 +1760,7 @@ for ( ii = 0; ii < tp; ii++ ) { /* For each index up to the current value of
|
||||
t--;
|
||||
if ( t >= 0 ) {
|
||||
++cp[t];
|
||||
- n = y[t];
|
||||
+ n = bz_y[t];
|
||||
}
|
||||
} /* END IF */
|
||||
|
||||
diff --git a/libfprint/nbis/bozorth3/bz_gbls.c b/libfprint/nbis/bozorth3/bz_gbls.c
|
||||
index dd828dc..ea283d8 100644
|
||||
--- a/libfprint/nbis/bozorth3/bz_gbls.c
|
||||
+++ b/libfprint/nbis/bozorth3/bz_gbls.c
|
||||
@@ -102,7 +102,7 @@ int yl[ YL_SIZE_1 ][ YL_SIZE_2 ];
|
||||
int rf[RF_SIZE_1][RF_SIZE_2];
|
||||
int cf[CF_SIZE_1][CF_SIZE_2];
|
||||
|
||||
- int y[20000];
|
||||
+ int bz_y[20000];
|
||||
#else
|
||||
int rq[ RQ_SIZE ] = {};
|
||||
int tq[ TQ_SIZE ] = {};
|
||||
@@ -122,6 +122,6 @@ int yl[ YL_SIZE_1 ][ YL_SIZE_2 ];
|
||||
int rf[RF_SIZE_1][RF_SIZE_2] = {};
|
||||
int cf[CF_SIZE_1][CF_SIZE_2] = {};
|
||||
|
||||
- int y[20000] = {};
|
||||
+ int bz_y[20000] = {};
|
||||
#endif
|
||||
|
||||
diff --git a/libfprint/nbis/include/bozorth.h b/libfprint/nbis/include/bozorth.h
|
||||
index 08ec4b1..a705da9 100644
|
||||
--- a/libfprint/nbis/include/bozorth.h
|
||||
+++ b/libfprint/nbis/include/bozorth.h
|
||||
@@ -245,7 +245,7 @@ extern int cp[ CP_SIZE ];
|
||||
extern int rp[ RP_SIZE ];
|
||||
extern int rf[RF_SIZE_1][RF_SIZE_2];
|
||||
extern int cf[CF_SIZE_1][CF_SIZE_2];
|
||||
-extern int y[20000];
|
||||
+extern int bz_y[20000];
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
diff --git a/libfprint/nbis/remove-global-y.cocci b/libfprint/nbis/remove-global-y.cocci
|
||||
new file mode 100644
|
||||
index 0000000..3b740af
|
||||
--- /dev/null
|
||||
+++ b/libfprint/nbis/remove-global-y.cocci
|
||||
@@ -0,0 +1,21 @@
|
||||
+@ global_y @
|
||||
+identifier y;
|
||||
+@@
|
||||
+int
|
||||
+- y
|
||||
++ bz_y
|
||||
+[20000];
|
||||
+
|
||||
+@@
|
||||
+identifier global_y.y;
|
||||
+@@
|
||||
+- y
|
||||
++ bz_y
|
||||
+[...]
|
||||
+
|
||||
+@@
|
||||
+@@
|
||||
+int
|
||||
+- y
|
||||
++ bz_y
|
||||
+[20000] = {};
|
||||
diff --git a/libfprint/nbis/update-from-nbis.sh b/libfprint/nbis/update-from-nbis.sh
|
||||
index 742c8cb..75e82ba 100755
|
||||
--- a/libfprint/nbis/update-from-nbis.sh
|
||||
+++ b/libfprint/nbis/update-from-nbis.sh
|
||||
@@ -186,6 +186,9 @@ sed -i 's/^\([[:space:]]*[[:alnum:]_]\+[\*[:space:]]\+'\
|
||||
# Use GLib memory management
|
||||
spatch --sp-file glib-memory.cocci --dir . --in-place
|
||||
|
||||
+# Rename global "y" variable in "bz_y"
|
||||
+spatch --sp-file remove-global-y.cocci bozorth3/* include/bozorth.h --in-place
|
||||
+
|
||||
# The above leaves an unused variable around, triggering a warning
|
||||
# remove it.
|
||||
patch -p0 < glib-mem-warning.patch
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,25 +0,0 @@
|
||||
From 15c75f743325a9e73c07fcb35de71c04eb9e9001 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 4 Dec 2019 13:13:40 +0100
|
||||
Subject: [PATCH 077/181] storage: Include storage header so that we have
|
||||
declarations
|
||||
|
||||
---
|
||||
examples/storage.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/examples/storage.c b/examples/storage.c
|
||||
index db35854..6ca6efc 100644
|
||||
--- a/examples/storage.c
|
||||
+++ b/examples/storage.c
|
||||
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include <libfprint/fprint.h>
|
||||
+#include "storage.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,69 +0,0 @@
|
||||
From 1d5ec0b9787f5f3d48fe3a8539c35d23e51745d6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 4 Dec 2019 13:23:26 +0100
|
||||
Subject: [PATCH 078/181] fp-device: Remove unused timeout function and source
|
||||
data
|
||||
|
||||
These were probably added in previous iterations, but they are not uneeded
|
||||
anymore as the GSource embeds already a callback function.
|
||||
|
||||
So make just this clearer in the dispatch function.
|
||||
---
|
||||
libfprint/fp-device.c | 22 +++++-----------------
|
||||
1 file changed, 5 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/libfprint/fp-device.c b/libfprint/fp-device.c
|
||||
index 182be51..334b998 100644
|
||||
--- a/libfprint/fp-device.c
|
||||
+++ b/libfprint/fp-device.c
|
||||
@@ -1382,22 +1382,10 @@ fp_device_list_prints_finish (FpDevice *device,
|
||||
|
||||
typedef struct
|
||||
{
|
||||
- GSource source;
|
||||
- FpDevice *device;
|
||||
- FpTimeoutFunc callback;
|
||||
- gpointer user_data;
|
||||
+ GSource source;
|
||||
+ FpDevice *device;
|
||||
} FpDeviceTimeoutSource;
|
||||
|
||||
-gboolean
|
||||
-device_timeout_cb (gpointer user_data)
|
||||
-{
|
||||
- FpDeviceTimeoutSource *source = user_data;
|
||||
-
|
||||
- source->callback (source->device, source->user_data);
|
||||
-
|
||||
- return G_SOURCE_REMOVE;
|
||||
-}
|
||||
-
|
||||
void
|
||||
timeout_finalize (GSource *source)
|
||||
{
|
||||
@@ -1409,11 +1397,12 @@ timeout_finalize (GSource *source)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
-timeout_dispatch (GSource *source, GSourceFunc callback, gpointer user_data)
|
||||
+timeout_dispatch (GSource *source, GSourceFunc gsource_func, gpointer user_data)
|
||||
{
|
||||
FpDeviceTimeoutSource *timeout_source = (FpDeviceTimeoutSource *) source;
|
||||
+ FpTimeoutFunc callback = (FpTimeoutFunc) gsource_func;
|
||||
|
||||
- ((FpTimeoutFunc) callback)(timeout_source->device, user_data);
|
||||
+ callback (timeout_source->device, user_data);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
@@ -1496,7 +1485,6 @@ fpi_device_add_timeout (FpDevice *device,
|
||||
source = (FpDeviceTimeoutSource *) g_source_new (&timeout_funcs,
|
||||
sizeof (FpDeviceTimeoutSource));
|
||||
source->device = device;
|
||||
- source->user_data = user_data;
|
||||
|
||||
g_source_attach (&source->source, NULL);
|
||||
g_source_set_callback (&source->source, (GSourceFunc) func, user_data, destroy_notify);
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,77 +0,0 @@
|
||||
From db83641a7cf40fe233606f1f8c3cf269756a7641 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 4 Dec 2019 13:25:27 +0100
|
||||
Subject: [PATCH 079/181] cleanup: Use static functions for non-declared
|
||||
methods
|
||||
|
||||
---
|
||||
libfprint/drivers/aes2501.c | 2 +-
|
||||
libfprint/drivers/elan.c | 4 ++--
|
||||
libfprint/fp-device.c | 2 +-
|
||||
libfprint/fpi-usb-transfer.c | 2 +-
|
||||
4 files changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/aes2501.c b/libfprint/drivers/aes2501.c
|
||||
index 1aa0538..57b0cca 100644
|
||||
--- a/libfprint/drivers/aes2501.c
|
||||
+++ b/libfprint/drivers/aes2501.c
|
||||
@@ -686,7 +686,7 @@ enum activate_states {
|
||||
ACTIVATE_NUM_STATES,
|
||||
};
|
||||
|
||||
-void
|
||||
+static void
|
||||
activate_read_regs_cb (FpImageDevice *dev, GError *error,
|
||||
unsigned char *regs, void *user_data)
|
||||
{
|
||||
diff --git a/libfprint/drivers/elan.c b/libfprint/drivers/elan.c
|
||||
index 7c7fb26..90a0306 100644
|
||||
--- a/libfprint/drivers/elan.c
|
||||
+++ b/libfprint/drivers/elan.c
|
||||
@@ -41,7 +41,7 @@
|
||||
#include "drivers_api.h"
|
||||
#include "elan.h"
|
||||
|
||||
-unsigned char
|
||||
+static unsigned char
|
||||
elan_get_pixel (struct fpi_frame_asmbl_ctx *ctx,
|
||||
struct fpi_frame *frame, unsigned int x,
|
||||
unsigned int y)
|
||||
@@ -91,7 +91,7 @@ G_DECLARE_FINAL_TYPE (FpiDeviceElan, fpi_device_elan, FPI, DEVICE_ELAN,
|
||||
FpImageDevice);
|
||||
G_DEFINE_TYPE (FpiDeviceElan, fpi_device_elan, FP_TYPE_IMAGE_DEVICE);
|
||||
|
||||
-int
|
||||
+static int
|
||||
cmp_short (const void *a, const void *b)
|
||||
{
|
||||
return (int) (*(short *) a - *(short *) b);
|
||||
diff --git a/libfprint/fp-device.c b/libfprint/fp-device.c
|
||||
index 334b998..2f706b3 100644
|
||||
--- a/libfprint/fp-device.c
|
||||
+++ b/libfprint/fp-device.c
|
||||
@@ -1386,7 +1386,7 @@ typedef struct
|
||||
FpDevice *device;
|
||||
} FpDeviceTimeoutSource;
|
||||
|
||||
-void
|
||||
+static void
|
||||
timeout_finalize (GSource *source)
|
||||
{
|
||||
FpDeviceTimeoutSource *timeout_source = (FpDeviceTimeoutSource *) source;
|
||||
diff --git a/libfprint/fpi-usb-transfer.c b/libfprint/fpi-usb-transfer.c
|
||||
index 08e75cb..99fe3d4 100644
|
||||
--- a/libfprint/fpi-usb-transfer.c
|
||||
+++ b/libfprint/fpi-usb-transfer.c
|
||||
@@ -298,7 +298,7 @@ fpi_usb_transfer_fill_interrupt_full (FpiUsbTransfer *transfer,
|
||||
transfer->free_buffer = free_func;
|
||||
}
|
||||
|
||||
-void
|
||||
+static void
|
||||
transfer_finish_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
|
||||
{
|
||||
GError *error = NULL;
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,53 +0,0 @@
|
||||
From 8f2c0ada0e2e8813f8c7da3fba9c110ec49c614e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 4 Dec 2019 14:04:04 +0100
|
||||
Subject: [PATCH 080/181] gtk-demo: Use G_DECLARE to avoid missing declarations
|
||||
|
||||
---
|
||||
demo/gtk-libfprint-test.c | 15 ++++++++-------
|
||||
1 file changed, 8 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/demo/gtk-libfprint-test.c b/demo/gtk-libfprint-test.c
|
||||
index c6dd90e..8026815 100644
|
||||
--- a/demo/gtk-libfprint-test.c
|
||||
+++ b/demo/gtk-libfprint-test.c
|
||||
@@ -22,9 +22,11 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <libfprint/fprint.h>
|
||||
|
||||
-typedef GtkApplication LibfprintDemo;
|
||||
-typedef GtkApplicationClass LibfprintDemoClass;
|
||||
-
|
||||
+struct _LibfprintDemo
|
||||
+{
|
||||
+ GtkApplication parent;
|
||||
+};
|
||||
+G_DECLARE_FINAL_TYPE (LibfprintDemo, libfprint_demo, FP, DEMO, GtkApplication)
|
||||
G_DEFINE_TYPE (LibfprintDemo, libfprint_demo, GTK_TYPE_APPLICATION)
|
||||
|
||||
typedef enum {
|
||||
@@ -33,7 +35,7 @@ typedef enum {
|
||||
IMAGE_DISPLAY_BINARY = 1 << 1
|
||||
} ImageDisplayFlags;
|
||||
|
||||
-typedef struct
|
||||
+struct _LibfprintDemoWindow
|
||||
{
|
||||
GtkApplicationWindow parent_instance;
|
||||
|
||||
@@ -52,10 +54,9 @@ typedef struct
|
||||
|
||||
FpImage *img;
|
||||
ImageDisplayFlags img_flags;
|
||||
-} LibfprintDemoWindow;
|
||||
-
|
||||
-typedef GtkApplicationWindowClass LibfprintDemoWindowClass;
|
||||
+};
|
||||
|
||||
+G_DECLARE_FINAL_TYPE (LibfprintDemoWindow, libfprint_demo_window, FP, DEMO_WINDOW, GtkApplicationWindow)
|
||||
G_DEFINE_TYPE (LibfprintDemoWindow, libfprint_demo_window, GTK_TYPE_APPLICATION_WINDOW)
|
||||
|
||||
typedef enum {
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,37 +0,0 @@
|
||||
From ce64d4db86ee179783571eadbdaa9288eeead72b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 4 Dec 2019 14:09:09 +0100
|
||||
Subject: [PATCH 081/181] vfs5011: Cast gpointer data values to proper type to
|
||||
do math operations
|
||||
|
||||
---
|
||||
libfprint/drivers/vfs5011.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/vfs5011.c b/libfprint/drivers/vfs5011.c
|
||||
index ef318f2..265495a 100644
|
||||
--- a/libfprint/drivers/vfs5011.c
|
||||
+++ b/libfprint/drivers/vfs5011.c
|
||||
@@ -210,8 +210,8 @@ vfs5011_get_deviation2 (struct fpi_line_asmbl_ctx *ctx, GSList *row1, GSList *ro
|
||||
int res = 0, mean = 0, i;
|
||||
const int size = 64;
|
||||
|
||||
- buf1 = row1->data + 56;
|
||||
- buf2 = row2->data + 168;
|
||||
+ buf1 = (unsigned char *) row1->data + 56;
|
||||
+ buf2 = (unsigned char *) row2->data + 168;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
mean += (int) buf1[i] + (int) buf2[i];
|
||||
@@ -232,7 +232,7 @@ vfs5011_get_pixel (struct fpi_line_asmbl_ctx *ctx,
|
||||
GSList *row,
|
||||
unsigned x)
|
||||
{
|
||||
- unsigned char *data = row->data + 8;
|
||||
+ unsigned char *data = (unsigned char *) row->data + 8;
|
||||
|
||||
return data[x];
|
||||
}
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,27 +0,0 @@
|
||||
From 8e9e3f1d8961615e6c12306014dcf8538d7e37de Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 4 Dec 2019 14:22:30 +0100
|
||||
Subject: [PATCH 082/181] vfs0050: Use proper casting summing pointers first
|
||||
|
||||
Cast the pointers as what fpi usb transfer expects.
|
||||
---
|
||||
libfprint/drivers/vfs0050.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libfprint/drivers/vfs0050.c b/libfprint/drivers/vfs0050.c
|
||||
index bb6851f..b08a865 100644
|
||||
--- a/libfprint/drivers/vfs0050.c
|
||||
+++ b/libfprint/drivers/vfs0050.c
|
||||
@@ -595,7 +595,8 @@ activate_ssm (FpiSsm *ssm, FpDevice *dev)
|
||||
/* Receive chunk of data */
|
||||
transfer = fpi_usb_transfer_new (dev);
|
||||
fpi_usb_transfer_fill_bulk_full (transfer, 0x82,
|
||||
- (void *) self->lines_buffer + self->bytes,
|
||||
+ (guint8 *)
|
||||
+ (self->lines_buffer + self->bytes),
|
||||
VFS_USB_BUFFER_SIZE, NULL);
|
||||
transfer->ssm = ssm;
|
||||
fpi_usb_transfer_submit (transfer, VFS_USB_TIMEOUT, NULL,
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,25 +0,0 @@
|
||||
From 4b6c3446e9be0ff5d03aa1fe24d79762d93b7ec7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 4 Dec 2019 13:34:14 +0100
|
||||
Subject: [PATCH 083/181] meson: Include fpi-context.h in generated
|
||||
fp-drivers.c
|
||||
|
||||
---
|
||||
meson.build | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 09abc1f..265ce30 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -118,6 +118,7 @@ endforeach
|
||||
|
||||
# Export the drivers' types to the core code
|
||||
drivers_type_list = '#include <glib-object.h>\n'
|
||||
+drivers_type_list += '#include "fpi-context.h"\n'
|
||||
drivers_type_func = 'void fpi_get_driver_types(GArray *drivers)\n{\n\tGType t;\n'
|
||||
foreach driver: drivers
|
||||
drivers_type_list += 'extern GType (fpi_device_' + driver + '_get_type) (void);\n'
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,67 +0,0 @@
|
||||
From 130466c3c9cceae69b41dfb6c474d4d474722426 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 4 Dec 2019 13:44:08 +0100
|
||||
Subject: [PATCH 084/181] meson: Move generated source to fpi- prefix and use
|
||||
more readable code
|
||||
|
||||
Instead of concatenating strings, use an array of strings and finally join
|
||||
them using newline.
|
||||
---
|
||||
libfprint/meson.build | 4 ++--
|
||||
meson.build | 19 +++++++++++++------
|
||||
2 files changed, 15 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/libfprint/meson.build b/libfprint/meson.build
|
||||
index 99ebf73..f73aba3 100644
|
||||
--- a/libfprint/meson.build
|
||||
+++ b/libfprint/meson.build
|
||||
@@ -172,11 +172,11 @@ fpi_enums = gnome.mkenums_simple('fpi-enums',
|
||||
fpi_enums_h = fpi_enums[1]
|
||||
|
||||
drivers_sources += configure_file(input: 'empty_file',
|
||||
- output: 'fp-drivers.c',
|
||||
+ output: 'fpi-drivers.c',
|
||||
capture: true,
|
||||
command: [
|
||||
'echo',
|
||||
- drivers_type_list + '\n\n' + drivers_type_func
|
||||
+ '\n'.join(drivers_type_list + [] + drivers_type_func)
|
||||
])
|
||||
|
||||
mapfile = 'libfprint.ver'
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 265ce30..65077c5 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -117,15 +117,22 @@ foreach driver: drivers
|
||||
endforeach
|
||||
|
||||
# Export the drivers' types to the core code
|
||||
-drivers_type_list = '#include <glib-object.h>\n'
|
||||
-drivers_type_list += '#include "fpi-context.h"\n'
|
||||
-drivers_type_func = 'void fpi_get_driver_types(GArray *drivers)\n{\n\tGType t;\n'
|
||||
+drivers_type_list = []
|
||||
+drivers_type_func = []
|
||||
+drivers_type_list += '#include <glib-object.h>'
|
||||
+drivers_type_list += '#include "fpi-context.h"'
|
||||
+drivers_type_list += ''
|
||||
+drivers_type_func += 'void fpi_get_driver_types (GArray *drivers)'
|
||||
+drivers_type_func += ' {'
|
||||
+drivers_type_func += ' GType t;'
|
||||
+drivers_type_func += ''
|
||||
foreach driver: drivers
|
||||
- drivers_type_list += 'extern GType (fpi_device_' + driver + '_get_type) (void);\n'
|
||||
- drivers_type_func += ' t = fpi_device_' + driver + '_get_type(); g_array_append_val (drivers, t);\n'
|
||||
+ drivers_type_list += 'extern GType (fpi_device_' + driver + '_get_type) (void);'
|
||||
+ drivers_type_func += ' t = fpi_device_' + driver + '_get_type ();'
|
||||
+ drivers_type_func += ' g_array_append_val (drivers, t);\n'
|
||||
endforeach
|
||||
drivers_type_list += ''
|
||||
-drivers_type_func += '};'
|
||||
+drivers_type_func += '}'
|
||||
|
||||
root_inc = include_directories('.')
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,72 +0,0 @@
|
||||
From 59ef7ba5213ea17a451c2d0f2806a5f70181721c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 4 Dec 2019 14:27:33 +0100
|
||||
Subject: [PATCH 085/181] meson: Use stricter C arguments to compile libfprint
|
||||
|
||||
These are based on what mutter does, being a quite strict project on c code
|
||||
quality.
|
||||
---
|
||||
meson.build | 37 +++++++++++++++++++++++++++++++++----
|
||||
1 file changed, 33 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 65077c5..1561ebf 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -21,20 +21,49 @@ glib_version_def = 'GLIB_VERSION_@0@_@1@'.format(
|
||||
glib_min_version.split('.')[0], glib_min_version.split('.')[1])
|
||||
common_cflags = cc.get_supported_arguments([
|
||||
'-Wall',
|
||||
+ '-Wcast-align',
|
||||
+ '-Wformat-nonliteral',
|
||||
+ '-Wformat-security',
|
||||
+ '-Wformat=2',
|
||||
+ '-Wignored-qualifiers',
|
||||
+ '-Wlogical-op',
|
||||
+ '-Wmissing-declarations',
|
||||
+ '-Wmissing-format-attribute',
|
||||
+ '-Wmissing-include-dirs',
|
||||
+ '-Wmissing-noreturn',
|
||||
+ '-Wpointer-arith',
|
||||
+ '-Wshadow',
|
||||
'-Wtype-limits',
|
||||
'-Wundef',
|
||||
'-Wunused',
|
||||
- '-Wstrict-prototypes',
|
||||
- '-Werror-implicit-function-declaration',
|
||||
- '-Wshadow',
|
||||
+ '-Werror=address',
|
||||
+ '-Werror=array-bounds',
|
||||
+ '-Werror=empty-body',
|
||||
+ '-Werror=init-self',
|
||||
+ '-Werror=int-to-pointer-cast',
|
||||
+ '-Werror=main',
|
||||
+ '-Werror=missing-braces',
|
||||
+ '-Werror=nonnull',
|
||||
+ '-Werror=redundant-decls',
|
||||
+ '-Werror=return-type',
|
||||
+ '-Werror=sequence-point',
|
||||
+ '-Werror=trigraphs',
|
||||
+ '-Werror=write-strings',
|
||||
+ '-fno-strict-aliasing',
|
||||
'-DGLIB_VERSION_MIN_REQUIRED=' + glib_version_def,
|
||||
'-DGLIB_VERSION_MAX_ALLOWED=' + glib_version_def,
|
||||
'-D_GNU_SOURCE',
|
||||
'-DG_LOG_DOMAIN="libfprint"',
|
||||
])
|
||||
c_cflags = cc.get_supported_arguments([
|
||||
- '-fgnu89-inline',
|
||||
'-std=gnu99',
|
||||
+ '-Wimplicit-function-declaration',
|
||||
+ '-Wmissing-prototypes',
|
||||
+ '-Wnested-externs',
|
||||
+ '-Wold-style-definition',
|
||||
+ '-Wstrict-prototypes',
|
||||
+ '-Werror=implicit',
|
||||
+ '-Werror=pointer-to-int-cast',
|
||||
])
|
||||
add_project_arguments(common_cflags + c_cflags, language: 'c')
|
||||
add_project_arguments(common_cflags, language: 'cpp')
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,45 +0,0 @@
|
||||
From 2dc4f575b333bee8481cb9707ec6ef293b71e4dd Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Wed, 4 Dec 2019 14:28:08 +0100
|
||||
Subject: [PATCH 086/181] elan: Fix internal state machine to ensure correct
|
||||
deactivation
|
||||
|
||||
During calibration, the internal state was stored as INACTIVE. This is
|
||||
not true though, the device is actively running state machines.
|
||||
|
||||
Move the state update to the start of the operation, therefore ensuring
|
||||
we don't deactivate without completing the SSM.
|
||||
|
||||
Note that this will prevent a crash, but the driver still does not
|
||||
behave quite correctly when such a state change does happen. However,
|
||||
this is just a safety measure as the state change should not happen in
|
||||
the first place.
|
||||
|
||||
See: #203
|
||||
---
|
||||
libfprint/drivers/elan.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libfprint/drivers/elan.c b/libfprint/drivers/elan.c
|
||||
index 90a0306..9495a48 100644
|
||||
--- a/libfprint/drivers/elan.c
|
||||
+++ b/libfprint/drivers/elan.c
|
||||
@@ -776,7 +776,6 @@ calibrate_complete (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
}
|
||||
else
|
||||
{
|
||||
- self->dev_state = FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON;
|
||||
elan_capture (dev);
|
||||
}
|
||||
|
||||
@@ -966,6 +965,7 @@ elan_change_state (FpImageDevice *idev)
|
||||
{
|
||||
case FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON:
|
||||
/* activation completed or another enroll stage started */
|
||||
+ self->dev_state = FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON;
|
||||
elan_calibrate (dev);
|
||||
break;
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,103 +0,0 @@
|
||||
From 56126df4a2b5ecee1a9580e8d27f4d3d6f6925cd Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Wed, 4 Dec 2019 15:50:06 +0100
|
||||
Subject: [PATCH 087/181] image-device: Prevent deactivation when waiting for
|
||||
finger
|
||||
|
||||
At the end of enroll, the image device would put the driver into the
|
||||
AWAIT_FINGER_ON state and then deactivate the device afterwards. Doing
|
||||
this adds additional complexity to drivers which would need to handle
|
||||
both cancellation and normal deactivation from that state.
|
||||
|
||||
Only put the device into the AWAIT_FINGER_ON state when we know that
|
||||
another enroll stage is needed. This avoids the critical state
|
||||
transition simplifying the driver state machine.
|
||||
|
||||
Fixes: #203
|
||||
Fixes: 689aff023253e4ca970c9f76f9e4209188175d3d
|
||||
---
|
||||
libfprint/fp-image-device.c | 31 ++++++++++++++++++++++++++++---
|
||||
1 file changed, 28 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libfprint/fp-image-device.c b/libfprint/fp-image-device.c
|
||||
index e45b6a9..26c3cb0 100644
|
||||
--- a/libfprint/fp-image-device.c
|
||||
+++ b/libfprint/fp-image-device.c
|
||||
@@ -51,6 +51,7 @@ typedef struct
|
||||
FpImageDeviceState state;
|
||||
gboolean active;
|
||||
|
||||
+ gboolean enroll_await_on_pending;
|
||||
gint enroll_stage;
|
||||
|
||||
guint pending_activation_timeout_id;
|
||||
@@ -256,6 +257,7 @@ fp_image_device_start_capture_action (FpDevice *device)
|
||||
}
|
||||
|
||||
priv->enroll_stage = 0;
|
||||
+ priv->enroll_await_on_pending = FALSE;
|
||||
|
||||
/* The device might still be deactivating from a previous call.
|
||||
* In that situation, try to wait for a bit before reporting back an
|
||||
@@ -385,6 +387,22 @@ fp_image_device_init (FpImageDevice *self)
|
||||
|
||||
}
|
||||
|
||||
+static void
|
||||
+fp_image_device_enroll_maybe_await_finger_on (FpImageDevice *self)
|
||||
+{
|
||||
+ FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
|
||||
+
|
||||
+ if (priv->enroll_await_on_pending)
|
||||
+ {
|
||||
+ priv->enroll_await_on_pending = FALSE;
|
||||
+ fp_image_device_change_state (self, FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ priv->enroll_await_on_pending = TRUE;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void
|
||||
fpi_image_device_minutiae_detected (GObject *source_object, GAsyncResult *res, gpointer user_data)
|
||||
{
|
||||
@@ -446,11 +464,16 @@ fpi_image_device_minutiae_detected (GObject *source_object, GAsyncResult *res, g
|
||||
fpi_device_enroll_progress (device, priv->enroll_stage,
|
||||
g_steal_pointer (&print), error);
|
||||
|
||||
+ /* Start another scan or deactivate. */
|
||||
if (priv->enroll_stage == IMG_ENROLL_STAGES)
|
||||
{
|
||||
fpi_device_enroll_complete (device, g_object_ref (enroll_print), NULL);
|
||||
fp_image_device_deactivate (device);
|
||||
}
|
||||
+ else
|
||||
+ {
|
||||
+ fp_image_device_enroll_maybe_await_finger_on (FP_IMAGE_DEVICE (device));
|
||||
+ }
|
||||
}
|
||||
else if (action == FP_DEVICE_ACTION_VERIFY)
|
||||
{
|
||||
@@ -572,13 +595,15 @@ fpi_image_device_report_finger_status (FpImageDevice *self,
|
||||
* 2. We are still deactivating the device after an action completed
|
||||
* 3. We were waiting for finger removal to start the new action
|
||||
* Either way, we always end up deactivating except for the enroll case.
|
||||
- * XXX: This is not quite correct though, as we assume we need another finger
|
||||
- * scan even though we might be processing the last one (successfully).
|
||||
+ *
|
||||
+ * The enroll case is special as AWAIT_FINGER_ON should only happen after
|
||||
+ * minutiae detection to prevent deactivation (without cancellation)
|
||||
+ * from the AWAIT_FINGER_ON state.
|
||||
*/
|
||||
if (action != FP_DEVICE_ACTION_ENROLL)
|
||||
fp_image_device_deactivate (device);
|
||||
else
|
||||
- fp_image_device_change_state (self, FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON);
|
||||
+ fp_image_device_enroll_maybe_await_finger_on (self);
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,43 +0,0 @@
|
||||
From b71219b5f80b646ca9655799d33bdcccf67daa66 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Wed, 4 Dec 2019 17:14:35 +0100
|
||||
Subject: [PATCH 088/181] uru4000: Fix state change from IRQ handler
|
||||
|
||||
The IRQ handler will re-register itself automatically. However, if this
|
||||
happens after the callback is called, then the check whether the IRQ
|
||||
handler is running fails.
|
||||
|
||||
Re-start the IRQ handler before calling the callback. This way the state
|
||||
changes happening from the callback will see the correct IRQ handler
|
||||
registration state.
|
||||
|
||||
See: #205
|
||||
---
|
||||
libfprint/drivers/uru4000.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/uru4000.c b/libfprint/drivers/uru4000.c
|
||||
index 122544d..4385f29 100644
|
||||
--- a/libfprint/drivers/uru4000.c
|
||||
+++ b/libfprint/drivers/uru4000.c
|
||||
@@ -332,6 +332,8 @@ irq_handler (FpiUsbTransfer *transfer,
|
||||
return;
|
||||
}
|
||||
|
||||
+ start_irq_handler (imgdev);
|
||||
+
|
||||
type = GUINT16_FROM_BE (*((uint16_t *) data));
|
||||
fp_dbg ("recv irq type %04x", type);
|
||||
|
||||
@@ -344,8 +346,6 @@ irq_handler (FpiUsbTransfer *transfer,
|
||||
urudev->irq_cb (imgdev, NULL, type, urudev->irq_cb_data);
|
||||
else
|
||||
fp_dbg ("ignoring interrupt");
|
||||
-
|
||||
- start_irq_handler (imgdev);
|
||||
}
|
||||
|
||||
static void
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,38 +0,0 @@
|
||||
From 7c15f7083406a40314b818c508359cf1e6a7926d Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Wed, 4 Dec 2019 13:07:10 +0100
|
||||
Subject: [PATCH 089/181] uru4000: Fix control transfer request type
|
||||
|
||||
During porting the request type was accidentally changed from VENDOR to
|
||||
DEVICE. Change the type back to VENDOR.
|
||||
|
||||
See: #205
|
||||
---
|
||||
libfprint/drivers/uru4000.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/uru4000.c b/libfprint/drivers/uru4000.c
|
||||
index 4385f29..5128a12 100644
|
||||
--- a/libfprint/drivers/uru4000.c
|
||||
+++ b/libfprint/drivers/uru4000.c
|
||||
@@ -175,7 +175,7 @@ write_regs (FpImageDevice *dev, uint16_t first_reg,
|
||||
transfer->short_is_error = TRUE;
|
||||
fpi_usb_transfer_fill_control (transfer,
|
||||
G_USB_DEVICE_DIRECTION_HOST_TO_DEVICE,
|
||||
- G_USB_DEVICE_REQUEST_TYPE_STANDARD,
|
||||
+ G_USB_DEVICE_REQUEST_TYPE_VENDOR,
|
||||
G_USB_DEVICE_RECIPIENT_DEVICE,
|
||||
USB_RQ, first_reg, 0,
|
||||
num_regs);
|
||||
@@ -202,7 +202,7 @@ read_regs (FpImageDevice *dev, uint16_t first_reg,
|
||||
|
||||
fpi_usb_transfer_fill_control (transfer,
|
||||
G_USB_DEVICE_DIRECTION_DEVICE_TO_HOST,
|
||||
- G_USB_DEVICE_REQUEST_TYPE_STANDARD,
|
||||
+ G_USB_DEVICE_REQUEST_TYPE_VENDOR,
|
||||
G_USB_DEVICE_RECIPIENT_DEVICE,
|
||||
USB_RQ, first_reg, 0, num_regs);
|
||||
fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL, callback, user_data);
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,168 +0,0 @@
|
||||
From 3dcd18da12dfdcd2f0da01c4099dac91c80b16ea Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 4 Dec 2019 20:03:23 +0100
|
||||
Subject: [PATCH 090/181] fpi-ssm: Support named SSMs and use a fallback macro
|
||||
|
||||
Add fpi_ssm_new_full() that allows to pass a name to the state-machine
|
||||
constructor, not to change all the drivers, provide a fpi_ssm_new() macro
|
||||
that stringifies the nr_parameters value (usually an enum value) as the name
|
||||
so that we can use it for better debugging.
|
||||
---
|
||||
doc/libfprint-sections.txt | 1 +
|
||||
libfprint/fpi-ssm.c | 43 +++++++++++++++++++++++++++-----------
|
||||
libfprint/fpi-ssm.h | 9 +++++---
|
||||
3 files changed, 38 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/doc/libfprint-sections.txt b/doc/libfprint-sections.txt
|
||||
index 9fb01bd..9e17f8e 100644
|
||||
--- a/doc/libfprint-sections.txt
|
||||
+++ b/doc/libfprint-sections.txt
|
||||
@@ -211,6 +211,7 @@ fpi_print_bz3_match
|
||||
FpiSsmCompletedCallback
|
||||
FpiSsmHandlerCallback
|
||||
fpi_ssm_new
|
||||
+fpi_ssm_new_full
|
||||
fpi_ssm_free
|
||||
fpi_ssm_start
|
||||
fpi_ssm_start_subsm
|
||||
diff --git a/libfprint/fpi-ssm.c b/libfprint/fpi-ssm.c
|
||||
index 09a31e3..96336e1 100644
|
||||
--- a/libfprint/fpi-ssm.c
|
||||
+++ b/libfprint/fpi-ssm.c
|
||||
@@ -81,6 +81,7 @@
|
||||
struct _FpiSsm
|
||||
{
|
||||
FpDevice *dev;
|
||||
+ const char *name;
|
||||
FpiSsm *parentsm;
|
||||
gpointer ssm_data;
|
||||
GDestroyNotify ssm_data_destroy;
|
||||
@@ -103,13 +104,29 @@ struct _FpiSsm
|
||||
*
|
||||
* Allocate a new ssm, with @nr_states states. The @handler callback
|
||||
* will be called after each state transition.
|
||||
+ * This is a macro that calls fpi_ssm_new_full() using the stringified
|
||||
+ * version of @nr_states, so will work better with named parameters.
|
||||
+ *
|
||||
+ * Returns: a new #FpiSsm state machine
|
||||
+ */
|
||||
+
|
||||
+/**
|
||||
+ * fpi_ssm_new_full:
|
||||
+ * @dev: a #fp_dev fingerprint device
|
||||
+ * @handler: the callback function
|
||||
+ * @nr_states: the number of states
|
||||
+ * @name: the name of the state machine (for debug purposes)
|
||||
+ *
|
||||
+ * Allocate a new ssm, with @nr_states states. The @handler callback
|
||||
+ * will be called after each state transition.
|
||||
*
|
||||
* Returns: a new #FpiSsm state machine
|
||||
*/
|
||||
FpiSsm *
|
||||
-fpi_ssm_new (FpDevice *dev,
|
||||
- FpiSsmHandlerCallback handler,
|
||||
- int nr_states)
|
||||
+fpi_ssm_new_full (FpDevice *dev,
|
||||
+ FpiSsmHandlerCallback handler,
|
||||
+ int nr_states,
|
||||
+ const char *name)
|
||||
{
|
||||
FpiSsm *machine;
|
||||
|
||||
@@ -120,6 +137,7 @@ fpi_ssm_new (FpDevice *dev,
|
||||
machine->handler = handler;
|
||||
machine->nr_states = nr_states;
|
||||
machine->dev = dev;
|
||||
+ machine->name = g_strdup (name);
|
||||
machine->completed = TRUE;
|
||||
return machine;
|
||||
}
|
||||
@@ -251,6 +269,7 @@ fpi_ssm_free (FpiSsm *machine)
|
||||
if (machine->ssm_data_destroy)
|
||||
g_clear_pointer (&machine->ssm_data, machine->ssm_data_destroy);
|
||||
g_clear_pointer (&machine->error, g_error_free);
|
||||
+ g_clear_pointer (&machine->name, g_free);
|
||||
fpi_ssm_clear_delayed_action (machine);
|
||||
g_free (machine);
|
||||
}
|
||||
@@ -259,7 +278,7 @@ fpi_ssm_free (FpiSsm *machine)
|
||||
static void
|
||||
__ssm_call_handler (FpiSsm *machine)
|
||||
{
|
||||
- fp_dbg ("%p entering state %d", machine, machine->cur_state);
|
||||
+ fp_dbg ("%s entering state %d", machine->name, machine->cur_state);
|
||||
machine->handler (machine, machine->dev);
|
||||
}
|
||||
|
||||
@@ -337,9 +356,9 @@ fpi_ssm_mark_completed (FpiSsm *machine)
|
||||
machine->completed = TRUE;
|
||||
|
||||
if (machine->error)
|
||||
- fp_dbg ("%p completed with error: %s", machine, machine->error->message);
|
||||
+ fp_dbg ("%s completed with error: %s", machine->name, machine->error->message);
|
||||
else
|
||||
- fp_dbg ("%p completed successfully", machine);
|
||||
+ fp_dbg ("%s completed successfully", machine->name);
|
||||
if (machine->callback)
|
||||
{
|
||||
GError *error = machine->error ? g_error_copy (machine->error) : NULL;
|
||||
@@ -383,9 +402,9 @@ fpi_ssm_mark_completed_delayed (FpiSsm *machine,
|
||||
on_device_timeout_complete, cancellable,
|
||||
machine, NULL);
|
||||
|
||||
- source_name = g_strdup_printf ("[%s] ssm %p complete %d",
|
||||
+ source_name = g_strdup_printf ("[%s] ssm %s complete %d",
|
||||
fp_device_get_device_id (machine->dev),
|
||||
- machine, machine->cur_state + 1);
|
||||
+ machine->name, machine->cur_state + 1);
|
||||
g_source_set_name (machine->timeout, source_name);
|
||||
}
|
||||
|
||||
@@ -482,9 +501,9 @@ fpi_ssm_next_state_delayed (FpiSsm *machine,
|
||||
on_device_timeout_next_state, cancellable,
|
||||
machine, NULL);
|
||||
|
||||
- source_name = g_strdup_printf ("[%s] ssm %p jump to next state %d",
|
||||
+ source_name = g_strdup_printf ("[%s] ssm %s jump to next state %d",
|
||||
fp_device_get_device_id (machine->dev),
|
||||
- machine, machine->cur_state + 1);
|
||||
+ machine->name, machine->cur_state + 1);
|
||||
g_source_set_name (machine->timeout, source_name);
|
||||
}
|
||||
|
||||
@@ -559,9 +578,9 @@ fpi_ssm_jump_to_state_delayed (FpiSsm *machine,
|
||||
on_device_timeout_jump_to_state,
|
||||
cancellable, data, g_free);
|
||||
|
||||
- source_name = g_strdup_printf ("[%s] ssm %p jump to state %d",
|
||||
+ source_name = g_strdup_printf ("[%s] ssm %s jump to state %d",
|
||||
fp_device_get_device_id (machine->dev),
|
||||
- machine, state);
|
||||
+ machine->name, state);
|
||||
g_source_set_name (machine->timeout, source_name);
|
||||
}
|
||||
|
||||
diff --git a/libfprint/fpi-ssm.h b/libfprint/fpi-ssm.h
|
||||
index 3ef653e..d1334b5 100644
|
||||
--- a/libfprint/fpi-ssm.h
|
||||
+++ b/libfprint/fpi-ssm.h
|
||||
@@ -60,9 +60,12 @@ typedef void (*FpiSsmHandlerCallback)(FpiSsm *ssm,
|
||||
FpDevice *dev);
|
||||
|
||||
/* for library and drivers */
|
||||
-FpiSsm *fpi_ssm_new (FpDevice *dev,
|
||||
- FpiSsmHandlerCallback handler,
|
||||
- int nr_states);
|
||||
+#define fpi_ssm_new(dev, handler, nr_states) \
|
||||
+ fpi_ssm_new_full (dev, handler, nr_states, #nr_states)
|
||||
+FpiSsm *fpi_ssm_new_full (FpDevice *dev,
|
||||
+ FpiSsmHandlerCallback handler,
|
||||
+ int nr_states,
|
||||
+ const char *machine_name);
|
||||
void fpi_ssm_free (FpiSsm *machine);
|
||||
void fpi_ssm_start (FpiSsm *ssm,
|
||||
FpiSsmCompletedCallback callback);
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,59 +0,0 @@
|
||||
From 49f9cbb5670565c7ddbc78768ff0ec14d99269eb Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 4 Dec 2019 20:14:16 +0100
|
||||
Subject: [PATCH 091/181] fpi-ssm: Improve debugging of SSM using driver infos
|
||||
|
||||
Always mention the driver that is triggering it
|
||||
---
|
||||
libfprint/fpi-ssm.c | 16 +++++++++++-----
|
||||
1 file changed, 11 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/libfprint/fpi-ssm.c b/libfprint/fpi-ssm.c
|
||||
index 96336e1..8b3e4bd 100644
|
||||
--- a/libfprint/fpi-ssm.c
|
||||
+++ b/libfprint/fpi-ssm.c
|
||||
@@ -278,7 +278,8 @@ fpi_ssm_free (FpiSsm *machine)
|
||||
static void
|
||||
__ssm_call_handler (FpiSsm *machine)
|
||||
{
|
||||
- fp_dbg ("%s entering state %d", machine->name, machine->cur_state);
|
||||
+ fp_dbg ("[%s] %s entering state %d", fp_device_get_driver (machine->dev),
|
||||
+ machine->name, machine->cur_state);
|
||||
machine->handler (machine, machine->dev);
|
||||
}
|
||||
|
||||
@@ -356,9 +357,11 @@ fpi_ssm_mark_completed (FpiSsm *machine)
|
||||
machine->completed = TRUE;
|
||||
|
||||
if (machine->error)
|
||||
- fp_dbg ("%s completed with error: %s", machine->name, machine->error->message);
|
||||
+ fp_dbg ("[%s] %s completed with error: %s", fp_device_get_driver (machine->dev),
|
||||
+ machine->name, machine->error->message);
|
||||
else
|
||||
- fp_dbg ("%s completed successfully", machine->name);
|
||||
+ fp_dbg ("[%s] %s completed successfully", fp_device_get_driver (machine->dev),
|
||||
+ machine->name);
|
||||
if (machine->callback)
|
||||
{
|
||||
GError *error = machine->error ? g_error_copy (machine->error) : NULL;
|
||||
@@ -421,12 +424,15 @@ fpi_ssm_mark_failed (FpiSsm *machine, GError *error)
|
||||
g_assert (error);
|
||||
if (machine->error)
|
||||
{
|
||||
- fp_warn ("SSM already has an error set, ignoring new error %s", error->message);
|
||||
+ fp_warn ("[%s] SSM %s already has an error set, ignoring new error %s",
|
||||
+ fp_device_get_driver (machine->dev), machine->name, error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
- fp_dbg ("SSM failed in state %d with error: %s", machine->cur_state, error->message);
|
||||
+ fp_dbg ("[%s] SSM %s failed in state %d with error: %s",
|
||||
+ fp_device_get_driver (machine->dev), machine->name,
|
||||
+ machine->cur_state, error->message);
|
||||
machine->error = g_steal_pointer (&error);
|
||||
fpi_ssm_mark_completed (machine);
|
||||
}
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,61 +0,0 @@
|
||||
From 170fca1c03aa1becb5e5dc84fa9c61a3f7cf1a32 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
||||
Date: Wed, 4 Dec 2019 20:14:49 +0100
|
||||
Subject: [PATCH 092/181] vfs0051: Use named SSMs for usb async exchanges
|
||||
|
||||
---
|
||||
libfprint/drivers/vfs5011.c | 16 +++++++++-------
|
||||
1 file changed, 9 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/vfs5011.c b/libfprint/drivers/vfs5011.c
|
||||
index 265495a..4af3207 100644
|
||||
--- a/libfprint/drivers/vfs5011.c
|
||||
+++ b/libfprint/drivers/vfs5011.c
|
||||
@@ -190,11 +190,13 @@ usbexchange_loop (FpiSsm *ssm, FpDevice *_dev)
|
||||
|
||||
static void
|
||||
usb_exchange_async (FpiSsm *ssm,
|
||||
- struct usbexchange_data *data)
|
||||
+ struct usbexchange_data *data,
|
||||
+ const char *exchange_name)
|
||||
{
|
||||
- FpiSsm *subsm = fpi_ssm_new (FP_DEVICE (data->device),
|
||||
- usbexchange_loop,
|
||||
- data->stepcount);
|
||||
+ FpiSsm *subsm = fpi_ssm_new_full (FP_DEVICE (data->device),
|
||||
+ usbexchange_loop,
|
||||
+ data->stepcount,
|
||||
+ exchange_name);
|
||||
|
||||
fpi_ssm_set_data (subsm, data, NULL);
|
||||
fpi_ssm_start_subsm (ssm, subsm);
|
||||
@@ -684,7 +686,7 @@ activate_loop (FpiSsm *ssm, FpDevice *_dev)
|
||||
self->init_sequence.receive_buf =
|
||||
g_malloc0 (VFS5011_RECEIVE_BUF_SIZE);
|
||||
self->init_sequence.timeout = 1000;
|
||||
- usb_exchange_async (ssm, &self->init_sequence);
|
||||
+ usb_exchange_async (ssm, &self->init_sequence, "ACTIVATE REQUEST");
|
||||
break;
|
||||
|
||||
case DEV_ACTIVATE_INIT_COMPLETE:
|
||||
@@ -716,7 +718,7 @@ activate_loop (FpiSsm *ssm, FpDevice *_dev)
|
||||
self->init_sequence.receive_buf =
|
||||
g_malloc0 (VFS5011_RECEIVE_BUF_SIZE);
|
||||
self->init_sequence.timeout = VFS5011_DEFAULT_WAIT_TIMEOUT;
|
||||
- usb_exchange_async (ssm, &self->init_sequence);
|
||||
+ usb_exchange_async (ssm, &self->init_sequence, "PREPARE CAPTURE");
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -769,7 +771,7 @@ open_loop (FpiSsm *ssm, FpDevice *_dev)
|
||||
self->init_sequence.receive_buf =
|
||||
g_malloc0 (VFS5011_RECEIVE_BUF_SIZE);
|
||||
self->init_sequence.timeout = VFS5011_DEFAULT_WAIT_TIMEOUT;
|
||||
- usb_exchange_async (ssm, &self->init_sequence);
|
||||
+ usb_exchange_async (ssm, &self->init_sequence, "DEVICE OPEN");
|
||||
break;
|
||||
}
|
||||
;
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,56 +0,0 @@
|
||||
From dfef13a3eb14ded653a0f1226eb5903e0b81b772 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Wed, 4 Dec 2019 19:54:07 +0100
|
||||
Subject: [PATCH 093/181] image-device: Print warning for incorrect
|
||||
deactivation
|
||||
|
||||
Drivers may not handle deactivation properly when they are awaiting a
|
||||
finger. This should be prevented by the internal FpImageDevice state
|
||||
machine.
|
||||
---
|
||||
libfprint/fp-image-device.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/libfprint/fp-image-device.c b/libfprint/fp-image-device.c
|
||||
index 26c3cb0..252f414 100644
|
||||
--- a/libfprint/fp-image-device.c
|
||||
+++ b/libfprint/fp-image-device.c
|
||||
@@ -50,6 +50,7 @@ typedef struct
|
||||
{
|
||||
FpImageDeviceState state;
|
||||
gboolean active;
|
||||
+ gboolean cancelling;
|
||||
|
||||
gboolean enroll_await_on_pending;
|
||||
gint enroll_stage;
|
||||
@@ -140,6 +141,9 @@ fp_image_device_deactivate (FpDevice *device)
|
||||
fp_dbg ("Already deactivated, ignoring request.");
|
||||
return;
|
||||
}
|
||||
+ if (!priv->cancelling && priv->state == FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON)
|
||||
+ g_warning ("Deactivating image device while waiting for finger, this should not happen.");
|
||||
+
|
||||
priv->state = FP_IMAGE_DEVICE_STATE_INACTIVE;
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FPI_STATE]);
|
||||
|
||||
@@ -203,6 +207,7 @@ static void
|
||||
fp_image_device_cancel_action (FpDevice *device)
|
||||
{
|
||||
FpImageDevice *self = FP_IMAGE_DEVICE (device);
|
||||
+ FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
|
||||
FpDeviceAction action;
|
||||
|
||||
action = fpi_device_get_current_action (device);
|
||||
@@ -214,7 +219,9 @@ fp_image_device_cancel_action (FpDevice *device)
|
||||
action == FP_DEVICE_ACTION_IDENTIFY ||
|
||||
action == FP_DEVICE_ACTION_CAPTURE)
|
||||
{
|
||||
+ priv->cancelling = TRUE;
|
||||
fp_image_device_deactivate (FP_DEVICE (self));
|
||||
+ priv->cancelling = FALSE;
|
||||
|
||||
/* XXX: Some nicer way of doing this would be good. */
|
||||
fpi_device_action_error (FP_DEVICE (self),
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,42 +0,0 @@
|
||||
From c064261975a12c68d34da8f52ff11942842a4e61 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Wed, 4 Dec 2019 19:55:25 +0100
|
||||
Subject: [PATCH 094/181] virtual-image: Only print warnings for actual errors
|
||||
|
||||
No need to warn for lost connections (if we don't expect more data) or
|
||||
cancellations.
|
||||
---
|
||||
libfprint/drivers/virtual-image.c | 7 ++++---
|
||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/virtual-image.c b/libfprint/drivers/virtual-image.c
|
||||
index c271c7a..07a631f 100644
|
||||
--- a/libfprint/drivers/virtual-image.c
|
||||
+++ b/libfprint/drivers/virtual-image.c
|
||||
@@ -75,9 +75,9 @@ recv_image_img_recv_cb (GObject *source_object,
|
||||
{
|
||||
if (!success)
|
||||
{
|
||||
- g_warning ("Error receiving header for image data: %s", error->message);
|
||||
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
||||
return;
|
||||
+ g_warning ("Error receiving header for image data: %s", error->message);
|
||||
}
|
||||
|
||||
self = FPI_DEVICE_VIRTUAL_IMAGE (user_data);
|
||||
@@ -113,9 +113,10 @@ recv_image_hdr_recv_cb (GObject *source_object,
|
||||
{
|
||||
if (!success)
|
||||
{
|
||||
- g_warning ("Error receiving header for image data: %s", error->message);
|
||||
- if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
||||
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) ||
|
||||
+ g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CLOSED))
|
||||
return;
|
||||
+ g_warning ("Error receiving header for image data: %s", error->message);
|
||||
}
|
||||
|
||||
self = FPI_DEVICE_VIRTUAL_IMAGE (user_data);
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,68 +0,0 @@
|
||||
From 57203198c5d777fedd50b4509b765dfa08b73992 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Wed, 4 Dec 2019 19:56:54 +0100
|
||||
Subject: [PATCH 095/181] virtual-image: Allow fine control over the finger
|
||||
state
|
||||
|
||||
Add commands to disable automatic finger reporting for images and to
|
||||
send a specific finger report. This is useful to test more code paths
|
||||
inside the image-device code.
|
||||
---
|
||||
libfprint/drivers/virtual-image.c | 19 +++++++++++++++++--
|
||||
1 file changed, 17 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libfprint/drivers/virtual-image.c b/libfprint/drivers/virtual-image.c
|
||||
index 07a631f..33f322e 100644
|
||||
--- a/libfprint/drivers/virtual-image.c
|
||||
+++ b/libfprint/drivers/virtual-image.c
|
||||
@@ -47,6 +47,7 @@ struct _FpDeviceVirtualImage
|
||||
gint socket_fd;
|
||||
gint client_fd;
|
||||
|
||||
+ gboolean automatic_finger;
|
||||
FpImage *recv_img;
|
||||
gint recv_img_hdr[2];
|
||||
};
|
||||
@@ -89,9 +90,11 @@ recv_image_img_recv_cb (GObject *source_object,
|
||||
self = FPI_DEVICE_VIRTUAL_IMAGE (user_data);
|
||||
device = FP_IMAGE_DEVICE (self);
|
||||
|
||||
- fpi_image_device_report_finger_status (device, TRUE);
|
||||
+ if (self->automatic_finger)
|
||||
+ fpi_image_device_report_finger_status (device, TRUE);
|
||||
fpi_image_device_image_captured (device, g_steal_pointer (&self->recv_img));
|
||||
- fpi_image_device_report_finger_status (device, FALSE);
|
||||
+ if (self->automatic_finger)
|
||||
+ fpi_image_device_report_finger_status (device, FALSE);
|
||||
|
||||
/* And, listen for more images from the same client. */
|
||||
recv_image (self, G_INPUT_STREAM (source_object));
|
||||
@@ -148,6 +151,17 @@ recv_image_hdr_recv_cb (GObject *source_object,
|
||||
fpi_device_error_new (self->recv_img_hdr[1]));
|
||||
break;
|
||||
|
||||
+ case -3:
|
||||
+ /* -3 sets/clears automatic finger detection for images */
|
||||
+ self->automatic_finger = !!self->recv_img_hdr[1];
|
||||
+ break;
|
||||
+
|
||||
+ case -4:
|
||||
+ /* -4 submits a finger detection report */
|
||||
+ fpi_image_device_report_finger_status (FP_IMAGE_DEVICE (self),
|
||||
+ !!self->recv_img_hdr[1]);
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
/* disconnect client, it didn't play fair */
|
||||
g_io_stream_close (G_IO_STREAM (self->connection), NULL, NULL);
|
||||
@@ -214,6 +228,7 @@ new_connection_cb (GObject *source_object, GAsyncResult *res, gpointer user_data
|
||||
}
|
||||
|
||||
dev->connection = connection;
|
||||
+ dev->automatic_finger = TRUE;
|
||||
stream = g_io_stream_get_input_stream (G_IO_STREAM (connection));
|
||||
|
||||
recv_image (dev, stream);
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,106 +0,0 @@
|
||||
From 77adf957d514715ea23f0810c07253cf3b97156e Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Wed, 4 Dec 2019 19:58:26 +0100
|
||||
Subject: [PATCH 096/181] tests: Update helper functions for new virtual-image
|
||||
features
|
||||
|
||||
This also changes the code to keep the connection open and adds
|
||||
automatic mainloop iteration to ensure the driver processes the request.
|
||||
This is important so we will not deadlock when we send multiple
|
||||
requests.
|
||||
---
|
||||
tests/virtual-image.py | 65 +++++++++++++++++++++++++-----------------
|
||||
1 file changed, 39 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/tests/virtual-image.py b/tests/virtual-image.py
|
||||
index 363219a..86bd86d 100755
|
||||
--- a/tests/virtual-image.py
|
||||
+++ b/tests/virtual-image.py
|
||||
@@ -24,20 +24,6 @@ if wrapper:
|
||||
os.unsetenv('LIBFPRINT_TEST_WRAPPER')
|
||||
sys.exit(subprocess.check_call(wrap_cmd))
|
||||
|
||||
-class Connection:
|
||||
-
|
||||
- def __init__(self, addr):
|
||||
- self.addr = addr
|
||||
-
|
||||
- def __enter__(self):
|
||||
- self.con = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
- self.con.connect(self.addr)
|
||||
- return self.con
|
||||
-
|
||||
- def __exit__(self, exc_type, exc_val, exc_tb):
|
||||
- self.con.close()
|
||||
- del self.con
|
||||
-
|
||||
def load_image(img):
|
||||
png = cairo.ImageSurface.create_from_png(img)
|
||||
|
||||
@@ -101,24 +87,51 @@ class VirtualImage(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.dev.open_sync()
|
||||
|
||||
+ self.con = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
+ self.con.connect(self.sockaddr)
|
||||
+
|
||||
def tearDown(self):
|
||||
+ self.con.close()
|
||||
+ del self.con
|
||||
self.dev.close_sync()
|
||||
|
||||
- def report_finger(self, state):
|
||||
- with Connection(self.sockaddr) as con:
|
||||
- con.write(struct.pack('ii', -1, 1 if state else 0))
|
||||
-
|
||||
- def send_image(self, image):
|
||||
+ def send_retry(self, retry_error=1, iterate=True):
|
||||
+ # The default (1) is too-short
|
||||
+ self.sendall(struct.pack('ii', -1, retry_error))
|
||||
+ while iterate and ctx.pending():
|
||||
+ ctx.iteration(False)
|
||||
+
|
||||
+ def send_error(self, device_error=0, iterate=True):
|
||||
+ # The default (0) is a generic error
|
||||
+ self.sendall(struct.pack('ii', -1, retry_error))
|
||||
+ while iterate and ctx.pending():
|
||||
+ ctx.iteration(False)
|
||||
+
|
||||
+ def send_finger_automatic(self, automatic, iterate=True):
|
||||
+ # Set whether finger on/off is reported around images
|
||||
+ self.con.sendall(struct.pack('ii', -3, 1 if automatic else 0))
|
||||
+ while iterate and ctx.pending():
|
||||
+ ctx.iteration(False)
|
||||
+
|
||||
+ def send_finger_report(self, has_finger, iterate=True):
|
||||
+ # Send finger on/off
|
||||
+ self.con.sendall(struct.pack('ii', -4, 1 if has_finger else 0))
|
||||
+ while iterate and ctx.pending():
|
||||
+ ctx.iteration(False)
|
||||
+
|
||||
+ def send_image(self, image, iterate=True):
|
||||
img = self.prints[image]
|
||||
- with Connection(self.sockaddr) as con:
|
||||
- mem = img.get_data()
|
||||
- mem = mem.tobytes()
|
||||
- assert len(mem) == img.get_width() * img.get_height()
|
||||
|
||||
- encoded_img = struct.pack('ii', img.get_width(), img.get_height())
|
||||
- encoded_img += mem
|
||||
+ mem = img.get_data()
|
||||
+ mem = mem.tobytes()
|
||||
+ assert len(mem) == img.get_width() * img.get_height()
|
||||
+
|
||||
+ encoded_img = struct.pack('ii', img.get_width(), img.get_height())
|
||||
+ encoded_img += mem
|
||||
|
||||
- con.sendall(encoded_img)
|
||||
+ self.con.sendall(encoded_img)
|
||||
+ while iterate and ctx.pending():
|
||||
+ ctx.iteration(False)
|
||||
|
||||
def test_capture_prevents_close(self):
|
||||
cancel = Gio.Cancellable()
|
||||
--
|
||||
2.24.1
|
||||
|
@ -1,34 +0,0 @@
|
||||
From e4c2c0a75a3032b26c5a7b361a0449120bb46529 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Berg <bberg@redhat.com>
|
||||
Date: Wed, 4 Dec 2019 20:00:49 +0100
|
||||
Subject: [PATCH 097/181] tests: Test finger removal after minutiae scan
|
||||
completion
|
||||
|
||||
---
|
||||
tests/virtual-image.py | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/tests/virtual-image.py b/tests/virtual-image.py
|
||||
index 86bd86d..87c221b 100755
|
||||
--- a/tests/virtual-image.py
|
||||
+++ b/tests/virtual-image.py
|
||||
@@ -182,10 +182,16 @@ class VirtualImage(unittest.TestCase):
|
||||
while self._step < 1:
|
||||
ctx.iteration(True)
|
||||
|
||||
+ # Test the image-device path where the finger is removed after
|
||||
+ # the minutiae scan is completed.
|
||||
+ self.send_finger_automatic(False)
|
||||
+ self.send_finger_report(True)
|
||||
self.send_image(image)
|
||||
while self._step < 2:
|
||||
ctx.iteration(True)
|
||||
+ self.send_finger_report(False)
|
||||
|
||||
+ self.send_finger_automatic(True)
|
||||
self.send_image(image)
|
||||
while self._step < 3:
|
||||
ctx.iteration(True)
|
||||
--
|
||||
2.24.1
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user