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/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/doc/libfprint-2-sections.txt b/doc/libfprint-2-sections.txt
index 33189854..91258b62 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
@@ -259,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
@@ -286,3 +290,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
+
diff --git a/examples/tod-inspector.c b/examples/tod-inspector.c
index e2012fdd..b121422b 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");
@@ -115,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");
@@ -122,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)
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);
}
/**
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 aba30b10..1738652d 100644
--- a/libfprint/fpi-device.h
+++ b/libfprint/fpi-device.h
@@ -23,11 +23,14 @@
#include "fp-device.h"
#include "fp-image.h"
#include "fpi-print.h"
+#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,
@@ -73,7 +76,10 @@ struct _FpIdEntry
/*< private >*/
/* padding for future expansion */
- gpointer _padding_dummy[13];
+ TOD_PADDING_ALIGNED (16,
+ sizeof (guint) * 2 +
+ sizeof (FpiDeviceUdevSubtypeFlags) +
+ sizeof (gpointer));
};
/**
@@ -186,7 +192,10 @@ struct _FpDeviceClass
/*< private >*/
/* padding for future expansion */
- gpointer _padding_dummy[27];
+ 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/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 },
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/meson.build b/meson.build
index d5c28772..ad105f1f 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,5 @@
project('libfprint', [ 'c', 'cpp' ],
- version: '1.94.1+tod1',
+ version: '1.94.2+tod1',
license: 'LGPLv2.1+',
default_options: [
'buildtype=debugoptimized',
diff --git a/tests/test-fp-todv1-types.c b/tests/test-fp-todv1-types.c
index 6846faa8..830cee75 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))
@@ -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
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 fe68e5bc..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,7 +172,9 @@ struct _FpIdEntryTODV1_92_0
/*< private >*/
/* padding for future expansion */
- gpointer _padding_dummy[13];
+ TOD_PADDING_ALIGNED (16, sizeof (guint) * 2 +
+ sizeof (FpiDeviceUdevSubtypeFlagsTODV1_92_0) +
+ sizeof (gpointer));
};
typedef struct _FpIdEntryTODV1_92_0 FpIdEntryTODV1_92_0;
@@ -211,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;
@@ -260,7 +262,10 @@ struct _FpDeviceClassTODV1_94_0
/*< private >*/
/* padding for future expansion */
- gpointer _padding_dummy[27];
+ 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);
};