Merge tag 'v1.94.6' into tod

v1.94.6

Git-EVTag-v0-SHA512: e1afaf08552dd3bc8e20229f4e8e141236a2133ce69cd3c68332e68483fb80a471ac0d7da1eedd6e4b0944b729433ac26e86ec12ef3accc78f86b1331150e185
This commit is contained in:
Marco Trevisan (Treviño)
2023-08-17 05:26:05 +02:00
46 changed files with 1075 additions and 355 deletions
+59 -16
View File
@@ -6,6 +6,16 @@ include:
file: '/templates/fedora.yml' file: '/templates/fedora.yml'
- remote: 'https://gitlab.gnome.org/GNOME/citemplates/-/raw/master/flatpak/flatpak_ci_initiative.yml' - remote: 'https://gitlab.gnome.org/GNOME/citemplates/-/raw/master/flatpak/flatpak_ci_initiative.yml'
default:
# Auto-retry jobs in case of infra failures
retry:
max: 1
when:
- 'runner_system_failure'
- 'stuck_or_timeout_failure'
- 'scheduler_failure'
- 'api_failure'
variables: variables:
extends: .libfprint_common_variables extends: .libfprint_common_variables
FDO_DISTRIBUTION_TAG: $LIBFPRINT_IMAGE_TAG FDO_DISTRIBUTION_TAG: $LIBFPRINT_IMAGE_TAG
@@ -15,6 +25,11 @@ variables:
BUNDLE: "org.freedesktop.libfprint.Demo.flatpak" BUNDLE: "org.freedesktop.libfprint.Demo.flatpak"
LAST_ABI_BREAK: "056ea541ddc97f5806cffbd99a12dc87e4da3546" LAST_ABI_BREAK: "056ea541ddc97f5806cffbd99a12dc87e4da3546"
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_PIPELINE_SOURCE == 'push'
stages: stages:
- image-build - image-build
- check-source - check-source
@@ -27,16 +42,16 @@ image: $FEDORA_IMAGE
.build_one_driver_template: &build_one_driver .build_one_driver_template: &build_one_driver
script: script:
# Build with a driver that doesn't need imaging, or nss # Build with a driver that doesn't need imaging, or nss
- meson --werror -Ddrivers=$driver . _build - meson setup _build --werror -Ddrivers=$driver
- ninja -C _build - meson compile -C _build
- rm -rf _build/ - rm -rf _build/
.build_template: &build .build_template: &build
script: script:
# And build with everything # And build with everything
- meson --werror -Ddrivers=all . _build - meson setup _build --werror -Ddrivers=all
- ninja -C _build - meson compile -C _build
- ninja -C _build install - meson install -C _build
.build_template: &check_abi .build_template: &check_abi
script: script:
@@ -65,11 +80,10 @@ test:
variables: variables:
- $CI_PIPELINE_SOURCE == "schedule" - $CI_PIPELINE_SOURCE == "schedule"
script: script:
- meson --werror -Ddrivers=all -Db_coverage=true . _build - meson setup _build --werror -Ddrivers=all -Db_coverage=true
- ninja -C _build
- meson test -C _build --print-errorlogs --no-stdsplit --timeout-multiplier 3 - meson test -C _build --print-errorlogs --no-stdsplit --timeout-multiplier 3
- ninja -C _build coverage - ninja -C _build coverage
- cat _build/meson-logs/coverage.txt - cat _build/meson-logs/coverage.txt || true
artifacts: artifacts:
reports: reports:
junit: "_build/meson-logs/testlog.junit.xml" junit: "_build/meson-logs/testlog.junit.xml"
@@ -91,12 +105,12 @@ test_valgrind:
variables: variables:
- $CI_PIPELINE_SOURCE == "schedule" - $CI_PIPELINE_SOURCE == "schedule"
script: script:
- meson -Ddrivers=all . _build - meson setup _build -Ddrivers=all
- ninja -C _build - meson compile -C _build
- meson test -C _build --print-errorlogs --no-stdsplit --setup=valgrind - meson test -C _build --print-errorlogs --no-stdsplit --setup=valgrind
artifacts: artifacts:
reports: reports:
junit: "_build/meson-logs/testlog.junit.xml" junit: "_build/meson-logs/testlog-valgrind.junit.xml"
expose_as: 'Valgrind test logs' expose_as: 'Valgrind test logs'
when: always when: always
paths: paths:
@@ -104,6 +118,27 @@ test_valgrind:
- _build/meson-logs/testlog-valgrind.txt - _build/meson-logs/testlog-valgrind.txt
expire_in: 1 week expire_in: 1 week
test_installed:
stage: test
except:
variables:
- $CI_PIPELINE_SOURCE == "schedule"
script:
- meson setup _build --prefix=/usr -Ddrivers=all
- meson install -C _build
- gnome-desktop-testing-runner --list libfprint-2
- gnome-desktop-testing-runner libfprint-2
--report-directory=_build/installed-tests-report/failed/
--log-directory=_build/installed-tests-report/logs/
--parallel=0
artifacts:
expose_as: 'GNOME Tests Runner logs'
when: always
paths:
- _build/meson-logs
- _build/installed-tests-report
expire_in: 1 week
test_scan_build: test_scan_build:
stage: test stage: test
@@ -112,9 +147,10 @@ test_scan_build:
- $CI_PIPELINE_SOURCE == "schedule" - $CI_PIPELINE_SOURCE == "schedule"
allow_failure: true allow_failure: true
script: script:
- meson -Ddrivers=all . _build - meson setup _build -Ddrivers=all
# Wrapper to add --status-bugs and disable malloc checker # Wrapper to add --status-bugs and disable malloc checker
- SCANBUILD=$CI_PROJECT_DIR/.gitlab-ci/scan-build ninja -C _build scan-build - SCANBUILD=$CI_PROJECT_DIR/.gitlab-ci/scan-build
ninja -C _build scan-build
artifacts: artifacts:
paths: paths:
- _build/meson-logs - _build/meson-logs
@@ -172,7 +208,6 @@ flatpak:
- $CI_PIPELINE_SOURCE == "never" - $CI_PIPELINE_SOURCE == "never"
variables: variables:
GIT_STRATEGY: none # no need to pull the whole tree for rebuilding the image GIT_STRATEGY: none # no need to pull the whole tree for rebuilding the image
FDO_FORCE_REBUILD: 1
# a list of packages to install # a list of packages to install
FDO_DISTRIBUTION_PACKAGES: FDO_DISTRIBUTION_PACKAGES:
$LIBFPRINT_DEPENDENCIES $LIBFPRINT_DEPENDENCIES
@@ -182,14 +217,22 @@ flatpak:
FDO_DISTRIBUTION_EXEC: | FDO_DISTRIBUTION_EXEC: |
$LIBFPRINT_EXEC $LIBFPRINT_EXEC
.container_fedora_build_forced:
variables:
FDO_FORCE_REBUILD: 1
container_fedora_build_schedule: container_fedora_build_schedule:
extends: .container_fedora_build_base extends:
- .container_fedora_build_base
- .container_fedora_build_forced
only: only:
variables: variables:
- $CI_PIPELINE_SOURCE == "schedule" && $CRON_TASK == "BUILD_CI_IMAGES" - $CI_PIPELINE_SOURCE == "schedule" && $CRON_TASK == "BUILD_CI_IMAGES"
container_fedora_build_manual: container_fedora_build_manual:
extends: .container_fedora_build_base extends:
- .container_fedora_build_base
- .container_fedora_build_forced
only: only:
variables: variables:
- $LIBFPRINT_CI_ACTION == "build-image" - $LIBFPRINT_CI_ACTION == "build-image"
+1 -1
View File
@@ -1,2 +1,2 @@
variables: variables:
LIBFPRINT_IMAGE_TAG: v2 LIBFPRINT_IMAGE_TAG: v3
+3 -1
View File
@@ -13,6 +13,7 @@
glib2-devel glib2-devel
glibc-devel glibc-devel
gobject-introspection-devel gobject-introspection-devel
gnome-desktop-testing
gtk-doc gtk-doc
gtk3-devel gtk3-devel
libabigail libabigail
@@ -33,7 +34,8 @@
diffutils diffutils
LIBFPRINT_EXEC: | LIBFPRINT_EXEC: |
dnf debuginfo-install -y \ dnf -y install dnf-utils
debuginfo-install -y \
glib2 \ glib2 \
glibc \ glibc \
libgusb \ libgusb \
+15
View File
@@ -1,6 +1,21 @@
This file lists notable changes in each release. For the full history of all This file lists notable changes in each release. For the full history of all
changes, see ChangeLog. changes, see ChangeLog.
2023-08-17: v1.94.6 release
Highlights:
* goodixmoc: New PIDs 0x60A4, 0x60BC, 0x6092, 0x633C and 0x6304.
* goodixmoc: Fix missing "enroll create" state.
* elanmoc: New PID 0x0C99.
* upektc: Improve compatibility with sensors 147e:2016.
* aes4000: Actually support 08FF:5501 devices.
* virtual-device-listener: Fix failing tests with GLib 2.76
* tests: Add installed tests
Bugs fixed:
* #526 libfprint: fpcmoc: use after free if enrollment or identification is
cancelled (Vasily Khoruzhick)
2022-10-13: v1.94.5 release 2022-10-13: v1.94.5 release
Highlights: Highlights:
+7 -1
View File
@@ -67,7 +67,7 @@ usb:v08FFp5731*
ID_PERSIST=0 ID_PERSIST=0
# Supported by libfprint driver aes4000 # Supported by libfprint driver aes4000
usb:v5501p08FF* usb:v08FFp5501*
ID_AUTOSUSPEND=1 ID_AUTOSUSPEND=1
ID_PERSIST=0 ID_PERSIST=0
@@ -149,6 +149,7 @@ usb:v04F3p0C82*
usb:v04F3p0C88* usb:v04F3p0C88*
usb:v04F3p0C8C* usb:v04F3p0C8C*
usb:v04F3p0C8D* usb:v04F3p0C8D*
usb:v04F3p0C99*
ID_AUTOSUSPEND=1 ID_AUTOSUSPEND=1
ID_PERSIST=0 ID_PERSIST=0
@@ -169,10 +170,15 @@ usb:v10A5pD205*
# Supported by libfprint driver goodixmoc # Supported by libfprint driver goodixmoc
usb:v27C6p5840* usb:v27C6p5840*
usb:v27C6p6014* usb:v27C6p6014*
usb:v27C6p6092*
usb:v27C6p6094* usb:v27C6p6094*
usb:v27C6p609C* usb:v27C6p609C*
usb:v27C6p60A2* usb:v27C6p60A2*
usb:v27C6p60A4*
usb:v27C6p60BC*
usb:v27C6p6304*
usb:v27C6p631C* usb:v27C6p631C*
usb:v27C6p633C*
usb:v27C6p634C* usb:v27C6p634C*
usb:v27C6p6384* usb:v27C6p6384*
usb:v27C6p639C* usb:v27C6p639C*
+1 -1
View File
@@ -25,7 +25,7 @@ docpath = join_paths(get_option('datadir'), 'gtk-doc', 'html')
gnome.gtkdoc(versioned_libname, gnome.gtkdoc(versioned_libname,
main_xml: 'libfprint-docs.xml', main_xml: 'libfprint-docs.xml',
src_dir: join_paths(meson.source_root(), 'libfprint'), src_dir: join_paths(meson.project_source_root(), 'libfprint'),
include_directories: include_directories('../libfprint'), include_directories: include_directories('../libfprint'),
dependencies: libfprint_dep, dependencies: libfprint_dep,
content_files: content_files, content_files: content_files,
+5
View File
@@ -22,6 +22,11 @@ executable('cpp-test',
dependencies: libfprint_dep, dependencies: libfprint_dep,
) )
if installed_tests
install_subdir('prints',
install_dir: installed_tests_testdir)
endif
if get_option('tod') if get_option('tod')
executable('tod-inspector', executable('tod-inspector',
sources: 'tod-inspector.c', sources: 'tod-inspector.c',
+1 -1
View File
@@ -124,7 +124,7 @@ G_DEFINE_TYPE (FpiDeviceAes4000, fpi_device_aes4000, FPI_TYPE_DEVICE_AES3K);
static const FpIdEntry id_table[] = { static const FpIdEntry id_table[] = {
{ .pid = 0x08ff, .vid = 0x5501 }, { .vid = 0x08ff, .pid = 0x5501 },
{ .vid = 0, .pid = 0, .driver_data = 0 }, { .vid = 0, .pid = 0, .driver_data = 0 },
}; };
+5
View File
@@ -31,6 +31,7 @@ static const FpIdEntry id_table[] = {
{ .vid = 0x04f3, .pid = 0x0c88, }, { .vid = 0x04f3, .pid = 0x0c88, },
{ .vid = 0x04f3, .pid = 0x0c8c, }, { .vid = 0x04f3, .pid = 0x0c8c, },
{ .vid = 0x04f3, .pid = 0x0c8d, }, { .vid = 0x04f3, .pid = 0x0c8d, },
{ .vid = 0x04f3, .pid = 0x0c99, },
{ .vid = 0, .pid = 0, .driver_data = 0 }, /* terminating entry */ { .vid = 0, .pid = 0, .driver_data = 0 }, /* terminating entry */
}; };
@@ -1086,6 +1087,10 @@ elanmoc_open (FpDevice *device)
self->max_moc_enroll_time = 11; self->max_moc_enroll_time = 11;
break; break;
case 0x0c99:
self->max_moc_enroll_time = 14;
break;
case 0x0c8d: case 0x0c8d:
self->max_moc_enroll_time = 17; self->max_moc_enroll_time = 17;
break; break;
+11 -18
View File
@@ -132,7 +132,11 @@ fpc_cmd_receive_cb (FpiUsbTransfer *transfer,
} }
ssm_state = fpi_ssm_get_cur_state (transfer->ssm); ssm_state = fpi_ssm_get_cur_state (transfer->ssm);
fp_dbg ("%s current ssm state: %d", G_STRFUNC, ssm_state); fp_dbg ("%s current ssm request: %d state: %d", G_STRFUNC, data->request, ssm_state);
/* clean cmd_ssm except capture command for suspend/resume case */
if (ssm_state != FP_CMD_SEND || data->request != FPC_CMD_ARM)
self->cmd_ssm = NULL;
if (data->cmdtype == FPC_CMDTYPE_TO_DEVICE) if (data->cmdtype == FPC_CMDTYPE_TO_DEVICE)
{ {
@@ -358,6 +362,7 @@ fpc_sensor_cmd (FpiDeviceFpcMoc *self,
g_clear_object (&self->interrupt_cancellable); g_clear_object (&self->interrupt_cancellable);
} }
g_assert (self->cmd_ssm == NULL);
self->cmd_ssm = fpi_ssm_new (FP_DEVICE (self), self->cmd_ssm = fpi_ssm_new (FP_DEVICE (self),
fpc_cmd_run_state, fpc_cmd_run_state,
FP_CMD_NUM_STATES); FP_CMD_NUM_STATES);
@@ -1149,12 +1154,9 @@ fpc_enroll_ssm_done (FpiSsm *ssm, FpDevice *dev, GError *error)
fp_info ("Enrollment complete!"); fp_info ("Enrollment complete!");
if (fpi_ssm_get_error (ssm))
error = fpi_ssm_get_error (ssm);
if (error) if (error)
{ {
fpi_device_enroll_complete (dev, NULL, error); fpi_device_enroll_complete (dev, NULL, g_steal_pointer (&error));
self->task_ssm = NULL; self->task_ssm = NULL;
return; return;
} }
@@ -1336,9 +1338,6 @@ fpc_verify_ssm_done (FpiSsm *ssm, FpDevice *dev, GError *error)
fp_info ("Verify_identify complete!"); fp_info ("Verify_identify complete!");
if (fpi_ssm_get_error (ssm))
error = fpi_ssm_get_error (ssm);
if (error && error->domain == FP_DEVICE_RETRY) if (error && error->domain == FP_DEVICE_RETRY)
{ {
if (fpi_device_get_current_action (dev) == FPI_DEVICE_ACTION_VERIFY) if (fpi_device_get_current_action (dev) == FPI_DEVICE_ACTION_VERIFY)
@@ -1348,9 +1347,9 @@ fpc_verify_ssm_done (FpiSsm *ssm, FpDevice *dev, GError *error)
} }
if (fpi_device_get_current_action (dev) == FPI_DEVICE_ACTION_VERIFY) if (fpi_device_get_current_action (dev) == FPI_DEVICE_ACTION_VERIFY)
fpi_device_verify_complete (dev, error); fpi_device_verify_complete (dev, g_steal_pointer (&error));
else else
fpi_device_identify_complete (dev, error); fpi_device_identify_complete (dev, g_steal_pointer (&error));
self->task_ssm = NULL; self->task_ssm = NULL;
} }
@@ -1448,10 +1447,7 @@ fpc_clear_ssm_done (FpiSsm *ssm, FpDevice *dev, GError *error)
fp_info ("Clear Storage complete!"); fp_info ("Clear Storage complete!");
if (fpi_ssm_get_error (ssm)) fpi_device_clear_storage_complete (dev, g_steal_pointer (&error));
error = fpi_ssm_get_error (ssm);
fpi_device_clear_storage_complete (dev, error);
self->task_ssm = NULL; self->task_ssm = NULL;
} }
@@ -1555,10 +1551,7 @@ fpc_init_ssm_done (FpiSsm *ssm, FpDevice *dev, GError *error)
{ {
FpiDeviceFpcMoc *self = FPI_DEVICE_FPCMOC (dev); FpiDeviceFpcMoc *self = FPI_DEVICE_FPCMOC (dev);
if (fpi_ssm_get_error (ssm)) fpi_device_open_complete (dev, g_steal_pointer (&error));
error = fpi_ssm_get_error (ssm);
fpi_device_open_complete (dev, error);
self->task_ssm = NULL; self->task_ssm = NULL;
} }
+24 -14
View File
@@ -631,11 +631,11 @@ fp_enroll_enum_cb (FpiDeviceGoodixMoc *self,
return; return;
} }
fpi_ssm_jump_to_state (self->task_ssm, FP_ENROLL_CAPTURE); fpi_ssm_next_state (self->task_ssm);
} }
static void static void
fp_enroll_init_cb (FpiDeviceGoodixMoc *self, fp_enroll_create_cb (FpiDeviceGoodixMoc *self,
gxfp_cmd_response_t *resp, gxfp_cmd_response_t *resp,
GError *error) GError *error)
{ {
@@ -644,7 +644,7 @@ fp_enroll_init_cb (FpiDeviceGoodixMoc *self,
fpi_ssm_mark_failed (self->task_ssm, error); fpi_ssm_mark_failed (self->task_ssm, error);
return; return;
} }
memcpy (self->template_id, resp->enroll_init.tid, TEMPLATE_ID_SIZE); memcpy (self->template_id, resp->enroll_create.tid, TEMPLATE_ID_SIZE);
fpi_ssm_next_state (self->task_ssm); fpi_ssm_next_state (self->task_ssm);
} }
@@ -837,16 +837,6 @@ fp_enroll_sm_run_state (FpiSsm *ssm, FpDevice *device)
switch (fpi_ssm_get_cur_state (ssm)) switch (fpi_ssm_get_cur_state (ssm))
{ {
case FP_ENROLL_ENUM:
{
goodix_sensor_cmd (self, MOC_CMD0_GETFINGERLIST, MOC_CMD1_DEFAULT,
false,
(const guint8 *) &dummy,
1,
fp_enroll_enum_cb);
}
break;
case FP_ENROLL_PWR_BTN_SHIELD_ON: case FP_ENROLL_PWR_BTN_SHIELD_ON:
{ {
goodix_sensor_cmd (self, MOC_CMD0_PWR_BTN_SHIELD, MOC_CMD1_PWR_BTN_SHIELD_ON, goodix_sensor_cmd (self, MOC_CMD0_PWR_BTN_SHIELD, MOC_CMD1_PWR_BTN_SHIELD_ON,
@@ -857,13 +847,23 @@ fp_enroll_sm_run_state (FpiSsm *ssm, FpDevice *device)
} }
break; break;
case FP_ENROLL_ENUM:
{
goodix_sensor_cmd (self, MOC_CMD0_GETFINGERLIST, MOC_CMD1_DEFAULT,
false,
(const guint8 *) &dummy,
1,
fp_enroll_enum_cb);
}
break;
case FP_ENROLL_CREATE: case FP_ENROLL_CREATE:
{ {
goodix_sensor_cmd (self, MOC_CMD0_ENROLL_INIT, MOC_CMD1_DEFAULT, goodix_sensor_cmd (self, MOC_CMD0_ENROLL_INIT, MOC_CMD1_DEFAULT,
false, false,
(const guint8 *) &dummy, (const guint8 *) &dummy,
1, 1,
fp_enroll_init_cb); fp_enroll_create_cb);
} }
break; break;
@@ -1359,10 +1359,15 @@ gx_fp_probe (FpDevice *device)
{ {
case 0x6496: case 0x6496:
case 0x60A2: case 0x60A2:
case 0x60A4:
case 0x6014: case 0x6014:
case 0x6092:
case 0x6094: case 0x6094:
case 0x609C: case 0x609C:
case 0x60BC:
case 0x6304:
case 0x631C: case 0x631C:
case 0x633C:
case 0x634C: case 0x634C:
case 0x6384: case 0x6384:
case 0x639C: case 0x639C:
@@ -1602,10 +1607,15 @@ fpi_device_goodixmoc_init (FpiDeviceGoodixMoc *self)
static const FpIdEntry id_table[] = { static const FpIdEntry id_table[] = {
{ .vid = 0x27c6, .pid = 0x5840, }, { .vid = 0x27c6, .pid = 0x5840, },
{ .vid = 0x27c6, .pid = 0x6014, }, { .vid = 0x27c6, .pid = 0x6014, },
{ .vid = 0x27c6, .pid = 0x6092, },
{ .vid = 0x27c6, .pid = 0x6094, }, { .vid = 0x27c6, .pid = 0x6094, },
{ .vid = 0x27c6, .pid = 0x609C, }, { .vid = 0x27c6, .pid = 0x609C, },
{ .vid = 0x27c6, .pid = 0x60A2, }, { .vid = 0x27c6, .pid = 0x60A2, },
{ .vid = 0x27c6, .pid = 0x60A4, },
{ .vid = 0x27c6, .pid = 0x60BC, },
{ .vid = 0x27c6, .pid = 0x6304, },
{ .vid = 0x27c6, .pid = 0x631C, }, { .vid = 0x27c6, .pid = 0x631C, },
{ .vid = 0x27c6, .pid = 0x633C, },
{ .vid = 0x27c6, .pid = 0x634C, }, { .vid = 0x27c6, .pid = 0x634C, },
{ .vid = 0x27c6, .pid = 0x6384, }, { .vid = 0x27c6, .pid = 0x6384, },
{ .vid = 0x27c6, .pid = 0x639C, }, { .vid = 0x27c6, .pid = 0x639C, },
-1
View File
@@ -44,7 +44,6 @@ typedef enum {
typedef enum { typedef enum {
FP_ENROLL_PWR_BTN_SHIELD_ON = 0, FP_ENROLL_PWR_BTN_SHIELD_ON = 0,
FP_ENROLL_ENUM, FP_ENROLL_ENUM,
FP_ENROLL_IDENTIFY,
FP_ENROLL_CREATE, FP_ENROLL_CREATE,
FP_ENROLL_CAPTURE, FP_ENROLL_CAPTURE,
FP_ENROLL_UPDATE, FP_ENROLL_UPDATE,
+2 -2
View File
@@ -343,10 +343,10 @@ gx_proto_parse_body (uint16_t cmd, uint8_t *buffer, uint16_t buffer_len, pgxfp_c
break; break;
case MOC_CMD0_ENROLL_INIT: case MOC_CMD0_ENROLL_INIT:
if (buffer_len < sizeof (gxfp_enroll_init_t) + 1) if (buffer_len < sizeof (gxfp_enroll_create_t) + 1)
return -1; return -1;
if (presp->result == GX_SUCCESS) if (presp->result == GX_SUCCESS)
memcpy (&presp->enroll_init.tid, &buffer[1], TEMPLATE_ID_SIZE); memcpy (&presp->enroll_create.tid, &buffer[1], TEMPLATE_ID_SIZE);
break; break;
case MOC_CMD0_ENROLL: case MOC_CMD0_ENROLL:
+3 -3
View File
@@ -105,10 +105,10 @@ typedef struct _gxfp_parse_msg
} gxfp_parse_msg_t, *pgxfp_parse_msg_t; } gxfp_parse_msg_t, *pgxfp_parse_msg_t;
typedef struct _gxfp_enroll_init typedef struct _gxfp_enroll_create
{ {
uint8_t tid[TEMPLATE_ID_SIZE]; uint8_t tid[TEMPLATE_ID_SIZE];
} gxfp_enroll_init_t, *pgxfp_enroll_init_t; } gxfp_enroll_create_t, *pgxfp_enroll_create_t;
#pragma pack(push, 1) #pragma pack(push, 1)
typedef struct _template_format typedef struct _template_format
@@ -192,7 +192,7 @@ typedef struct _fp_cmd_response
{ {
gxfp_parse_msg_t parse_msg; gxfp_parse_msg_t parse_msg;
gxfp_verify_t verify; gxfp_verify_t verify;
gxfp_enroll_init_t enroll_init; gxfp_enroll_create_t enroll_create;
gxfp_capturedata_t capture_data_resp; gxfp_capturedata_t capture_data_resp;
gxfp_check_duplicate_t check_duplicate_resp; gxfp_check_duplicate_t check_duplicate_resp;
gxfp_enroll_commit_t enroll_commit; gxfp_enroll_commit_t enroll_commit;
+112 -20
View File
@@ -31,10 +31,6 @@ static void start_deactivation (FpImageDevice *dev);
#define CTRL_TIMEOUT 4000 #define CTRL_TIMEOUT 4000
#define BULK_TIMEOUT 4000 #define BULK_TIMEOUT 4000
#define IMAGE_WIDTH 144
#define IMAGE_HEIGHT 384
#define IMAGE_SIZE (IMAGE_WIDTH * IMAGE_HEIGHT)
#define MAX_CMD_SIZE 64 #define MAX_CMD_SIZE 64
#define MAX_RESPONSE_SIZE 2052 #define MAX_RESPONSE_SIZE 2052
#define SHORT_RESPONSE_SIZE 64 #define SHORT_RESPONSE_SIZE 64
@@ -47,8 +43,10 @@ struct _FpiDeviceUpektcImg
unsigned char response[MAX_RESPONSE_SIZE]; unsigned char response[MAX_RESPONSE_SIZE];
unsigned char *image_bits; unsigned char *image_bits;
unsigned char seq; unsigned char seq;
size_t expected_image_size;
size_t image_size; size_t image_size;
size_t response_rest; size_t response_rest;
gboolean area_sensor;
gboolean deactivating; gboolean deactivating;
}; };
G_DECLARE_FINAL_TYPE (FpiDeviceUpektcImg, fpi_device_upektc_img, FPI, G_DECLARE_FINAL_TYPE (FpiDeviceUpektcImg, fpi_device_upektc_img, FPI,
@@ -180,6 +178,7 @@ capture_read_data_cb (FpiUsbTransfer *transfer, FpDevice *device,
gpointer user_data, GError *error) gpointer user_data, GError *error)
{ {
FpImageDevice *dev = FP_IMAGE_DEVICE (device); FpImageDevice *dev = FP_IMAGE_DEVICE (device);
FpImageDeviceClass *img_class = FP_IMAGE_DEVICE_GET_CLASS (dev);
FpiDeviceUpektcImg *self = FPI_DEVICE_UPEKTC_IMG (dev); FpiDeviceUpektcImg *self = FPI_DEVICE_UPEKTC_IMG (dev);
unsigned char *data = self->response; unsigned char *data = self->response;
FpImage *img; FpImage *img;
@@ -247,8 +246,30 @@ capture_read_data_cb (FpiUsbTransfer *transfer, FpDevice *device,
CAPTURE_ACK_00_28); CAPTURE_ACK_00_28);
break; break;
case 0x13:
/* finger is present keep your finger on reader */
fpi_device_report_finger_status_changes (device,
FP_FINGER_STATUS_NEEDED,
FP_FINGER_STATUS_NONE);
fpi_ssm_jump_to_state (transfer->ssm,
self->area_sensor ?
CAPTURE_ACK_00_28 : CAPTURE_ACK_00_28_TERM);
break;
case 0x00: case 0x00:
/* finger is present! */ /* finger is present! */
fpi_device_report_finger_status_changes (device,
FP_FINGER_STATUS_PRESENT,
FP_FINGER_STATUS_NONE);
fpi_ssm_jump_to_state (transfer->ssm,
CAPTURE_ACK_00_28);
break;
case 0x01:
/* no finger! */
fpi_device_report_finger_status_changes (device,
FP_FINGER_STATUS_NONE,
FP_FINGER_STATUS_PRESENT);
fpi_ssm_jump_to_state (transfer->ssm, fpi_ssm_jump_to_state (transfer->ssm,
CAPTURE_ACK_00_28); CAPTURE_ACK_00_28);
break; break;
@@ -261,18 +282,20 @@ capture_read_data_cb (FpiUsbTransfer *transfer, FpDevice *device,
fpi_image_device_report_finger_status (dev, fpi_image_device_report_finger_status (dev,
FALSE); FALSE);
fpi_ssm_jump_to_state (transfer->ssm, fpi_ssm_jump_to_state (transfer->ssm,
CAPTURE_ACK_00_28_TERM); self->area_sensor ?
CAPTURE_ACK_00_28 : CAPTURE_ACK_00_28_TERM);
break; break;
case 0x1d: case 0x1d:
/* too much horisontal movement */ /* too much horizontal movement */
fp_err ("too much horisontal movement, aborting"); fp_err ("too much horizontal movement, aborting");
fpi_image_device_retry_scan (dev, fpi_image_device_retry_scan (dev,
FP_DEVICE_RETRY_CENTER_FINGER); FP_DEVICE_RETRY_CENTER_FINGER);
fpi_image_device_report_finger_status (dev, fpi_image_device_report_finger_status (dev,
FALSE); FALSE);
fpi_ssm_jump_to_state (transfer->ssm, fpi_ssm_jump_to_state (transfer->ssm,
CAPTURE_ACK_00_28_TERM); self->area_sensor ?
CAPTURE_ACK_00_28 : CAPTURE_ACK_00_28_TERM);
break; break;
default: default:
@@ -283,7 +306,8 @@ capture_read_data_cb (FpiUsbTransfer *transfer, FpDevice *device,
fpi_image_device_report_finger_status (dev, fpi_image_device_report_finger_status (dev,
FALSE); FALSE);
fpi_ssm_jump_to_state (transfer->ssm, fpi_ssm_jump_to_state (transfer->ssm,
CAPTURE_ACK_00_28_TERM); self->area_sensor ?
CAPTURE_ACK_00_28 : CAPTURE_ACK_00_28_TERM);
break; break;
} }
break; break;
@@ -307,13 +331,13 @@ capture_read_data_cb (FpiUsbTransfer *transfer, FpDevice *device,
self->image_size += self->image_size +=
upektc_img_process_image_frame (self->image_bits + self->image_size, upektc_img_process_image_frame (self->image_bits + self->image_size,
data); data);
BUG_ON (self->image_size != IMAGE_SIZE); BUG_ON (self->image_size != self->expected_image_size);
fp_dbg ("Image size is %lu", fp_dbg ("Image size is %lu",
(gulong) self->image_size); (gulong) self->image_size);
img = fp_image_new (IMAGE_WIDTH, IMAGE_HEIGHT); img = fp_image_new (img_class->img_width, img_class->img_height);
img->flags |= FPI_IMAGE_PARTIAL; img->flags |= FPI_IMAGE_PARTIAL;
memcpy (img->data, self->image_bits, memcpy (img->data, self->image_bits,
IMAGE_SIZE); self->image_size);
fpi_image_device_image_captured (dev, img); fpi_image_device_image_captured (dev, img);
fpi_image_device_report_finger_status (dev, fpi_image_device_report_finger_status (dev,
FALSE); FALSE);
@@ -346,6 +370,10 @@ capture_run_state (FpiSsm *ssm, FpDevice *_dev)
switch (fpi_ssm_get_cur_state (ssm)) switch (fpi_ssm_get_cur_state (ssm))
{ {
case CAPTURE_INIT_CAPTURE: case CAPTURE_INIT_CAPTURE:
if (self->area_sensor)
upektc_img_submit_req (ssm, dev, upek2020_init_capture_press, sizeof (upek2020_init_capture_press),
self->seq, capture_reqs_cb);
else
upektc_img_submit_req (ssm, dev, upek2020_init_capture, sizeof (upek2020_init_capture), upektc_img_submit_req (ssm, dev, upek2020_init_capture, sizeof (upek2020_init_capture),
self->seq, capture_reqs_cb); self->seq, capture_reqs_cb);
self->seq++; self->seq++;
@@ -513,15 +541,81 @@ init_reqs_cb (FpiUsbTransfer *transfer, FpDevice *device,
fpi_ssm_mark_failed (transfer->ssm, error); fpi_ssm_mark_failed (transfer->ssm, error);
} }
/* TODO: process response properly */
static void static void
init_read_data_cb (FpiUsbTransfer *transfer, FpDevice *device, init_read_data_cb (FpiUsbTransfer *transfer, FpDevice *device,
gpointer user_data, GError *error) gpointer user_data, GError *error)
{ {
if (!error) FpImageDevice *dev = FP_IMAGE_DEVICE (device);
fpi_ssm_next_state (transfer->ssm); FpiDeviceUpektcImg *self = FPI_DEVICE_UPEKTC_IMG (dev);
else unsigned char *data = self->response;
if (error)
{
fpi_ssm_mark_failed (transfer->ssm, error); fpi_ssm_mark_failed (transfer->ssm, error);
return;
}
if (data[12] == 0x06 && data[13] == 0x14) /* if get_info */
{
FpImageDeviceClass *img_class = FP_IMAGE_DEVICE_GET_CLASS (dev);
uint16_t width = (data[51] << 8) | data[50];
uint16_t height = (data[53] << 8) | data[52];
self->area_sensor = !(data[49] & 0x80);
switch (width)
{
case 256:
fp_dbg ("Sensor type : TCS1x, width x height: %hu x %hu", width, height); /* 360x256 --- 270x192 must be set */
BUG_ON (height != 360);
img_class->img_width = 192;
img_class->img_height = 270;
break;
case 208:
fp_dbg ("Sensor type : TCS2, width x height: %hu x %hu", width, height); /* 288x208 --- 216x156 must be set */
BUG_ON (height != 288);
img_class->img_width = 156;
img_class->img_height = 216;
break;
case 248:
fp_dbg ("Sensor type : TCS3, width x height: %hu x %hu", width, height); /* 360x248 --- 270x186 must be set */
BUG_ON (height != 360);
img_class->img_width = 186;
img_class->img_height = 270;
break;
case 192:
fp_dbg ("Sensor type : TCS4x, width x height: %hu x %hu", width, height); /* 512x192 --- 384x144 must be set */
BUG_ON (height != 512);
img_class->img_width = 144;
img_class->img_height = 384;
break;
case 144:
fp_dbg ("Sensor type : TCS5x, width x height: %hu x %hu", width, height); /* 512x144 --- 384x108 must be set */
BUG_ON (height != 512);
img_class->img_width = 108;
img_class->img_height = 384;
break;
default:
fp_dbg ("Sensor type : Unknown");
fpi_ssm_mark_failed (transfer->ssm,
fpi_device_error_new_msg (FP_DEVICE_ERROR_PROTO,
"Unknown sensor type (reported size %dx%d)",
width, height));
return;
}
self->expected_image_size = img_class->img_width * img_class->img_height;
self->image_bits = g_malloc0 (self->expected_image_size * 2);
}
fpi_ssm_next_state (transfer->ssm);
} }
static void static void
@@ -616,7 +710,6 @@ dev_deactivate (FpImageDevice *dev)
static void static void
dev_init (FpImageDevice *dev) dev_init (FpImageDevice *dev)
{ {
FpiDeviceUpektcImg *self = FPI_DEVICE_UPEKTC_IMG (dev);
GError *error = NULL; GError *error = NULL;
/* TODO check that device has endpoints we're using */ /* TODO check that device has endpoints we're using */
@@ -627,7 +720,6 @@ dev_init (FpImageDevice *dev)
return; return;
} }
self->image_bits = g_malloc0 (IMAGE_SIZE * 2);
fpi_image_device_open_complete (dev, NULL); fpi_image_device_open_complete (dev, NULL);
} }
@@ -687,6 +779,6 @@ fpi_device_upektc_img_class_init (FpiDeviceUpektcImgClass *klass)
img_class->bz3_threshold = 20; img_class->bz3_threshold = 20;
img_class->img_width = IMAGE_WIDTH; img_class->img_width = -1;
img_class->img_height = IMAGE_HEIGHT; img_class->img_height = -1;
} }
+16
View File
@@ -75,6 +75,22 @@ static const unsigned char upek2020_init_capture[] = {
0x02, 0x02,
0x00, /* Wait for acceptable finger */ 0x00, /* Wait for acceptable finger */
0x02, 0x02,
0x25, 0xa9 /* CRC */
};
static const unsigned char upek2020_init_capture_press[] = {
'C', 'i', 'a', 'o',
0x00,
0x00, 0x0e, /* Seq = 7, len = 0x00e */
0x28, /* CMD = 0x28 */
0x0b, 0x00, /* Inner len = 0x000b */
0x00, 0x00,
0x0e, /* SUBCMD = 0x0e */
0x02,
0xfe, 0xff, 0xff, 0xff, /* timeout = -2 = 0xfffffffe = infinite time */
0x02,
0x01, /* Wait for finger */
0x02,
0x14, 0x9a /* CRC */ 0x14, 0x9a /* CRC */
}; };
+2 -1
View File
@@ -273,7 +273,8 @@ on_stream_read_cb (GObject *source_object,
} }
else else
{ {
// g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_INVALID_DATA, "Got empty data"); g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
"Got empty data");
return; return;
} }
} }
+6
View File
@@ -733,7 +733,13 @@ dev_deinit (FpDevice *dev)
} }
if (!self->keep_alive) if (!self->keep_alive)
{
stop_listener (self); stop_listener (self);
self->supports_cancellation = TRUE;
}
self->enroll_stages_passed = 0;
self->match_reported = FALSE;
fpi_device_close_complete (dev, NULL); fpi_device_close_complete (dev, NULL);
} }
+3 -3
View File
@@ -26,7 +26,7 @@
#include <nbis.h> #include <nbis.h>
#include <config.h> #include <config.h>
#if HAVE_PIXMAN #ifdef HAVE_PIXMAN
#include <pixman.h> #include <pixman.h>
#endif #endif
@@ -113,7 +113,7 @@ fpi_image_resize (FpImage *orig_img,
guint w_factor, guint w_factor,
guint h_factor) guint h_factor)
{ {
#if HAVE_PIXMAN #ifdef HAVE_PIXMAN
int new_width = orig_img->width * w_factor; int new_width = orig_img->width * w_factor;
int new_height = orig_img->height * h_factor; int new_height = orig_img->height * h_factor;
pixman_image_t *orig, *resized; pixman_image_t *orig, *resized;
@@ -149,6 +149,6 @@ fpi_image_resize (FpImage *orig_img,
#else #else
fp_err ("Libfprint compiled without pixman support, impossible to resize"); fp_err ("Libfprint compiled without pixman support, impossible to resize");
return NULL; return g_object_ref (orig_img);
#endif #endif
} }
+2 -2
View File
@@ -132,7 +132,7 @@ main (int argc, char **argv)
g_print ("%s", (char *) l->data); g_print ("%s", (char *) l->data);
g_print ("\n"); g_print ("\n");
g_list_free_full (usb_list, g_free); g_list_free_full (g_steal_pointer (&usb_list), g_free);
g_print ("## SPI devices\n"); g_print ("## SPI devices\n");
g_print ("\n"); g_print ("\n");
@@ -146,7 +146,7 @@ main (int argc, char **argv)
g_print ("%s", (char *) l->data); g_print ("%s", (char *) l->data);
g_print ("\n"); g_print ("\n");
g_list_free_full (usb_list, g_free); g_list_free_full (g_steal_pointer (&spi_list), g_free);
g_hash_table_destroy (printed); g_hash_table_destroy (printed);
+2 -2
View File
@@ -267,7 +267,7 @@ libfprint_drivers = static_library('fprint-drivers',
install: false) install: false)
mapfile = files('libfprint.ver') mapfile = files('libfprint.ver')
vflag = '-Wl,--version-script,@0@/@1@'.format(meson.source_root(), mapfile[0]) vflag = '-Wl,--version-script,@0@/@1@'.format(meson.project_source_root(), mapfile[0])
libfprint = shared_library(versioned_libname.split('lib')[1], libfprint = shared_library(versioned_libname.split('lib')[1],
sources: [ sources: [
@@ -343,7 +343,7 @@ sync_udev_udb = custom_target('sync-udev-hwdb',
command: [ command: [
'cp', '-v', 'cp', '-v',
udev_hwdb_generator.full_path(), udev_hwdb_generator.full_path(),
meson.source_root() / 'data' meson.project_source_root() / 'data'
] ]
) )
+11 -6
View File
@@ -1,18 +1,23 @@
project('libfprint', [ 'c', 'cpp' ], project('libfprint', [ 'c', 'cpp' ],
version: '1.94.5+tod1', version: '1.94.6+tod1',
license: 'LGPLv2.1+', license: 'LGPLv2.1+',
default_options: [ default_options: [
'buildtype=debugoptimized', 'buildtype=debugoptimized',
'warning_level=1', 'warning_level=1',
'c_std=gnu99', 'c_std=gnu99',
], ],
meson_version: '>= 0.49.0') meson_version: '>= 0.56.0')
gnome = import('gnome') gnome = import('gnome')
libfprint_conf = configuration_data() libfprint_conf = configuration_data()
libfprint_conf.set_quoted('LIBFPRINT_VERSION', meson.project_version()) libfprint_conf.set_quoted('LIBFPRINT_VERSION', meson.project_version())
prefix = get_option('prefix')
libdir = prefix / get_option('libdir')
libexecdir = prefix / get_option('libexecdir')
datadir = prefix / get_option('datadir')
cc = meson.get_compiler('c') cc = meson.get_compiler('c')
cpp = meson.get_compiler('cpp') cpp = meson.get_compiler('cpp')
host_system = host_machine.system() host_system = host_machine.system()
@@ -286,8 +291,6 @@ else
endif endif
if get_option('gtk-examples') if get_option('gtk-examples')
gnome = import('gnome')
gtk_dep = dependency('gtk+-3.0', required: false) gtk_dep = dependency('gtk+-3.0', required: false)
if not gtk_dep.found() if not gtk_dep.found()
error('GTK+ 3.x is required for GTK+ examples') error('GTK+ 3.x is required for GTK+ examples')
@@ -300,9 +303,7 @@ subdir('libfprint')
libfprint_conf.set10('HAVE_LIBFPRINT_TOD', get_option('tod')) libfprint_conf.set10('HAVE_LIBFPRINT_TOD', get_option('tod'))
configure_file(output: 'config.h', configuration: libfprint_conf) configure_file(output: 'config.h', configuration: libfprint_conf)
subdir('examples')
if get_option('doc') if get_option('doc')
gnome = import('gnome')
subdir('doc') subdir('doc')
endif endif
if get_option('gtk-examples') if get_option('gtk-examples')
@@ -312,6 +313,8 @@ endif
subdir('data') subdir('data')
subdir('tests') subdir('tests')
subdir('examples')
pkgconfig = import('pkgconfig') pkgconfig = import('pkgconfig')
pkgconfig.generate( pkgconfig.generate(
name: versioned_libname, name: versioned_libname,
@@ -322,3 +325,5 @@ pkgconfig.generate(
subdirs: versioned_libname, subdirs: versioned_libname,
filebase: versioned_libname, filebase: versioned_libname,
) )
summary({'Drivers': drivers, }, section: 'Drivers')
+5
View File
@@ -31,6 +31,11 @@ option('doc',
type: 'boolean', type: 'boolean',
value: true) value: true)
option('installed-tests',
description: 'Whether to install the installed tests',
type: 'boolean',
value: true)
option('tod', option('tod',
description: 'Whether to build the TOD library', description: 'Whether to build the TOD library',
type: 'boolean', type: 'boolean',
+5
View File
@@ -0,0 +1,5 @@
[Test]
Type=session
# We can't use TestEnvironment as per
# https://gitlab.gnome.org/GNOME/gnome-desktop-testing/-/issues/1
Exec=env @driver_env@ @installed_tests_execdir@/@umockdev_test_name@ @installed_tests_testdir@/@driver_test@
Binary file not shown.
+80 -69
View File
@@ -1,31 +1,30 @@
P: /devices/pci0000:00/0000:00:14.0/usb1/1-3 P: /devices/pci0000:00/0000:00:14.0/usb3/3-9
N: bus/usb/001/023=12010002EF000040C627966400010102030109022000010103A0320904000002FF0000040705830240000007050102400000 N: bus/usb/003/004=12010002EF000040C627AC6300010102030109022000010103A0320904000002FF0000040705830240000007050102400000
E: DEVNAME=/dev/bus/usb/001/023 E: DEVNAME=/dev/bus/usb/003/004
E: DEVTYPE=usb_device E: DEVTYPE=usb_device
E: DRIVER=usb E: DRIVER=usb
E: PRODUCT=27c6/6496/100 E: PRODUCT=27c6/63ac/100
E: TYPE=239/0/0 E: TYPE=239/0/0
E: BUSNUM=001 E: BUSNUM=003
E: DEVNUM=023 E: DEVNUM=004
E: MAJOR=189 E: MAJOR=189
E: MINOR=22 E: MINOR=259
E: SUBSYSTEM=usb E: SUBSYSTEM=usb
E: ID_VENDOR=Goodix_Technology_Co.__Ltd. E: ID_VENDOR=Goodix_Technology_Co.__Ltd.
E: ID_VENDOR_ENC=Goodix\x20Technology\x20Co.\x2c\x20Ltd. E: ID_VENDOR_ENC=Goodix\x20Technology\x20Co.\x2c\x20Ltd.
E: ID_VENDOR_ID=27c6 E: ID_VENDOR_ID=27c6
E: ID_MODEL=Goodix_USB2.0_MISC E: ID_MODEL=Goodix_USB2.0_MISC
E: ID_MODEL_ENC=Goodix\x20USB2.0\x20MISC E: ID_MODEL_ENC=Goodix\x20USB2.0\x20MISC
E: ID_MODEL_ID=6496 E: ID_MODEL_ID=63ac
E: ID_REVISION=0100 E: ID_REVISION=0100
E: ID_SERIAL=Goodix_Technology_Co.__Ltd._Goodix_USB2.0_MISC_XXXX_MOC_B0 E: ID_SERIAL=Goodix_Technology_Co.__Ltd._Goodix_USB2.0_MISC_UID4C77C784_XXXX_MOC_B0
E: ID_SERIAL_SHORT=XXXX_MOC_B0 E: ID_SERIAL_SHORT=UID4C77C784_XXXX_MOC_B0
E: ID_BUS=usb E: ID_BUS=usb
E: ID_USB_INTERFACES=:ff0000: E: ID_USB_INTERFACES=:ff0000:
E: ID_VENDOR_FROM_DATABASE=Shenzhen Goodix Technology Co.,Ltd. E: ID_VENDOR_FROM_DATABASE=Shenzhen Goodix Technology Co.,Ltd.
E: ID_AUTOSUSPEND=1 E: ID_AUTOSUSPEND=1
E: ID_PERSIST=0 E: ID_PATH=pci-0000:00:14.0-usb-0:9
E: ID_PATH=pci-0000:00:14.0-usb-0:3 E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_9
E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_3
A: authorized=1\n A: authorized=1\n
A: avoid_reset_quirk=0\n A: avoid_reset_quirk=0\n
A: bConfigurationValue=1\n A: bConfigurationValue=1\n
@@ -38,30 +37,34 @@ A: bNumConfigurations=1\n
A: bNumInterfaces= 1\n A: bNumInterfaces= 1\n
A: bcdDevice=0100\n A: bcdDevice=0100\n
A: bmAttributes=a0\n A: bmAttributes=a0\n
A: busnum=1\n A: busnum=3\n
A: configuration=XXXX_MOC_B0\n A: configuration=UID4C77C784_XXXX_MOC_B0\n
H: descriptors=12010002EF000040C627966400010102030109022000010103A0320904000002FF0000040705830240000007050102400000 H: descriptors=12010002EF000040C627AC6300010102030109022000010103A0320904000002FF0000040705830240000007050102400000
A: dev=189:22\n A: dev=189:259\n
A: devnum=23\n A: devnum=4\n
A: devpath=3\n A: devpath=9\n
L: driver=../../../../../bus/usb/drivers/usb L: driver=../../../../../bus/usb/drivers/usb
L: firmware_node=../../../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:1c/device:1d/device:20 L: firmware_node=../../../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:13/device:14/device:1f
A: idProduct=6496\n A: idProduct=63ac\n
A: idVendor=27c6\n A: idVendor=27c6\n
A: ltm_capable=no\n A: ltm_capable=no\n
A: manufacturer=Goodix Technology Co., Ltd.\n A: manufacturer=Goodix Technology Co., Ltd.\n
A: maxchild=0\n A: maxchild=0\n
L: port=../1-0:1.0/usb1-port3 L: port=../3-0:1.0/usb3-port9
A: power/active_duration=22667\n A: power/active_duration=702588\n
A: power/async=enabled\n
A: power/autosuspend=2\n A: power/autosuspend=2\n
A: power/autosuspend_delay_ms=2000\n A: power/autosuspend_delay_ms=2000\n
A: power/connected_duration=917616\n A: power/connected_duration=78973756\n
A: power/control=auto\n A: power/control=auto\n
A: power/level=auto\n A: power/level=auto\n
A: power/persist=1\n A: power/persist=1\n
A: power/runtime_active_time=22809\n A: power/runtime_active_kids=0\n
A: power/runtime_active_time=707156\n
A: power/runtime_enabled=enabled\n
A: power/runtime_status=active\n A: power/runtime_status=active\n
A: power/runtime_suspended_time=894564\n A: power/runtime_suspended_time=78265226\n
A: power/runtime_usage=0\n
A: power/wakeup=disabled\n A: power/wakeup=disabled\n
A: power/wakeup_abort_count=\n A: power/wakeup_abort_count=\n
A: power/wakeup_active=\n A: power/wakeup_active=\n
@@ -73,34 +76,34 @@ A: power/wakeup_max_time_ms=\n
A: power/wakeup_total_time_ms=\n A: power/wakeup_total_time_ms=\n
A: product=Goodix USB2.0 MISC\n A: product=Goodix USB2.0 MISC\n
A: quirks=0x0\n A: quirks=0x0\n
A: removable=removable\n A: removable=fixed\n
A: rx_lanes=1\n A: rx_lanes=1\n
A: serial=XXXX_MOC_B0\n A: serial=UID4C77C784_XXXX_MOC_B0\n
A: speed=12\n A: speed=12\n
A: tx_lanes=1\n A: tx_lanes=1\n
A: urbnum=298\n A: urbnum=5759\n
A: version= 2.00\n A: version= 2.00\n
P: /devices/pci0000:00/0000:00:14.0/usb1 P: /devices/pci0000:00/0000:00:14.0/usb3
N: bus/usb/001/001=12010002090001406B1D020017050302010109021900010100E0000904000001090000000705810304000C N: bus/usb/003/001=12010002090001406B1D020015050302010109021900010100E0000904000001090000000705810304000C
E: DEVNAME=/dev/bus/usb/001/001 E: DEVNAME=/dev/bus/usb/003/001
E: DEVTYPE=usb_device E: DEVTYPE=usb_device
E: DRIVER=usb E: DRIVER=usb
E: PRODUCT=1d6b/2/517 E: PRODUCT=1d6b/2/515
E: TYPE=9/0/1 E: TYPE=9/0/1
E: BUSNUM=001 E: BUSNUM=003
E: DEVNUM=001 E: DEVNUM=001
E: MAJOR=189 E: MAJOR=189
E: MINOR=0 E: MINOR=256
E: SUBSYSTEM=usb E: SUBSYSTEM=usb
E: ID_VENDOR=Linux_5.17.12-300.fc36.x86_64_xhci-hcd E: ID_VENDOR=Linux_5.15.0-57-generic_xhci-hcd
E: ID_VENDOR_ENC=Linux\x205.17.12-300.fc36.x86_64\x20xhci-hcd E: ID_VENDOR_ENC=Linux\x205.15.0-57-generic\x20xhci-hcd
E: ID_VENDOR_ID=1d6b E: ID_VENDOR_ID=1d6b
E: ID_MODEL=xHCI_Host_Controller E: ID_MODEL=xHCI_Host_Controller
E: ID_MODEL_ENC=xHCI\x20Host\x20Controller E: ID_MODEL_ENC=xHCI\x20Host\x20Controller
E: ID_MODEL_ID=0002 E: ID_MODEL_ID=0002
E: ID_REVISION=0517 E: ID_REVISION=0515
E: ID_SERIAL=Linux_5.17.12-300.fc36.x86_64_xhci-hcd_xHCI_Host_Controller_0000:00:14.0 E: ID_SERIAL=Linux_5.15.0-57-generic_xhci-hcd_xHCI_Host_Controller_0000:00:14.0
E: ID_SERIAL_SHORT=0000:00:14.0 E: ID_SERIAL_SHORT=0000:00:14.0
E: ID_BUS=usb E: ID_BUS=usb
E: ID_USB_INTERFACES=:090000: E: ID_USB_INTERFACES=:090000:
@@ -123,31 +126,35 @@ A: bMaxPacketSize0=64\n
A: bMaxPower=0mA\n A: bMaxPower=0mA\n
A: bNumConfigurations=1\n A: bNumConfigurations=1\n
A: bNumInterfaces= 1\n A: bNumInterfaces= 1\n
A: bcdDevice=0517\n A: bcdDevice=0515\n
A: bmAttributes=e0\n A: bmAttributes=e0\n
A: busnum=1\n A: busnum=3\n
A: configuration=\n A: configuration=
H: descriptors=12010002090001406B1D020017050302010109021900010100E0000904000001090000000705810304000C H: descriptors=12010002090001406B1D020015050302010109021900010100E0000904000001090000000705810304000C
A: dev=189:0\n A: dev=189:256\n
A: devnum=1\n A: devnum=1\n
A: devpath=0\n A: devpath=0\n
L: driver=../../../../bus/usb/drivers/usb L: driver=../../../../bus/usb/drivers/usb
L: firmware_node=../../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:1c/device:1d L: firmware_node=../../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:13/device:14
A: idProduct=0002\n A: idProduct=0002\n
A: idVendor=1d6b\n A: idVendor=1d6b\n
A: interface_authorized_default=1\n A: interface_authorized_default=1\n
A: ltm_capable=no\n A: ltm_capable=no\n
A: manufacturer=Linux 5.17.12-300.fc36.x86_64 xhci-hcd\n A: manufacturer=Linux 5.15.0-57-generic xhci-hcd\n
A: maxchild=12\n A: maxchild=12\n
A: power/active_duration=164289796\n A: power/active_duration=78971960\n
A: power/async=enabled\n
A: power/autosuspend=0\n A: power/autosuspend=0\n
A: power/autosuspend_delay_ms=0\n A: power/autosuspend_delay_ms=0\n
A: power/connected_duration=164360220\n A: power/connected_duration=78974992\n
A: power/control=auto\n A: power/control=auto\n
A: power/level=auto\n A: power/level=auto\n
A: power/runtime_active_time=164331876\n A: power/runtime_active_kids=2\n
A: power/runtime_active_time=78973899\n
A: power/runtime_enabled=enabled\n
A: power/runtime_status=active\n A: power/runtime_status=active\n
A: power/runtime_suspended_time=0\n A: power/runtime_suspended_time=0\n
A: power/runtime_usage=0\n
A: power/wakeup=disabled\n A: power/wakeup=disabled\n
A: power/wakeup_abort_count=\n A: power/wakeup_abort_count=\n
A: power/wakeup_active=\n A: power/wakeup_active=\n
@@ -164,48 +171,52 @@ A: rx_lanes=1\n
A: serial=0000:00:14.0\n A: serial=0000:00:14.0\n
A: speed=480\n A: speed=480\n
A: tx_lanes=1\n A: tx_lanes=1\n
A: urbnum=2097\n A: urbnum=1824\n
A: version= 2.00\n A: version= 2.00\n
P: /devices/pci0000:00/0000:00:14.0 P: /devices/pci0000:00/0000:00:14.0
E: DRIVER=xhci_hcd E: DRIVER=xhci_hcd
E: PCI_CLASS=C0330 E: PCI_CLASS=C0330
E: PCI_ID=8086:9DED E: PCI_ID=8086:51ED
E: PCI_SUBSYS_ID=17AA:2292 E: PCI_SUBSYS_ID=1028:0B00
E: PCI_SLOT_NAME=0000:00:14.0 E: PCI_SLOT_NAME=0000:00:14.0
E: MODALIAS=pci:v00008086d00009DEDsv000017AAsd00002292bc0Csc03i30 E: MODALIAS=pci:v00008086d000051EDsv00001028sd00000B00bc0Csc03i30
E: SUBSYSTEM=pci E: SUBSYSTEM=pci
E: ID_PCI_CLASS_FROM_DATABASE=Serial bus controller E: ID_PCI_CLASS_FROM_DATABASE=Serial bus controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=USB controller E: ID_PCI_SUBCLASS_FROM_DATABASE=USB controller
E: ID_PCI_INTERFACE_FROM_DATABASE=XHCI E: ID_PCI_INTERFACE_FROM_DATABASE=XHCI
E: ID_VENDOR_FROM_DATABASE=Intel Corporation E: ID_VENDOR_FROM_DATABASE=Intel Corporation
E: ID_AUTOSUSPEND=1
E: ID_MODEL_FROM_DATABASE=Cannon Point-LP USB 3.1 xHCI Controller
A: ari_enabled=0\n A: ari_enabled=0\n
A: broken_parity_status=0\n A: broken_parity_status=0\n
A: class=0x0c0330\n A: class=0x0c0330\n
H: config=8680ED9D060490021130030C00008000040022EA000000000000000000000000000000000000000000000000AA179222000000007000000000000000FF010000FD0134808FC6FF8300000000000000007F6DDC0F00000000F507312600000000316000000000000000000000000000000180C2C1080000000000000000000000059087001803E0FE0000000000000000090014F01000400100000000C10A080000080E00001800008F40020000010000000000000000000008000000040000000000000000000000000000000000000000000000000000000800000004000000000000000000000000000000000000000000000000000000B50F320112000000 H: config=8680ED51060490020130030C0000800004002A8F6200000000000000000000000000000000000000000000002810000B000000007000000000000000FF010000FD0134A089C27F8000000000000000003F6DD80F000000000000000000000000316000000000000000000000000000000180C2C1080000000000000000000000059087003808E0FE000000000000000009B014F01000400100000000C10A080000080E00001800008F50020000010000090000018680C00009001014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000B50F100112000000
A: consistent_dma_mask_bits=64\n A: consistent_dma_mask_bits=64\n
A: d3cold_allowed=1\n A: d3cold_allowed=1\n
A: dbc=disabled\n A: dbc=disabled\n
A: device=0x9ded\n A: device=0x51ed\n
A: dma_mask_bits=64\n A: dma_mask_bits=64\n
L: driver=../../../bus/pci/drivers/xhci_hcd L: driver=../../../bus/pci/drivers/xhci_hcd
A: driver_override=(null)\n A: driver_override=(null)\n
A: enable=1\n A: enable=1\n
L: firmware_node=../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:1c L: firmware_node=../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:13
A: irq=128\n L: iommu=../../virtual/iommu/dmar1
A: local_cpulist=0-7\n L: iommu_group=../../../kernel/iommu_groups/13
A: local_cpus=ff\n A: irq=167\n
A: modalias=pci:v00008086d00009DEDsv000017AAsd00002292bc0Csc03i30\n A: local_cpulist=0-19\n
A: local_cpus=fffff\n
A: modalias=pci:v00008086d000051EDsv00001028sd00000B00bc0Csc03i30\n
A: msi_bus=1\n A: msi_bus=1\n
A: msi_irqs/128=msi\n A: msi_irqs/167=msi\n
A: numa_node=-1\n A: numa_node=-1\n
A: pools=poolinfo - 0.1\nbuffer-2048 0 0 2048 0\nbuffer-512 0 0 512 0\nbuffer-128 0 0 128 0\nbuffer-32 0 0 32 0\nxHCI 1KB stream ctx arrays 0 0 1024 0\nxHCI 256 byte stream ctx arrays 0 0 256 0\nxHCI input/output contexts 11 12 2112 12\nxHCI ring segments 46 50 4096 50\nbuffer-2048 0 0 2048 0\nbuffer-512 0 0 512 0\nbuffer-128 6 32 128 1\nbuffer-32 0 0 32 0\n A: pools=poolinfo - 0.1\nxHCI 1KB stream ctx arrays 0 0 1024 0\nxHCI 256 byte stream ctx arrays 0 0 256 0\nxHCI input/output contexts 13 14 2112 14\nxHCI ring segments 38 42 4096 42\nbuffer-2048 0 0 2048 0\nbuffer-512 0 0 512 0\nbuffer-128 0 0 128 0\nbuffer-32 0 0 32 0\nbuffer-2048 0 0 2048 0\nbuffer-512 0 0 512 0\nbuffer-128 3 32 128 1\nbuffer-32 0 0 32 0\n
A: power/async=enabled\n
A: power/control=auto\n A: power/control=auto\n
A: power/runtime_active_time=164332777\n A: power/runtime_active_kids=1\n
A: power/runtime_active_time=78974886\n
A: power/runtime_enabled=enabled\n
A: power/runtime_status=active\n A: power/runtime_status=active\n
A: power/runtime_suspended_time=0\n A: power/runtime_suspended_time=0\n
A: power/runtime_usage=0\n
A: power/wakeup=enabled\n A: power/wakeup=enabled\n
A: power/wakeup_abort_count=0\n A: power/wakeup_abort_count=0\n
A: power/wakeup_active=0\n A: power/wakeup_active=0\n
@@ -216,9 +227,9 @@ A: power/wakeup_last_time_ms=0\n
A: power/wakeup_max_time_ms=0\n A: power/wakeup_max_time_ms=0\n
A: power/wakeup_total_time_ms=0\n A: power/wakeup_total_time_ms=0\n
A: power_state=D0\n A: power_state=D0\n
A: resource=0x00000000ea220000 0x00000000ea22ffff 0x0000000000140204\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n A: resource=0x000000628f2a0000 0x000000628f2affff 0x0000000000140204\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n0x0000000000000000 0x0000000000000000 0x0000000000000000\n
A: revision=0x11\n A: revision=0x01\n
A: subsystem_device=0x2292\n A: subsystem_device=0x0b00\n
A: subsystem_vendor=0x17aa\n A: subsystem_vendor=0x1028\n
A: vendor=0x8086\n A: vendor=0x8086\n
+7
View File
@@ -17,3 +17,10 @@
... ...
} }
{
<ignore-g-thread-new-leak>
Memcheck:Leak
fun:calloc
...
fun:g_thread_new
}
+114 -14
View File
@@ -4,9 +4,9 @@ envs.set('G_DEBUG', 'fatal-warnings')
envs.set('G_MESSAGES_DEBUG', 'all') envs.set('G_MESSAGES_DEBUG', 'all')
# Setup paths # Setup paths
envs.set('MESON_SOURCE_ROOT', meson.source_root()) envs.set('MESON_SOURCE_ROOT', meson.project_source_root())
envs.set('MESON_BUILD_ROOT', meson.build_root()) envs.set('MESON_BUILD_ROOT', meson.project_build_root())
envs.prepend('LD_LIBRARY_PATH', join_paths(meson.build_root(), 'libfprint')) envs.prepend('LD_LIBRARY_PATH', meson.project_build_root() / 'libfprint')
# Set FP_DEVICE_EMULATION so that drivers can adapt (e.g. to use fixed # Set FP_DEVICE_EMULATION so that drivers can adapt (e.g. to use fixed
# random numbers rather than proper ones) # random numbers rather than proper ones)
@@ -19,8 +19,17 @@ envs.set('FP_DRIVERS_WHITELIST', ':'.join([
'virtual_device_storage', 'virtual_device_storage',
])) ]))
envs.set('FP_PRINTS_PATH', meson.project_source_root() / 'examples' / 'prints')
envs.set('NO_AT_BRIDGE', '1') envs.set('NO_AT_BRIDGE', '1')
python3 = find_program('python3')
installed_tests = get_option('installed-tests')
installed_tests_execdir = libexecdir / 'installed-tests' / versioned_libname
installed_tests_testdir = datadir / 'installed-tests' / versioned_libname
installed_tests_libdir = libdir
drivers_tests = [ drivers_tests = [
'aes2501', 'aes2501',
'aes3500', 'aes3500',
@@ -30,6 +39,7 @@ drivers_tests = [
'elanspi', 'elanspi',
'synaptics', 'synaptics',
'upektc_img', 'upektc_img',
'upektc_img-tcs1s',
'uru4000-msv2', 'uru4000-msv2',
'uru4000-4500', 'uru4000-4500',
'vfs0050', 'vfs0050',
@@ -44,23 +54,33 @@ drivers_tests = [
if get_option('introspection') if get_option('introspection')
conf = configuration_data() conf = configuration_data()
conf.set('SRCDIR', meson.source_root()) conf.set('SRCDIR', meson.project_source_root())
conf.set('BUILDDIR', meson.build_root()) conf.set('BUILDDIR', meson.project_build_root())
configure_file(configuration: conf, configure_file(configuration: conf,
input: 'create-driver-test.py.in', input: 'create-driver-test.py.in',
output: 'create-driver-test.py') output: 'create-driver-test.py')
endif endif
env_parser_cmd = '''
import os;
print(" ".join([f"{k}={v}" for k, v in os.environ.items()
if k.startswith("FP_") or k.startswith("G_")]))
'''
envs_str = run_command(python3, '-c', env_parser_cmd,
env: envs,
check: installed_tests).stdout().strip()
if get_option('introspection') if get_option('introspection')
envs.prepend('GI_TYPELIB_PATH', join_paths(meson.build_root(), 'libfprint')) envs.prepend('GI_TYPELIB_PATH', meson.project_build_root() / 'libfprint')
virtual_devices_tests = [ virtual_devices_tests = [
'virtual-image', 'virtual-image',
'virtual-device', 'virtual-device',
] ]
python3 = find_program('python3')
unittest_inspector = find_program('unittest_inspector.py') unittest_inspector = find_program('unittest_inspector.py')
umockdev_test = find_program('umockdev-test.py') umockdev_test_name = 'umockdev-test.py'
umockdev_test = find_program(umockdev_test_name)
foreach vdtest: virtual_devices_tests foreach vdtest: virtual_devices_tests
driver_name = '_'.join(vdtest.split('-')) driver_name = '_'.join(vdtest.split('-'))
@@ -92,6 +112,31 @@ if get_option('introspection')
env: envs, env: envs,
) )
endforeach endforeach
if installed_tests
install_data(base_args,
install_dir: installed_tests_execdir,
install_mode: 'rwxr-xr-x',
)
configure_file(
input: 'test.in',
output: vdtest + '.test',
install_dir: installed_tests_testdir,
configuration: {
# FIXME: use fs.name() on meson 0.58
'exec': installed_tests_execdir / '@0@'.format(base_args[0]).split('/')[-1],
'env': ' '.join([
envs_str,
'LD_LIBRARY_PATH=' + installed_tests_libdir,
'FP_PRINTS_PATH=' + installed_tests_testdir / 'prints',
# FIXME: Adding this requires gnome-desktop-testing!12
# 'GI_TYPELIB_PATH=' + installed_tests_libdir / 'girepository-1.0',
]),
'extra_content': '',
},
)
endif
else else
test(vdtest, test(vdtest,
find_program('sh'), find_program('sh'),
@@ -100,6 +145,7 @@ if get_option('introspection')
endif endif
endforeach endforeach
driver_tests_enabled = false
foreach driver_test: drivers_tests foreach driver_test: drivers_tests
driver_name = driver_test.split('-')[0] driver_name = driver_test.split('-')[0]
driver_envs = envs driver_envs = envs
@@ -107,6 +153,7 @@ if get_option('introspection')
if (driver_name in supported_drivers and if (driver_name in supported_drivers and
gusb_dep.version().version_compare('>= 0.3.0')) gusb_dep.version().version_compare('>= 0.3.0'))
driver_tests_enabled = true
test(driver_test, test(driver_test,
python3, python3,
args: [ args: [
@@ -118,6 +165,32 @@ if get_option('introspection')
timeout: 15, timeout: 15,
depends: libfprint_typelib, depends: libfprint_typelib,
) )
if installed_tests
driver_envs_str = run_command(python3, '-c', env_parser_cmd,
env: driver_envs,
check: true).stdout().strip()
configure_file(
input: 'driver.test.in',
output: 'driver-' + driver_test + '.test',
install_dir: installed_tests_testdir,
configuration: {
'installed_tests_execdir': installed_tests_execdir,
'installed_tests_testdir': installed_tests_testdir,
'umockdev_test_name': umockdev_test_name,
'driver_test': driver_test,
'driver_env': ' '.join([
driver_envs_str,
'LD_LIBRARY_PATH=' + installed_tests_libdir,
# FIXME: Adding this requires gnome-desktop-testing!12
# 'GI_TYPELIB_PATH=' + installed_tests_libdir / 'girepository-1.0',
]),
},
)
install_subdir(driver_test, install_dir: installed_tests_testdir)
endif
else else
test(driver_test, test(driver_test,
find_program('sh'), find_program('sh'),
@@ -125,6 +198,17 @@ if get_option('introspection')
) )
endif endif
endforeach endforeach
if installed_tests and driver_tests_enabled
install_data(umockdev_test.full_path(),
install_dir: installed_tests_execdir,
install_mode: 'rwxr-xr-x',
)
install_data('capture.py',
install_dir: installed_tests_execdir,
install_mode: 'rwxr-xr-x',
)
endif
else else
warning('Skipping all driver tests as introspection bindings are missing') warning('Skipping all driver tests as introspection bindings are missing')
test('virtual-image', test('virtual-image',
@@ -164,7 +248,7 @@ endif
unit_tests_deps = { 'fpi-assembling' : [cairo_dep] } unit_tests_deps = { 'fpi-assembling' : [cairo_dep] }
test_config = configuration_data() test_config = configuration_data()
test_config.set_quoted('SOURCE_ROOT', meson.source_root()) test_config.set_quoted('SOURCE_ROOT', meson.project_source_root())
test_config_h = configure_file(output: 'test-config.h', configuration: test_config) test_config_h = configure_file(output: 'test-config.h', configuration: test_config)
foreach test_name: unit_tests foreach test_name: unit_tests
@@ -197,13 +281,28 @@ foreach test_name: unit_tests
sources: [basename + '.c', test_config_h], sources: [basename + '.c', test_config_h],
dependencies: [ libfprint_private_dep ] + extra_deps, dependencies: [ libfprint_private_dep ] + extra_deps,
c_args: common_cflags, c_args: common_cflags,
link_with: test_utils, link_whole: test_utils,
install: installed_tests,
install_dir: installed_tests_execdir,
) )
test(test_name, test(test_name,
test_exe, test_exe,
suite: ['unit-tests'], suite: ['unit-tests'],
env: envs, env: envs,
) )
configure_file(
input: 'test.in',
output: test_name + '.test',
install: installed_tests,
install_dir: installed_tests_testdir,
configuration: {
'exec': installed_tests_execdir / basename,
'env': envs_str,
'extra_content': 'TestEnvironment=LD_LIBRARY_PATH=' +
installed_tests_libdir,
},
)
endforeach endforeach
# Run udev rule generator with fatal warnings # Run udev rule generator with fatal warnings
@@ -217,7 +316,7 @@ test('udev-hwdb',
gdb = find_program('gdb', required: false) gdb = find_program('gdb', required: false)
if gdb.found() if gdb.found()
libfprint_wrapper = [ libfprint_wrapper = [
gdb.path(), gdb.full_path(),
'-batch', '-batch',
'-ex', 'run', '-ex', 'run',
'--args', '--args',
@@ -234,12 +333,12 @@ valgrind = find_program('valgrind', required: false)
if valgrind.found() if valgrind.found()
glib_share = glib_dep.get_pkgconfig_variable('prefix') / 'share' / glib_dep.name() glib_share = glib_dep.get_pkgconfig_variable('prefix') / 'share' / glib_dep.name()
glib_suppressions = glib_share + '/valgrind/glib.supp' glib_suppressions = glib_share + '/valgrind/glib.supp'
libfprint_suppressions = '@0@/@1@'.format(meson.source_root(), libfprint_suppressions = '@0@/@1@'.format(meson.project_source_root(),
files('libfprint.supp')[0]) files('libfprint.supp')[0])
python_suppressions = '@0@/@1@'.format(meson.source_root(), python_suppressions = '@0@/@1@'.format(meson.project_source_root(),
files('valgrind-python.supp')[0]) files('valgrind-python.supp')[0])
libfprint_wrapper = [ libfprint_wrapper = [
valgrind.path(), valgrind.full_path(),
'--tool=memcheck', '--tool=memcheck',
'--leak-check=full', '--leak-check=full',
'--leak-resolution=high', '--leak-resolution=high',
@@ -248,6 +347,7 @@ if valgrind.found()
'--track-origins=yes', '--track-origins=yes',
'--show-leak-kinds=definite,possible', '--show-leak-kinds=definite,possible',
'--show-error-list=yes', '--show-error-list=yes',
'--gen-suppressions=all',
'--suppressions=' + libfprint_suppressions, '--suppressions=' + libfprint_suppressions,
'--suppressions=' + glib_suppressions, '--suppressions=' + glib_suppressions,
'--suppressions=' + python_suppressions, '--suppressions=' + python_suppressions,
+4
View File
@@ -144,8 +144,10 @@ tod_check_device_version (FpDevice *device_class,
} }
/* gcc 12.0.1 is complaining about dangling pointers in the auto_close* functions */ /* gcc 12.0.1 is complaining about dangling pointers in the auto_close* functions */
#if G_GNUC_CHECK_VERSION (12, 0)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdangling-pointer" #pragma GCC diagnostic ignored "-Wdangling-pointer"
#endif
/* Utility functions */ /* Utility functions */
@@ -187,7 +189,9 @@ auto_close_fake_device_free (FpAutoCloseDevice *device)
} }
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FpAutoCloseDevice, auto_close_fake_device_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC (FpAutoCloseDevice, auto_close_fake_device_free)
#if G_GNUC_CHECK_VERSION (12, 0)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif
typedef FpDeviceClass FpAutoResetClass; typedef FpDeviceClass FpAutoResetClass;
static FpAutoResetClass default_fake_dev_class = {0}; static FpAutoResetClass default_fake_dev_class = {0};
+6
View File
@@ -0,0 +1,6 @@
[Test]
Type=session
# We can't use TestEnvironment as per
# https://gitlab.gnome.org/GNOME/gnome-desktop-testing/-/issues/1
Exec=env @env@ @exec@
@extra_content@
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

File diff suppressed because one or more lines are too long
+14
View File
@@ -40,6 +40,20 @@
fun:_Py* fun:_Py*
} }
{
ignore__py_addr32
Memcheck:Addr32
...
fun:_Py*
}
{
ignore__py_addr32
Memcheck:Addr32
...
fun:Py*
}
{ {
ignore_py_leaks ignore_py_leaks
Memcheck:Leak Memcheck:Leak
+130 -73
View File
@@ -59,6 +59,17 @@ class GLibErrorMessage:
class VirtualDeviceBase(unittest.TestCase): class VirtualDeviceBase(unittest.TestCase):
DEFAULT_ENROLL_STEPS = 5
USE_CLASS_DEVICE = True
@classmethod
def get_device(cls, ctx):
for dev in ctx.get_devices():
# We might have a USB device in the test system that needs skipping
if dev.get_driver() == cls._driver_name:
return dev
return None
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
unittest.TestCase.setUpClass() unittest.TestCase.setUpClass()
@@ -73,26 +84,28 @@ class VirtualDeviceBase(unittest.TestCase):
cls.sockaddr = os.path.join(cls.tmpdir, '{}.socket'.format(sock_name)) cls.sockaddr = os.path.join(cls.tmpdir, '{}.socket'.format(sock_name))
os.environ['FP_{}'.format(driver_name.upper())] = cls.sockaddr os.environ['FP_{}'.format(driver_name.upper())] = cls.sockaddr
cls._driver_name = driver_name
if cls.USE_CLASS_DEVICE:
cls.ctx = FPrint.Context() cls.ctx = FPrint.Context()
cls.dev = cls.get_device(cls.ctx)
cls.dev = None assert cls.dev is not None, "You need to compile with {} for testing".format(
for dev in cls.ctx.get_devices(): driver_name)
# We might have a USB device in the test system that needs skipping
if dev.get_driver() == driver_name:
cls.dev = dev
break
assert cls.dev is not None, "You need to compile with {} for testing".format(driver_name)
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
shutil.rmtree(cls.tmpdir) shutil.rmtree(cls.tmpdir)
if cls.USE_CLASS_DEVICE:
del cls.dev del cls.dev
del cls.ctx del cls.ctx
unittest.TestCase.tearDownClass() unittest.TestCase.tearDownClass()
def setUp(self): def setUp(self):
super().setUp() super().setUp()
if not self.USE_CLASS_DEVICE:
self.ctx = FPrint.Context()
self.dev = self.get_device(self.ctx)
self.assertIsNotNone(self.dev)
self._close_on_teardown = True self._close_on_teardown = True
self.assertFalse(self.dev.is_open()) self.assertFalse(self.dev.is_open())
self.dev.open_sync() self.dev.open_sync()
@@ -101,8 +114,13 @@ class VirtualDeviceBase(unittest.TestCase):
def tearDown(self): def tearDown(self):
if self._close_on_teardown: if self._close_on_teardown:
self.assertTrue(self.dev.is_open()) self.assertTrue(self.dev.is_open())
self.set_keep_alive(False)
self.send_command('SET_ENROLL_STAGES', self.DEFAULT_ENROLL_STEPS)
self.dev.close_sync() self.dev.close_sync()
self.assertFalse(self.dev.is_open()) self.assertFalse(self.dev.is_open())
if not self.USE_CLASS_DEVICE:
del self.dev
del self.ctx
super().tearDown() super().tearDown()
def wait_timeout(self, interval): def wait_timeout(self, interval):
@@ -331,6 +349,107 @@ class VirtualDeviceBase(unittest.TestCase):
self.assertEqual(self._verify_fp.props.fpi_data.get_string(), scan_nick) self.assertEqual(self._verify_fp.props.fpi_data.get_string(), scan_nick)
class VirtualDeviceUnplugging(VirtualDeviceBase):
driver_name = 'virtual_device'
USE_CLASS_DEVICE = False
def test_device_unplug(self):
self._close_on_teardown = False
notified_spec = None
def on_removed_notify(dev, spec):
nonlocal notified_spec
notified_spec = spec
removed = False
ctx_removed = False
def on_ctx_removed(ctx, dev):
nonlocal ctx_removed
ctx_removed = dev == self.dev
self.assertEqual(removed, ctx_removed)
def on_removed(dev):
nonlocal removed
removed = dev.props.removed
self.assertNotEqual(removed, ctx_removed)
self.assertFalse(self.dev.props.removed)
self.dev.connect('notify::removed', on_removed_notify)
self.ctx.connect('device-removed', on_ctx_removed)
self.dev.connect('removed', on_removed)
self.send_command('UNPLUG')
self.assertEqual(notified_spec.name, 'removed')
self.assertTrue(self.dev.props.removed)
self.assertIn(self.dev, self.ctx.get_devices())
self.assertTrue(removed)
with self.assertRaises(GLib.GError) as error:
self.dev.close_sync()
self.assertTrue(error.exception.matches(FPrint.DeviceError.quark(),
FPrint.DeviceError.REMOVED))
while not ctx_removed:
ctx.iteration(True)
self.assertNotIn(self.dev, self.ctx.get_devices())
def test_device_unplug_during_verify(self):
self._close_on_teardown = False
self._destroy_on_teardown = True
notified_spec = None
def on_removed_notify(dev, spec):
nonlocal notified_spec
notified_spec = spec
removed = False
ctx_removed = False
def on_ctx_removed(ctx, dev):
nonlocal ctx_removed
ctx_removed = dev == self.dev
self.assertEqual(removed, ctx_removed)
def on_removed(dev):
nonlocal removed
removed = dev.props.removed
self.assertNotEqual(removed, ctx_removed)
self.assertFalse(self.dev.props.removed)
self.dev.connect('notify::removed', on_removed_notify)
self.ctx.connect('device-removed', on_ctx_removed)
self.dev.connect('removed', on_removed)
self.start_verify(FPrint.Print.new(self.dev),
identify=self.dev.supports_identify())
self.send_command('UNPLUG')
self.assertEqual(notified_spec.name, 'removed')
self.assertTrue(self.dev.props.removed)
self.assertIn(self.dev, self.ctx.get_devices())
self.assertFalse(removed)
with self.assertRaises(GLib.GError) as error:
self.complete_verify()
self.assertTrue(error.exception.matches(FPrint.DeviceError.quark(),
FPrint.DeviceError.REMOVED))
self.assertTrue(removed)
self.assertIn(self.dev, self.ctx.get_devices())
with self.assertRaises(GLib.GError) as error:
self.dev.close_sync()
self.assertTrue(error.exception.matches(FPrint.DeviceError.quark(),
FPrint.DeviceError.REMOVED))
while not ctx_removed:
ctx.iteration(True)
self.assertNotIn(self.dev, self.ctx.get_devices())
class VirtualDevice(VirtualDeviceBase): class VirtualDevice(VirtualDeviceBase):
def test_device_properties(self): def test_device_properties(self):
@@ -339,7 +458,8 @@ class VirtualDevice(VirtualDeviceBase):
self.assertEqual(self.dev.get_name(), 'Virtual device for debugging') self.assertEqual(self.dev.get_name(), 'Virtual device for debugging')
self.assertTrue(self.dev.is_open()) self.assertTrue(self.dev.is_open())
self.assertEqual(self.dev.get_scan_type(), FPrint.ScanType.SWIPE) self.assertEqual(self.dev.get_scan_type(), FPrint.ScanType.SWIPE)
self.assertEqual(self.dev.get_nr_enroll_stages(), 5) self.assertEqual(self.dev.get_nr_enroll_stages(),
self.DEFAULT_ENROLL_STEPS)
self.assertFalse(self.dev.supports_identify()) self.assertFalse(self.dev.supports_identify())
self.assertFalse(self.dev.supports_capture()) self.assertFalse(self.dev.supports_capture())
self.assertFalse(self.dev.has_storage()) self.assertFalse(self.dev.has_storage())
@@ -700,69 +820,6 @@ class VirtualDevice(VirtualDeviceBase):
self.assertEqual(self.dev.get_scan_type(), FPrint.ScanType.SWIPE) self.assertEqual(self.dev.get_scan_type(), FPrint.ScanType.SWIPE)
self.assertIsNone(notified_spec) self.assertIsNone(notified_spec)
def test_device_unplug(self):
self._close_on_teardown = False
notified_spec = None
def on_removed_notify(dev, spec):
nonlocal notified_spec
notified_spec = spec
removed = False
def on_removed(dev):
nonlocal removed
removed = True
self.assertFalse(self.dev.props.removed)
self.dev.connect('notify::removed', on_removed_notify)
self.dev.connect('removed', on_removed)
self.send_command('UNPLUG')
self.assertEqual(notified_spec.name, 'removed')
self.assertTrue(self.dev.props.removed)
self.assertTrue(removed)
with self.assertRaises(GLib.GError) as error:
self.dev.close_sync()
self.assertTrue(error.exception.matches(FPrint.DeviceError.quark(),
FPrint.DeviceError.REMOVED))
def test_device_unplug_during_verify(self):
self._close_on_teardown = False
notified_spec = None
def on_removed_notify(dev, spec):
nonlocal notified_spec
notified_spec = spec
removed = False
def on_removed(dev):
nonlocal removed
removed = True
self.assertFalse(self.dev.props.removed)
self.dev.connect('notify::removed', on_removed_notify)
self.dev.connect('removed', on_removed)
self.start_verify(FPrint.Print.new(self.dev),
identify=self.dev.supports_identify())
self.send_command('UNPLUG')
self.assertEqual(notified_spec.name, 'removed')
self.assertTrue(self.dev.props.removed)
self.assertFalse(removed)
with self.assertRaises(GLib.GError) as error:
self.complete_verify()
self.assertTrue(error.exception.matches(FPrint.DeviceError.quark(),
FPrint.DeviceError.REMOVED))
self.assertTrue(removed)
with self.assertRaises(GLib.GError) as error:
self.dev.close_sync()
self.assertTrue(error.exception.matches(FPrint.DeviceError.quark(),
FPrint.DeviceError.REMOVED))
def test_device_sleep(self): def test_device_sleep(self):
self.send_sleep(1500) self.send_sleep(1500)
+9 -4
View File
@@ -46,12 +46,15 @@ def load_image(img):
return img return img
if hasattr(os.environ, 'MESON_SOURCE_ROOT'): if 'FP_PRINTS_PATH' in os.environ:
root = os.environ['MESON_SOURCE_ROOT'] prints_path = os.environ['FP_PRINTS_PATH']
else: else:
if 'MESON_SOURCE_ROOT' in os.environ:
root = os.environ['MESON_SOURCE_ROOT']
else:
root = os.path.join(os.path.dirname(__file__), '..') root = os.path.join(os.path.dirname(__file__), '..')
imgdir = os.path.join(root, 'examples', 'prints') prints_path = os.path.join(root, 'examples', 'prints')
ctx = GLib.main_context_default() ctx = GLib.main_context_default()
@@ -76,10 +79,12 @@ class VirtualImage(unittest.TestCase):
assert cls.dev is not None, "You need to compile with virtual_image for testing" assert cls.dev is not None, "You need to compile with virtual_image for testing"
cls.prints = {} cls.prints = {}
for f in glob.glob(os.path.join(imgdir, '*.png')): for f in glob.glob(os.path.join(prints_path, '*.png')):
n = os.path.basename(f)[:-4] n = os.path.basename(f)[:-4]
cls.prints[n] = load_image(f) cls.prints[n] = load_image(f)
assert cls.prints, "No prints found in " + prints_path
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
shutil.rmtree(cls.tmpdir) shutil.rmtree(cls.tmpdir)