mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2025-11-15 07:38:12 +00:00
Compare commits
50 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
135a015b6a | ||
|
|
96645eaa7a | ||
|
|
d37b255a11 | ||
|
|
903ee43b2d | ||
|
|
8562f8a964 | ||
|
|
5ff794c105 | ||
|
|
f68e0972c2 | ||
|
|
ba3cc04e84 | ||
|
|
3d4cf44f9b | ||
|
|
8e702012fd | ||
|
|
f49879b522 | ||
|
|
5e0bf2446b | ||
|
|
4d96a3efaa | ||
|
|
c27d72e3a1 | ||
|
|
0819df6988 | ||
|
|
28579239a6 | ||
|
|
e48d2b467a | ||
|
|
1c589336a2 | ||
|
|
9546659c15 | ||
|
|
c782298ae4 | ||
|
|
682fce6a5b | ||
|
|
6ed1b707d5 | ||
|
|
9fd2ccff29 | ||
|
|
b6223a9d0a | ||
|
|
5e98f10011 | ||
|
|
e7ca05e1bf | ||
|
|
677c50fc51 | ||
|
|
bb5feeca77 | ||
|
|
22683ec490 | ||
|
|
0bf7d58c5e | ||
|
|
86566e8d0b | ||
|
|
7080a5ff8b | ||
|
|
5e52ad2ad1 | ||
|
|
bfaa9a9241 | ||
|
|
9c900789de | ||
|
|
29a24ba67f | ||
|
|
987f23698e | ||
|
|
cda4e6136c | ||
|
|
522b481297 | ||
|
|
fafe70f985 | ||
|
|
62818b9407 | ||
|
|
db2fa81358 | ||
|
|
d492901c3e | ||
|
|
a5d52eb853 | ||
|
|
89509c76f4 | ||
|
|
6395dda012 | ||
|
|
54bb0c12e6 | ||
|
|
1f1ed80dbf | ||
|
|
36bcb24b3a | ||
|
|
ddacf07e3b |
@@ -6,6 +6,16 @@ include:
|
||||
file: '/templates/fedora.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:
|
||||
extends: .libfprint_common_variables
|
||||
FDO_DISTRIBUTION_TAG: $LIBFPRINT_IMAGE_TAG
|
||||
@@ -15,6 +25,11 @@ variables:
|
||||
BUNDLE: "org.freedesktop.libfprint.Demo.flatpak"
|
||||
LAST_ABI_BREAK: "056ea541ddc97f5806cffbd99a12dc87e4da3546"
|
||||
|
||||
workflow:
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
|
||||
- if: $CI_PIPELINE_SOURCE == 'push'
|
||||
|
||||
stages:
|
||||
- image-build
|
||||
- check-source
|
||||
@@ -27,16 +42,16 @@ image: $FEDORA_IMAGE
|
||||
.build_one_driver_template: &build_one_driver
|
||||
script:
|
||||
# Build with a driver that doesn't need imaging, or nss
|
||||
- meson --werror -Ddrivers=$driver . _build
|
||||
- ninja -C _build
|
||||
- meson setup _build --werror -Ddrivers=$driver
|
||||
- meson compile -C _build
|
||||
- rm -rf _build/
|
||||
|
||||
.build_template: &build
|
||||
script:
|
||||
# And build with everything
|
||||
- meson --werror -Ddrivers=all . _build
|
||||
- ninja -C _build
|
||||
- ninja -C _build install
|
||||
- meson setup _build --werror -Ddrivers=all
|
||||
- meson compile -C _build
|
||||
- meson install -C _build
|
||||
|
||||
.build_template: &check_abi
|
||||
script:
|
||||
@@ -65,11 +80,10 @@ test:
|
||||
variables:
|
||||
- $CI_PIPELINE_SOURCE == "schedule"
|
||||
script:
|
||||
- meson --werror -Ddrivers=all -Db_coverage=true . _build
|
||||
- ninja -C _build
|
||||
- meson setup _build --werror -Ddrivers=all -Db_coverage=true
|
||||
- meson test -C _build --print-errorlogs --no-stdsplit --timeout-multiplier 3
|
||||
- ninja -C _build coverage
|
||||
- cat _build/meson-logs/coverage.txt
|
||||
- cat _build/meson-logs/coverage.txt || true
|
||||
artifacts:
|
||||
reports:
|
||||
junit: "_build/meson-logs/testlog.junit.xml"
|
||||
@@ -90,12 +104,12 @@ test_valgrind:
|
||||
variables:
|
||||
- $CI_PIPELINE_SOURCE == "schedule"
|
||||
script:
|
||||
- meson -Ddrivers=all . _build
|
||||
- ninja -C _build
|
||||
- meson setup _build -Ddrivers=all
|
||||
- meson compile -C _build
|
||||
- meson test -C _build --print-errorlogs --no-stdsplit --setup=valgrind
|
||||
artifacts:
|
||||
reports:
|
||||
junit: "_build/meson-logs/testlog.junit.xml"
|
||||
junit: "_build/meson-logs/testlog-valgrind.junit.xml"
|
||||
expose_as: 'Valgrind test logs'
|
||||
when: always
|
||||
paths:
|
||||
@@ -103,6 +117,27 @@ test_valgrind:
|
||||
- _build/meson-logs/testlog-valgrind.txt
|
||||
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:
|
||||
stage: test
|
||||
@@ -111,9 +146,10 @@ test_scan_build:
|
||||
- $CI_PIPELINE_SOURCE == "schedule"
|
||||
allow_failure: true
|
||||
script:
|
||||
- meson -Ddrivers=all . _build
|
||||
- meson setup _build -Ddrivers=all
|
||||
# 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:
|
||||
paths:
|
||||
- _build/meson-logs
|
||||
@@ -171,7 +207,6 @@ flatpak:
|
||||
- $CI_PIPELINE_SOURCE == "never"
|
||||
variables:
|
||||
GIT_STRATEGY: none # no need to pull the whole tree for rebuilding the image
|
||||
FDO_FORCE_REBUILD: 1
|
||||
# a list of packages to install
|
||||
FDO_DISTRIBUTION_PACKAGES:
|
||||
$LIBFPRINT_DEPENDENCIES
|
||||
@@ -181,14 +216,22 @@ flatpak:
|
||||
FDO_DISTRIBUTION_EXEC: |
|
||||
$LIBFPRINT_EXEC
|
||||
|
||||
.container_fedora_build_forced:
|
||||
variables:
|
||||
FDO_FORCE_REBUILD: 1
|
||||
|
||||
container_fedora_build_schedule:
|
||||
extends: .container_fedora_build_base
|
||||
extends:
|
||||
- .container_fedora_build_base
|
||||
- .container_fedora_build_forced
|
||||
only:
|
||||
variables:
|
||||
- $CI_PIPELINE_SOURCE == "schedule" && $CRON_TASK == "BUILD_CI_IMAGES"
|
||||
|
||||
container_fedora_build_manual:
|
||||
extends: .container_fedora_build_base
|
||||
extends:
|
||||
- .container_fedora_build_base
|
||||
- .container_fedora_build_forced
|
||||
only:
|
||||
variables:
|
||||
- $LIBFPRINT_CI_ACTION == "build-image"
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
variables:
|
||||
LIBFPRINT_IMAGE_TAG: v2
|
||||
LIBFPRINT_IMAGE_TAG: v3
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
glib2-devel
|
||||
glibc-devel
|
||||
gobject-introspection-devel
|
||||
gnome-desktop-testing
|
||||
gtk-doc
|
||||
gtk3-devel
|
||||
libabigail
|
||||
@@ -33,7 +34,8 @@
|
||||
diffutils
|
||||
|
||||
LIBFPRINT_EXEC: |
|
||||
dnf debuginfo-install -y \
|
||||
dnf -y install dnf-utils
|
||||
debuginfo-install -y \
|
||||
glib2 \
|
||||
glibc \
|
||||
libgusb \
|
||||
|
||||
15
NEWS
15
NEWS
@@ -1,6 +1,21 @@
|
||||
This file lists notable changes in each release. For the full history of all
|
||||
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
|
||||
|
||||
Highlights:
|
||||
|
||||
@@ -67,7 +67,7 @@ usb:v08FFp5731*
|
||||
ID_PERSIST=0
|
||||
|
||||
# Supported by libfprint driver aes4000
|
||||
usb:v5501p08FF*
|
||||
usb:v08FFp5501*
|
||||
ID_AUTOSUSPEND=1
|
||||
ID_PERSIST=0
|
||||
|
||||
@@ -149,6 +149,7 @@ usb:v04F3p0C82*
|
||||
usb:v04F3p0C88*
|
||||
usb:v04F3p0C8C*
|
||||
usb:v04F3p0C8D*
|
||||
usb:v04F3p0C99*
|
||||
ID_AUTOSUSPEND=1
|
||||
ID_PERSIST=0
|
||||
|
||||
@@ -169,10 +170,15 @@ usb:v10A5pD205*
|
||||
# Supported by libfprint driver goodixmoc
|
||||
usb:v27C6p5840*
|
||||
usb:v27C6p6014*
|
||||
usb:v27C6p6092*
|
||||
usb:v27C6p6094*
|
||||
usb:v27C6p609C*
|
||||
usb:v27C6p60A2*
|
||||
usb:v27C6p60A4*
|
||||
usb:v27C6p60BC*
|
||||
usb:v27C6p6304*
|
||||
usb:v27C6p631C*
|
||||
usb:v27C6p633C*
|
||||
usb:v27C6p634C*
|
||||
usb:v27C6p6384*
|
||||
usb:v27C6p639C*
|
||||
|
||||
@@ -102,9 +102,9 @@ plot_minutiae (unsigned char *rgbdata,
|
||||
int i;
|
||||
|
||||
#define write_pixel(num) do { \
|
||||
rgbdata[((num) * 3)] = 0xff; \
|
||||
rgbdata[((num) * 3) + 1] = 0; \
|
||||
rgbdata[((num) * 3) + 2] = 0; \
|
||||
rgbdata[((num) * 3)] = 0xff; \
|
||||
rgbdata[((num) * 3) + 1] = 0; \
|
||||
rgbdata[((num) * 3) + 2] = 0; \
|
||||
} while(0)
|
||||
|
||||
for (i = 0; i < minutiae->len; i++)
|
||||
|
||||
@@ -25,7 +25,7 @@ docpath = join_paths(get_option('datadir'), 'gtk-doc', 'html')
|
||||
|
||||
gnome.gtkdoc(versioned_libname,
|
||||
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'),
|
||||
dependencies: libfprint_dep,
|
||||
content_files: content_files,
|
||||
|
||||
@@ -21,3 +21,8 @@ executable('cpp-test',
|
||||
'cpp-test.cpp',
|
||||
dependencies: libfprint_dep,
|
||||
)
|
||||
|
||||
if installed_tests
|
||||
install_subdir('prints',
|
||||
install_dir: installed_tests_testdir)
|
||||
endif
|
||||
|
||||
@@ -124,7 +124,7 @@ G_DEFINE_TYPE (FpiDeviceAes4000, fpi_device_aes4000, FPI_TYPE_DEVICE_AES3K);
|
||||
|
||||
|
||||
static const FpIdEntry id_table[] = {
|
||||
{ .pid = 0x08ff, .vid = 0x5501 },
|
||||
{ .vid = 0x08ff, .pid = 0x5501 },
|
||||
{ .vid = 0, .pid = 0, .driver_data = 0 },
|
||||
};
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ static const FpIdEntry id_table[] = {
|
||||
{ .vid = 0x04f3, .pid = 0x0c88, },
|
||||
{ .vid = 0x04f3, .pid = 0x0c8c, },
|
||||
{ .vid = 0x04f3, .pid = 0x0c8d, },
|
||||
{ .vid = 0x04f3, .pid = 0x0c99, },
|
||||
{ .vid = 0, .pid = 0, .driver_data = 0 }, /* terminating entry */
|
||||
};
|
||||
|
||||
@@ -1086,6 +1087,10 @@ elanmoc_open (FpDevice *device)
|
||||
self->max_moc_enroll_time = 11;
|
||||
break;
|
||||
|
||||
case 0x0c99:
|
||||
self->max_moc_enroll_time = 14;
|
||||
break;
|
||||
|
||||
case 0x0c8d:
|
||||
self->max_moc_enroll_time = 17;
|
||||
break;
|
||||
|
||||
@@ -132,7 +132,11 @@ fpc_cmd_receive_cb (FpiUsbTransfer *transfer,
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -358,6 +362,7 @@ fpc_sensor_cmd (FpiDeviceFpcMoc *self,
|
||||
g_clear_object (&self->interrupt_cancellable);
|
||||
}
|
||||
|
||||
g_assert (self->cmd_ssm == NULL);
|
||||
self->cmd_ssm = fpi_ssm_new (FP_DEVICE (self),
|
||||
fpc_cmd_run_state,
|
||||
FP_CMD_NUM_STATES);
|
||||
@@ -1149,12 +1154,9 @@ fpc_enroll_ssm_done (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
|
||||
fp_info ("Enrollment complete!");
|
||||
|
||||
if (fpi_ssm_get_error (ssm))
|
||||
error = fpi_ssm_get_error (ssm);
|
||||
|
||||
if (error)
|
||||
{
|
||||
fpi_device_enroll_complete (dev, NULL, error);
|
||||
fpi_device_enroll_complete (dev, NULL, g_steal_pointer (&error));
|
||||
self->task_ssm = NULL;
|
||||
return;
|
||||
}
|
||||
@@ -1336,9 +1338,6 @@ fpc_verify_ssm_done (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
|
||||
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 (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)
|
||||
fpi_device_verify_complete (dev, error);
|
||||
fpi_device_verify_complete (dev, g_steal_pointer (&error));
|
||||
else
|
||||
fpi_device_identify_complete (dev, error);
|
||||
fpi_device_identify_complete (dev, g_steal_pointer (&error));
|
||||
|
||||
self->task_ssm = NULL;
|
||||
}
|
||||
@@ -1448,10 +1447,7 @@ fpc_clear_ssm_done (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
|
||||
fp_info ("Clear Storage complete!");
|
||||
|
||||
if (fpi_ssm_get_error (ssm))
|
||||
error = fpi_ssm_get_error (ssm);
|
||||
|
||||
fpi_device_clear_storage_complete (dev, error);
|
||||
fpi_device_clear_storage_complete (dev, g_steal_pointer (&error));
|
||||
self->task_ssm = NULL;
|
||||
}
|
||||
|
||||
@@ -1555,10 +1551,7 @@ fpc_init_ssm_done (FpiSsm *ssm, FpDevice *dev, GError *error)
|
||||
{
|
||||
FpiDeviceFpcMoc *self = FPI_DEVICE_FPCMOC (dev);
|
||||
|
||||
if (fpi_ssm_get_error (ssm))
|
||||
error = fpi_ssm_get_error (ssm);
|
||||
|
||||
fpi_device_open_complete (dev, error);
|
||||
fpi_device_open_complete (dev, g_steal_pointer (&error));
|
||||
self->task_ssm = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -631,20 +631,20 @@ fp_enroll_enum_cb (FpiDeviceGoodixMoc *self,
|
||||
return;
|
||||
}
|
||||
|
||||
fpi_ssm_jump_to_state (self->task_ssm, FP_ENROLL_CAPTURE);
|
||||
fpi_ssm_next_state (self->task_ssm);
|
||||
}
|
||||
|
||||
static void
|
||||
fp_enroll_init_cb (FpiDeviceGoodixMoc *self,
|
||||
gxfp_cmd_response_t *resp,
|
||||
GError *error)
|
||||
fp_enroll_create_cb (FpiDeviceGoodixMoc *self,
|
||||
gxfp_cmd_response_t *resp,
|
||||
GError *error)
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
fpi_ssm_mark_failed (self->task_ssm, error);
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -837,16 +837,6 @@ fp_enroll_sm_run_state (FpiSsm *ssm, FpDevice *device)
|
||||
|
||||
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:
|
||||
{
|
||||
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;
|
||||
|
||||
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:
|
||||
{
|
||||
goodix_sensor_cmd (self, MOC_CMD0_ENROLL_INIT, MOC_CMD1_DEFAULT,
|
||||
false,
|
||||
(const guint8 *) &dummy,
|
||||
1,
|
||||
fp_enroll_init_cb);
|
||||
fp_enroll_create_cb);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1359,10 +1359,15 @@ gx_fp_probe (FpDevice *device)
|
||||
{
|
||||
case 0x6496:
|
||||
case 0x60A2:
|
||||
case 0x60A4:
|
||||
case 0x6014:
|
||||
case 0x6092:
|
||||
case 0x6094:
|
||||
case 0x609C:
|
||||
case 0x60BC:
|
||||
case 0x6304:
|
||||
case 0x631C:
|
||||
case 0x633C:
|
||||
case 0x634C:
|
||||
case 0x6384:
|
||||
case 0x639C:
|
||||
@@ -1602,10 +1607,15 @@ fpi_device_goodixmoc_init (FpiDeviceGoodixMoc *self)
|
||||
static const FpIdEntry id_table[] = {
|
||||
{ .vid = 0x27c6, .pid = 0x5840, },
|
||||
{ .vid = 0x27c6, .pid = 0x6014, },
|
||||
{ .vid = 0x27c6, .pid = 0x6092, },
|
||||
{ .vid = 0x27c6, .pid = 0x6094, },
|
||||
{ .vid = 0x27c6, .pid = 0x609C, },
|
||||
{ .vid = 0x27c6, .pid = 0x60A2, },
|
||||
{ .vid = 0x27c6, .pid = 0x60A4, },
|
||||
{ .vid = 0x27c6, .pid = 0x60BC, },
|
||||
{ .vid = 0x27c6, .pid = 0x6304, },
|
||||
{ .vid = 0x27c6, .pid = 0x631C, },
|
||||
{ .vid = 0x27c6, .pid = 0x633C, },
|
||||
{ .vid = 0x27c6, .pid = 0x634C, },
|
||||
{ .vid = 0x27c6, .pid = 0x6384, },
|
||||
{ .vid = 0x27c6, .pid = 0x639C, },
|
||||
|
||||
@@ -44,7 +44,6 @@ typedef enum {
|
||||
typedef enum {
|
||||
FP_ENROLL_PWR_BTN_SHIELD_ON = 0,
|
||||
FP_ENROLL_ENUM,
|
||||
FP_ENROLL_IDENTIFY,
|
||||
FP_ENROLL_CREATE,
|
||||
FP_ENROLL_CAPTURE,
|
||||
FP_ENROLL_UPDATE,
|
||||
|
||||
@@ -343,10 +343,10 @@ gx_proto_parse_body (uint16_t cmd, uint8_t *buffer, uint16_t buffer_len, pgxfp_c
|
||||
break;
|
||||
|
||||
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;
|
||||
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;
|
||||
|
||||
case MOC_CMD0_ENROLL:
|
||||
@@ -465,4 +465,4 @@ gx_proto_init_sensor_config (pgxfp_sensor_cfg_t pconfig)
|
||||
memcpy (pconfig->crc_value, &crc32_calc, PACKAGE_CRC_SIZE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,10 +105,10 @@ typedef struct _gxfp_parse_msg
|
||||
} gxfp_parse_msg_t, *pgxfp_parse_msg_t;
|
||||
|
||||
|
||||
typedef struct _gxfp_enroll_init
|
||||
typedef struct _gxfp_enroll_create
|
||||
{
|
||||
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)
|
||||
typedef struct _template_format
|
||||
@@ -192,7 +192,7 @@ typedef struct _fp_cmd_response
|
||||
{
|
||||
gxfp_parse_msg_t parse_msg;
|
||||
gxfp_verify_t verify;
|
||||
gxfp_enroll_init_t enroll_init;
|
||||
gxfp_enroll_create_t enroll_create;
|
||||
gxfp_capturedata_t capture_data_resp;
|
||||
gxfp_check_duplicate_t check_duplicate_resp;
|
||||
gxfp_enroll_commit_t enroll_commit;
|
||||
|
||||
@@ -74,26 +74,26 @@ struct _FpiDeviceUpeksonly
|
||||
FpiSsm *loopsm;
|
||||
|
||||
/* Do we really need multiple concurrent transfers? */
|
||||
GCancellable *img_cancellable;
|
||||
GPtrArray *img_transfers;
|
||||
int num_flying;
|
||||
GCancellable *img_cancellable;
|
||||
GPtrArray *img_transfers;
|
||||
int num_flying;
|
||||
|
||||
GSList *rows;
|
||||
unsigned num_rows;
|
||||
unsigned char *rowbuf;
|
||||
int rowbuf_offset;
|
||||
GSList *rows;
|
||||
unsigned num_rows;
|
||||
unsigned char *rowbuf;
|
||||
int rowbuf_offset;
|
||||
|
||||
int wraparounds;
|
||||
int num_blank;
|
||||
int num_nonblank;
|
||||
enum sonly_fs finger_state;
|
||||
int last_seqnum;
|
||||
int wraparounds;
|
||||
int num_blank;
|
||||
int num_nonblank;
|
||||
enum sonly_fs finger_state;
|
||||
int last_seqnum;
|
||||
|
||||
enum sonly_kill_transfers_action killing_transfers;
|
||||
GError *kill_error;
|
||||
FpiSsm *kill_ssm;
|
||||
GError *kill_error;
|
||||
FpiSsm *kill_ssm;
|
||||
|
||||
struct fpi_line_asmbl_ctx assembling_ctx;
|
||||
struct fpi_line_asmbl_ctx assembling_ctx;
|
||||
};
|
||||
G_DECLARE_FINAL_TYPE (FpiDeviceUpeksonly, fpi_device_upeksonly, FPI,
|
||||
DEVICE_UPEKSONLY, FpImageDevice);
|
||||
|
||||
@@ -31,10 +31,6 @@ static void start_deactivation (FpImageDevice *dev);
|
||||
#define CTRL_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_RESPONSE_SIZE 2052
|
||||
#define SHORT_RESPONSE_SIZE 64
|
||||
@@ -47,8 +43,10 @@ struct _FpiDeviceUpektcImg
|
||||
unsigned char response[MAX_RESPONSE_SIZE];
|
||||
unsigned char *image_bits;
|
||||
unsigned char seq;
|
||||
size_t expected_image_size;
|
||||
size_t image_size;
|
||||
size_t response_rest;
|
||||
gboolean area_sensor;
|
||||
gboolean deactivating;
|
||||
};
|
||||
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)
|
||||
{
|
||||
FpImageDevice *dev = FP_IMAGE_DEVICE (device);
|
||||
FpImageDeviceClass *img_class = FP_IMAGE_DEVICE_GET_CLASS (dev);
|
||||
FpiDeviceUpektcImg *self = FPI_DEVICE_UPEKTC_IMG (dev);
|
||||
unsigned char *data = self->response;
|
||||
FpImage *img;
|
||||
@@ -247,8 +246,30 @@ capture_read_data_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
CAPTURE_ACK_00_28);
|
||||
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:
|
||||
/* 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,
|
||||
CAPTURE_ACK_00_28);
|
||||
break;
|
||||
@@ -261,18 +282,20 @@ capture_read_data_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
fpi_image_device_report_finger_status (dev,
|
||||
FALSE);
|
||||
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;
|
||||
|
||||
case 0x1d:
|
||||
/* too much horisontal movement */
|
||||
fp_err ("too much horisontal movement, aborting");
|
||||
/* too much horizontal movement */
|
||||
fp_err ("too much horizontal movement, aborting");
|
||||
fpi_image_device_retry_scan (dev,
|
||||
FP_DEVICE_RETRY_CENTER_FINGER);
|
||||
fpi_image_device_report_finger_status (dev,
|
||||
FALSE);
|
||||
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;
|
||||
|
||||
default:
|
||||
@@ -283,7 +306,8 @@ capture_read_data_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
fpi_image_device_report_finger_status (dev,
|
||||
FALSE);
|
||||
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;
|
||||
@@ -307,13 +331,13 @@ capture_read_data_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
self->image_size +=
|
||||
upektc_img_process_image_frame (self->image_bits + self->image_size,
|
||||
data);
|
||||
BUG_ON (self->image_size != IMAGE_SIZE);
|
||||
BUG_ON (self->image_size != self->expected_image_size);
|
||||
fp_dbg ("Image size is %lu",
|
||||
(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;
|
||||
memcpy (img->data, self->image_bits,
|
||||
IMAGE_SIZE);
|
||||
self->image_size);
|
||||
fpi_image_device_image_captured (dev, img);
|
||||
fpi_image_device_report_finger_status (dev,
|
||||
FALSE);
|
||||
@@ -346,8 +370,12 @@ capture_run_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
switch (fpi_ssm_get_cur_state (ssm))
|
||||
{
|
||||
case CAPTURE_INIT_CAPTURE:
|
||||
upektc_img_submit_req (ssm, dev, upek2020_init_capture, sizeof (upek2020_init_capture),
|
||||
self->seq, capture_reqs_cb);
|
||||
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),
|
||||
self->seq, capture_reqs_cb);
|
||||
self->seq++;
|
||||
break;
|
||||
|
||||
@@ -513,15 +541,81 @@ init_reqs_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
fpi_ssm_mark_failed (transfer->ssm, error);
|
||||
}
|
||||
|
||||
/* TODO: process response properly */
|
||||
static void
|
||||
init_read_data_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
gpointer user_data, GError *error)
|
||||
{
|
||||
if (!error)
|
||||
fpi_ssm_next_state (transfer->ssm);
|
||||
else
|
||||
fpi_ssm_mark_failed (transfer->ssm, error);
|
||||
FpImageDevice *dev = FP_IMAGE_DEVICE (device);
|
||||
FpiDeviceUpektcImg *self = FPI_DEVICE_UPEKTC_IMG (dev);
|
||||
unsigned char *data = self->response;
|
||||
|
||||
if (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
|
||||
@@ -616,7 +710,6 @@ dev_deactivate (FpImageDevice *dev)
|
||||
static void
|
||||
dev_init (FpImageDevice *dev)
|
||||
{
|
||||
FpiDeviceUpektcImg *self = FPI_DEVICE_UPEKTC_IMG (dev);
|
||||
GError *error = NULL;
|
||||
|
||||
/* TODO check that device has endpoints we're using */
|
||||
@@ -627,7 +720,6 @@ dev_init (FpImageDevice *dev)
|
||||
return;
|
||||
}
|
||||
|
||||
self->image_bits = g_malloc0 (IMAGE_SIZE * 2);
|
||||
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->img_width = IMAGE_WIDTH;
|
||||
img_class->img_height = IMAGE_HEIGHT;
|
||||
img_class->img_width = -1;
|
||||
img_class->img_height = -1;
|
||||
}
|
||||
|
||||
@@ -75,6 +75,22 @@ static const unsigned char upek2020_init_capture[] = {
|
||||
0x02,
|
||||
0x00, /* Wait for acceptable finger */
|
||||
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 */
|
||||
};
|
||||
|
||||
|
||||
@@ -162,9 +162,9 @@ enum {
|
||||
|
||||
/* Dump buffer for debug */
|
||||
#define dump_buffer(buf) \
|
||||
fp_dbg ("%02x %02x %02x %02x %02x %02x %02x %02x", \
|
||||
buf[6], buf[7], buf[8], buf[9], buf[10], buf[11], buf[12], buf[13] \
|
||||
)
|
||||
fp_dbg ("%02x %02x %02x %02x %02x %02x %02x %02x", \
|
||||
buf[6], buf[7], buf[8], buf[9], buf[10], buf[11], buf[12], buf[13] \
|
||||
)
|
||||
|
||||
/* Callback of asynchronous send */
|
||||
static void
|
||||
|
||||
@@ -157,7 +157,7 @@ vfs301_proto_generate_0B (int subtype, gssize *len)
|
||||
}
|
||||
|
||||
#define HEX_TO_INT(c) \
|
||||
(((c) >= '0' && (c) <= '9') ? ((c) - '0') : ((c) - 'A' + 10))
|
||||
(((c) >= '0' && (c) <= '9') ? ((c) - '0') : ((c) - 'A' + 10))
|
||||
|
||||
static guint8 *
|
||||
translate_str (const char **srcL, gssize *len)
|
||||
@@ -422,15 +422,15 @@ img_process_data (int first_block, FpDeviceVfs301 *dev, const guint8 *buf, int l
|
||||
/************************** PROTOCOL STUFF ************************************/
|
||||
|
||||
#define USB_RECV(from, len) \
|
||||
usb_recv (dev, from, len, NULL, NULL)
|
||||
usb_recv (dev, from, len, NULL, NULL)
|
||||
|
||||
#define USB_SEND(type, subtype) \
|
||||
{ \
|
||||
const guint8 *data; \
|
||||
gssize len; \
|
||||
data = vfs301_proto_generate (type, subtype, &len); \
|
||||
usb_send (dev, data, len, NULL); \
|
||||
}
|
||||
{ \
|
||||
const guint8 *data; \
|
||||
gssize len; \
|
||||
data = vfs301_proto_generate (type, subtype, &len); \
|
||||
usb_send (dev, data, len, NULL); \
|
||||
}
|
||||
|
||||
#define RAW_DATA(x) g_memdup2 (x, sizeof (x)), sizeof (x)
|
||||
|
||||
@@ -489,13 +489,13 @@ vfs301_proto_peek_event (FpDeviceVfs301 *dev)
|
||||
* we will run into timeouts randomly and need to then try again.
|
||||
*/
|
||||
#define PARALLEL_RECEIVE(e1, l1, e2, l2) \
|
||||
{ \
|
||||
g_autoptr(GError) error = NULL; \
|
||||
usb_recv (dev, e1, l1, NULL, &error); \
|
||||
usb_recv (dev, e2, l2, NULL, NULL); \
|
||||
if (g_error_matches (error, G_USB_DEVICE_ERROR, G_USB_DEVICE_ERROR_TIMED_OUT)) \
|
||||
usb_recv (dev, e1, l1, NULL, NULL); \
|
||||
}
|
||||
{ \
|
||||
g_autoptr(GError) error = NULL; \
|
||||
usb_recv (dev, e1, l1, NULL, &error); \
|
||||
usb_recv (dev, e2, l2, NULL, NULL); \
|
||||
if (g_error_matches (error, G_USB_DEVICE_ERROR, G_USB_DEVICE_ERROR_TIMED_OUT)) \
|
||||
usb_recv (dev, e1, l1, NULL, NULL); \
|
||||
}
|
||||
|
||||
static void
|
||||
vfs301_proto_process_event_cb (FpiUsbTransfer *transfer,
|
||||
|
||||
@@ -41,30 +41,30 @@ struct usb_action
|
||||
};
|
||||
|
||||
#define SEND(ENDPOINT, COMMAND) \
|
||||
{ \
|
||||
.type = ACTION_SEND, \
|
||||
.endpoint = ENDPOINT, \
|
||||
.name = #COMMAND, \
|
||||
.size = sizeof (COMMAND), \
|
||||
.data = COMMAND \
|
||||
},
|
||||
{ \
|
||||
.type = ACTION_SEND, \
|
||||
.endpoint = ENDPOINT, \
|
||||
.name = #COMMAND, \
|
||||
.size = sizeof (COMMAND), \
|
||||
.data = COMMAND \
|
||||
},
|
||||
|
||||
#define RECV(ENDPOINT, SIZE) \
|
||||
{ \
|
||||
.type = ACTION_RECEIVE, \
|
||||
.endpoint = ENDPOINT, \
|
||||
.size = SIZE, \
|
||||
.data = NULL \
|
||||
},
|
||||
{ \
|
||||
.type = ACTION_RECEIVE, \
|
||||
.endpoint = ENDPOINT, \
|
||||
.size = SIZE, \
|
||||
.data = NULL \
|
||||
},
|
||||
|
||||
#define RECV_CHECK(ENDPOINT, SIZE, EXPECTED) \
|
||||
{ \
|
||||
.type = ACTION_RECEIVE, \
|
||||
.endpoint = ENDPOINT, \
|
||||
.size = SIZE, \
|
||||
.data = EXPECTED, \
|
||||
.correct_reply_size = sizeof (EXPECTED) \
|
||||
},
|
||||
{ \
|
||||
.type = ACTION_RECEIVE, \
|
||||
.endpoint = ENDPOINT, \
|
||||
.size = SIZE, \
|
||||
.data = EXPECTED, \
|
||||
.correct_reply_size = sizeof (EXPECTED) \
|
||||
},
|
||||
|
||||
struct usbexchange_data
|
||||
{
|
||||
|
||||
@@ -51,39 +51,39 @@ struct usb_action
|
||||
};
|
||||
|
||||
#define SEND(ENDPOINT, COMMAND) \
|
||||
{ \
|
||||
.type = ACTION_SEND, \
|
||||
.endpoint = ENDPOINT, \
|
||||
.name = #COMMAND, \
|
||||
.size = sizeof (COMMAND), \
|
||||
.data = COMMAND \
|
||||
},
|
||||
{ \
|
||||
.type = ACTION_SEND, \
|
||||
.endpoint = ENDPOINT, \
|
||||
.name = #COMMAND, \
|
||||
.size = sizeof (COMMAND), \
|
||||
.data = COMMAND \
|
||||
},
|
||||
|
||||
#define RECV(ENDPOINT, SIZE) \
|
||||
{ \
|
||||
.type = ACTION_RECEIVE, \
|
||||
.endpoint = ENDPOINT, \
|
||||
.size = SIZE, \
|
||||
.data = NULL \
|
||||
},
|
||||
{ \
|
||||
.type = ACTION_RECEIVE, \
|
||||
.endpoint = ENDPOINT, \
|
||||
.size = SIZE, \
|
||||
.data = NULL \
|
||||
},
|
||||
|
||||
#define RECV_CHECK(ENDPOINT, SIZE, EXPECTED) \
|
||||
{ \
|
||||
.type = ACTION_RECEIVE, \
|
||||
.endpoint = ENDPOINT, \
|
||||
.size = SIZE, \
|
||||
.data = EXPECTED, \
|
||||
.correct_reply_size = sizeof (EXPECTED) \
|
||||
},
|
||||
{ \
|
||||
.type = ACTION_RECEIVE, \
|
||||
.endpoint = ENDPOINT, \
|
||||
.size = SIZE, \
|
||||
.data = EXPECTED, \
|
||||
.correct_reply_size = sizeof (EXPECTED) \
|
||||
},
|
||||
|
||||
#define RECV_CHECK_SIZE(ENDPOINT, SIZE, EXPECTED) \
|
||||
{ \
|
||||
.type = ACTION_RECEIVE, \
|
||||
.endpoint = ENDPOINT, \
|
||||
.size = SIZE, \
|
||||
.data = NULL, \
|
||||
.correct_reply_size = sizeof (EXPECTED) \
|
||||
},
|
||||
{ \
|
||||
.type = ACTION_RECEIVE, \
|
||||
.endpoint = ENDPOINT, \
|
||||
.size = SIZE, \
|
||||
.data = NULL, \
|
||||
.correct_reply_size = sizeof (EXPECTED) \
|
||||
},
|
||||
|
||||
struct usbexchange_data
|
||||
{
|
||||
|
||||
@@ -273,7 +273,8 @@ on_stream_read_cb (GObject *source_object,
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -733,7 +733,13 @@ dev_deinit (FpDevice *dev)
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -111,8 +111,6 @@ typedef struct
|
||||
GDestroyNotify enroll_progress_destroy;
|
||||
} FpEnrollData;
|
||||
|
||||
void enroll_data_free (FpEnrollData *enroll_data);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
FpPrint *enrolled_print; /* verify */
|
||||
@@ -128,7 +126,6 @@ typedef struct
|
||||
GDestroyNotify match_destroy;
|
||||
} FpMatchData;
|
||||
|
||||
void match_data_free (FpMatchData *match_data);
|
||||
|
||||
void fpi_device_suspend (FpDevice *device);
|
||||
void fpi_device_resume (FpDevice *device);
|
||||
|
||||
@@ -1088,6 +1088,15 @@ fp_device_resume_finish (FpDevice *device,
|
||||
return g_task_propagate_boolean (G_TASK (result), error);
|
||||
}
|
||||
|
||||
static void
|
||||
enroll_data_free (FpEnrollData *data)
|
||||
{
|
||||
if (data->enroll_progress_destroy)
|
||||
data->enroll_progress_destroy (data->enroll_progress_data);
|
||||
data->enroll_progress_data = NULL;
|
||||
g_clear_object (&data->print);
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
/**
|
||||
* fp_device_enroll:
|
||||
@@ -1217,6 +1226,23 @@ fp_device_enroll_finish (FpDevice *device,
|
||||
return g_task_propagate_pointer (G_TASK (result), error);
|
||||
}
|
||||
|
||||
static void
|
||||
match_data_free (FpMatchData *data)
|
||||
{
|
||||
g_clear_object (&data->print);
|
||||
g_clear_object (&data->match);
|
||||
g_clear_error (&data->error);
|
||||
|
||||
if (data->match_destroy)
|
||||
data->match_destroy (data->match_data);
|
||||
data->match_data = NULL;
|
||||
|
||||
g_clear_object (&data->enrolled_print);
|
||||
g_clear_pointer (&data->gallery, g_ptr_array_unref);
|
||||
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
/**
|
||||
* fp_device_verify:
|
||||
* @device: a #FpDevice
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "fpi-image.h"
|
||||
#include "fpi-log.h"
|
||||
|
||||
#include <config.h>
|
||||
#include <nbis.h>
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,7 @@ G_BEGIN_DECLS
|
||||
G_DECLARE_FINAL_TYPE (FpPrint, fp_print, FP, PRINT, GInitiallyUnowned)
|
||||
|
||||
#define FP_FINGER_IS_VALID(finger) \
|
||||
((finger) >= FP_FINGER_FIRST && (finger) <= FP_FINGER_LAST)
|
||||
((finger) >= FP_FINGER_FIRST && (finger) <= FP_FINGER_LAST)
|
||||
|
||||
#include "fp-device.h"
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (GDate, g_date_free);
|
||||
#define g_memdup2(data, size) g_memdup ((data), (size))
|
||||
#else
|
||||
#define g_memdup2(data, size) \
|
||||
(G_GNUC_EXTENSION ({ \
|
||||
(G_GNUC_EXTENSION ({ \
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
|
||||
g_memdup2 ((data), (size)); \
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS \
|
||||
|
||||
@@ -522,33 +522,6 @@ fpi_device_get_driver_data (FpDevice *device)
|
||||
return priv->driver_data;
|
||||
}
|
||||
|
||||
void
|
||||
enroll_data_free (FpEnrollData *data)
|
||||
{
|
||||
if (data->enroll_progress_destroy)
|
||||
data->enroll_progress_destroy (data->enroll_progress_data);
|
||||
data->enroll_progress_data = NULL;
|
||||
g_clear_object (&data->print);
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
void
|
||||
match_data_free (FpMatchData *data)
|
||||
{
|
||||
g_clear_object (&data->print);
|
||||
g_clear_object (&data->match);
|
||||
g_clear_error (&data->error);
|
||||
|
||||
if (data->match_destroy)
|
||||
data->match_destroy (data->match_data);
|
||||
data->match_data = NULL;
|
||||
|
||||
g_clear_object (&data->enrolled_print);
|
||||
g_clear_pointer (&data->gallery, g_ptr_array_unref);
|
||||
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
/**
|
||||
* fpi_device_get_enroll_data:
|
||||
* @device: The #FpDevice
|
||||
|
||||
@@ -24,8 +24,9 @@
|
||||
#include "fpi-log.h"
|
||||
|
||||
#include <nbis.h>
|
||||
#include <config.h>
|
||||
|
||||
#if HAVE_PIXMAN
|
||||
#ifdef HAVE_PIXMAN
|
||||
#include <pixman.h>
|
||||
#endif
|
||||
|
||||
@@ -107,12 +108,12 @@ fpi_mean_sq_diff_norm (const guint8 *buf1,
|
||||
return res / size;
|
||||
}
|
||||
|
||||
#if HAVE_PIXMAN
|
||||
FpImage *
|
||||
fpi_image_resize (FpImage *orig_img,
|
||||
guint w_factor,
|
||||
guint h_factor)
|
||||
{
|
||||
#ifdef HAVE_PIXMAN
|
||||
int new_width = orig_img->width * w_factor;
|
||||
int new_height = orig_img->height * h_factor;
|
||||
pixman_image_t *orig, *resized;
|
||||
@@ -145,5 +146,9 @@ fpi_image_resize (FpImage *orig_img,
|
||||
pixman_image_unref (resized);
|
||||
|
||||
return newimg;
|
||||
}
|
||||
#else
|
||||
fp_err ("Libfprint compiled without pixman support, impossible to resize");
|
||||
|
||||
return g_object_ref (orig_img);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <config.h>
|
||||
#include "fp-image.h"
|
||||
|
||||
/**
|
||||
@@ -77,8 +76,6 @@ gint fpi_mean_sq_diff_norm (const guint8 *buf1,
|
||||
const guint8 *buf2,
|
||||
gint size);
|
||||
|
||||
#if HAVE_PIXMAN
|
||||
FpImage *fpi_image_resize (FpImage *orig,
|
||||
guint w_factor,
|
||||
guint h_factor);
|
||||
#endif
|
||||
|
||||
@@ -80,12 +80,12 @@
|
||||
* Uses fp_err() to print an error if the @condition is true.
|
||||
*/
|
||||
#define BUG_ON(condition) G_STMT_START \
|
||||
if (condition) { \
|
||||
char *s; \
|
||||
s = g_strconcat ("BUG: (", #condition, ")", NULL); \
|
||||
fp_err ("%s: %s() %s:%d", s, G_STRFUNC, __FILE__, __LINE__); \
|
||||
g_free (s); \
|
||||
} G_STMT_END
|
||||
if (condition) { \
|
||||
char *s; \
|
||||
s = g_strconcat ("BUG: (", #condition, ")", NULL); \
|
||||
fp_err ("%s: %s() %s:%d", s, G_STRFUNC, __FILE__, __LINE__); \
|
||||
g_free (s); \
|
||||
} G_STMT_END
|
||||
|
||||
/**
|
||||
* BUG:
|
||||
|
||||
@@ -60,7 +60,7 @@ typedef void (*FpiSsmHandlerCallback)(FpiSsm *ssm,
|
||||
|
||||
/* for library and drivers */
|
||||
#define fpi_ssm_new(dev, handler, nr_states) \
|
||||
fpi_ssm_new_full (dev, handler, nr_states, nr_states, #nr_states)
|
||||
fpi_ssm_new_full (dev, handler, nr_states, nr_states, #nr_states)
|
||||
FpiSsm *fpi_ssm_new_full (FpDevice *dev,
|
||||
FpiSsmHandlerCallback handler,
|
||||
int nr_states,
|
||||
|
||||
@@ -132,7 +132,7 @@ main (int argc, char **argv)
|
||||
g_print ("%s", (char *) l->data);
|
||||
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 ("\n");
|
||||
@@ -146,7 +146,7 @@ main (int argc, char **argv)
|
||||
g_print ("%s", (char *) l->data);
|
||||
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);
|
||||
|
||||
@@ -263,7 +263,7 @@ libfprint_drivers = static_library('fprint-drivers',
|
||||
install: false)
|
||||
|
||||
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],
|
||||
sources: [
|
||||
@@ -339,7 +339,7 @@ sync_udev_udb = custom_target('sync-udev-hwdb',
|
||||
command: [
|
||||
'cp', '-v',
|
||||
udev_hwdb_generator.full_path(),
|
||||
meson.source_root() / 'data'
|
||||
meson.project_source_root() / 'data'
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
17
meson.build
17
meson.build
@@ -1,18 +1,23 @@
|
||||
project('libfprint', [ 'c', 'cpp' ],
|
||||
version: '1.94.4',
|
||||
version: '1.94.6',
|
||||
license: 'LGPLv2.1+',
|
||||
default_options: [
|
||||
'buildtype=debugoptimized',
|
||||
'warning_level=1',
|
||||
'c_std=gnu99',
|
||||
],
|
||||
meson_version: '>= 0.49.0')
|
||||
meson_version: '>= 0.56.0')
|
||||
|
||||
gnome = import('gnome')
|
||||
|
||||
libfprint_conf = configuration_data()
|
||||
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')
|
||||
cpp = meson.get_compiler('cpp')
|
||||
host_system = host_machine.system()
|
||||
@@ -286,8 +291,6 @@ else
|
||||
endif
|
||||
|
||||
if get_option('gtk-examples')
|
||||
gnome = import('gnome')
|
||||
|
||||
gtk_dep = dependency('gtk+-3.0', required: false)
|
||||
if not gtk_dep.found()
|
||||
error('GTK+ 3.x is required for GTK+ examples')
|
||||
@@ -299,9 +302,7 @@ subdir('libfprint')
|
||||
|
||||
configure_file(output: 'config.h', configuration: libfprint_conf)
|
||||
|
||||
subdir('examples')
|
||||
if get_option('doc')
|
||||
gnome = import('gnome')
|
||||
subdir('doc')
|
||||
endif
|
||||
if get_option('gtk-examples')
|
||||
@@ -311,6 +312,8 @@ endif
|
||||
subdir('data')
|
||||
subdir('tests')
|
||||
|
||||
subdir('examples')
|
||||
|
||||
pkgconfig = import('pkgconfig')
|
||||
pkgconfig.generate(
|
||||
name: versioned_libname,
|
||||
@@ -321,3 +324,5 @@ pkgconfig.generate(
|
||||
subdirs: versioned_libname,
|
||||
filebase: versioned_libname,
|
||||
)
|
||||
|
||||
summary({'Drivers': drivers, }, section: 'Drivers')
|
||||
|
||||
@@ -30,3 +30,7 @@ option('doc',
|
||||
description: 'Whether to build the API documentation',
|
||||
type: 'boolean',
|
||||
value: true)
|
||||
option('installed-tests',
|
||||
description: 'Whether to install the installed tests',
|
||||
type: 'boolean',
|
||||
value: true)
|
||||
|
||||
5
tests/driver.test.in
Normal file
5
tests/driver.test.in
Normal 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.
@@ -1,31 +1,30 @@
|
||||
P: /devices/pci0000:00/0000:00:14.0/usb1/1-3
|
||||
N: bus/usb/001/023=12010002EF000040C627966400010102030109022000010103A0320904000002FF0000040705830240000007050102400000
|
||||
E: DEVNAME=/dev/bus/usb/001/023
|
||||
P: /devices/pci0000:00/0000:00:14.0/usb3/3-9
|
||||
N: bus/usb/003/004=12010002EF000040C627AC6300010102030109022000010103A0320904000002FF0000040705830240000007050102400000
|
||||
E: DEVNAME=/dev/bus/usb/003/004
|
||||
E: DEVTYPE=usb_device
|
||||
E: DRIVER=usb
|
||||
E: PRODUCT=27c6/6496/100
|
||||
E: PRODUCT=27c6/63ac/100
|
||||
E: TYPE=239/0/0
|
||||
E: BUSNUM=001
|
||||
E: DEVNUM=023
|
||||
E: BUSNUM=003
|
||||
E: DEVNUM=004
|
||||
E: MAJOR=189
|
||||
E: MINOR=22
|
||||
E: MINOR=259
|
||||
E: SUBSYSTEM=usb
|
||||
E: ID_VENDOR=Goodix_Technology_Co.__Ltd.
|
||||
E: ID_VENDOR_ENC=Goodix\x20Technology\x20Co.\x2c\x20Ltd.
|
||||
E: ID_VENDOR_ID=27c6
|
||||
E: ID_MODEL=Goodix_USB2.0_MISC
|
||||
E: ID_MODEL_ENC=Goodix\x20USB2.0\x20MISC
|
||||
E: ID_MODEL_ID=6496
|
||||
E: ID_MODEL_ID=63ac
|
||||
E: ID_REVISION=0100
|
||||
E: ID_SERIAL=Goodix_Technology_Co.__Ltd._Goodix_USB2.0_MISC_XXXX_MOC_B0
|
||||
E: ID_SERIAL_SHORT=XXXX_MOC_B0
|
||||
E: ID_SERIAL=Goodix_Technology_Co.__Ltd._Goodix_USB2.0_MISC_UID4C77C784_XXXX_MOC_B0
|
||||
E: ID_SERIAL_SHORT=UID4C77C784_XXXX_MOC_B0
|
||||
E: ID_BUS=usb
|
||||
E: ID_USB_INTERFACES=:ff0000:
|
||||
E: ID_VENDOR_FROM_DATABASE=Shenzhen Goodix Technology Co.,Ltd.
|
||||
E: ID_AUTOSUSPEND=1
|
||||
E: ID_PERSIST=0
|
||||
E: ID_PATH=pci-0000:00:14.0-usb-0:3
|
||||
E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_3
|
||||
E: ID_PATH=pci-0000:00:14.0-usb-0:9
|
||||
E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_9
|
||||
A: authorized=1\n
|
||||
A: avoid_reset_quirk=0\n
|
||||
A: bConfigurationValue=1\n
|
||||
@@ -38,30 +37,34 @@ A: bNumConfigurations=1\n
|
||||
A: bNumInterfaces= 1\n
|
||||
A: bcdDevice=0100\n
|
||||
A: bmAttributes=a0\n
|
||||
A: busnum=1\n
|
||||
A: configuration=XXXX_MOC_B0\n
|
||||
H: descriptors=12010002EF000040C627966400010102030109022000010103A0320904000002FF0000040705830240000007050102400000
|
||||
A: dev=189:22\n
|
||||
A: devnum=23\n
|
||||
A: devpath=3\n
|
||||
A: busnum=3\n
|
||||
A: configuration=UID4C77C784_XXXX_MOC_B0\n
|
||||
H: descriptors=12010002EF000040C627AC6300010102030109022000010103A0320904000002FF0000040705830240000007050102400000
|
||||
A: dev=189:259\n
|
||||
A: devnum=4\n
|
||||
A: devpath=9\n
|
||||
L: driver=../../../../../bus/usb/drivers/usb
|
||||
L: firmware_node=../../../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:1c/device:1d/device:20
|
||||
A: idProduct=6496\n
|
||||
L: firmware_node=../../../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:13/device:14/device:1f
|
||||
A: idProduct=63ac\n
|
||||
A: idVendor=27c6\n
|
||||
A: ltm_capable=no\n
|
||||
A: manufacturer=Goodix Technology Co., Ltd.\n
|
||||
A: maxchild=0\n
|
||||
L: port=../1-0:1.0/usb1-port3
|
||||
A: power/active_duration=22667\n
|
||||
L: port=../3-0:1.0/usb3-port9
|
||||
A: power/active_duration=702588\n
|
||||
A: power/async=enabled\n
|
||||
A: power/autosuspend=2\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/level=auto\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_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_abort_count=\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: product=Goodix USB2.0 MISC\n
|
||||
A: quirks=0x0\n
|
||||
A: removable=removable\n
|
||||
A: removable=fixed\n
|
||||
A: rx_lanes=1\n
|
||||
A: serial=XXXX_MOC_B0\n
|
||||
A: serial=UID4C77C784_XXXX_MOC_B0\n
|
||||
A: speed=12\n
|
||||
A: tx_lanes=1\n
|
||||
A: urbnum=298\n
|
||||
A: urbnum=5759\n
|
||||
A: version= 2.00\n
|
||||
|
||||
P: /devices/pci0000:00/0000:00:14.0/usb1
|
||||
N: bus/usb/001/001=12010002090001406B1D020017050302010109021900010100E0000904000001090000000705810304000C
|
||||
E: DEVNAME=/dev/bus/usb/001/001
|
||||
P: /devices/pci0000:00/0000:00:14.0/usb3
|
||||
N: bus/usb/003/001=12010002090001406B1D020015050302010109021900010100E0000904000001090000000705810304000C
|
||||
E: DEVNAME=/dev/bus/usb/003/001
|
||||
E: DEVTYPE=usb_device
|
||||
E: DRIVER=usb
|
||||
E: PRODUCT=1d6b/2/517
|
||||
E: PRODUCT=1d6b/2/515
|
||||
E: TYPE=9/0/1
|
||||
E: BUSNUM=001
|
||||
E: BUSNUM=003
|
||||
E: DEVNUM=001
|
||||
E: MAJOR=189
|
||||
E: MINOR=0
|
||||
E: MINOR=256
|
||||
E: SUBSYSTEM=usb
|
||||
E: ID_VENDOR=Linux_5.17.12-300.fc36.x86_64_xhci-hcd
|
||||
E: ID_VENDOR_ENC=Linux\x205.17.12-300.fc36.x86_64\x20xhci-hcd
|
||||
E: ID_VENDOR=Linux_5.15.0-57-generic_xhci-hcd
|
||||
E: ID_VENDOR_ENC=Linux\x205.15.0-57-generic\x20xhci-hcd
|
||||
E: ID_VENDOR_ID=1d6b
|
||||
E: ID_MODEL=xHCI_Host_Controller
|
||||
E: ID_MODEL_ENC=xHCI\x20Host\x20Controller
|
||||
E: ID_MODEL_ID=0002
|
||||
E: ID_REVISION=0517
|
||||
E: ID_SERIAL=Linux_5.17.12-300.fc36.x86_64_xhci-hcd_xHCI_Host_Controller_0000:00:14.0
|
||||
E: ID_REVISION=0515
|
||||
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_BUS=usb
|
||||
E: ID_USB_INTERFACES=:090000:
|
||||
@@ -123,31 +126,35 @@ A: bMaxPacketSize0=64\n
|
||||
A: bMaxPower=0mA\n
|
||||
A: bNumConfigurations=1\n
|
||||
A: bNumInterfaces= 1\n
|
||||
A: bcdDevice=0517\n
|
||||
A: bcdDevice=0515\n
|
||||
A: bmAttributes=e0\n
|
||||
A: busnum=1\n
|
||||
A: configuration=\n
|
||||
H: descriptors=12010002090001406B1D020017050302010109021900010100E0000904000001090000000705810304000C
|
||||
A: dev=189:0\n
|
||||
A: busnum=3\n
|
||||
A: configuration=
|
||||
H: descriptors=12010002090001406B1D020015050302010109021900010100E0000904000001090000000705810304000C
|
||||
A: dev=189:256\n
|
||||
A: devnum=1\n
|
||||
A: devpath=0\n
|
||||
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: idVendor=1d6b\n
|
||||
A: interface_authorized_default=1\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: power/active_duration=164289796\n
|
||||
A: power/active_duration=78971960\n
|
||||
A: power/async=enabled\n
|
||||
A: power/autosuspend=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/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_suspended_time=0\n
|
||||
A: power/runtime_usage=0\n
|
||||
A: power/wakeup=disabled\n
|
||||
A: power/wakeup_abort_count=\n
|
||||
A: power/wakeup_active=\n
|
||||
@@ -164,48 +171,52 @@ A: rx_lanes=1\n
|
||||
A: serial=0000:00:14.0\n
|
||||
A: speed=480\n
|
||||
A: tx_lanes=1\n
|
||||
A: urbnum=2097\n
|
||||
A: urbnum=1824\n
|
||||
A: version= 2.00\n
|
||||
|
||||
P: /devices/pci0000:00/0000:00:14.0
|
||||
E: DRIVER=xhci_hcd
|
||||
E: PCI_CLASS=C0330
|
||||
E: PCI_ID=8086:9DED
|
||||
E: PCI_SUBSYS_ID=17AA:2292
|
||||
E: PCI_ID=8086:51ED
|
||||
E: PCI_SUBSYS_ID=1028:0B00
|
||||
E: PCI_SLOT_NAME=0000:00:14.0
|
||||
E: MODALIAS=pci:v00008086d00009DEDsv000017AAsd00002292bc0Csc03i30
|
||||
E: MODALIAS=pci:v00008086d000051EDsv00001028sd00000B00bc0Csc03i30
|
||||
E: SUBSYSTEM=pci
|
||||
E: ID_PCI_CLASS_FROM_DATABASE=Serial bus controller
|
||||
E: ID_PCI_SUBCLASS_FROM_DATABASE=USB controller
|
||||
E: ID_PCI_INTERFACE_FROM_DATABASE=XHCI
|
||||
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: broken_parity_status=0\n
|
||||
A: class=0x0c0330\n
|
||||
H: config=8680ED9D060490021130030C00008000040022EA000000000000000000000000000000000000000000000000AA179222000000007000000000000000FF010000FD0134808FC6FF8300000000000000007F6DDC0F00000000F507312600000000316000000000000000000000000000000180C2C1080000000000000000000000059087001803E0FE0000000000000000090014F01000400100000000C10A080000080E00001800008F40020000010000000000000000000008000000040000000000000000000000000000000000000000000000000000000800000004000000000000000000000000000000000000000000000000000000B50F320112000000
|
||||
H: config=8680ED51060490020130030C0000800004002A8F6200000000000000000000000000000000000000000000002810000B000000007000000000000000FF010000FD0134A089C27F8000000000000000003F6DD80F000000000000000000000000316000000000000000000000000000000180C2C1080000000000000000000000059087003808E0FE000000000000000009B014F01000400100000000C10A080000080E00001800008F50020000010000090000018680C00009001014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000B50F100112000000
|
||||
A: consistent_dma_mask_bits=64\n
|
||||
A: d3cold_allowed=1\n
|
||||
A: dbc=disabled\n
|
||||
A: device=0x9ded\n
|
||||
A: device=0x51ed\n
|
||||
A: dma_mask_bits=64\n
|
||||
L: driver=../../../bus/pci/drivers/xhci_hcd
|
||||
A: driver_override=(null)\n
|
||||
A: enable=1\n
|
||||
L: firmware_node=../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:1c
|
||||
A: irq=128\n
|
||||
A: local_cpulist=0-7\n
|
||||
A: local_cpus=ff\n
|
||||
A: modalias=pci:v00008086d00009DEDsv000017AAsd00002292bc0Csc03i30\n
|
||||
L: firmware_node=../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:13
|
||||
L: iommu=../../virtual/iommu/dmar1
|
||||
L: iommu_group=../../../kernel/iommu_groups/13
|
||||
A: irq=167\n
|
||||
A: local_cpulist=0-19\n
|
||||
A: local_cpus=fffff\n
|
||||
A: modalias=pci:v00008086d000051EDsv00001028sd00000B00bc0Csc03i30\n
|
||||
A: msi_bus=1\n
|
||||
A: msi_irqs/128=msi\n
|
||||
A: msi_irqs/167=msi\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/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_suspended_time=0\n
|
||||
A: power/runtime_usage=0\n
|
||||
A: power/wakeup=enabled\n
|
||||
A: power/wakeup_abort_count=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_total_time_ms=0\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: revision=0x11\n
|
||||
A: subsystem_device=0x2292\n
|
||||
A: subsystem_vendor=0x17aa\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=0x01\n
|
||||
A: subsystem_device=0x0b00\n
|
||||
A: subsystem_vendor=0x1028\n
|
||||
A: vendor=0x8086\n
|
||||
|
||||
|
||||
@@ -17,3 +17,10 @@
|
||||
...
|
||||
}
|
||||
|
||||
{
|
||||
<ignore-g-thread-new-leak>
|
||||
Memcheck:Leak
|
||||
fun:calloc
|
||||
...
|
||||
fun:g_thread_new
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ envs.set('G_DEBUG', 'fatal-warnings')
|
||||
envs.set('G_MESSAGES_DEBUG', 'all')
|
||||
|
||||
# Setup paths
|
||||
envs.set('MESON_SOURCE_ROOT', meson.source_root())
|
||||
envs.set('MESON_BUILD_ROOT', meson.build_root())
|
||||
envs.prepend('LD_LIBRARY_PATH', join_paths(meson.build_root(), 'libfprint'))
|
||||
envs.set('MESON_SOURCE_ROOT', meson.project_source_root())
|
||||
envs.set('MESON_BUILD_ROOT', meson.project_build_root())
|
||||
envs.prepend('LD_LIBRARY_PATH', meson.project_build_root() / 'libfprint')
|
||||
|
||||
# Set FP_DEVICE_EMULATION so that drivers can adapt (e.g. to use fixed
|
||||
# random numbers rather than proper ones)
|
||||
@@ -19,8 +19,17 @@ envs.set('FP_DRIVERS_WHITELIST', ':'.join([
|
||||
'virtual_device_storage',
|
||||
]))
|
||||
|
||||
envs.set('FP_PRINTS_PATH', meson.project_source_root() / 'examples' / 'prints')
|
||||
|
||||
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 = [
|
||||
'aes2501',
|
||||
'aes3500',
|
||||
@@ -30,6 +39,7 @@ drivers_tests = [
|
||||
'elanspi',
|
||||
'synaptics',
|
||||
'upektc_img',
|
||||
'upektc_img-tcs1s',
|
||||
'uru4000-msv2',
|
||||
'uru4000-4500',
|
||||
'vfs0050',
|
||||
@@ -44,23 +54,33 @@ drivers_tests = [
|
||||
|
||||
if get_option('introspection')
|
||||
conf = configuration_data()
|
||||
conf.set('SRCDIR', meson.source_root())
|
||||
conf.set('BUILDDIR', meson.build_root())
|
||||
conf.set('SRCDIR', meson.project_source_root())
|
||||
conf.set('BUILDDIR', meson.project_build_root())
|
||||
configure_file(configuration: conf,
|
||||
input: 'create-driver-test.py.in',
|
||||
output: 'create-driver-test.py')
|
||||
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')
|
||||
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-image',
|
||||
'virtual-device',
|
||||
]
|
||||
|
||||
python3 = find_program('python3')
|
||||
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
|
||||
driver_name = '_'.join(vdtest.split('-'))
|
||||
@@ -92,6 +112,31 @@ if get_option('introspection')
|
||||
env: envs,
|
||||
)
|
||||
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
|
||||
test(vdtest,
|
||||
find_program('sh'),
|
||||
@@ -100,6 +145,7 @@ if get_option('introspection')
|
||||
endif
|
||||
endforeach
|
||||
|
||||
driver_tests_enabled = false
|
||||
foreach driver_test: drivers_tests
|
||||
driver_name = driver_test.split('-')[0]
|
||||
driver_envs = envs
|
||||
@@ -107,6 +153,7 @@ if get_option('introspection')
|
||||
|
||||
if (driver_name in supported_drivers and
|
||||
gusb_dep.version().version_compare('>= 0.3.0'))
|
||||
driver_tests_enabled = true
|
||||
test(driver_test,
|
||||
python3,
|
||||
args: [
|
||||
@@ -118,6 +165,32 @@ if get_option('introspection')
|
||||
timeout: 15,
|
||||
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
|
||||
test(driver_test,
|
||||
find_program('sh'),
|
||||
@@ -125,6 +198,17 @@ if get_option('introspection')
|
||||
)
|
||||
endif
|
||||
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
|
||||
warning('Skipping all driver tests as introspection bindings are missing')
|
||||
test('virtual-image',
|
||||
@@ -164,7 +248,7 @@ endif
|
||||
unit_tests_deps = { 'fpi-assembling' : [cairo_dep] }
|
||||
|
||||
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)
|
||||
|
||||
foreach test_name: unit_tests
|
||||
@@ -197,13 +281,28 @@ foreach test_name: unit_tests
|
||||
sources: [basename + '.c', test_config_h],
|
||||
dependencies: [ libfprint_private_dep ] + extra_deps,
|
||||
c_args: common_cflags,
|
||||
link_with: test_utils,
|
||||
link_whole: test_utils,
|
||||
install: installed_tests,
|
||||
install_dir: installed_tests_execdir,
|
||||
)
|
||||
test(test_name,
|
||||
test_exe,
|
||||
suite: ['unit-tests'],
|
||||
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
|
||||
|
||||
# Run udev rule generator with fatal warnings
|
||||
@@ -217,7 +316,7 @@ test('udev-hwdb',
|
||||
gdb = find_program('gdb', required: false)
|
||||
if gdb.found()
|
||||
libfprint_wrapper = [
|
||||
gdb.path(),
|
||||
gdb.full_path(),
|
||||
'-batch',
|
||||
'-ex', 'run',
|
||||
'--args',
|
||||
@@ -234,12 +333,12 @@ valgrind = find_program('valgrind', required: false)
|
||||
if valgrind.found()
|
||||
glib_share = glib_dep.get_pkgconfig_variable('prefix') / 'share' / glib_dep.name()
|
||||
glib_suppressions = glib_share + '/valgrind/glib.supp'
|
||||
libfprint_suppressions = '@0@/@1@'.format(meson.source_root(),
|
||||
libfprint_suppressions = '@0@/@1@'.format(meson.project_source_root(),
|
||||
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])
|
||||
libfprint_wrapper = [
|
||||
valgrind.path(),
|
||||
valgrind.full_path(),
|
||||
'--tool=memcheck',
|
||||
'--leak-check=full',
|
||||
'--leak-resolution=high',
|
||||
@@ -248,6 +347,7 @@ if valgrind.found()
|
||||
'--track-origins=yes',
|
||||
'--show-leak-kinds=definite,possible',
|
||||
'--show-error-list=yes',
|
||||
'--gen-suppressions=all',
|
||||
'--suppressions=' + libfprint_suppressions,
|
||||
'--suppressions=' + glib_suppressions,
|
||||
'--suppressions=' + python_suppressions,
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#define FP_COMPONENT "fake_test_dev"
|
||||
|
||||
#include "fpi-log.h"
|
||||
#include "test-device-fake.h"
|
||||
|
||||
G_DEFINE_TYPE (FpiDeviceFake, fpi_device_fake, FP_TYPE_DEVICE)
|
||||
@@ -29,12 +30,28 @@ static const FpIdEntry driver_ids[] = {
|
||||
{ .virtual_envvar = NULL }
|
||||
};
|
||||
|
||||
static void
|
||||
(debug_action) (FpDevice * device,
|
||||
const gchar *func)
|
||||
{
|
||||
g_autofree char *action_str = NULL;
|
||||
|
||||
action_str = g_enum_to_string (FPI_TYPE_DEVICE_ACTION,
|
||||
fpi_device_get_current_action (device));
|
||||
|
||||
fp_dbg ("%s: Device %s in action %s\n",
|
||||
func, fp_device_get_name (device), action_str);
|
||||
}
|
||||
|
||||
#define debug_action(d) (debug_action) ((d), G_STRFUNC)
|
||||
|
||||
static void
|
||||
fpi_device_fake_probe (FpDevice *device)
|
||||
{
|
||||
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_probe;
|
||||
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_PROBE);
|
||||
|
||||
@@ -55,6 +72,7 @@ fpi_device_fake_open (FpDevice *device)
|
||||
{
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_open;
|
||||
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_OPEN);
|
||||
|
||||
@@ -72,6 +90,7 @@ fpi_device_fake_close (FpDevice *device)
|
||||
{
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_close;
|
||||
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_CLOSE);
|
||||
|
||||
@@ -90,6 +109,7 @@ fpi_device_fake_enroll (FpDevice *device)
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
FpPrint *print = fake_dev->ret_print;
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_enroll;
|
||||
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_ENROLL);
|
||||
|
||||
@@ -118,6 +138,7 @@ fpi_device_fake_verify (FpDevice *device)
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
FpPrint *print = fake_dev->ret_print;
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_verify;
|
||||
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_VERIFY);
|
||||
|
||||
@@ -149,6 +170,7 @@ fpi_device_fake_identify (FpDevice *device)
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
FpPrint *match = fake_dev->ret_match;
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_identify;
|
||||
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_IDENTIFY);
|
||||
|
||||
@@ -197,6 +219,7 @@ fpi_device_fake_capture (FpDevice *device)
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
gboolean wait_for_finger;
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_capture;
|
||||
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_CAPTURE);
|
||||
|
||||
@@ -216,6 +239,7 @@ fpi_device_fake_list (FpDevice *device)
|
||||
{
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_list;
|
||||
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_LIST);
|
||||
|
||||
@@ -233,6 +257,7 @@ fpi_device_fake_delete (FpDevice *device)
|
||||
{
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_delete;
|
||||
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_DELETE);
|
||||
|
||||
@@ -251,6 +276,7 @@ fpi_device_fake_clear_storage (FpDevice *device)
|
||||
{
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_clear_storage;
|
||||
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_CLEAR_STORAGE);
|
||||
|
||||
@@ -268,6 +294,7 @@ fpi_device_fake_cancel (FpDevice *device)
|
||||
{
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_cancel;
|
||||
g_assert_cmpuint (fpi_device_get_current_action (device), !=, FPI_DEVICE_ACTION_NONE);
|
||||
}
|
||||
@@ -277,6 +304,7 @@ fpi_device_fake_suspend (FpDevice *device)
|
||||
{
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_suspend;
|
||||
|
||||
fpi_device_suspend_complete (device, g_steal_pointer (&fake_dev->ret_suspend));
|
||||
@@ -287,6 +315,7 @@ fpi_device_fake_resume (FpDevice *device)
|
||||
{
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_resume;
|
||||
|
||||
fpi_device_resume_complete (device, g_steal_pointer (&fake_dev->ret_resume));
|
||||
|
||||
@@ -30,8 +30,10 @@
|
||||
#include "fp-print-private.h"
|
||||
|
||||
/* 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 ignored "-Wdangling-pointer"
|
||||
#endif
|
||||
|
||||
/* Utility functions */
|
||||
|
||||
@@ -69,7 +71,9 @@ auto_close_fake_device_free (FpAutoCloseDevice *device)
|
||||
}
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FpAutoCloseDevice, auto_close_fake_device_free)
|
||||
|
||||
#if G_GNUC_CHECK_VERSION (12, 0)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
typedef FpDeviceClass FpAutoResetClass;
|
||||
static FpAutoResetClass default_fake_dev_class = {0};
|
||||
|
||||
6
tests/test.in
Normal file
6
tests/test.in
Normal 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@
|
||||
BIN
tests/upektc_img-tcs1s/capture.pcapng
Normal file
BIN
tests/upektc_img-tcs1s/capture.pcapng
Normal file
Binary file not shown.
BIN
tests/upektc_img-tcs1s/capture.png
Normal file
BIN
tests/upektc_img-tcs1s/capture.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 74 KiB |
308
tests/upektc_img-tcs1s/device
Normal file
308
tests/upektc_img-tcs1s/device
Normal file
File diff suppressed because one or more lines are too long
@@ -40,6 +40,20 @@
|
||||
fun:_Py*
|
||||
}
|
||||
|
||||
{
|
||||
ignore__py_addr32
|
||||
Memcheck:Addr32
|
||||
...
|
||||
fun:_Py*
|
||||
}
|
||||
|
||||
{
|
||||
ignore__py_addr32
|
||||
Memcheck:Addr32
|
||||
...
|
||||
fun:Py*
|
||||
}
|
||||
|
||||
{
|
||||
ignore_py_leaks
|
||||
Memcheck:Leak
|
||||
|
||||
@@ -59,6 +59,17 @@ class GLibErrorMessage:
|
||||
|
||||
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
|
||||
def setUpClass(cls):
|
||||
unittest.TestCase.setUpClass()
|
||||
@@ -73,26 +84,28 @@ class VirtualDeviceBase(unittest.TestCase):
|
||||
cls.sockaddr = os.path.join(cls.tmpdir, '{}.socket'.format(sock_name))
|
||||
os.environ['FP_{}'.format(driver_name.upper())] = cls.sockaddr
|
||||
|
||||
cls.ctx = FPrint.Context()
|
||||
cls._driver_name = driver_name
|
||||
|
||||
cls.dev = None
|
||||
for dev in cls.ctx.get_devices():
|
||||
# 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)
|
||||
if cls.USE_CLASS_DEVICE:
|
||||
cls.ctx = FPrint.Context()
|
||||
cls.dev = cls.get_device(cls.ctx)
|
||||
assert cls.dev is not None, "You need to compile with {} for testing".format(
|
||||
driver_name)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
shutil.rmtree(cls.tmpdir)
|
||||
del cls.dev
|
||||
del cls.ctx
|
||||
if cls.USE_CLASS_DEVICE:
|
||||
del cls.dev
|
||||
del cls.ctx
|
||||
unittest.TestCase.tearDownClass()
|
||||
|
||||
def setUp(self):
|
||||
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.assertFalse(self.dev.is_open())
|
||||
self.dev.open_sync()
|
||||
@@ -101,8 +114,13 @@ class VirtualDeviceBase(unittest.TestCase):
|
||||
def tearDown(self):
|
||||
if self._close_on_teardown:
|
||||
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.assertFalse(self.dev.is_open())
|
||||
if not self.USE_CLASS_DEVICE:
|
||||
del self.dev
|
||||
del self.ctx
|
||||
super().tearDown()
|
||||
|
||||
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)
|
||||
|
||||
|
||||
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):
|
||||
|
||||
def test_device_properties(self):
|
||||
@@ -339,7 +458,8 @@ class VirtualDevice(VirtualDeviceBase):
|
||||
self.assertEqual(self.dev.get_name(), 'Virtual device for debugging')
|
||||
self.assertTrue(self.dev.is_open())
|
||||
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_capture())
|
||||
self.assertFalse(self.dev.has_storage())
|
||||
@@ -700,69 +820,6 @@ class VirtualDevice(VirtualDeviceBase):
|
||||
self.assertEqual(self.dev.get_scan_type(), FPrint.ScanType.SWIPE)
|
||||
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):
|
||||
self.send_sleep(1500)
|
||||
|
||||
|
||||
@@ -46,12 +46,15 @@ def load_image(img):
|
||||
|
||||
return img
|
||||
|
||||
if hasattr(os.environ, 'MESON_SOURCE_ROOT'):
|
||||
root = os.environ['MESON_SOURCE_ROOT']
|
||||
if 'FP_PRINTS_PATH' in os.environ:
|
||||
prints_path = os.environ['FP_PRINTS_PATH']
|
||||
else:
|
||||
root = os.path.join(os.path.dirname(__file__), '..')
|
||||
if 'MESON_SOURCE_ROOT' in os.environ:
|
||||
root = os.environ['MESON_SOURCE_ROOT']
|
||||
else:
|
||||
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()
|
||||
|
||||
@@ -76,10 +79,12 @@ class VirtualImage(unittest.TestCase):
|
||||
assert cls.dev is not None, "You need to compile with virtual_image for testing"
|
||||
|
||||
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]
|
||||
cls.prints[n] = load_image(f)
|
||||
|
||||
assert cls.prints, "No prints found in " + prints_path
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
shutil.rmtree(cls.tmpdir)
|
||||
|
||||
Reference in New Issue
Block a user