From 01b0f7aba0f9389b3bedadd0fe463971b7ad6b4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 28 Oct 2021 16:39:35 +0200 Subject: [PATCH 01/11] doc: Include missing types (SPI) and functions to the Drivers API --- doc/libfprint-2-sections.txt | 18 ++++++++++++++++++ doc/libfprint-docs.xml | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/doc/libfprint-2-sections.txt b/doc/libfprint-2-sections.txt index 33189854..d355ba88 100644 --- a/doc/libfprint-2-sections.txt +++ b/doc/libfprint-2-sections.txt @@ -179,6 +179,7 @@ fpi_device_enroll_complete fpi_device_verify_complete fpi_device_identify_complete fpi_device_capture_complete +fpi_device_clear_storage_complete fpi_device_delete_complete fpi_device_list_complete fpi_device_suspend_complete @@ -286,3 +287,20 @@ FPI_TYPE_USB_TRANSFER fpi_usb_transfer_get_type +
+fpi-spi-transfer +FpiSpiTransferCallback +FpiSpiTransfer +fpi_spi_transfer_new +fpi_spi_transfer_ref +fpi_spi_transfer_unref +fpi_spi_transfer_write +fpi_spi_transfer_write_full +fpi_spi_transfer_read +fpi_spi_transfer_read_full +fpi_spi_transfer_submit +fpi_spi_transfer_submit_sync + +FPI_TYPE_SPI_TRANSFER +fpi_spi_transfer_get_type +
diff --git a/doc/libfprint-docs.xml b/doc/libfprint-docs.xml index b866aab0..0a57efb4 100644 --- a/doc/libfprint-docs.xml +++ b/doc/libfprint-docs.xml @@ -41,7 +41,8 @@ - USB and State Machine helpers + USB, SPI and State Machine helpers + From 378fae0ea2105058a78bb0960549ef301a8690ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 28 Oct 2021 16:56:11 +0200 Subject: [PATCH 02/11] doc: Add missing Drivers API SSM functions --- doc/libfprint-2-sections.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/libfprint-2-sections.txt b/doc/libfprint-2-sections.txt index d355ba88..91258b62 100644 --- a/doc/libfprint-2-sections.txt +++ b/doc/libfprint-2-sections.txt @@ -260,7 +260,10 @@ fpi_ssm_get_device fpi_ssm_get_error fpi_ssm_dup_error fpi_ssm_get_cur_state +fpi_ssm_spi_transfer_cb +fpi_ssm_spi_transfer_with_weak_pointer_cb fpi_ssm_usb_transfer_cb +fpi_ssm_usb_transfer_with_weak_pointer_cb FpiSsm From ec8a9ba0fd83c89b6b98a8e5100ad11e9ccd3c20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Sun, 31 Oct 2021 19:19:41 +0100 Subject: [PATCH 03/11] fpi-device: Adjust padding based on actual gpointer size In some architectures pointer size is different. So let's adapt it to it --- libfprint/fpi-device.h | 12 ++++++++++++ tests/test-fp-todv1-types.c | 4 ++-- tests/tod-drivers/base-fpi-device.h | 12 ++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/libfprint/fpi-device.h b/libfprint/fpi-device.h index aba30b10..299b1d75 100644 --- a/libfprint/fpi-device.h +++ b/libfprint/fpi-device.h @@ -73,7 +73,13 @@ struct _FpIdEntry /*< private >*/ /* padding for future expansion */ +#if GLIB_SIZEOF_VOID_P == 8 gpointer _padding_dummy[13]; +#elif GLIB_SIZEOF_VOID_P == 4 + gpointer _padding_dummy[11]; +#else + G_STATIC_ASSERT("Unexpected pointer size") +#endif }; /** @@ -186,7 +192,13 @@ struct _FpDeviceClass /*< private >*/ /* padding for future expansion */ +#if GLIB_SIZEOF_VOID_P == 8 gpointer _padding_dummy[27]; +#elif GLIB_SIZEOF_VOID_P == 4 + gpointer _padding_dummy[26]; +#else + G_STATIC_ASSERT("Unexpected pointer size") +#endif }; void fpi_device_class_auto_initialize_features (FpDeviceClass *device_class); diff --git a/tests/test-fp-todv1-types.c b/tests/test-fp-todv1-types.c index 6846faa8..b9bbea05 100644 --- a/tests/test-fp-todv1-types.c +++ b/tests/test-fp-todv1-types.c @@ -109,13 +109,13 @@ check_compatiblity_auto (GType old_type, GType current_type) type ## TODV ## major ## _ ## minor ## _ ## micro #define check_struct_size(type, major, minor, micro) \ - g_debug ("Checking " # type " size @ " G_STRLOC); \ + g_debug ("Checking " # type " v" #major "." #minor "." #micro " size @ " G_STRLOC); \ g_assert_cmpuint (sizeof (tod_versioned_type (type, major, minor, micro)), \ ==, \ sizeof (type)) #define check_struct_member(type, major, minor, micro, member) \ - g_debug ("Checking " # type "'s " # member " offset @ " G_STRLOC); \ + g_debug ("Checking " # type " v" #major "." #minor "." #micro "'s " # member " offset @ " G_STRLOC); \ g_assert_cmpuint (G_STRUCT_OFFSET (tod_versioned_type (type, major, minor, micro), member), \ ==, \ G_STRUCT_OFFSET (type, member)) diff --git a/tests/tod-drivers/base-fpi-device.h b/tests/tod-drivers/base-fpi-device.h index fe68e5bc..9be6a720 100644 --- a/tests/tod-drivers/base-fpi-device.h +++ b/tests/tod-drivers/base-fpi-device.h @@ -172,7 +172,13 @@ struct _FpIdEntryTODV1_92_0 /*< private >*/ /* padding for future expansion */ +#if GLIB_SIZEOF_VOID_P == 8 gpointer _padding_dummy[13]; +#elif GLIB_SIZEOF_VOID_P == 4 + gpointer _padding_dummy[11]; +#else + G_STATIC_ASSERT("Unexpected pointer size") +#endif }; typedef struct _FpIdEntryTODV1_92_0 FpIdEntryTODV1_92_0; @@ -260,7 +266,13 @@ struct _FpDeviceClassTODV1_94_0 /*< private >*/ /* padding for future expansion */ +#if GLIB_SIZEOF_VOID_P == 8 gpointer _padding_dummy[27]; +#elif GLIB_SIZEOF_VOID_P == 4 + gpointer _padding_dummy[26]; +#else + G_STATIC_ASSERT("Unexpected pointer size") +#endif }; typedef struct _FpDeviceClassTODV1_94_0 FpDeviceClassTODV1_94_0; From 608a9f10df73fdaf56bd69300769479773bf669c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Sun, 31 Oct 2021 22:22:56 +0100 Subject: [PATCH 04/11] libfprint: Use a macro to easily compute TOD padding --- libfprint/fpi-assembling.h | 5 +++- libfprint/fpi-device.h | 23 +++++++--------- libfprint/fpi-image-device.h | 2 +- libfprint/fpi-image.h | 3 ++- libfprint/fpi-spi-transfer.h | 2 +- libfprint/fpi-usb-transfer.h | 3 +-- libfprint/tod/tod-macros.h | 32 +++++++++++++++++++++++ tests/tod-drivers/base-fp-device.h | 2 ++ tests/tod-drivers/base-fpi-device.h | 27 +++++++------------ tests/tod-drivers/base-fpi-image-device.h | 2 +- tests/tod-drivers/base-fpi-image.h | 4 ++- tests/tod-drivers/base-fpi-spi.h | 2 +- tests/tod-drivers/base-fpi-usb.h | 3 +-- 13 files changed, 68 insertions(+), 42 deletions(-) create mode 100644 libfprint/tod/tod-macros.h diff --git a/libfprint/fpi-assembling.h b/libfprint/fpi-assembling.h index b56aa26e..808b66b8 100644 --- a/libfprint/fpi-assembling.h +++ b/libfprint/fpi-assembling.h @@ -20,6 +20,7 @@ #pragma once #include "fp-image.h" +#include "tod/tod-macros.h" /** * fpi_frame: @@ -110,7 +111,9 @@ struct fpi_line_asmbl_ctx unsigned char (*get_pixel)(struct fpi_line_asmbl_ctx *ctx, GSList *line, unsigned int x); - gpointer _padding_dummy[32]; + + /*< private >*/ + TOD_PADDING (32, 0); }; FpImage *fpi_assemble_lines (struct fpi_line_asmbl_ctx *ctx, diff --git a/libfprint/fpi-device.h b/libfprint/fpi-device.h index 299b1d75..76f07c40 100644 --- a/libfprint/fpi-device.h +++ b/libfprint/fpi-device.h @@ -23,6 +23,7 @@ #include "fp-device.h" #include "fp-image.h" #include "fpi-print.h" +#include "tod/tod-macros.h" /** * FpiDeviceUdevSubtype: @@ -73,13 +74,10 @@ struct _FpIdEntry /*< private >*/ /* padding for future expansion */ -#if GLIB_SIZEOF_VOID_P == 8 - gpointer _padding_dummy[13]; -#elif GLIB_SIZEOF_VOID_P == 4 - gpointer _padding_dummy[11]; -#else - G_STATIC_ASSERT("Unexpected pointer size") -#endif + TOD_PADDING_ALIGNED (16, + sizeof (guint) * 2 + + sizeof (FpiDeviceUdevSubtypeFlags) + + sizeof (gpointer)); }; /** @@ -192,13 +190,10 @@ struct _FpDeviceClass /*< private >*/ /* padding for future expansion */ -#if GLIB_SIZEOF_VOID_P == 8 - gpointer _padding_dummy[27]; -#elif GLIB_SIZEOF_VOID_P == 4 - gpointer _padding_dummy[26]; -#else - G_STATIC_ASSERT("Unexpected pointer size") -#endif + TOD_PADDING_ALIGNED8 (32, + sizeof (FpDeviceFeature) + + sizeof (gint32) * 2 + + sizeof (gpointer) * 3); }; void fpi_device_class_auto_initialize_features (FpDeviceClass *device_class); diff --git a/libfprint/fpi-image-device.h b/libfprint/fpi-image-device.h index f1a6efdb..63e70b13 100644 --- a/libfprint/fpi-image-device.h +++ b/libfprint/fpi-image-device.h @@ -117,7 +117,7 @@ struct _FpImageDeviceClass /*< private >*/ /* padding for future expansion */ - gpointer _padding_dummy[32]; + TOD_PADDING (32, 0); }; void fpi_image_device_set_bz3_threshold (FpImageDevice *self, diff --git a/libfprint/fpi-image.h b/libfprint/fpi-image.h index 0ae19f9f..7c54a71f 100644 --- a/libfprint/fpi-image.h +++ b/libfprint/fpi-image.h @@ -21,6 +21,7 @@ #pragma once #include "fp-image.h" +#include "tod/tod-macros.h" /** * FpiImageFlags: @@ -69,7 +70,7 @@ struct _FpImage GPtrArray *minutiae; guint ref_count; - gpointer _padding_dummy[32]; + TOD_PADDING (32, 0); }; gint fpi_std_sq_dev (const guint8 *buf, diff --git a/libfprint/fpi-spi-transfer.h b/libfprint/fpi-spi-transfer.h index 0b75673b..e545e6ad 100644 --- a/libfprint/fpi-spi-transfer.h +++ b/libfprint/fpi-spi-transfer.h @@ -75,7 +75,7 @@ struct _FpiSpiTransfer GDestroyNotify free_buffer_rd; /* padding for future expansion */ - gpointer _padding_dummy[32]; + TOD_PADDING (32, 0); }; GType fpi_spi_transfer_get_type (void) G_GNUC_CONST; diff --git a/libfprint/fpi-usb-transfer.h b/libfprint/fpi-usb-transfer.h index 7f0deacd..8b862b4c 100644 --- a/libfprint/fpi-usb-transfer.h +++ b/libfprint/fpi-usb-transfer.h @@ -103,9 +103,8 @@ struct _FpiUsbTransfer /* Data free function */ GDestroyNotify free_buffer; - /*< private >*/ /* padding for future expansion */ - gpointer _padding_dummy[32]; + TOD_PADDING (32, 0); }; GType fpi_usb_transfer_get_type (void) G_GNUC_CONST; diff --git a/libfprint/tod/tod-macros.h b/libfprint/tod/tod-macros.h new file mode 100644 index 00000000..4adfd941 --- /dev/null +++ b/libfprint/tod/tod-macros.h @@ -0,0 +1,32 @@ +/* + * Shared library loader for libfprint + * Copyright (C) 2021 Marco Trevisan + * + * 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 + +#define TOD_PADDING(original, wasted) \ + char _tod_expansion_padding[(GLIB_SIZEOF_VOID_P * (original)) - (wasted)]; + +#define TOD_PADDING_ALIGNED(original, wasted) \ + TOD_PADDING (original, (wasted) + GLIB_SIZEOF_VOID_P) + +#define TOD_PADDING_ALIGNED4(original, wasted) \ + TOD_PADDING (original, (wasted) + (GLIB_SIZEOF_VOID_P == 4 ? GLIB_SIZEOF_VOID_P : 0)) + +#define TOD_PADDING_ALIGNED8(original, wasted) \ + TOD_PADDING (original, (wasted) + (GLIB_SIZEOF_VOID_P == 8 ? GLIB_SIZEOF_VOID_P : 0)) diff --git a/tests/tod-drivers/base-fp-device.h b/tests/tod-drivers/base-fp-device.h index 600bdf9f..5d3bbc26 100644 --- a/tests/tod-drivers/base-fp-device.h +++ b/tests/tod-drivers/base-fp-device.h @@ -19,6 +19,8 @@ #pragma once +#include "tod/tod-macros.h" + typedef struct _FpDevice FpDevice; typedef enum { diff --git a/tests/tod-drivers/base-fpi-device.h b/tests/tod-drivers/base-fpi-device.h index 9be6a720..0e847611 100644 --- a/tests/tod-drivers/base-fpi-device.h +++ b/tests/tod-drivers/base-fpi-device.h @@ -43,7 +43,7 @@ struct _FpIdEntryTODV1_90_1 /*< private >*/ /* padding for future expansion */ - gpointer _padding_dummy[16]; + TOD_PADDING (16, 0); }; struct _FpDeviceClassTODV1_90_1 @@ -78,7 +78,7 @@ struct _FpDeviceClassTODV1_90_1 /*< private >*/ /* padding for future expansion */ - gpointer _padding_dummy[32]; + TOD_PADDING (32, 0); }; typedef struct _FpDeviceClassTODV1_90_1 FpDeviceClassTODV1_90_1; @@ -172,13 +172,9 @@ struct _FpIdEntryTODV1_92_0 /*< private >*/ /* padding for future expansion */ -#if GLIB_SIZEOF_VOID_P == 8 - gpointer _padding_dummy[13]; -#elif GLIB_SIZEOF_VOID_P == 4 - gpointer _padding_dummy[11]; -#else - G_STATIC_ASSERT("Unexpected pointer size") -#endif + TOD_PADDING_ALIGNED (16, sizeof (guint) * 2 + + sizeof (FpiDeviceUdevSubtypeFlagsTODV1_92_0) + + sizeof (gpointer)); }; typedef struct _FpIdEntryTODV1_92_0 FpIdEntryTODV1_92_0; @@ -217,7 +213,7 @@ struct _FpDeviceClassTODV1_92_0 /*< private >*/ /* padding for future expansion */ - gpointer _padding_dummy[31]; + TOD_PADDING (32, sizeof (FpDeviceFeatureTODV1_92_0)); }; typedef struct _FpDeviceClassTODV1_92_0 FpDeviceClassTODV1_92_0; @@ -266,13 +262,10 @@ struct _FpDeviceClassTODV1_94_0 /*< private >*/ /* padding for future expansion */ -#if GLIB_SIZEOF_VOID_P == 8 - gpointer _padding_dummy[27]; -#elif GLIB_SIZEOF_VOID_P == 4 - gpointer _padding_dummy[26]; -#else - G_STATIC_ASSERT("Unexpected pointer size") -#endif + TOD_PADDING_ALIGNED8 (32, + sizeof (FpDeviceFeatureTODV1_94_0) + + sizeof (gint32) * 2 + + sizeof (gpointer) * 3) }; typedef struct _FpDeviceClassTODV1_94_0 FpDeviceClassTODV1_94_0; diff --git a/tests/tod-drivers/base-fpi-image-device.h b/tests/tod-drivers/base-fpi-image-device.h index 5d83d1e0..4228e04c 100644 --- a/tests/tod-drivers/base-fpi-image-device.h +++ b/tests/tod-drivers/base-fpi-image-device.h @@ -57,5 +57,5 @@ typedef struct _FpImageDeviceClassTODV1_90_1 /*< private >*/ /* padding for future expansion */ - gpointer _padding_dummy[32]; + TOD_PADDING (32, 0); } FpImageDeviceClassTODV1_90_1; diff --git a/tests/tod-drivers/base-fpi-image.h b/tests/tod-drivers/base-fpi-image.h index 22d0c779..172fce89 100644 --- a/tests/tod-drivers/base-fpi-image.h +++ b/tests/tod-drivers/base-fpi-image.h @@ -22,6 +22,8 @@ #include #include +#include "tod/tod-macros.h" + typedef struct _FpImage FpImage; typedef struct _FpImageTODV1_90_1 FpImageTODV1_90_1; @@ -58,5 +60,5 @@ struct _FpImageTODV1_90_1 GPtrArray *minutiae; guint ref_count; - gpointer _padding_dummy[32]; + TOD_PADDING (32, 0); }; diff --git a/tests/tod-drivers/base-fpi-spi.h b/tests/tod-drivers/base-fpi-spi.h index 73aa293f..e2e9bf37 100644 --- a/tests/tod-drivers/base-fpi-spi.h +++ b/tests/tod-drivers/base-fpi-spi.h @@ -56,5 +56,5 @@ struct _FpiSpiTransferTODV1_92_0 GDestroyNotify free_buffer_rd; /* padding for future expansion */ - gpointer _padding_dummy[32]; + TOD_PADDING (32, 0); }; diff --git a/tests/tod-drivers/base-fpi-usb.h b/tests/tod-drivers/base-fpi-usb.h index 5542a102..3637e6f3 100644 --- a/tests/tod-drivers/base-fpi-usb.h +++ b/tests/tod-drivers/base-fpi-usb.h @@ -75,7 +75,6 @@ struct _FpiUsbTransferTODV1_90_1 /* Data free function */ GDestroyNotify free_buffer; - /*< private >*/ /* padding for future expansion */ - gpointer _padding_dummy[32]; + TOD_PADDING (32, 0); }; From fef4120ae15feefc0b7a6d3c328dcc246826e61a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Sun, 31 Oct 2021 23:26:29 +0100 Subject: [PATCH 05/11] test-fpi-todv1-types: Check missing device class members for 1.94 Not a problem now, as we're still on 1.94, but will be needed to ensure that future versions will be checked. --- tests/test-fp-todv1-types.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test-fp-todv1-types.c b/tests/test-fp-todv1-types.c index b9bbea05..830cee75 100644 --- a/tests/test-fp-todv1-types.c +++ b/tests/test-fp-todv1-types.c @@ -193,6 +193,9 @@ test_device_type (void) check_struct_member (FpDeviceClass, 1, 94, 0, list); check_struct_member (FpDeviceClass, 1, 94, 0, delete); check_struct_member (FpDeviceClass, 1, 94, 0, cancel); + check_struct_member (FpDeviceClass, 1, 94, 0, clear_storage); + check_struct_member (FpDeviceClass, 1, 94, 0, suspend); + check_struct_member (FpDeviceClass, 1, 94, 0, resume); check_struct_member (FpDeviceClass, 1, 94, 0, id); check_struct_member (FpDeviceClass, 1, 94, 0, full_name); @@ -203,6 +206,9 @@ test_device_type (void) check_struct_member (FpDeviceClass, 1, 94, 0, scan_type); check_struct_member (FpDeviceClass, 1, 94, 0, features); + + check_struct_member (FpDeviceClass, 1, 94, 0, temp_hot_seconds); + check_struct_member (FpDeviceClass, 1, 94, 0, temp_cold_seconds); } static void From 8ae5522201b128fb11a4a7366ad144a9558a5eae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Sun, 31 Oct 2021 23:44:05 +0100 Subject: [PATCH 06/11] tod-inspector: Support udev devices --- examples/tod-inspector.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/examples/tod-inspector.c b/examples/tod-inspector.c index e2012fdd..6f50dca8 100644 --- a/examples/tod-inspector.c +++ b/examples/tod-inspector.c @@ -47,6 +47,24 @@ id_table_to_string (FpDeviceType device_type, if (entry->vid) value = g_strdup_printf ("%04x:%04x", entry->vid, entry->pid); } + else if (device_type == FP_DEVICE_TYPE_UDEV) + { + if (entry->hid_id.vid) + { + g_autofree gchar *udev_flags = NULL; + + udev_flags = g_flags_to_string (fpi_device_udev_subtype_flags_get_type (), + entry->udev_types); + value = g_strdup_printf ("%s (%04x:%04x) [%s]", + entry->spi_acpi_id, + entry->hid_id.vid, entry->hid_id.pid, + udev_flags); + } + else + { + value = g_strdup (entry->spi_acpi_id); + } + } else { return g_strdup ("Unsupported device type"); From a36a4f20ff81d1ed965d5b9c1235fffc77ddd4df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Sun, 31 Oct 2021 23:44:37 +0100 Subject: [PATCH 07/11] tod-inspector: Add support for 1.94 device class members --- examples/tod-inspector.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/tod-inspector.c b/examples/tod-inspector.c index 6f50dca8..b121422b 100644 --- a/examples/tod-inspector.c +++ b/examples/tod-inspector.c @@ -133,6 +133,8 @@ main (void) g_print ("Type: %s\n", device_type_to_string (cls->type)); g_print ("Enroll stages: %d\n", cls->nr_enroll_stages); g_print ("Scan type: %s\n", scan_type_to_string (cls->scan_type)); + g_print ("Seconds to get Hot: %d\n", cls->temp_hot_seconds); + g_print ("Seconds to get Cold: %d\n", cls->temp_cold_seconds); g_print ("Supported Devices: %s\n", id_table); g_print ("Supported features: %s\n", features); g_print ("Implemented VFuncs:\n"); @@ -140,12 +142,15 @@ main (void) g_print (" probe: %s\n", cls->probe ? "true" : "false"); g_print (" open: %s\n", cls->open ? "true" : "false"); g_print (" close: %s\n", cls->close ? "true" : "false"); + g_print (" suspend: %s\n", cls->suspend ? "true" : "false"); + g_print (" resume: %s\n", cls->resume ? "true" : "false"); g_print (" enroll: %s\n", cls->enroll ? "true" : "false"); g_print (" verify: %s\n", cls->verify ? "true" : "false"); g_print (" identify: %s\n", cls->identify ? "true" : "false"); g_print (" capture: %s\n", cls->capture ? "true" : "false"); g_print (" list: %s\n", cls->list ? "true" : "false"); g_print (" delete: %s\n", cls->delete ? "true" : "false"); + g_print (" clear_storage: %s\n", cls->clear_storage ? "true" : "false"); g_print (" cancel: %s\n", cls->cancel ? "true" : "false"); if (i < shared_drivers->len - 1) From 2cfff27729e9faa12e1e5de3788b431adeb3e7c3 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Tue, 2 Nov 2021 16:27:33 +0100 Subject: [PATCH 08/11] udev-hwdb: Update unsupported device list --- data/autosuspend.hwdb | 1 + libfprint/fprint-list-udev-hwdb.c | 1 + 2 files changed, 2 insertions(+) diff --git a/data/autosuspend.hwdb b/data/autosuspend.hwdb index 42d22ca7..cbc6109f 100644 --- a/data/autosuspend.hwdb +++ b/data/autosuspend.hwdb @@ -286,6 +286,7 @@ usb:v0A5Cp5842* usb:v0A5Cp5843* usb:v0A5Cp5844* usb:v0A5Cp5845* +usb:v0BDAp5812* usb:v10A5p0007* usb:v1188p9545* usb:v138Ap0007* diff --git a/libfprint/fprint-list-udev-hwdb.c b/libfprint/fprint-list-udev-hwdb.c index d271752a..f5674574 100644 --- a/libfprint/fprint-list-udev-hwdb.c +++ b/libfprint/fprint-list-udev-hwdb.c @@ -60,6 +60,7 @@ static const FpIdEntry whitelist_id_table[] = { { .vid = 0x0a5c, .pid = 0x5843 }, { .vid = 0x0a5c, .pid = 0x5844 }, { .vid = 0x0a5c, .pid = 0x5845 }, + { .vid = 0x0bda, .pid = 0x5812 }, { .vid = 0x10a5, .pid = 0x0007 }, { .vid = 0x1188, .pid = 0x9545 }, { .vid = 0x138a, .pid = 0x0007 }, From 5e4bb268012f4051fc72578e6a1866c729cd8a2f Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Tue, 2 Nov 2021 16:20:32 +0100 Subject: [PATCH 09/11] Release 1.94.2 --- NEWS | 7 +++++++ meson.build | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index cf96ff33..eacd99c9 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,13 @@ This file lists notable changes in each release. For the full history of all changes, see ChangeLog. +2021-11-02: v1.94.2 release + +Highlights: + * goodixmoc: Fix protocol error with certain username lengths + * elanmoc: New PID 0x0c7d + * goodixmoc: New PID 0x63cc + 2021-09-24: v1.94.1 release Highlights: diff --git a/meson.build b/meson.build index 795f313c..f2750519 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('libfprint', [ 'c', 'cpp' ], - version: '1.94.1', + version: '1.94.2', license: 'LGPLv2.1+', default_options: [ 'buildtype=debugoptimized', From 0b37a36874a9c6b57b1bd3c28428b47049ca4462 Mon Sep 17 00:00:00 2001 From: Matthew Mirvish Date: Mon, 15 Nov 2021 17:10:44 -0500 Subject: [PATCH 10/11] doc: Fix broken documentation for FpiDeviceUdevSubtypeFlags enum Added description and fixed incorrect name in comment, so now gtkdoc actually shows useful information. --- libfprint/fpi-device.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libfprint/fpi-device.h b/libfprint/fpi-device.h index 76f07c40..1738652d 100644 --- a/libfprint/fpi-device.h +++ b/libfprint/fpi-device.h @@ -26,9 +26,11 @@ #include "tod/tod-macros.h" /** - * FpiDeviceUdevSubtype: + * FpiDeviceUdevSubtypeFlags: * @FPI_DEVICE_UDEV_SUBTYPE_SPIDEV: The device requires an spidev node * @FPI_DEVICE_UDEV_SUBTYPE_HIDRAW: The device requires a hidraw node + * + * Bitfield of required hardware resources for a udev-backed device. */ typedef enum { FPI_DEVICE_UDEV_SUBTYPE_SPIDEV = 1 << 0, From c3ef68fa5e3a8a7f438ac01d03922d0466e0f73e Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Wed, 24 Nov 2021 12:09:18 +0100 Subject: [PATCH 11/11] context: Ensure mainloop is idle before enumeration completes This ensures that we have processed all hotplug events before considering enumeration to be complete. This is important due to USB persist being turned off. At resume time, devices will disappear and immediately re-appear. In this situatoin, enumerate could first see the old state with a removed device resulting in it to not be discovered. As a hotplug event is semingly emitted by the kernel immediately, we can simply make sure to process this hotplug event before returning from enumerate. Closes: fprintd#119 --- libfprint/fp-context.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/libfprint/fp-context.c b/libfprint/fp-context.c index a5b45e8f..65c57b22 100644 --- a/libfprint/fp-context.c +++ b/libfprint/fp-context.c @@ -437,6 +437,7 @@ void fp_context_enumerate (FpContext *context) { FpContextPrivate *priv = fp_context_get_instance_private (context); + gboolean dispatched; gint i; g_return_if_fail (FP_IS_CONTEXT (context)); @@ -575,8 +576,19 @@ fp_context_enumerate (FpContext *context) } #endif - while (priv->pending_devices) - g_main_context_iteration (NULL, TRUE); + /* Iterate until 1. we have no pending devices, and 2. the mainloop is idle + * This takes care of processing hotplug events that happened during + * enumeration. + * This is important due to USB `persist` being turned off. At resume time, + * devices will disappear and immediately re-appear. In this situation, + * enumerate could first see the old state with a removed device resulting + * in it to not be discovered. + * As a hotplug event is seemingly emitted by the kernel immediately, we can + * simply make sure to process all events before returning from enumerate. + */ + dispatched = TRUE; + while (priv->pending_devices || dispatched) + dispatched = g_main_context_iteration (NULL, !!priv->pending_devices); } /**