mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2026-06-11 18:38:07 +00:00
tests/tod-drivers: Add newly supported types
This commit is contained in:
@@ -251,6 +251,7 @@ if get_option('tod')
|
|||||||
'tod-drivers/base-fp-print.h',
|
'tod-drivers/base-fp-print.h',
|
||||||
'tod-drivers/base-fpi-device.h',
|
'tod-drivers/base-fpi-device.h',
|
||||||
'tod-drivers/base-fpi-image-device.h',
|
'tod-drivers/base-fpi-image-device.h',
|
||||||
|
'tod-drivers/base-fpi-spi.h',
|
||||||
'tod-drivers/base-fpi-usb.h',
|
'tod-drivers/base-fpi-usb.h',
|
||||||
],
|
],
|
||||||
install_header: false)
|
install_header: false)
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include "tod-drivers/base-fp-print.h"
|
#include "tod-drivers/base-fp-print.h"
|
||||||
#include "tod-drivers/base-fpi-device.h"
|
#include "tod-drivers/base-fpi-device.h"
|
||||||
#include "tod-drivers/base-fpi-image-device.h"
|
#include "tod-drivers/base-fpi-image-device.h"
|
||||||
|
#include "tod-drivers/base-fpi-spi.h"
|
||||||
#include "tod-drivers/base-fpi-usb.h"
|
#include "tod-drivers/base-fpi-usb.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -164,6 +165,25 @@ test_usb_private (void)
|
|||||||
check_struct_member (FpiUsbTransfer, free_buffer);
|
check_struct_member (FpiUsbTransfer, free_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_spi_private (void)
|
||||||
|
{
|
||||||
|
check_struct_size (FpiSpiTransfer);
|
||||||
|
|
||||||
|
check_struct_member (FpiSpiTransfer, device);
|
||||||
|
check_struct_member (FpiSpiTransfer, ssm);
|
||||||
|
check_struct_member (FpiSpiTransfer, length_wr);
|
||||||
|
check_struct_member (FpiSpiTransfer, length_rd);
|
||||||
|
check_struct_member (FpiSpiTransfer, buffer_wr);
|
||||||
|
check_struct_member (FpiSpiTransfer, buffer_rd);
|
||||||
|
check_struct_member (FpiSpiTransfer, ref_count);
|
||||||
|
check_struct_member (FpiSpiTransfer, spidev_fd);
|
||||||
|
check_struct_member (FpiSpiTransfer, user_data);
|
||||||
|
check_struct_member (FpiSpiTransfer, callback);
|
||||||
|
check_struct_member (FpiSpiTransfer, free_buffer_wr);
|
||||||
|
check_struct_member (FpiSpiTransfer, free_buffer_rd);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_device_public_enums (void)
|
test_device_public_enums (void)
|
||||||
{
|
{
|
||||||
@@ -171,6 +191,8 @@ test_device_public_enums (void)
|
|||||||
check_type_compatibility (FP_TYPE_SCAN_TYPE);
|
check_type_compatibility (FP_TYPE_SCAN_TYPE);
|
||||||
check_type_compatibility (FP_TYPE_DEVICE_RETRY);
|
check_type_compatibility (FP_TYPE_DEVICE_RETRY);
|
||||||
check_type_compatibility (FP_TYPE_DEVICE_ERROR);
|
check_type_compatibility (FP_TYPE_DEVICE_ERROR);
|
||||||
|
check_type_compatibility (FP_TYPE_DEVICE_FEATURE);
|
||||||
|
check_type_compatibility (FPI_TYPE_DEVICE_UDEV_SUBTYPE_FLAGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -223,6 +245,7 @@ main (int argc, char *argv[])
|
|||||||
g_test_add_func ("/type/image-device/enums", test_image_device_enums);
|
g_test_add_func ("/type/image-device/enums", test_image_device_enums);
|
||||||
g_test_add_func ("/type/usb/private", test_usb_private);
|
g_test_add_func ("/type/usb/private", test_usb_private);
|
||||||
g_test_add_func ("/type/usb/enums", test_usb_enums);
|
g_test_add_func ("/type/usb/enums", test_usb_enums);
|
||||||
|
g_test_add_func ("/type/spi/private", test_spi_private);
|
||||||
|
|
||||||
return g_test_run ();
|
return g_test_run ();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,3 +95,20 @@ typedef enum {
|
|||||||
FPI_DEVICE_ACTION_TODV1_LIST,
|
FPI_DEVICE_ACTION_TODV1_LIST,
|
||||||
FPI_DEVICE_ACTION_TODV1_DELETE,
|
FPI_DEVICE_ACTION_TODV1_DELETE,
|
||||||
} FpiDeviceActionTODV1;
|
} FpiDeviceActionTODV1;
|
||||||
|
|
||||||
|
typedef enum /*< flags >*/ {
|
||||||
|
FP_DEVICE_FEATURE_TODV1_NONE = 0,
|
||||||
|
FP_DEVICE_FEATURE_TODV1_CAPTURE = 1 << 0,
|
||||||
|
FP_DEVICE_FEATURE_TODV1_IDENTIFY = 1 << 1,
|
||||||
|
FP_DEVICE_FEATURE_TODV1_VERIFY = 1 << 2,
|
||||||
|
FP_DEVICE_FEATURE_TODV1_STORAGE = 1 << 3,
|
||||||
|
FP_DEVICE_FEATURE_TODV1_STORAGE_LIST = 1 << 4,
|
||||||
|
FP_DEVICE_FEATURE_TODV1_STORAGE_DELETE = 1 << 5,
|
||||||
|
FP_DEVICE_FEATURE_TODV1_STORAGE_CLEAR = 1 << 6,
|
||||||
|
FP_DEVICE_FEATURE_TODV1_DUPLICATES_CHECK = 1 << 7,
|
||||||
|
} FpDeviceFeatureTODV1;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
FPI_DEVICE_UDEV_SUBTYPE_TODV1_SPIDEV = 1 << 0,
|
||||||
|
FPI_DEVICE_UDEV_SUBTYPE_TODV1_HIDRAW = 1 << 1,
|
||||||
|
} FpiDeviceUdevSubtypeFlagsTODV1;
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* FpDevice - A fingerprint reader device
|
||||||
|
* Copyright (C) 2021 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
|
||||||
|
|
||||||
|
#include "base-fpi-device.h"
|
||||||
|
|
||||||
|
typedef struct _FpiSpiTransferTODV1 FpiSpiTransferTODV1;
|
||||||
|
typedef struct _FpiSsm FpiSsm;
|
||||||
|
|
||||||
|
typedef void (*FpiSpiTransferCallbackTODV1)(FpiSpiTransferTODV1 *transfer,
|
||||||
|
FpDevice *dev,
|
||||||
|
gpointer user_data,
|
||||||
|
GError *error);
|
||||||
|
|
||||||
|
struct _FpiSpiTransferTODV1
|
||||||
|
{
|
||||||
|
/*< public >*/
|
||||||
|
FpDevice *device;
|
||||||
|
|
||||||
|
FpiSsm *ssm;
|
||||||
|
|
||||||
|
gssize length_wr;
|
||||||
|
gssize length_rd;
|
||||||
|
|
||||||
|
guchar *buffer_wr;
|
||||||
|
guchar *buffer_rd;
|
||||||
|
|
||||||
|
/*< private >*/
|
||||||
|
guint ref_count;
|
||||||
|
|
||||||
|
int spidev_fd;
|
||||||
|
|
||||||
|
/* Callbacks */
|
||||||
|
gpointer user_data;
|
||||||
|
FpiSpiTransferCallbackTODV1 callback;
|
||||||
|
|
||||||
|
/* Data free function */
|
||||||
|
GDestroyNotify free_buffer_wr;
|
||||||
|
GDestroyNotify free_buffer_rd;
|
||||||
|
|
||||||
|
/* padding for future expansion */
|
||||||
|
gpointer _padding_dummy[32];
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user