mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2025-11-15 07:38:12 +00:00
Compare commits
1 Commits
v1.94.6
...
benzea/per
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
afa37cbcbf |
118
.gitlab-ci.yml
118
.gitlab-ci.yml
@@ -1,37 +1,20 @@
|
||||
include:
|
||||
- local: '.gitlab-ci/libfprint-image-variables.yaml'
|
||||
- local: '.gitlab-ci/libfprint-templates.yaml'
|
||||
- project: 'freedesktop/ci-templates'
|
||||
ref: master
|
||||
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
|
||||
FDO_DISTRIBUTION_TAG: latest
|
||||
FDO_DISTRIBUTION_VERSION: rawhide
|
||||
FDO_UPSTREAM_REPO: "libfprint/$CI_PROJECT_NAME"
|
||||
FEDORA_IMAGE: "$CI_REGISTRY/libfprint/$CI_PROJECT_NAME/fedora/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG"
|
||||
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
|
||||
- build
|
||||
- test
|
||||
@@ -42,16 +25,16 @@ image: $FEDORA_IMAGE
|
||||
.build_one_driver_template: &build_one_driver
|
||||
script:
|
||||
# Build with a driver that doesn't need imaging, or nss
|
||||
- meson setup _build --werror -Ddrivers=$driver
|
||||
- meson compile -C _build
|
||||
- meson --werror -Ddrivers=$driver . _build
|
||||
- ninja -C _build
|
||||
- rm -rf _build/
|
||||
|
||||
.build_template: &build
|
||||
script:
|
||||
# And build with everything
|
||||
- meson setup _build --werror -Ddrivers=all
|
||||
- meson compile -C _build
|
||||
- meson install -C _build
|
||||
- meson --werror -Ddrivers=all . _build
|
||||
- ninja -C _build
|
||||
- ninja -C _build install
|
||||
|
||||
.build_template: &check_abi
|
||||
script:
|
||||
@@ -80,16 +63,12 @@ test:
|
||||
variables:
|
||||
- $CI_PIPELINE_SOURCE == "schedule"
|
||||
script:
|
||||
- meson setup _build --werror -Ddrivers=all -Db_coverage=true
|
||||
- meson --werror -Ddrivers=all -Db_coverage=true . _build
|
||||
- ninja -C _build
|
||||
- meson test -C _build --print-errorlogs --no-stdsplit --timeout-multiplier 3
|
||||
- ninja -C _build coverage
|
||||
- cat _build/meson-logs/coverage.txt || true
|
||||
- cat _build/meson-logs/coverage.txt
|
||||
artifacts:
|
||||
reports:
|
||||
junit: "_build/meson-logs/testlog.junit.xml"
|
||||
coverage_report:
|
||||
coverage_format: cobertura
|
||||
path: _build/meson-logs/coverage.xml
|
||||
expose_as: 'Coverage Report'
|
||||
when: always
|
||||
paths:
|
||||
@@ -104,12 +83,10 @@ test_valgrind:
|
||||
variables:
|
||||
- $CI_PIPELINE_SOURCE == "schedule"
|
||||
script:
|
||||
- meson setup _build -Ddrivers=all
|
||||
- meson compile -C _build
|
||||
- meson -Ddrivers=all . _build
|
||||
- ninja -C _build
|
||||
- meson test -C _build --print-errorlogs --no-stdsplit --setup=valgrind
|
||||
artifacts:
|
||||
reports:
|
||||
junit: "_build/meson-logs/testlog-valgrind.junit.xml"
|
||||
expose_as: 'Valgrind test logs'
|
||||
when: always
|
||||
paths:
|
||||
@@ -117,27 +94,6 @@ 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
|
||||
@@ -146,10 +102,9 @@ test_scan_build:
|
||||
- $CI_PIPELINE_SOURCE == "schedule"
|
||||
allow_failure: true
|
||||
script:
|
||||
- meson setup _build -Ddrivers=all
|
||||
- meson -Ddrivers=all . _build
|
||||
# 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
|
||||
@@ -163,7 +118,7 @@ test_indent:
|
||||
script:
|
||||
- scripts/uncrustify.sh
|
||||
- git diff
|
||||
- git diff-index --name-only --exit-code HEAD
|
||||
- "! git status -s | grep -q ."
|
||||
|
||||
test_unsupported_list:
|
||||
stage: check-source
|
||||
@@ -177,8 +132,7 @@ test_unsupported_list:
|
||||
flatpak:
|
||||
stage: flatpak
|
||||
extends: .flatpak
|
||||
# From https://gitlab.gnome.org/GNOME/gnome-runtime-images/container_registry
|
||||
image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:42
|
||||
image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:3.36
|
||||
variables:
|
||||
MANIFEST_PATH: "demo/org.freedesktop.libfprint.Demo.json"
|
||||
FLATPAK_MODULE: "libfprint"
|
||||
@@ -199,14 +153,14 @@ flatpak:
|
||||
allow_failure: true
|
||||
|
||||
# CONTAINERS creation stage
|
||||
.container_fedora_build_base:
|
||||
container_fedora_build:
|
||||
extends: .fdo.container-build@fedora
|
||||
stage: image-build
|
||||
only:
|
||||
variables:
|
||||
- $CI_PIPELINE_SOURCE == "never"
|
||||
- $CI_PIPELINE_SOURCE == "schedule" && $CRON_TASK == "BUILD_CI_IMAGES"
|
||||
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
|
||||
@@ -214,35 +168,7 @@ flatpak:
|
||||
libpcap-devel
|
||||
libudev-devel
|
||||
FDO_DISTRIBUTION_EXEC: |
|
||||
$LIBFPRINT_EXEC
|
||||
|
||||
.container_fedora_build_forced:
|
||||
variables:
|
||||
FDO_FORCE_REBUILD: 1
|
||||
|
||||
container_fedora_build_schedule:
|
||||
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
|
||||
- .container_fedora_build_forced
|
||||
only:
|
||||
variables:
|
||||
- $LIBFPRINT_CI_ACTION == "build-image"
|
||||
|
||||
container_fedora_build_on_deps_changed:
|
||||
extends: .container_fedora_build_base
|
||||
only:
|
||||
variables:
|
||||
- $CI_PROJECT_NAMESPACE == "libfprint" && $CI_PIPELINE_SOURCE != "schedule"
|
||||
refs:
|
||||
- branches
|
||||
- merge_requests
|
||||
changes:
|
||||
- .gitlab-ci/libfprint-image-variables.yaml
|
||||
git clone https://github.com/martinpitt/umockdev.git && \
|
||||
cd umockdev && \
|
||||
meson _build --prefix=/usr && \
|
||||
ninja -C _build && ninja -C _build install
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
variables:
|
||||
LIBFPRINT_IMAGE_TAG: v3
|
||||
@@ -1,10 +1,6 @@
|
||||
# Bump image version on .gitlab-ci/libfprint-image-variables.yaml to trigger
|
||||
# a rebuild on changes to this file
|
||||
|
||||
.libfprint_common_variables:
|
||||
LIBFPRINT_DEPENDENCIES:
|
||||
doxygen
|
||||
dnf-plugins-core
|
||||
flatpak-builder
|
||||
gcc
|
||||
gcc-c++
|
||||
@@ -13,7 +9,6 @@
|
||||
glib2-devel
|
||||
glibc-devel
|
||||
gobject-introspection-devel
|
||||
gnome-desktop-testing
|
||||
gtk-doc
|
||||
gtk3-devel
|
||||
libabigail
|
||||
@@ -32,18 +27,3 @@
|
||||
valgrind
|
||||
clang-analyzer
|
||||
diffutils
|
||||
|
||||
LIBFPRINT_EXEC: |
|
||||
dnf -y install dnf-utils
|
||||
debuginfo-install -y \
|
||||
glib2 \
|
||||
glibc \
|
||||
libgusb \
|
||||
libusb \
|
||||
nss \
|
||||
pixman
|
||||
|
||||
git clone https://github.com/martinpitt/umockdev.git && \
|
||||
cd umockdev && \
|
||||
meson _build --prefix=/usr && \
|
||||
ninja -C _build && ninja -C _build install
|
||||
|
||||
27
NEWS
27
NEWS
@@ -1,33 +1,6 @@
|
||||
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:
|
||||
* New driver: fpcmoc, supporting various FPC MOC Fingerprint Sensors
|
||||
* goodixmoc: New PIDs 0x6014, 0x6094, 0x631C, 0x634C, 0x6384, 0x659A.
|
||||
* goodixmoc: Support resetting device on firmware failure due to corrupted DB.
|
||||
* elanmoc: New PIDs 0x0c88, 0x0c8c, 0x0c8d.
|
||||
* synaptics: New PID 0x0104.
|
||||
* upektc: New PID 0x2017.
|
||||
* Fixed various memory leaks
|
||||
* More tests
|
||||
|
||||
2022-05-24: v1.94.4 release
|
||||
|
||||
Highlights:
|
||||
|
||||
108
README.md
108
README.md
@@ -1,86 +1,54 @@
|
||||
# libfprint
|
||||
|
||||
|
||||
<div align="center">
|
||||
|
||||
# LibFPrint
|
||||
|
||||
*LibFPrint is part of the **[FPrint][Website]** project.*
|
||||
|
||||
<br/>
|
||||
|
||||
[![Button Website]][Website]
|
||||
[![Button Documentation]][Documentation]
|
||||
|
||||
[![Button Supported]][Supported]
|
||||
[![Button Unsupported]][Unsupported]
|
||||
|
||||
[![Button Contribute]][Contribute]
|
||||
[![Button Contributors]][Contributors]
|
||||
|
||||
</div>
|
||||
libfprint is part of the fprint project:
|
||||
https://fprint.freedesktop.org/
|
||||
|
||||
## History
|
||||
|
||||
**LibFPrint** was originally developed as part of an
|
||||
academic project at the **[University Of Manchester]**.
|
||||
libfprint was originally developed as part of an academic project at the
|
||||
University of Manchester with the aim of hiding differences between different
|
||||
consumer fingerprint scanners and providing a single uniform API to application
|
||||
developers. The ultimate goal of the fprint project is to make fingerprint
|
||||
scanners widely and easily usable under common Linux environments.
|
||||
|
||||
It aimed to hide the differences between consumer
|
||||
fingerprint scanners and provide a single uniform
|
||||
API to application developers.
|
||||
|
||||
## Goal
|
||||
|
||||
The ultimate goal of the **FPrint** project is to make
|
||||
fingerprint scanners widely and easily usable under
|
||||
common Linux environments.
|
||||
The academic university project runs off a codebase maintained separately
|
||||
from this one, although I try to keep them as similar as possible (I'm not
|
||||
hiding anything in the academic branch, it's just the open source release
|
||||
contains some commits excluded from the academic project).
|
||||
|
||||
## License
|
||||
|
||||
`Section 6` of the license states that for compiled works that use
|
||||
this library, such works must include **LibFPrint** copyright notices
|
||||
alongside the copyright notices for the other parts of the work.
|
||||
THE UNIVERSITY OF MANCHESTER DOES NOT ENDORSE THIS THIS SOFTWARE RELEASE AND
|
||||
IS IN NO WAY RESPONSIBLE FOR THE CODE CONTAINED WITHIN, OR ANY DAMAGES CAUSED
|
||||
BY USING OR DISTRIBUTING THE SOFTWARE. Development does not happen on
|
||||
university computers and the project is not hosted at the university either.
|
||||
|
||||
**LibFPrint** includes code from **NIST's** **[NBIS]** software distribution.
|
||||
For more information on libfprint, supported devices, API documentation, etc.,
|
||||
see the homepage:
|
||||
https://fprint.freedesktop.org/
|
||||
|
||||
We include **Bozorth3** from the **[US Export Controlled]**
|
||||
distribution, which we have determined to be fine
|
||||
being shipped in an open source project.
|
||||
libfprint is licensed under the GNU LGPL version 2.1. See the COPYING file
|
||||
for the license text.
|
||||
|
||||
<br/>
|
||||
Section 6 of the license states that for compiled works that use this
|
||||
library, such works must include libfprint copyright notices alongside the
|
||||
copyright notices for the other parts of the work. We have attempted to
|
||||
make this process slightly easier for you by grouping these all in one place:
|
||||
the AUTHORS file.
|
||||
|
||||
<div align="right">
|
||||
libfprint includes code from NIST's NBIS software distribution:
|
||||
http://fingerprint.nist.gov/NBIS/index.html
|
||||
We include bozorth3 from the US export controlled distribution. We have
|
||||
determined that it is fine to ship bozorth3 in an open source project,
|
||||
see https://fprint.freedesktop.org/us-export-control.html
|
||||
|
||||
[![Badge License]][License]
|
||||
## Historical links
|
||||
|
||||
</div>
|
||||
Older versions of libfprint are available at:
|
||||
https://sourceforge.net/projects/fprint/files/
|
||||
|
||||
Historical mailing-list archives:
|
||||
http://www.reactivated.net/fprint_list_archives/
|
||||
|
||||
<!----------------------------------------------------------------------------->
|
||||
|
||||
[Documentation]: https://fprint.freedesktop.org/libfprint-dev/
|
||||
[Contributors]: https://gitlab.freedesktop.org/libfprint/libfprint/-/graphs/master
|
||||
[Unsupported]: https://gitlab.freedesktop.org/libfprint/wiki/-/wikis/Unsupported-Devices
|
||||
[Supported]: https://fprint.freedesktop.org/supported-devices.html
|
||||
[Website]: https://fprint.freedesktop.org/
|
||||
|
||||
[Contribute]: ./HACKING.md
|
||||
[License]: ./COPYING
|
||||
|
||||
[University Of Manchester]: https://www.manchester.ac.uk/
|
||||
[US Export Controlled]: https://fprint.freedesktop.org/us-export-control.html
|
||||
[NBIS]: http://fingerprint.nist.gov/NBIS/index.html
|
||||
|
||||
|
||||
<!---------------------------------[ Badges ]---------------------------------->
|
||||
|
||||
[Badge License]: https://img.shields.io/badge/License-LGPL2.1-015d93.svg?style=for-the-badge&labelColor=blue
|
||||
|
||||
|
||||
<!---------------------------------[ Buttons ]--------------------------------->
|
||||
|
||||
[Button Documentation]: https://img.shields.io/badge/Documentation-04ACE6?style=for-the-badge&logoColor=white&logo=BookStack
|
||||
[Button Contributors]: https://img.shields.io/badge/Contributors-FF4F8B?style=for-the-badge&logoColor=white&logo=ActiGraph
|
||||
[Button Unsupported]: https://img.shields.io/badge/Unsupported_Devices-EF2D5E?style=for-the-badge&logoColor=white&logo=AdBlock
|
||||
[Button Contribute]: https://img.shields.io/badge/Contribute-66459B?style=for-the-badge&logoColor=white&logo=Git
|
||||
[Button Supported]: https://img.shields.io/badge/Supported_Devices-428813?style=for-the-badge&logoColor=white&logo=AdGuard
|
||||
[Button Website]: https://img.shields.io/badge/Homepage-3B80AE?style=for-the-badge&logoColor=white&logo=freedesktopDotOrg
|
||||
Historical website:
|
||||
http://web.archive.org/web/*/https://www.freedesktop.org/wiki/Software/fprint/
|
||||
|
||||
@@ -67,7 +67,7 @@ usb:v08FFp5731*
|
||||
ID_PERSIST=0
|
||||
|
||||
# Supported by libfprint driver aes4000
|
||||
usb:v08FFp5501*
|
||||
usb:v5501p08FF*
|
||||
ID_AUTOSUSPEND=1
|
||||
ID_PERSIST=0
|
||||
|
||||
@@ -147,9 +147,6 @@ usb:v04F3p0C7D*
|
||||
usb:v04F3p0C7E*
|
||||
usb:v04F3p0C82*
|
||||
usb:v04F3p0C88*
|
||||
usb:v04F3p0C8C*
|
||||
usb:v04F3p0C8D*
|
||||
usb:v04F3p0C99*
|
||||
ID_AUTOSUSPEND=1
|
||||
ID_PERSIST=0
|
||||
|
||||
@@ -158,29 +155,10 @@ usb:v1C7Ap0603*
|
||||
ID_AUTOSUSPEND=1
|
||||
ID_PERSIST=0
|
||||
|
||||
# Supported by libfprint driver fpcmoc
|
||||
usb:v10A5pFFE0*
|
||||
usb:v10A5pA305*
|
||||
usb:v10A5pDA04*
|
||||
usb:v10A5pD805*
|
||||
usb:v10A5pD205*
|
||||
ID_AUTOSUSPEND=1
|
||||
ID_PERSIST=0
|
||||
|
||||
# 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*
|
||||
usb:v27C6p63AC*
|
||||
usb:v27C6p63BC*
|
||||
@@ -190,7 +168,6 @@ usb:v27C6p6584*
|
||||
usb:v27C6p658C*
|
||||
usb:v27C6p6592*
|
||||
usb:v27C6p6594*
|
||||
usb:v27C6p659A*
|
||||
usb:v27C6p659C*
|
||||
usb:v27C6p6A94*
|
||||
ID_AUTOSUSPEND=1
|
||||
@@ -215,7 +192,6 @@ usb:v06CBp0126*
|
||||
usb:v06CBp0129*
|
||||
usb:v06CBp0168*
|
||||
usb:v06CBp015F*
|
||||
usb:v06CBp0104*
|
||||
ID_AUTOSUSPEND=1
|
||||
ID_PERSIST=0
|
||||
|
||||
@@ -228,7 +204,6 @@ usb:v147Ep1001*
|
||||
|
||||
# Supported by libfprint driver upektc
|
||||
usb:v0483p2015*
|
||||
usb:v0483p2017*
|
||||
usb:v147Ep3001*
|
||||
ID_AUTOSUSPEND=1
|
||||
ID_PERSIST=0
|
||||
@@ -290,13 +265,7 @@ usb:v04F3p0C00*
|
||||
usb:v04F3p0C4C*
|
||||
usb:v04F3p0C57*
|
||||
usb:v04F3p0C5E*
|
||||
usb:v04F3p0C5A*
|
||||
usb:v04F3p0C70*
|
||||
usb:v04F3p0C72*
|
||||
usb:v04F3p2706*
|
||||
usb:v04F3p3057*
|
||||
usb:v04F3p3104*
|
||||
usb:v04F3p310D*
|
||||
usb:v06CBp0081*
|
||||
usb:v06CBp0088*
|
||||
usb:v06CBp008A*
|
||||
@@ -351,14 +320,12 @@ usb:v1C7Ap0576*
|
||||
usb:v27C6p5042*
|
||||
usb:v27C6p5110*
|
||||
usb:v27C6p5117*
|
||||
usb:v27C6p5120*
|
||||
usb:v27C6p5125*
|
||||
usb:v27C6p5201*
|
||||
usb:v27C6p521D*
|
||||
usb:v27C6p5301*
|
||||
usb:v27C6p530C*
|
||||
usb:v27C6p532D*
|
||||
usb:v27C6p5335*
|
||||
usb:v27C6p533C*
|
||||
usb:v27C6p5381*
|
||||
usb:v27C6p5385*
|
||||
@@ -366,17 +333,13 @@ usb:v27C6p538C*
|
||||
usb:v27C6p538D*
|
||||
usb:v27C6p5395*
|
||||
usb:v27C6p5503*
|
||||
usb:v27C6p550A*
|
||||
usb:v27C6p550C*
|
||||
usb:v27C6p5584*
|
||||
usb:v27C6p55A2*
|
||||
usb:v27C6p55A4*
|
||||
usb:v27C6p55B4*
|
||||
usb:v27C6p5740*
|
||||
usb:v27C6p5E0A*
|
||||
usb:v27C6p581A*
|
||||
usb:v2808p9338*
|
||||
usb:v2808p93A9*
|
||||
usb:v298Dp2020*
|
||||
usb:v298Dp2033*
|
||||
usb:v3538p0930*
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"app-id": "org.freedesktop.libfprint.Demo",
|
||||
"runtime": "org.gnome.Platform",
|
||||
"runtime-version": "42",
|
||||
"runtime-version": "3.36",
|
||||
"sdk": "org.gnome.Sdk",
|
||||
"command": "gtk-libfprint-test",
|
||||
"finish-args": [
|
||||
/* X11 + XShm access */
|
||||
"--share=ipc", "--socket=fallback-x11",
|
||||
"--share=ipc", "--socket=x11",
|
||||
/* Wayland access */
|
||||
"--socket=wayland",
|
||||
/* OpenGL access */
|
||||
@@ -18,7 +18,7 @@
|
||||
"modules": [
|
||||
{
|
||||
"name": "libusb",
|
||||
"config-opts": [ "--disable-static" ],
|
||||
"config-opts": [ "--disable-static", "--disable-udev" ],
|
||||
"cleanup": [
|
||||
"/lib/*.la",
|
||||
"/lib/pkgconfig",
|
||||
@@ -27,12 +27,12 @@
|
||||
"sources": [
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2",
|
||||
"sha256": "12ce7a61fc9854d1d2a1ffe095f7b5fac19ddba095c259e6067a46500381b5a5"
|
||||
"url": "https://github.com/libusb/libusb/archive/v1.0.22.tar.gz",
|
||||
"sha256": "3500f7b182750cd9ccf9be8b1df998f83df56a39ab264976bdb3307773e16f48"
|
||||
}
|
||||
],
|
||||
"post-install": [
|
||||
"install -Dm644 COPYING /app/share/licenses/libusb/COPYING"
|
||||
"install -Dm644 COPYING /app/share/licenses/libgusb/COPYING"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -62,11 +62,12 @@
|
||||
{
|
||||
"name": "libfprint",
|
||||
"buildsystem": "meson",
|
||||
"config-opts": [ "-Dudev_hwdb=disabled", "-Dudev_rules=disabled", "-Dgtk-examples=true", "-Ddrivers=all" ],
|
||||
"config-opts": [ "-Dudev_hwdb=disabled", "-Dudev_rules=disabled", "-Dx11-examples=false", "-Dgtk-examples=true", "-Ddrivers=all" ],
|
||||
"sources": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://gitlab.freedesktop.org/libfprint/libfprint.git"
|
||||
"url": "https://gitlab.freedesktop.org/libfprint/libfprint.git",
|
||||
"branch": "wip/benzea/v2"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -40,6 +40,8 @@ fp_device_has_feature
|
||||
fp_device_has_storage
|
||||
fp_device_supports_identify
|
||||
fp_device_supports_capture
|
||||
fp_device_get_persistent_data
|
||||
fp_device_set_persistent_data
|
||||
fp_device_is_open
|
||||
fp_device_open
|
||||
fp_device_close
|
||||
|
||||
@@ -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.project_source_root(), 'libfprint'),
|
||||
src_dir: join_paths(meson.source_root(), 'libfprint'),
|
||||
include_directories: include_directories('../libfprint'),
|
||||
dependencies: libfprint_dep,
|
||||
content_files: content_files,
|
||||
|
||||
@@ -21,8 +21,3 @@ 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[] = {
|
||||
{ .vid = 0x08ff, .pid = 0x5501 },
|
||||
{ .pid = 0x08ff, .vid = 0x5501 },
|
||||
{ .vid = 0, .pid = 0, .driver_data = 0 },
|
||||
};
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ data_resp_cb (FpiUsbTransfer *transfer, FpDevice *dev, gpointer user_data, GErro
|
||||
{
|
||||
if (!self->stop && (self->strips_len > 0))
|
||||
{
|
||||
g_autoptr(FpImage) img = NULL;
|
||||
FpImage *img;
|
||||
self->strips = g_slist_reverse (self->strips);
|
||||
fpi_do_movement_estimation (&assembling_ctx, self->strips);
|
||||
img = fpi_assemble_frames (&assembling_ctx, self->strips);
|
||||
@@ -199,7 +199,7 @@ data_resp_cb (FpiUsbTransfer *transfer, FpDevice *dev, gpointer user_data, GErro
|
||||
self->strips = NULL;
|
||||
self->strips_len = 0;
|
||||
FpImage *resizeImage = fpi_image_resize (img, EGIS0570_RESIZE, EGIS0570_RESIZE);
|
||||
fpi_image_device_image_captured (img_self, g_steal_pointer (&resizeImage));
|
||||
fpi_image_device_image_captured (img_self, resizeImage);
|
||||
}
|
||||
|
||||
fpi_image_device_report_finger_status (img_self, FALSE);
|
||||
|
||||
@@ -357,7 +357,7 @@ elan_cmd_cb (FpiUsbTransfer *transfer, FpDevice *dev,
|
||||
if (transfer->endpoint & FPI_USB_ENDPOINT_IN)
|
||||
{
|
||||
/* just finished receiving */
|
||||
self->last_read = g_memdup2 (transfer->buffer, transfer->actual_length);
|
||||
self->last_read = g_memdup (transfer->buffer, transfer->actual_length);
|
||||
elan_cmd_done (ssm);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -29,9 +29,6 @@ static const FpIdEntry id_table[] = {
|
||||
{ .vid = 0x04f3, .pid = 0x0c7e, },
|
||||
{ .vid = 0x04f3, .pid = 0x0c82, },
|
||||
{ .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 */
|
||||
};
|
||||
|
||||
@@ -380,9 +377,9 @@ elanmoc_enroll_cb (FpiDeviceElanmoc *self,
|
||||
enroll_status_report (self, ENROLL_RSP_RETRY, self->num_frames, NULL);
|
||||
}
|
||||
|
||||
if (self->num_frames == self->max_moc_enroll_time && buffer_in[1] == ELAN_MSG_OK)
|
||||
if (self->num_frames == ELAN_MOC_ENROLL_TIMES && buffer_in[1] == ELAN_MSG_OK)
|
||||
fpi_ssm_next_state (self->task_ssm);
|
||||
else if (self->num_frames < self->max_moc_enroll_time)
|
||||
else if (self->num_frames < ELAN_MOC_ENROLL_TIMES)
|
||||
fpi_ssm_jump_to_state (self->task_ssm, MOC_ENROLL_WAIT_FINGER);
|
||||
else
|
||||
fpi_ssm_mark_failed (self->task_ssm, error);
|
||||
@@ -445,7 +442,7 @@ elan_enroll_run_state (FpiSsm *ssm, FpDevice *dev)
|
||||
case MOC_ENROLL_WAIT_FINGER:
|
||||
cmd_buf = elanmoc_compose_cmd (&elanmoc_enroll_cmd);
|
||||
cmd_buf[3] = self->curr_enrolled;
|
||||
cmd_buf[4] = self->max_moc_enroll_time;
|
||||
cmd_buf[4] = ELAN_MOC_ENROLL_TIMES;
|
||||
cmd_buf[5] = self->num_frames;
|
||||
elanmoc_get_cmd (dev, cmd_buf, elanmoc_enroll_cmd.cmd_len, elanmoc_enroll_cmd.resp_len, 1, elanmoc_enroll_cb);
|
||||
break;
|
||||
@@ -510,7 +507,7 @@ create_print_from_response (FpiDeviceElanmoc *self,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
userid = g_memdup2 (&buffer_in[5], userid_len);
|
||||
userid = g_memdup (&buffer_in[5], userid_len);
|
||||
userid_safe = g_strndup ((const char *) &buffer_in[5], userid_len);
|
||||
print = fp_print_new (FP_DEVICE (self));
|
||||
uid = g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE, userid, userid_len, 1);
|
||||
@@ -1011,12 +1008,6 @@ elanmoc_get_status_cb (FpiDeviceElanmoc *self,
|
||||
}
|
||||
|
||||
if (buffer_in[1] != 0x03 && self->cmd_retry_cnt != 0)
|
||||
{
|
||||
self->cmd_retry_cnt--;
|
||||
cmd_buf = elanmoc_compose_cmd (&cal_status_cmd);
|
||||
elanmoc_get_cmd (FP_DEVICE (self), cmd_buf, cal_status_cmd.cmd_len, cal_status_cmd.resp_len, 0, elanmoc_get_status_cb);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(self->cmd_retry_cnt == 0)
|
||||
{
|
||||
@@ -1025,6 +1016,12 @@ elanmoc_get_status_cb (FpiDeviceElanmoc *self,
|
||||
"Sensor not ready"));
|
||||
return;
|
||||
}
|
||||
self->cmd_retry_cnt--;
|
||||
cmd_buf = elanmoc_compose_cmd (&cal_status_cmd);
|
||||
elanmoc_get_cmd (FP_DEVICE (self), cmd_buf, cal_status_cmd.cmd_len, cal_status_cmd.resp_len, 0, elanmoc_get_status_cb);
|
||||
}
|
||||
else
|
||||
{
|
||||
fpi_ssm_next_state (self->task_ssm);
|
||||
}
|
||||
}
|
||||
@@ -1072,7 +1069,6 @@ elanmoc_open (FpDevice *device)
|
||||
{
|
||||
FpiDeviceElanmoc *self = FPI_DEVICE_ELANMOC (device);
|
||||
GError *error = NULL;
|
||||
gint productid = 0;
|
||||
|
||||
if (!g_usb_device_reset (fpi_device_get_usb_device (device), &error))
|
||||
goto error;
|
||||
@@ -1080,28 +1076,6 @@ elanmoc_open (FpDevice *device)
|
||||
if (!g_usb_device_claim_interface (fpi_device_get_usb_device (device), 0, 0, &error))
|
||||
goto error;
|
||||
|
||||
productid = g_usb_device_get_pid (fpi_device_get_usb_device (device));
|
||||
switch (productid)
|
||||
{
|
||||
case 0x0c8c:
|
||||
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;
|
||||
|
||||
default:
|
||||
self->max_moc_enroll_time = ELAN_MOC_ENROLL_TIMES;
|
||||
break;
|
||||
}
|
||||
|
||||
fpi_device_set_nr_enroll_stages (device, self->max_moc_enroll_time);
|
||||
|
||||
self->task_ssm = fpi_ssm_new (FP_DEVICE (self), dev_init_handler, DEV_INIT_STATES);
|
||||
fpi_ssm_start (self->task_ssm, task_ssm_init_done);
|
||||
return;
|
||||
|
||||
@@ -188,7 +188,6 @@ struct _FpiDeviceElanmoc
|
||||
unsigned char y_trace;
|
||||
int num_frames;
|
||||
int curr_enrolled;
|
||||
int max_moc_enroll_time;
|
||||
int cancel_result;
|
||||
int cmd_retry_cnt;
|
||||
int list_index;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,221 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Fingerprint Cards AB <tech@fingerprints.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fpi-device.h"
|
||||
#include "fpi-ssm.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define TEMPLATE_ID_SIZE (32)
|
||||
#define MAX_FW_VERSION_STR_LEN (16)
|
||||
#define FPC_CMD_INIT (0x01)
|
||||
#define FPC_CMD_ARM (0x02)
|
||||
#define FPC_CMD_ABORT (0x03)
|
||||
#define FPC_CMD_INDICATE_S_STATE (0x08)
|
||||
#define FPC_CMD_GET_IMG (0x09)
|
||||
#define FPC_CMD_GET_KPI (0x0C)
|
||||
#define FPC_CMD_LOAD_DB (0x60)
|
||||
#define FPC_CMD_STORE_DB (0x61)
|
||||
#define FPC_CMD_DELETE_DB (0x62)
|
||||
#define FPC_CMD_DELETE_TEMPLATE (0x63)
|
||||
#define FPC_CMD_BEGIN_ENROL (0x67)
|
||||
#define FPC_CMD_ENROL (0x68)
|
||||
#define FPC_CMD_END_ENROL (0x69)
|
||||
#define FPC_CMD_BIND_IDENTITY (0x6A)
|
||||
#define FPC_CMD_IDENTIFY (0x6B)
|
||||
#define FPC_CMD_ENUM (0x70)
|
||||
#define FPC_EVT_INIT_RESULT (0x02)
|
||||
#define FPC_EVT_FINGER_DWN (0x06)
|
||||
#define FPC_EVT_IMG (0x08)
|
||||
#define FPC_EVT_FID_DATA (0x31)
|
||||
#define FPC_DB_ID_LEN (16)
|
||||
#define FPC_IDENTITY_TYPE_WILDCARD (0x1)
|
||||
#define FPC_IDENTITY_TYPE_RESERVED (0x3)
|
||||
#define FPC_IDENTITY_WILDCARD (0x25066282)
|
||||
#define FPC_SUBTYPE_ANY (0xFF)
|
||||
#define FPC_SUBTYPE_RESERVED (0xF5)
|
||||
#define FPC_SUBTYPE_NOINFORMATION (0x00)
|
||||
#define FPC_CAPTUREID_RESERVED (0x701100F)
|
||||
#define FPC_SESSIONID_RESERVED (0x0077FF12)
|
||||
#define FPC_TEMPLATES_MAX (10)
|
||||
#define SECURITY_MAX_SID_SIZE (68)
|
||||
#define FPC_HOST_MS_S0 (0x10)
|
||||
#define FPC_HOST_MS_SX (0x11)
|
||||
|
||||
G_DECLARE_FINAL_TYPE (FpiDeviceFpcMoc, fpi_device_fpcmoc, FPI,
|
||||
DEVICE_FPCMOC, FpDevice);
|
||||
|
||||
typedef struct _FPC_FID_DATA
|
||||
{
|
||||
guint32 identity_type;
|
||||
guint32 reserved;
|
||||
guint32 identity_size;
|
||||
guint32 subfactor;
|
||||
guint8 data[SECURITY_MAX_SID_SIZE];
|
||||
} FPC_FID_DATA, *PFPC_FID_DATA;
|
||||
|
||||
typedef struct _FPC_LOAD_DB
|
||||
{
|
||||
gint32 status;
|
||||
guint32 reserved;
|
||||
guint32 database_id_size;
|
||||
guint8 data[FPC_DB_ID_LEN];
|
||||
} FPC_LOAD_DB, *PFPC_LOAD_DB;
|
||||
|
||||
typedef union _FPC_DELETE_DB
|
||||
{
|
||||
guint32 reserved;
|
||||
guint32 database_id_size;
|
||||
guint8 data[FPC_DB_ID_LEN];
|
||||
} FPC_DB_OP, *PFPC_DB_OP;
|
||||
|
||||
typedef struct _FPC_BEGIN_ENROL
|
||||
{
|
||||
gint32 status;
|
||||
guint32 reserved1;
|
||||
guint32 reserved2;
|
||||
} FPC_BEGIN_ENROL, *PFPC_BEGIN_ENROL;
|
||||
|
||||
typedef struct _FPC_ENROL
|
||||
{
|
||||
gint32 status;
|
||||
guint32 remaining;
|
||||
} FPC_ENROL, *PFPC_ENROL;
|
||||
|
||||
typedef struct _FPC_END_ENROL
|
||||
{
|
||||
gint32 status;
|
||||
guint32 fid;
|
||||
} FPC_END_ENROL, *PFPC_END_ENROL;
|
||||
|
||||
typedef struct _FPC_IDENTIFY
|
||||
{
|
||||
gint32 status;
|
||||
guint32 identity_type;
|
||||
guint32 identity_offset;
|
||||
guint32 identity_size;
|
||||
guint32 subfactor;
|
||||
guint8 data[SECURITY_MAX_SID_SIZE];
|
||||
} FPC_IDENTIFY, *PFPC_IDENTIFY;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
guint32 cmdid;
|
||||
guint32 length;
|
||||
guint32 status;
|
||||
} evt_hdr_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
evt_hdr_t hdr;
|
||||
guint16 sensor;
|
||||
guint16 hw_id;
|
||||
guint16 img_w;
|
||||
guint16 img_h;
|
||||
guint8 fw_version[MAX_FW_VERSION_STR_LEN];
|
||||
guint16 fw_capabilities;
|
||||
} evt_initiated_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
guint8 subfactor;
|
||||
guint32 identity_type;
|
||||
guint32 identity_size;
|
||||
guint8 identity[SECURITY_MAX_SID_SIZE];
|
||||
} __attribute__((packed)) fpc_fid_data_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
evt_hdr_t hdr;
|
||||
gint status;
|
||||
guint32 num_ids;
|
||||
fpc_fid_data_t fid_data[FPC_TEMPLATES_MAX];
|
||||
} __attribute__((packed)) evt_enum_fids_t;
|
||||
|
||||
typedef struct _fp_cmd_response
|
||||
{
|
||||
union
|
||||
{
|
||||
evt_hdr_t evt_hdr;
|
||||
evt_initiated_t evt_inited;
|
||||
evt_enum_fids_t evt_enum_fids;
|
||||
};
|
||||
} fpc_cmd_response_t, *pfpc_cmd_response_t;
|
||||
|
||||
enum {
|
||||
FPC_ENROL_STATUS_COMPLETED = 0,
|
||||
FPC_ENROL_STATUS_PROGRESS = 1,
|
||||
FPC_ENROL_STATUS_FAILED_COULD_NOT_COMPLETE = 2,
|
||||
FPC_ENROL_STATUS_FAILED_ALREADY_ENROLED = 3,
|
||||
FPC_ENROL_STATUS_IMAGE_LOW_COVERAGE = 4,
|
||||
FPC_ENROL_STATUS_IMAGE_TOO_SIMILAR = 5,
|
||||
FPC_ENROL_STATUS_IMAGE_LOW_QUALITY = 6,
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
FPC_CMDTYPE_UNKNOWN = 0,
|
||||
FPC_CMDTYPE_TO_DEVICE,
|
||||
FPC_CMDTYPE_TO_DEVICE_EVTDATA,
|
||||
FPC_CMDTYPE_FROM_DEVICE,
|
||||
} FpcCmdType;
|
||||
|
||||
typedef enum {
|
||||
FP_CMD_SEND = 0,
|
||||
FP_CMD_GET_DATA,
|
||||
FP_CMD_SUSPENDED,
|
||||
FP_CMD_RESUME,
|
||||
FP_CMD_NUM_STATES,
|
||||
} FpCmdState;
|
||||
|
||||
typedef enum {
|
||||
FP_INIT = 0,
|
||||
FP_LOAD_DB,
|
||||
FP_INIT_NUM_STATES,
|
||||
} FpInitState;
|
||||
|
||||
typedef enum {
|
||||
FP_ENROLL_ENUM = 0,
|
||||
FP_ENROLL_CREATE,
|
||||
FP_ENROLL_CAPTURE,
|
||||
FP_ENROLL_GET_IMG,
|
||||
FP_ENROLL_UPDATE,
|
||||
FP_ENROLL_COMPLETE,
|
||||
FP_ENROLL_CHECK_DUPLICATE,
|
||||
FP_ENROLL_BINDID,
|
||||
FP_ENROLL_COMMIT,
|
||||
FP_ENROLL_DICARD,
|
||||
FP_ENROLL_CLEANUP,
|
||||
FP_ENROLL_NUM_STATES,
|
||||
} FpEnrollState;
|
||||
|
||||
typedef enum {
|
||||
FP_VERIFY_CAPTURE = 0,
|
||||
FP_VERIFY_GET_IMG,
|
||||
FP_VERIFY_IDENTIFY,
|
||||
FP_VERIFY_CANCEL,
|
||||
FP_VERIFY_NUM_STATES,
|
||||
} FpVerifyState;
|
||||
|
||||
typedef enum {
|
||||
FP_CLEAR_DELETE_DB = 0,
|
||||
FP_CLEAR_CREATE_DB,
|
||||
FP_CLEAR_NUM_STATES,
|
||||
} FpClearState;
|
||||
@@ -631,11 +631,11 @@ fp_enroll_enum_cb (FpiDeviceGoodixMoc *self,
|
||||
return;
|
||||
}
|
||||
|
||||
fpi_ssm_next_state (self->task_ssm);
|
||||
fpi_ssm_jump_to_state (self->task_ssm, FP_ENROLL_CAPTURE);
|
||||
}
|
||||
|
||||
static void
|
||||
fp_enroll_create_cb (FpiDeviceGoodixMoc *self,
|
||||
fp_enroll_init_cb (FpiDeviceGoodixMoc *self,
|
||||
gxfp_cmd_response_t *resp,
|
||||
GError *error)
|
||||
{
|
||||
@@ -644,7 +644,7 @@ fp_enroll_create_cb (FpiDeviceGoodixMoc *self,
|
||||
fpi_ssm_mark_failed (self->task_ssm, error);
|
||||
return;
|
||||
}
|
||||
memcpy (self->template_id, resp->enroll_create.tid, TEMPLATE_ID_SIZE);
|
||||
memcpy (self->template_id, resp->enroll_init.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_PWR_BTN_SHIELD_ON:
|
||||
{
|
||||
goodix_sensor_cmd (self, MOC_CMD0_PWR_BTN_SHIELD, MOC_CMD1_PWR_BTN_SHIELD_ON,
|
||||
false,
|
||||
NULL,
|
||||
0,
|
||||
fp_pwr_btn_shield_cb);
|
||||
}
|
||||
break;
|
||||
|
||||
case FP_ENROLL_ENUM:
|
||||
{
|
||||
goodix_sensor_cmd (self, MOC_CMD0_GETFINGERLIST, MOC_CMD1_DEFAULT,
|
||||
@@ -857,13 +847,23 @@ fp_enroll_sm_run_state (FpiSsm *ssm, FpDevice *device)
|
||||
}
|
||||
break;
|
||||
|
||||
case FP_ENROLL_PWR_BTN_SHIELD_ON:
|
||||
{
|
||||
goodix_sensor_cmd (self, MOC_CMD0_PWR_BTN_SHIELD, MOC_CMD1_PWR_BTN_SHIELD_ON,
|
||||
false,
|
||||
NULL,
|
||||
0,
|
||||
fp_pwr_btn_shield_cb);
|
||||
}
|
||||
break;
|
||||
|
||||
case FP_ENROLL_CREATE:
|
||||
{
|
||||
goodix_sensor_cmd (self, MOC_CMD0_ENROLL_INIT, MOC_CMD1_DEFAULT,
|
||||
false,
|
||||
(const guint8 *) &dummy,
|
||||
1,
|
||||
fp_enroll_create_cb);
|
||||
fp_enroll_init_cb);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1359,23 +1359,12 @@ 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:
|
||||
case 0x63AC:
|
||||
case 0x63BC:
|
||||
case 0x63CC:
|
||||
case 0x6A94:
|
||||
case 0x659A:
|
||||
self->max_enroll_stage = 12;
|
||||
break;
|
||||
|
||||
@@ -1606,18 +1595,8 @@ 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, },
|
||||
{ .vid = 0x27c6, .pid = 0x63AC, },
|
||||
{ .vid = 0x27c6, .pid = 0x63BC, },
|
||||
@@ -1627,7 +1606,6 @@ static const FpIdEntry id_table[] = {
|
||||
{ .vid = 0x27c6, .pid = 0x658C, },
|
||||
{ .vid = 0x27c6, .pid = 0x6592, },
|
||||
{ .vid = 0x27c6, .pid = 0x6594, },
|
||||
{ .vid = 0x27c6, .pid = 0x659A, },
|
||||
{ .vid = 0x27c6, .pid = 0x659C, },
|
||||
{ .vid = 0x27c6, .pid = 0x6A94, },
|
||||
{ .vid = 0, .pid = 0, .driver_data = 0 }, /* terminating entry */
|
||||
|
||||
@@ -44,6 +44,7 @@ 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_create_t) + 1)
|
||||
if (buffer_len < sizeof (gxfp_enroll_init_t) + 1)
|
||||
return -1;
|
||||
if (presp->result == GX_SUCCESS)
|
||||
memcpy (&presp->enroll_create.tid, &buffer[1], TEMPLATE_ID_SIZE);
|
||||
memcpy (&presp->enroll_init.tid, &buffer[1], TEMPLATE_ID_SIZE);
|
||||
break;
|
||||
|
||||
case MOC_CMD0_ENROLL:
|
||||
|
||||
@@ -105,10 +105,10 @@ typedef struct _gxfp_parse_msg
|
||||
} gxfp_parse_msg_t, *pgxfp_parse_msg_t;
|
||||
|
||||
|
||||
typedef struct _gxfp_enroll_create
|
||||
typedef struct _gxfp_enroll_init
|
||||
{
|
||||
uint8_t tid[TEMPLATE_ID_SIZE];
|
||||
} gxfp_enroll_create_t, *pgxfp_enroll_create_t;
|
||||
} gxfp_enroll_init_t, *pgxfp_enroll_init_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_create_t enroll_create;
|
||||
gxfp_enroll_init_t enroll_init;
|
||||
gxfp_capturedata_t capture_data_resp;
|
||||
gxfp_check_duplicate_t check_duplicate_resp;
|
||||
gxfp_enroll_commit_t enroll_commit;
|
||||
|
||||
@@ -44,7 +44,6 @@ static const FpIdEntry id_table[] = {
|
||||
{ .vid = SYNAPTICS_VENDOR_ID, .pid = 0x0129, },
|
||||
{ .vid = SYNAPTICS_VENDOR_ID, .pid = 0x0168, },
|
||||
{ .vid = SYNAPTICS_VENDOR_ID, .pid = 0x015F, },
|
||||
{ .vid = SYNAPTICS_VENDOR_ID, .pid = 0x0104, },
|
||||
{ .vid = 0, .pid = 0, .driver_data = 0 }, /* terminating entry */
|
||||
};
|
||||
|
||||
|
||||
@@ -431,7 +431,6 @@ dev_deinit (FpImageDevice *dev)
|
||||
|
||||
static const FpIdEntry id_table[] = {
|
||||
{ .vid = 0x0483, .pid = 0x2015, .driver_data = UPEKTC_2015 },
|
||||
{ .vid = 0x0483, .pid = 0x2017, .driver_data = UPEKTC_2015 },
|
||||
{ .vid = 0x147e, .pid = 0x3001, .driver_data = UPEKTC_3001 },
|
||||
{ .vid = 0, .pid = 0, .driver_data = 0 },
|
||||
};
|
||||
|
||||
@@ -31,6 +31,10 @@ 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
|
||||
@@ -43,10 +47,8 @@ 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,
|
||||
@@ -178,7 +180,6 @@ 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;
|
||||
@@ -246,30 +247,8 @@ 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;
|
||||
@@ -282,20 +261,18 @@ capture_read_data_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
fpi_image_device_report_finger_status (dev,
|
||||
FALSE);
|
||||
fpi_ssm_jump_to_state (transfer->ssm,
|
||||
self->area_sensor ?
|
||||
CAPTURE_ACK_00_28 : CAPTURE_ACK_00_28_TERM);
|
||||
CAPTURE_ACK_00_28_TERM);
|
||||
break;
|
||||
|
||||
case 0x1d:
|
||||
/* too much horizontal movement */
|
||||
fp_err ("too much horizontal movement, aborting");
|
||||
/* too much horisontal movement */
|
||||
fp_err ("too much horisontal 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,
|
||||
self->area_sensor ?
|
||||
CAPTURE_ACK_00_28 : CAPTURE_ACK_00_28_TERM);
|
||||
CAPTURE_ACK_00_28_TERM);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -306,8 +283,7 @@ capture_read_data_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
||||
fpi_image_device_report_finger_status (dev,
|
||||
FALSE);
|
||||
fpi_ssm_jump_to_state (transfer->ssm,
|
||||
self->area_sensor ?
|
||||
CAPTURE_ACK_00_28 : CAPTURE_ACK_00_28_TERM);
|
||||
CAPTURE_ACK_00_28_TERM);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -331,13 +307,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 != self->expected_image_size);
|
||||
BUG_ON (self->image_size != IMAGE_SIZE);
|
||||
fp_dbg ("Image size is %lu",
|
||||
(gulong) self->image_size);
|
||||
img = fp_image_new (img_class->img_width, img_class->img_height);
|
||||
img = fp_image_new (IMAGE_WIDTH, IMAGE_HEIGHT);
|
||||
img->flags |= FPI_IMAGE_PARTIAL;
|
||||
memcpy (img->data, self->image_bits,
|
||||
self->image_size);
|
||||
IMAGE_SIZE);
|
||||
fpi_image_device_image_captured (dev, img);
|
||||
fpi_image_device_report_finger_status (dev,
|
||||
FALSE);
|
||||
@@ -370,10 +346,6 @@ capture_run_state (FpiSsm *ssm, FpDevice *_dev)
|
||||
switch (fpi_ssm_get_cur_state (ssm))
|
||||
{
|
||||
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),
|
||||
self->seq, capture_reqs_cb);
|
||||
self->seq++;
|
||||
@@ -541,81 +513,15 @@ 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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
if (!error)
|
||||
fpi_ssm_next_state (transfer->ssm);
|
||||
else
|
||||
fpi_ssm_mark_failed (transfer->ssm, error);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -710,6 +616,7 @@ 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 */
|
||||
@@ -720,6 +627,7 @@ dev_init (FpImageDevice *dev)
|
||||
return;
|
||||
}
|
||||
|
||||
self->image_bits = g_malloc0 (IMAGE_SIZE * 2);
|
||||
fpi_image_device_open_complete (dev, NULL);
|
||||
}
|
||||
|
||||
@@ -779,6 +687,6 @@ fpi_device_upektc_img_class_init (FpiDeviceUpektcImgClass *klass)
|
||||
|
||||
img_class->bz3_threshold = 20;
|
||||
|
||||
img_class->img_width = -1;
|
||||
img_class->img_height = -1;
|
||||
img_class->img_width = IMAGE_WIDTH;
|
||||
img_class->img_height = IMAGE_HEIGHT;
|
||||
}
|
||||
|
||||
@@ -75,22 +75,6 @@ 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 */
|
||||
};
|
||||
|
||||
|
||||
@@ -317,7 +317,6 @@ irq_handler (FpiUsbTransfer *transfer,
|
||||
if (urudev->irqs_stopped_cb)
|
||||
urudev->irqs_stopped_cb (imgdev);
|
||||
urudev->irqs_stopped_cb = NULL;
|
||||
g_clear_error (&error);
|
||||
return;
|
||||
}
|
||||
else if (error)
|
||||
@@ -552,7 +551,7 @@ image_transfer_cb (FpiUsbTransfer *transfer, FpDevice *dev,
|
||||
}
|
||||
else
|
||||
{
|
||||
self->img_data = g_memdup2 (transfer->buffer, sizeof (struct uru4k_image));
|
||||
self->img_data = g_memdup (transfer->buffer, sizeof (struct uru4k_image));
|
||||
self->img_data_actual_length = transfer->actual_length;
|
||||
fpi_ssm_next_state (ssm);
|
||||
}
|
||||
@@ -1414,9 +1413,6 @@ dev_deinit (FpImageDevice *dev)
|
||||
SECITEM_FreeItem (self->param, PR_TRUE);
|
||||
if (self->slot)
|
||||
PK11_FreeSlot (self->slot);
|
||||
|
||||
NSS_Shutdown ();
|
||||
|
||||
g_usb_device_release_interface (fpi_device_get_usb_device (FP_DEVICE (dev)),
|
||||
self->interface, 0, &error);
|
||||
g_clear_pointer (&self->rand, g_rand_free);
|
||||
|
||||
@@ -581,7 +581,7 @@ activate_ssm (FpiSsm *ssm, FpDevice *dev)
|
||||
/* Initialize fingerprint buffer */
|
||||
g_free (self->lines_buffer);
|
||||
self->memory = VFS_USB_BUFFER_SIZE;
|
||||
self->lines_buffer = g_malloc0 (self->memory);
|
||||
self->lines_buffer = g_malloc (self->memory);
|
||||
self->bytes = 0;
|
||||
|
||||
/* Finger is on the scanner */
|
||||
@@ -589,15 +589,12 @@ activate_ssm (FpiSsm *ssm, FpDevice *dev)
|
||||
}
|
||||
|
||||
/* Increase buffer size while it's insufficient */
|
||||
while (self->memory < self->bytes + VFS_USB_BUFFER_SIZE)
|
||||
while (self->bytes + VFS_USB_BUFFER_SIZE > self->memory)
|
||||
{
|
||||
int pre_memory = self->memory;
|
||||
self->memory += VFS_USB_BUFFER_SIZE;
|
||||
self->memory <<= 1;
|
||||
self->lines_buffer =
|
||||
(struct vfs_line *) g_realloc (self->lines_buffer,
|
||||
self->memory);
|
||||
memset ((guint8 *) self->lines_buffer + pre_memory, 0,
|
||||
VFS_USB_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
/* Receive chunk of data */
|
||||
|
||||
@@ -432,7 +432,7 @@ img_process_data (int first_block, FpDeviceVfs301 *dev, const guint8 *buf, int l
|
||||
usb_send (dev, data, len, NULL); \
|
||||
}
|
||||
|
||||
#define RAW_DATA(x) g_memdup2 (x, sizeof (x)), sizeof (x)
|
||||
#define RAW_DATA(x) g_memdup (x, sizeof (x)), sizeof (x)
|
||||
|
||||
#define IS_VFS301_FP_SEQ_START(b) ((b[0] == 0x01) && (b[1] == 0xfe))
|
||||
|
||||
|
||||
@@ -273,8 +273,7 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -526,8 +526,8 @@ dev_verify (FpDevice *dev)
|
||||
|
||||
if (scan_id)
|
||||
{
|
||||
g_autoptr(FpPrint) new_scan = NULL;
|
||||
GVariant *data = NULL;
|
||||
FpPrint *new_scan;
|
||||
FpPrint *print;
|
||||
gboolean success;
|
||||
|
||||
@@ -556,7 +556,7 @@ dev_verify (FpDevice *dev)
|
||||
self->match_reported = TRUE;
|
||||
fpi_device_verify_report (dev,
|
||||
success ? FPI_MATCH_SUCCESS : FPI_MATCH_FAIL,
|
||||
g_steal_pointer (&new_scan),
|
||||
new_scan,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
@@ -733,13 +733,7 @@ dev_deinit (FpDevice *dev)
|
||||
}
|
||||
|
||||
if (!self->keep_alive)
|
||||
{
|
||||
stop_listener (self);
|
||||
self->supports_cancellation = TRUE;
|
||||
}
|
||||
|
||||
self->enroll_stages_passed = 0;
|
||||
self->match_reported = FALSE;
|
||||
|
||||
fpi_device_close_complete (dev, NULL);
|
||||
}
|
||||
|
||||
@@ -291,10 +291,11 @@ fp_context_finalize (GObject *object)
|
||||
FpContext *self = (FpContext *) object;
|
||||
FpContextPrivate *priv = fp_context_get_instance_private (self);
|
||||
|
||||
g_clear_pointer (&priv->devices, g_ptr_array_unref);
|
||||
|
||||
g_cancellable_cancel (priv->cancellable);
|
||||
g_clear_object (&priv->cancellable);
|
||||
g_clear_pointer (&priv->drivers, g_array_unref);
|
||||
g_clear_pointer (&priv->devices, g_ptr_array_unref);
|
||||
|
||||
g_slist_free_full (g_steal_pointer (&priv->sources), (GDestroyNotify) g_source_destroy);
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ typedef struct
|
||||
FpDeviceFeature features;
|
||||
|
||||
guint64 driver_data;
|
||||
GVariant *persistent_data;
|
||||
|
||||
gint nr_enroll_stages;
|
||||
GSList *sources;
|
||||
@@ -111,6 +112,8 @@ typedef struct
|
||||
GDestroyNotify enroll_progress_destroy;
|
||||
} FpEnrollData;
|
||||
|
||||
void enroll_data_free (FpEnrollData *enroll_data);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
FpPrint *enrolled_print; /* verify */
|
||||
@@ -126,6 +129,7 @@ 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);
|
||||
|
||||
@@ -54,6 +54,7 @@ enum {
|
||||
PROP_FPI_UDEV_DATA_SPIDEV,
|
||||
PROP_FPI_UDEV_DATA_HIDRAW,
|
||||
PROP_FPI_DRIVER_DATA,
|
||||
PROP_FPI_PERSISTENT_DATA,
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
@@ -235,6 +236,8 @@ fp_device_finalize (GObject *object)
|
||||
g_clear_pointer (&priv->udev_data.spidev_path, g_free);
|
||||
g_clear_pointer (&priv->udev_data.hidraw_path, g_free);
|
||||
|
||||
g_clear_pointer (&priv->persistent_data, g_variant_unref);
|
||||
|
||||
G_OBJECT_CLASS (fp_device_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
@@ -304,6 +307,10 @@ fp_device_get_property (GObject *object,
|
||||
g_value_set_string (value, NULL);
|
||||
break;
|
||||
|
||||
case PROP_FPI_PERSISTENT_DATA:
|
||||
g_value_set_variant (value, priv->persistent_data);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
@@ -354,6 +361,11 @@ fp_device_set_property (GObject *object,
|
||||
priv->driver_data = g_value_get_uint64 (value);
|
||||
break;
|
||||
|
||||
case PROP_FPI_PERSISTENT_DATA:
|
||||
g_clear_pointer (&priv->persistent_data, g_variant_unref);
|
||||
priv->persistent_data = g_value_dup_variant (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
@@ -594,6 +606,21 @@ fp_device_class_init (FpDeviceClass *klass)
|
||||
0,
|
||||
G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
|
||||
|
||||
/**
|
||||
* FpDevice::fpi-persistent-data: (skip)
|
||||
*
|
||||
* This property is only for internal purposes.
|
||||
*
|
||||
* Stability: private
|
||||
*/
|
||||
properties[PROP_FPI_PERSISTENT_DATA] =
|
||||
g_param_spec_variant ("fpi-persistent-data",
|
||||
"Persistent Driver Data",
|
||||
"Private: Previously stored data for the device",
|
||||
G_VARIANT_TYPE_ANY,
|
||||
NULL,
|
||||
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE);
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPS, properties);
|
||||
}
|
||||
|
||||
@@ -739,6 +766,139 @@ fp_device_get_temperature (FpDevice *device)
|
||||
return priv->temp_current;
|
||||
}
|
||||
|
||||
/**
|
||||
* fp_device_get_persistent_data:
|
||||
* @device: A #FpDevice
|
||||
* @data: (array length=length) (transfer full) (out): Return location for data pointer
|
||||
* @length: (transfer full) (out): Length of @data
|
||||
* @error: Return location for error
|
||||
*
|
||||
* Retrieves persistent data that should be stored for this device. Storage
|
||||
* needs to be device specific, i.e. device ID and driver must match when
|
||||
* restored.
|
||||
*
|
||||
* Returns: (type void): %TRUE on success
|
||||
*/
|
||||
gboolean
|
||||
fp_device_get_persistent_data (FpDevice *device,
|
||||
guchar **data,
|
||||
gsize *length,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GVariant) res = NULL;
|
||||
FpDevicePrivate *priv = fp_device_get_instance_private (device);
|
||||
|
||||
g_assert (data);
|
||||
g_assert (length);
|
||||
|
||||
if (priv->persistent_data == NULL)
|
||||
{
|
||||
*data = NULL;
|
||||
*length = 0;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Version + variant from driver */
|
||||
res = g_variant_new ("(issv)",
|
||||
1,
|
||||
fp_device_get_driver (device),
|
||||
priv->device_id,
|
||||
priv->persistent_data);
|
||||
|
||||
*length = g_variant_get_size (res);
|
||||
*data = g_malloc (*length);
|
||||
g_variant_store (res, *data);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* fp_device_get_persistent_data:
|
||||
* @device: A #FpDevice
|
||||
* @data: (array length=length) (transfer none): Persistent Data
|
||||
* @length: (transfer none): Length of @data
|
||||
* @error: Return location for error
|
||||
*
|
||||
* Load persistent data from storage. This function should be called after
|
||||
* a device was discovered and before it is opened for the first time. It is
|
||||
* an error to call it if data has already been set (or generated by the
|
||||
* driver).
|
||||
*
|
||||
* Note that the driver may update the data. The API user should retrieve the
|
||||
* value when done with the device and store it in a persistent location.
|
||||
*
|
||||
* Returns: (type void): %TRUE on success
|
||||
*/
|
||||
gboolean
|
||||
fp_device_set_persistent_data (FpDevice *device,
|
||||
guchar *data,
|
||||
gsize length,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GVariant) stored = NULL;
|
||||
g_autoptr(GVariant) loaded = NULL;
|
||||
FpDevicePrivate *priv = fp_device_get_instance_private (device);
|
||||
guchar *copy;
|
||||
gint version;
|
||||
const gchar *device_id;
|
||||
const gchar *driver;
|
||||
|
||||
if (priv->is_open)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||
"Data can only be set right after device creation");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (priv->persistent_data)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_EXISTS,
|
||||
"Data has already been set");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (length == 0)
|
||||
{
|
||||
g_clear_pointer (&priv->persistent_data, g_variant_unref);
|
||||
g_object_notify_by_pspec (G_OBJECT (device), properties[PROP_FPI_PERSISTENT_DATA]);
|
||||
return TRUE;
|
||||
}
|
||||
g_assert (data);
|
||||
|
||||
copy = g_memdup (data, length);
|
||||
stored = g_variant_new_from_data (G_VARIANT_TYPE ("(issv)"), copy, length, FALSE, g_free, copy);
|
||||
|
||||
if (!stored)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
|
||||
"Data could not be parsed");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_variant_get (stored, "(issv)", &version, &driver, &device_id, &loaded);
|
||||
if (version != 1)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
|
||||
"Unknown data storage version");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (g_strcmp0 (device_id, priv->device_id) != 0 ||
|
||||
g_strcmp0 (driver, fp_device_get_driver (device)) != 0)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
|
||||
"Driver or device ID mismatch!");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_clear_pointer (&priv->persistent_data, g_variant_unref);
|
||||
priv->persistent_data = g_steal_pointer (&loaded);
|
||||
g_object_notify_by_pspec (G_OBJECT (device), properties[PROP_FPI_PERSISTENT_DATA]);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* fp_device_supports_identify:
|
||||
* @device: A #FpDevice
|
||||
@@ -1088,15 +1248,6 @@ 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:
|
||||
@@ -1181,6 +1332,10 @@ fp_device_enroll (FpDevice *device,
|
||||
}
|
||||
}
|
||||
|
||||
priv->current_action = FPI_DEVICE_ACTION_ENROLL;
|
||||
priv->current_task = g_steal_pointer (&task);
|
||||
setup_task_cancellable (device);
|
||||
|
||||
fpi_device_update_temp (device, TRUE);
|
||||
if (priv->temp_current == FP_TEMPERATURE_HOT)
|
||||
{
|
||||
@@ -1189,10 +1344,6 @@ fp_device_enroll (FpDevice *device,
|
||||
return;
|
||||
}
|
||||
|
||||
priv->current_action = FPI_DEVICE_ACTION_ENROLL;
|
||||
priv->current_task = g_steal_pointer (&task);
|
||||
setup_task_cancellable (device);
|
||||
|
||||
data = g_new0 (FpEnrollData, 1);
|
||||
data->print = g_object_ref_sink (template_print);
|
||||
data->enroll_progress_cb = progress_cb;
|
||||
@@ -1226,23 +1377,6 @@ 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
|
||||
@@ -1299,6 +1433,10 @@ fp_device_verify (FpDevice *device,
|
||||
return;
|
||||
}
|
||||
|
||||
priv->current_action = FPI_DEVICE_ACTION_VERIFY;
|
||||
priv->current_task = g_steal_pointer (&task);
|
||||
setup_task_cancellable (device);
|
||||
|
||||
fpi_device_update_temp (device, TRUE);
|
||||
if (priv->temp_current == FP_TEMPERATURE_HOT)
|
||||
{
|
||||
@@ -1307,10 +1445,6 @@ fp_device_verify (FpDevice *device,
|
||||
return;
|
||||
}
|
||||
|
||||
priv->current_action = FPI_DEVICE_ACTION_VERIFY;
|
||||
priv->current_task = g_steal_pointer (&task);
|
||||
setup_task_cancellable (device);
|
||||
|
||||
data = g_new0 (FpMatchData, 1);
|
||||
data->enrolled_print = g_object_ref (enrolled_print);
|
||||
data->match_cb = match_cb;
|
||||
@@ -1426,13 +1560,9 @@ fp_device_identify (FpDevice *device,
|
||||
return;
|
||||
}
|
||||
|
||||
if (prints == NULL)
|
||||
{
|
||||
g_task_return_error (task,
|
||||
fpi_device_error_new_msg (FP_DEVICE_ERROR_DATA_INVALID,
|
||||
"Invalid gallery array"));
|
||||
return;
|
||||
}
|
||||
priv->current_action = FPI_DEVICE_ACTION_IDENTIFY;
|
||||
priv->current_task = g_steal_pointer (&task);
|
||||
setup_task_cancellable (device);
|
||||
|
||||
fpi_device_update_temp (device, TRUE);
|
||||
if (priv->temp_current == FP_TEMPERATURE_HOT)
|
||||
@@ -1442,10 +1572,6 @@ fp_device_identify (FpDevice *device,
|
||||
return;
|
||||
}
|
||||
|
||||
priv->current_action = FPI_DEVICE_ACTION_IDENTIFY;
|
||||
priv->current_task = g_steal_pointer (&task);
|
||||
setup_task_cancellable (device);
|
||||
|
||||
data = g_new0 (FpMatchData, 1);
|
||||
/* We cannot store the gallery directly, because the ptr array may not own
|
||||
* a reference to each print. Also, the caller could in principle modify the
|
||||
@@ -1559,6 +1685,10 @@ fp_device_capture (FpDevice *device,
|
||||
return;
|
||||
}
|
||||
|
||||
priv->current_action = FPI_DEVICE_ACTION_CAPTURE;
|
||||
priv->current_task = g_steal_pointer (&task);
|
||||
setup_task_cancellable (device);
|
||||
|
||||
fpi_device_update_temp (device, TRUE);
|
||||
if (priv->temp_current == FP_TEMPERATURE_HOT)
|
||||
{
|
||||
@@ -1567,10 +1697,6 @@ fp_device_capture (FpDevice *device,
|
||||
return;
|
||||
}
|
||||
|
||||
priv->current_action = FPI_DEVICE_ACTION_CAPTURE;
|
||||
priv->current_task = g_steal_pointer (&task);
|
||||
setup_task_cancellable (device);
|
||||
|
||||
priv->wait_for_finger = wait_for_finger;
|
||||
|
||||
cls->capture (device);
|
||||
|
||||
@@ -230,6 +230,15 @@ FpDeviceFeature fp_device_get_features (FpDevice *device);
|
||||
gboolean fp_device_has_feature (FpDevice *device,
|
||||
FpDeviceFeature feature);
|
||||
|
||||
gboolean fp_device_get_persistent_data (FpDevice *device,
|
||||
guchar **data,
|
||||
gsize *length,
|
||||
GError **error);
|
||||
gboolean fp_device_set_persistent_data (FpDevice *device,
|
||||
guchar *data,
|
||||
gsize length,
|
||||
GError **error);
|
||||
|
||||
/* Opening the device */
|
||||
void fp_device_open (FpDevice *device,
|
||||
GCancellable *cancellable,
|
||||
|
||||
@@ -20,11 +20,9 @@
|
||||
|
||||
#define FP_COMPONENT "image"
|
||||
|
||||
#include "fpi-compat.h"
|
||||
#include "fpi-image.h"
|
||||
#include "fpi-log.h"
|
||||
|
||||
#include <config.h>
|
||||
#include <nbis.h>
|
||||
|
||||
/**
|
||||
@@ -297,7 +295,7 @@ fp_image_detect_minutiae_thread_func (GTask *task,
|
||||
|
||||
data->flags &= ~(FPI_IMAGE_H_FLIPPED | FPI_IMAGE_V_FLIPPED | FPI_IMAGE_COLORS_INVERTED);
|
||||
|
||||
lfsparms = g_memdup2 (&g_lfsparms_V2, sizeof (LFSPARMS));
|
||||
lfsparms = g_memdup (&g_lfsparms_V2, sizeof (LFSPARMS));
|
||||
lfsparms->remove_perimeter_pts = data->flags & FPI_IMAGE_PARTIAL ? TRUE : FALSE;
|
||||
|
||||
timer = g_timer_new ();
|
||||
|
||||
@@ -339,7 +339,7 @@ fp_print_init (FpPrint *self)
|
||||
* create a new print, fill in the relevant metadata, and then start
|
||||
* enrollment.
|
||||
*
|
||||
* Returns: (transfer floating): A newly created #FpPrint
|
||||
* Returns: (transfer floating): A newyl created #FpPrint
|
||||
*/
|
||||
FpPrint *
|
||||
fp_print_new (FpDevice *device)
|
||||
|
||||
@@ -1181,7 +1181,7 @@ fpi_byte_reader_dup_string_utf##bits (FpiByteReader * reader, type ** str) \
|
||||
*str = NULL; \
|
||||
return FALSE; \
|
||||
} \
|
||||
*str = g_memdup2 (reader->data + reader->byte, size); \
|
||||
*str = g_memdup (reader->data + reader->byte, size); \
|
||||
reader->byte += size; \
|
||||
return TRUE; \
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <glib.h>
|
||||
#include "fpi-compat.h"
|
||||
#include "fpi-byte-utils.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@@ -361,7 +360,7 @@ static inline guint8 *
|
||||
fpi_byte_reader_dup_data_unchecked (FpiByteReader * reader, guint size)
|
||||
{
|
||||
gconstpointer data = fpi_byte_reader_get_data_unchecked (reader, size);
|
||||
return (guint8 *) g_memdup2 (data, size);
|
||||
return (guint8 *) g_memdup (data, size);
|
||||
}
|
||||
|
||||
/* Unchecked variants that should not be used */
|
||||
|
||||
@@ -211,7 +211,7 @@ fpi_byte_writer_reset_and_get_data (FpiByteWriter * writer)
|
||||
|
||||
data = (guint8 *) writer->parent.data;
|
||||
if (!writer->owned)
|
||||
data = g_memdup2 (data, writer->parent.size);
|
||||
data = g_memdup (data, writer->parent.size);
|
||||
writer->parent.data = NULL;
|
||||
fpi_byte_writer_reset (writer);
|
||||
|
||||
|
||||
@@ -39,17 +39,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (FpDeviceClass, g_type_class_unref);
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GDate, g_date_free);
|
||||
#endif
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 68, 0)
|
||||
#define g_memdup2(data, size) g_memdup ((data), (size))
|
||||
#else
|
||||
#define g_memdup2(data, size) \
|
||||
(G_GNUC_EXTENSION ({ \
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
|
||||
g_memdup2 ((data), (size)); \
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS \
|
||||
}))
|
||||
#endif
|
||||
|
||||
#if __GNUC__ > 10 || (__GNUC__ == 10 && __GNUC_MINOR__ >= 1)
|
||||
#define FP_GNUC_ACCESS(m, p, s) __attribute__((access (m, p, s)))
|
||||
#else
|
||||
|
||||
@@ -522,6 +522,33 @@ 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
|
||||
@@ -595,14 +622,7 @@ fpi_device_get_verify_data (FpDevice *device,
|
||||
* @device: The #FpDevice
|
||||
* @prints: (out) (transfer none) (element-type FpPrint): The gallery of prints
|
||||
*
|
||||
* Get prints gallery for identification.
|
||||
*
|
||||
* The @prints array is always non-%NULL and may contain a list of #FpPrint's
|
||||
* that the device should match against.
|
||||
*
|
||||
* Note that @prints can be an empty array, in such case the device is expected
|
||||
* to report the scanned print matching the one in its internal storage, if any.
|
||||
*
|
||||
* Get data for identify.
|
||||
*/
|
||||
void
|
||||
fpi_device_get_identify_data (FpDevice *device,
|
||||
@@ -1292,14 +1312,12 @@ fpi_device_enroll_complete (FpDevice *device, FpPrint *print, GError *error)
|
||||
* @device: The #FpDevice
|
||||
* @error: A #GError if result is %FPI_MATCH_ERROR
|
||||
*
|
||||
* Finish an ongoing verify operation.
|
||||
* Finish an ongoing verify operation. The returned print should be
|
||||
* representing the new scan and not the one passed for verification.
|
||||
*
|
||||
* Note that @error should only be set for actual errors. In the case
|
||||
* of retry errors, report these using fpi_device_verify_report()
|
||||
* and then call this function without any error argument.
|
||||
*
|
||||
* If @error is not set, we expect that a result (and print, in case)
|
||||
* have been already reported via fpi_device_verify_report().
|
||||
*/
|
||||
void
|
||||
fpi_device_verify_complete (FpDevice *device,
|
||||
@@ -1357,14 +1375,9 @@ fpi_device_verify_complete (FpDevice *device,
|
||||
* @device: The #FpDevice
|
||||
* @error: The #GError or %NULL on success
|
||||
*
|
||||
* Finish an ongoing identify operation.
|
||||
*
|
||||
* Note that @error should only be set for actual errors. In the case
|
||||
* of retry errors, report these using fpi_device_identify_report()
|
||||
* and then call this function without any error argument.
|
||||
*
|
||||
* If @error is not set, we expect that a match and / or a print have been
|
||||
* already reported via fpi_device_identify_report()
|
||||
* Finish an ongoing identify operation. The match that was identified is
|
||||
* returned in @match. The @print parameter returns the newly created scan
|
||||
* that was used for matching.
|
||||
*/
|
||||
void
|
||||
fpi_device_identify_complete (FpDevice *device,
|
||||
@@ -1583,13 +1596,11 @@ update_attr (const char *attr, const char *value)
|
||||
static void
|
||||
complete_suspend_resume_task (FpDevice *device)
|
||||
{
|
||||
g_autoptr(GTask) task = NULL;
|
||||
FpDevicePrivate *priv = fp_device_get_instance_private (device);
|
||||
|
||||
g_assert (priv->suspend_resume_task);
|
||||
task = g_steal_pointer (&priv->suspend_resume_task);
|
||||
|
||||
g_task_return_boolean (task, TRUE);
|
||||
g_task_return_boolean (g_steal_pointer (&priv->suspend_resume_task), TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1693,9 +1704,9 @@ fpi_device_configure_wakeup (FpDevice *device, gboolean enabled)
|
||||
case FP_DEVICE_TYPE_USB:
|
||||
{
|
||||
g_autoptr(GString) ports = NULL;
|
||||
g_autoptr(GUsbDevice) dev = NULL;
|
||||
GUsbDevice *dev, *parent;
|
||||
const char *wakeup_command = enabled ? "enabled" : "disabled";
|
||||
guint8 bus;
|
||||
guint8 bus, port;
|
||||
g_autofree gchar *sysfs_wakeup = NULL;
|
||||
g_autofree gchar *sysfs_persist = NULL;
|
||||
int res;
|
||||
@@ -1704,20 +1715,12 @@ fpi_device_configure_wakeup (FpDevice *device, gboolean enabled)
|
||||
bus = g_usb_device_get_bus (priv->usb_device);
|
||||
|
||||
/* Walk up, skipping the root hub. */
|
||||
g_set_object (&dev, priv->usb_device);
|
||||
while (TRUE)
|
||||
dev = priv->usb_device;
|
||||
while ((parent = g_usb_device_get_parent (dev)))
|
||||
{
|
||||
g_autoptr(GUsbDevice) parent = g_usb_device_get_parent (dev);
|
||||
g_autofree gchar *port_str = NULL;
|
||||
guint8 port;
|
||||
|
||||
if (!parent)
|
||||
break;
|
||||
|
||||
port = g_usb_device_get_port_number (dev);
|
||||
port_str = g_strdup_printf ("%d.", port);
|
||||
g_string_prepend (ports, port_str);
|
||||
g_set_object (&dev, parent);
|
||||
g_string_prepend (ports, g_strdup_printf ("%d.", port));
|
||||
dev = parent;
|
||||
}
|
||||
g_string_set_size (ports, ports->len - 1);
|
||||
|
||||
@@ -1754,7 +1757,6 @@ fpi_device_configure_wakeup (FpDevice *device, gboolean enabled)
|
||||
static void
|
||||
fpi_device_suspend_completed (FpDevice *device)
|
||||
{
|
||||
g_autoptr(GTask) task = NULL;
|
||||
FpDevicePrivate *priv = fp_device_get_instance_private (device);
|
||||
|
||||
/* We have an ongoing operation, allow the device to wake up the machine. */
|
||||
@@ -1764,12 +1766,11 @@ fpi_device_suspend_completed (FpDevice *device)
|
||||
if (priv->critical_section)
|
||||
g_warning ("Driver was in a critical section at suspend time. It likely deadlocked!");
|
||||
|
||||
task = g_steal_pointer (&priv->suspend_resume_task);
|
||||
|
||||
if (priv->suspend_error)
|
||||
g_task_return_error (task, g_steal_pointer (&priv->suspend_error));
|
||||
g_task_return_error (g_steal_pointer (&priv->suspend_resume_task),
|
||||
g_steal_pointer (&priv->suspend_error));
|
||||
else
|
||||
g_task_return_boolean (task, TRUE);
|
||||
g_task_return_boolean (g_steal_pointer (&priv->suspend_resume_task), TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1797,12 +1798,11 @@ fpi_device_suspend_complete (FpDevice *device,
|
||||
g_return_if_fail (priv->suspend_resume_task);
|
||||
g_return_if_fail (priv->suspend_error == NULL);
|
||||
|
||||
priv->suspend_error = g_steal_pointer (&error);
|
||||
priv->suspend_error = error;
|
||||
priv->is_suspended = TRUE;
|
||||
|
||||
/* If there is no error, we have no running task, return immediately. */
|
||||
if (!priv->suspend_error || !priv->current_task ||
|
||||
g_task_get_completed (priv->current_task))
|
||||
if (error == NULL || !priv->current_task || g_task_get_completed (priv->current_task))
|
||||
{
|
||||
fpi_device_suspend_completed (device);
|
||||
return;
|
||||
@@ -1834,7 +1834,6 @@ void
|
||||
fpi_device_resume_complete (FpDevice *device,
|
||||
GError *error)
|
||||
{
|
||||
g_autoptr(GTask) task = NULL;
|
||||
FpDevicePrivate *priv = fp_device_get_instance_private (device);
|
||||
|
||||
g_return_if_fail (FP_IS_DEVICE (device));
|
||||
@@ -1843,12 +1842,10 @@ fpi_device_resume_complete (FpDevice *device,
|
||||
priv->is_suspended = FALSE;
|
||||
fpi_device_configure_wakeup (device, FALSE);
|
||||
|
||||
task = g_steal_pointer (&priv->suspend_resume_task);
|
||||
|
||||
if (error)
|
||||
g_task_return_error (task, error);
|
||||
g_task_return_error (g_steal_pointer (&priv->suspend_resume_task), error);
|
||||
else
|
||||
g_task_return_boolean (task, TRUE);
|
||||
g_task_return_boolean (g_steal_pointer (&priv->suspend_resume_task), TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2005,26 +2002,12 @@ fpi_device_verify_report (FpDevice *device,
|
||||
* fpi_device_identify_report:
|
||||
* @device: The #FpDevice
|
||||
* @match: (transfer none): The #FpPrint from the gallery that matched
|
||||
* @print: (transfer floating): The scanned #FpPrint, set in the absence
|
||||
* of an error.
|
||||
* @error: A #GError of %FP_DEVICE_RETRY type if @match and @print are unset.
|
||||
* @print: (transfer floating): The scanned #FpPrint
|
||||
* @error: A #GError if result is %FPI_MATCH_ERROR
|
||||
*
|
||||
* Report the results of an identify operation.
|
||||
*
|
||||
* In case of successful identification @match is expected to be set to a
|
||||
* #FpPrint that matches one from the provided gallery, while @print
|
||||
* represents the scanned print and will be different.
|
||||
*
|
||||
* If there are no errors, it's expected that the device always reports the
|
||||
* recognized @print even if there is no @match with the provided gallery (that
|
||||
* can be potentially empty). This is required for application logic further
|
||||
* up in the stack, such as for enroll-duplicate checking. @print needs to be
|
||||
* sufficiently filled to do a comparison.
|
||||
*
|
||||
* In case of error, both @match and @print are expected to be %NULL.
|
||||
* Note that the passed @error must be a retry error from the %FP_DEVICE_RETRY
|
||||
* domain. For all other error cases, the error should passed to
|
||||
* fpi_device_identify_complete().
|
||||
* Report the result of a identify operation. Note that the passed @error must be
|
||||
* a retry error with the %FP_DEVICE_RETRY domain. For all other error cases,
|
||||
* the error should passed to fpi_device_identify_complete().
|
||||
*/
|
||||
void
|
||||
fpi_device_identify_report (FpDevice *device,
|
||||
|
||||
@@ -24,9 +24,8 @@
|
||||
#include "fpi-log.h"
|
||||
|
||||
#include <nbis.h>
|
||||
#include <config.h>
|
||||
|
||||
#ifdef HAVE_PIXMAN
|
||||
#if HAVE_PIXMAN
|
||||
#include <pixman.h>
|
||||
#endif
|
||||
|
||||
@@ -108,12 +107,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;
|
||||
@@ -146,9 +145,5 @@ 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
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <config.h>
|
||||
#include "fp-image.h"
|
||||
|
||||
/**
|
||||
@@ -76,6 +77,8 @@ 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
|
||||
|
||||
@@ -50,7 +50,7 @@ fpi_print_add_print (FpPrint *print, FpPrint *add)
|
||||
g_return_if_fail (add->type == FPI_PRINT_NBIS);
|
||||
|
||||
g_assert (add->prints->len == 1);
|
||||
g_ptr_array_add (print->prints, g_memdup2 (add->prints->pdata[0], sizeof (struct xyt_struct)));
|
||||
g_ptr_array_add (print->prints, g_memdup (add->prints->pdata[0], sizeof (struct xyt_struct)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -132,7 +132,7 @@ main (int argc, char **argv)
|
||||
g_print ("%s", (char *) l->data);
|
||||
g_print ("\n");
|
||||
|
||||
g_list_free_full (g_steal_pointer (&usb_list), g_free);
|
||||
g_list_free_full (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 (g_steal_pointer (&spi_list), g_free);
|
||||
g_list_free_full (usb_list, g_free);
|
||||
|
||||
|
||||
g_hash_table_destroy (printed);
|
||||
|
||||
@@ -35,13 +35,7 @@ static const FpIdEntry whitelist_id_table[] = {
|
||||
{ .vid = 0x04f3, .pid = 0x0c4c },
|
||||
{ .vid = 0x04f3, .pid = 0x0c57 },
|
||||
{ .vid = 0x04f3, .pid = 0x0c5e },
|
||||
{ .vid = 0x04f3, .pid = 0x0c5a },
|
||||
{ .vid = 0x04f3, .pid = 0x0c70 },
|
||||
{ .vid = 0x04f3, .pid = 0x0c72 },
|
||||
{ .vid = 0x04f3, .pid = 0x2706 },
|
||||
{ .vid = 0x04f3, .pid = 0x3057 },
|
||||
{ .vid = 0x04f3, .pid = 0x3104 },
|
||||
{ .vid = 0x04f3, .pid = 0x310d },
|
||||
{ .vid = 0x06cb, .pid = 0x0081 },
|
||||
{ .vid = 0x06cb, .pid = 0x0088 },
|
||||
{ .vid = 0x06cb, .pid = 0x008a },
|
||||
@@ -96,14 +90,12 @@ static const FpIdEntry whitelist_id_table[] = {
|
||||
{ .vid = 0x27c6, .pid = 0x5042 },
|
||||
{ .vid = 0x27c6, .pid = 0x5110 },
|
||||
{ .vid = 0x27c6, .pid = 0x5117 },
|
||||
{ .vid = 0x27c6, .pid = 0x5120 },
|
||||
{ .vid = 0x27c6, .pid = 0x5125 },
|
||||
{ .vid = 0x27c6, .pid = 0x5201 },
|
||||
{ .vid = 0x27c6, .pid = 0x521d },
|
||||
{ .vid = 0x27c6, .pid = 0x5301 },
|
||||
{ .vid = 0x27c6, .pid = 0x530c },
|
||||
{ .vid = 0x27c6, .pid = 0x532d },
|
||||
{ .vid = 0x27c6, .pid = 0x5335 },
|
||||
{ .vid = 0x27c6, .pid = 0x533c },
|
||||
{ .vid = 0x27c6, .pid = 0x5381 },
|
||||
{ .vid = 0x27c6, .pid = 0x5385 },
|
||||
@@ -111,17 +103,13 @@ static const FpIdEntry whitelist_id_table[] = {
|
||||
{ .vid = 0x27c6, .pid = 0x538d },
|
||||
{ .vid = 0x27c6, .pid = 0x5395 },
|
||||
{ .vid = 0x27c6, .pid = 0x5503 },
|
||||
{ .vid = 0x27c6, .pid = 0x550a },
|
||||
{ .vid = 0x27c6, .pid = 0x550c },
|
||||
{ .vid = 0x27c6, .pid = 0x5584 },
|
||||
{ .vid = 0x27c6, .pid = 0x55a2 },
|
||||
{ .vid = 0x27c6, .pid = 0x55a4 },
|
||||
{ .vid = 0x27c6, .pid = 0x55b4 },
|
||||
{ .vid = 0x27c6, .pid = 0x5740 },
|
||||
{ .vid = 0x27c6, .pid = 0x5e0a },
|
||||
{ .vid = 0x27c6, .pid = 0x581a },
|
||||
{ .vid = 0x2808, .pid = 0x9338 },
|
||||
{ .vid = 0x2808, .pid = 0x93a9 },
|
||||
{ .vid = 0x298d, .pid = 0x2020 },
|
||||
{ .vid = 0x298d, .pid = 0x2033 },
|
||||
{ .vid = 0x3538, .pid = 0x0930 },
|
||||
|
||||
@@ -139,8 +139,6 @@ driver_sources = {
|
||||
[ 'drivers/synaptics/synaptics.c', 'drivers/synaptics/bmkt_message.c' ],
|
||||
'goodixmoc' :
|
||||
[ 'drivers/goodixmoc/goodix.c', 'drivers/goodixmoc/goodix_proto.c' ],
|
||||
'fpcmoc' :
|
||||
[ 'drivers/fpcmoc/fpc.c' ],
|
||||
}
|
||||
|
||||
helper_sources = {
|
||||
@@ -263,7 +261,7 @@ libfprint_drivers = static_library('fprint-drivers',
|
||||
install: false)
|
||||
|
||||
mapfile = files('libfprint.ver')
|
||||
vflag = '-Wl,--version-script,@0@/@1@'.format(meson.project_source_root(), mapfile[0])
|
||||
vflag = '-Wl,--version-script,@0@/@1@'.format(meson.source_root(), mapfile[0])
|
||||
|
||||
libfprint = shared_library(versioned_libname.split('lib')[1],
|
||||
sources: [
|
||||
@@ -332,19 +330,17 @@ if install_udev_rules
|
||||
)
|
||||
endif
|
||||
|
||||
sync_udev_udb = custom_target('sync-udev-hwdb',
|
||||
custom_target('sync-udev-hwdb',
|
||||
depends: udev_hwdb_generator,
|
||||
output: 'sync-udev-hwdb',
|
||||
install: false,
|
||||
command: [
|
||||
'cp', '-v',
|
||||
udev_hwdb_generator.full_path(),
|
||||
meson.project_source_root() / 'data'
|
||||
meson.source_root() / 'data'
|
||||
]
|
||||
)
|
||||
|
||||
alias_target('sync-udev-hwdb', sync_udev_udb)
|
||||
|
||||
supported_devices = executable('fprint-list-supported-devices',
|
||||
'fprint-list-supported-devices.c',
|
||||
dependencies: libfprint_private_dep,
|
||||
|
||||
18
meson.build
18
meson.build
@@ -1,23 +1,18 @@
|
||||
project('libfprint', [ 'c', 'cpp' ],
|
||||
version: '1.94.6',
|
||||
version: '1.94.4',
|
||||
license: 'LGPLv2.1+',
|
||||
default_options: [
|
||||
'buildtype=debugoptimized',
|
||||
'warning_level=1',
|
||||
'c_std=gnu99',
|
||||
],
|
||||
meson_version: '>= 0.56.0')
|
||||
meson_version: '>= 0.49.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()
|
||||
@@ -130,7 +125,6 @@ default_drivers = [
|
||||
'upekts',
|
||||
'goodixmoc',
|
||||
'nb1010',
|
||||
'fpcmoc',
|
||||
|
||||
# SPI
|
||||
'elanspi',
|
||||
@@ -291,6 +285,8 @@ 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')
|
||||
@@ -302,7 +298,9 @@ 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')
|
||||
@@ -312,8 +310,6 @@ endif
|
||||
subdir('data')
|
||||
subdir('tests')
|
||||
|
||||
subdir('examples')
|
||||
|
||||
pkgconfig = import('pkgconfig')
|
||||
pkgconfig.generate(
|
||||
name: versioned_libname,
|
||||
@@ -324,5 +320,3 @@ pkgconfig.generate(
|
||||
subdirs: versioned_libname,
|
||||
filebase: versioned_libname,
|
||||
)
|
||||
|
||||
summary({'Drivers': drivers, }, section: 'Drivers')
|
||||
|
||||
@@ -30,7 +30,3 @@ 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)
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import cairo
|
||||
import sys
|
||||
import traceback
|
||||
import gi
|
||||
|
||||
gi.require_version('FPrint', '2.0')
|
||||
from gi.repository import FPrint, GLib
|
||||
|
||||
# Exit with error on any exception, included those happening in async callbacks
|
||||
sys.excepthook = lambda *args: (traceback.print_exception(*args), sys.exit(1))
|
||||
import cairo
|
||||
import sys
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print("Please specify exactly one argument, the output location for the capture image")
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
[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@
|
||||
@@ -1,15 +1,9 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import traceback
|
||||
import sys
|
||||
import gi
|
||||
|
||||
gi.require_version('FPrint', '2.0')
|
||||
from gi.repository import FPrint, GLib
|
||||
|
||||
# Exit with error on any exception, included those happening in async callbacks
|
||||
sys.excepthook = lambda *args: (traceback.print_exception(*args), sys.exit(1))
|
||||
|
||||
ctx = GLib.main_context_default()
|
||||
|
||||
c = FPrint.Context()
|
||||
|
||||
Binary file not shown.
@@ -1,92 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import traceback
|
||||
import sys
|
||||
import gi
|
||||
|
||||
gi.require_version('FPrint', '2.0')
|
||||
from gi.repository import FPrint, GLib
|
||||
|
||||
# Exit with error on any exception, included those happening in async callbacks
|
||||
sys.excepthook = lambda *args: (traceback.print_exception(*args), sys.exit(1))
|
||||
|
||||
ctx = GLib.main_context_default()
|
||||
|
||||
c = FPrint.Context()
|
||||
c.enumerate()
|
||||
devices = c.get_devices()
|
||||
|
||||
d = devices[0]
|
||||
del devices
|
||||
|
||||
assert d.get_driver() == "fpcmoc"
|
||||
assert not d.has_feature(FPrint.DeviceFeature.CAPTURE)
|
||||
assert d.has_feature(FPrint.DeviceFeature.IDENTIFY)
|
||||
assert d.has_feature(FPrint.DeviceFeature.VERIFY)
|
||||
assert d.has_feature(FPrint.DeviceFeature.DUPLICATES_CHECK)
|
||||
assert d.has_feature(FPrint.DeviceFeature.STORAGE)
|
||||
assert d.has_feature(FPrint.DeviceFeature.STORAGE_LIST)
|
||||
assert d.has_feature(FPrint.DeviceFeature.STORAGE_DELETE)
|
||||
assert d.has_feature(FPrint.DeviceFeature.STORAGE_CLEAR)
|
||||
|
||||
d.open_sync()
|
||||
|
||||
print("Clear")
|
||||
d.clear_storage_sync()
|
||||
print("Clear done")
|
||||
|
||||
template = FPrint.Print.new(d)
|
||||
|
||||
def enroll_progress(*args):
|
||||
assert d.get_finger_status() == FPrint.FingerStatusFlags.NEEDED
|
||||
print('enroll progress: ' + str(args))
|
||||
|
||||
def identify_done(dev, res):
|
||||
global identified
|
||||
identified = True
|
||||
identify_match, identify_print = dev.identify_finish(res)
|
||||
print('indentification_done: ', identify_match, identify_print)
|
||||
assert identify_match.equal(identify_print)
|
||||
|
||||
# List, enroll, list, verify, identify, delete
|
||||
print("enrolling")
|
||||
assert d.get_finger_status() == FPrint.FingerStatusFlags.NONE
|
||||
p = d.enroll_sync(template, None, enroll_progress, None)
|
||||
assert d.get_finger_status() == FPrint.FingerStatusFlags.NONE
|
||||
print("enroll done")
|
||||
|
||||
print("listing")
|
||||
stored = d.list_prints_sync()
|
||||
print("listing done")
|
||||
assert len(stored) == 1
|
||||
assert stored[0].equal(p)
|
||||
print("verifying")
|
||||
assert d.get_finger_status() == FPrint.FingerStatusFlags.NONE
|
||||
verify_res, verify_print = d.verify_sync(p)
|
||||
assert d.get_finger_status() == FPrint.FingerStatusFlags.NONE
|
||||
print("verify done")
|
||||
del p
|
||||
assert verify_res == True
|
||||
|
||||
identified = False
|
||||
deserialized_prints = []
|
||||
for p in stored:
|
||||
deserialized_prints.append(FPrint.Print.deserialize(p.serialize()))
|
||||
assert deserialized_prints[-1].equal(p)
|
||||
del stored
|
||||
|
||||
print('async identifying')
|
||||
d.identify(deserialized_prints, callback=identify_done)
|
||||
del deserialized_prints
|
||||
|
||||
while not identified:
|
||||
ctx.iteration(True)
|
||||
|
||||
print("deleting")
|
||||
d.delete_print_sync(p)
|
||||
print("delete done")
|
||||
|
||||
d.close_sync()
|
||||
|
||||
del d
|
||||
del c
|
||||
@@ -1,234 +0,0 @@
|
||||
P: /devices/pci0000:00/0000:00:14.0/usb1/1-1
|
||||
N: bus/usb/001/019=1201000200000040A510E0FF10000102000109021900010104A0320904000001FFFFFF0507058102400000
|
||||
E: DEVNAME=/dev/bus/usb/001/019
|
||||
E: DEVTYPE=usb_device
|
||||
E: DRIVER=usb
|
||||
E: PRODUCT=10a5/ffe0/10
|
||||
E: TYPE=0/0/0
|
||||
E: BUSNUM=001
|
||||
E: DEVNUM=019
|
||||
E: MAJOR=189
|
||||
E: MINOR=18
|
||||
E: SUBSYSTEM=usb
|
||||
E: ID_VENDOR=FPC
|
||||
E: ID_VENDOR_ENC=FPC
|
||||
E: ID_VENDOR_ID=10a5
|
||||
E: ID_MODEL=FPC_L:0001_FW:127010
|
||||
E: ID_MODEL_ENC=FPC\x20L:0001\x20FW:127010
|
||||
E: ID_MODEL_ID=ffe0
|
||||
E: ID_REVISION=0010
|
||||
E: ID_SERIAL=FPC_FPC_L:0001_FW:127010
|
||||
E: ID_BUS=usb
|
||||
E: ID_USB_INTERFACES=:ffffff:
|
||||
E: ID_PATH=pci-0000:00:14.0-usb-0:1
|
||||
E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_1
|
||||
E: ID_FOR_SEAT=usb-pci-0000_00_14_0-usb-0_1
|
||||
E: TAGS=:seat:
|
||||
E: CURRENT_TAGS=:seat:
|
||||
A: authorized=1\n
|
||||
A: avoid_reset_quirk=0\n
|
||||
A: bConfigurationValue=1\n
|
||||
A: bDeviceClass=00\n
|
||||
A: bDeviceProtocol=00\n
|
||||
A: bDeviceSubClass=00\n
|
||||
A: bMaxPacketSize0=64\n
|
||||
A: bMaxPower=100mA\n
|
||||
A: bNumConfigurations=1\n
|
||||
A: bNumInterfaces= 1\n
|
||||
A: bcdDevice=0010\n
|
||||
A: bmAttributes=a0\n
|
||||
A: busnum=1\n
|
||||
A: configuration=FPC\n
|
||||
H: descriptors=1201000200000040A510E0FF10000102000109021900010104A0320904000001FFFFFF0507058102400000
|
||||
A: dev=189:18\n
|
||||
A: devnum=19\n
|
||||
A: devpath=1\n
|
||||
L: driver=../../../../../bus/usb/drivers/usb
|
||||
L: firmware_node=../../../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:1c/device:1d/device:1e
|
||||
A: idProduct=ffe0\n
|
||||
A: idVendor=10a5\n
|
||||
A: ltm_capable=no\n
|
||||
A: manufacturer=FPC\n
|
||||
A: maxchild=0\n
|
||||
L: port=../1-0:1.0/usb1-port1
|
||||
A: power/active_duration=27204308\n
|
||||
A: power/async=enabled\n
|
||||
A: power/autosuspend=2\n
|
||||
A: power/autosuspend_delay_ms=2000\n
|
||||
A: power/connected_duration=27204308\n
|
||||
A: power/control=on\n
|
||||
A: power/level=on\n
|
||||
A: power/persist=1\n
|
||||
A: power/runtime_active_kids=0\n
|
||||
A: power/runtime_active_time=27204033\n
|
||||
A: power/runtime_enabled=forbidden\n
|
||||
A: power/runtime_status=active\n
|
||||
A: power/runtime_suspended_time=0\n
|
||||
A: power/runtime_usage=1\n
|
||||
A: power/wakeup=disabled\n
|
||||
A: power/wakeup_abort_count=\n
|
||||
A: power/wakeup_active=\n
|
||||
A: power/wakeup_active_count=\n
|
||||
A: power/wakeup_count=\n
|
||||
A: power/wakeup_expire_count=\n
|
||||
A: power/wakeup_last_time_ms=\n
|
||||
A: power/wakeup_max_time_ms=\n
|
||||
A: power/wakeup_total_time_ms=\n
|
||||
A: product=FPC L:0001 FW:127010\n
|
||||
A: quirks=0x0\n
|
||||
A: removable=removable\n
|
||||
A: rx_lanes=1\n
|
||||
A: speed=12\n
|
||||
A: tx_lanes=1\n
|
||||
A: urbnum=31\n
|
||||
A: version= 2.00\n
|
||||
|
||||
P: /devices/pci0000:00/0000:00:14.0/usb1
|
||||
N: bus/usb/001/001=12010002090001406B1D020013050302010109021900010100E0000904000001090000000705810304000C
|
||||
E: DEVNAME=/dev/bus/usb/001/001
|
||||
E: DEVTYPE=usb_device
|
||||
E: DRIVER=usb
|
||||
E: PRODUCT=1d6b/2/513
|
||||
E: TYPE=9/0/1
|
||||
E: BUSNUM=001
|
||||
E: DEVNUM=001
|
||||
E: MAJOR=189
|
||||
E: MINOR=0
|
||||
E: SUBSYSTEM=usb
|
||||
E: ID_VENDOR=Linux_5.13.0-52-generic_xhci-hcd
|
||||
E: ID_VENDOR_ENC=Linux\x205.13.0-52-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=0513
|
||||
E: ID_SERIAL=Linux_5.13.0-52-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:
|
||||
E: ID_VENDOR_FROM_DATABASE=Linux Foundation
|
||||
E: ID_AUTOSUSPEND=1
|
||||
E: ID_MODEL_FROM_DATABASE=2.0 root hub
|
||||
E: ID_PATH=pci-0000:00:14.0
|
||||
E: ID_PATH_TAG=pci-0000_00_14_0
|
||||
E: ID_FOR_SEAT=usb-pci-0000_00_14_0
|
||||
E: TAGS=:seat:
|
||||
E: CURRENT_TAGS=:seat:
|
||||
A: authorized=1\n
|
||||
A: authorized_default=1\n
|
||||
A: avoid_reset_quirk=0\n
|
||||
A: bConfigurationValue=1\n
|
||||
A: bDeviceClass=09\n
|
||||
A: bDeviceProtocol=01\n
|
||||
A: bDeviceSubClass=00\n
|
||||
A: bMaxPacketSize0=64\n
|
||||
A: bMaxPower=0mA\n
|
||||
A: bNumConfigurations=1\n
|
||||
A: bNumInterfaces= 1\n
|
||||
A: bcdDevice=0513\n
|
||||
A: bmAttributes=e0\n
|
||||
A: busnum=1\n
|
||||
A: configuration=
|
||||
H: descriptors=12010002090001406B1D020013050302010109021900010100E0000904000001090000000705810304000C
|
||||
A: dev=189:0\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
|
||||
A: idProduct=0002\n
|
||||
A: idVendor=1d6b\n
|
||||
A: interface_authorized_default=1\n
|
||||
A: ltm_capable=no\n
|
||||
A: manufacturer=Linux 5.13.0-52-generic xhci-hcd\n
|
||||
A: maxchild=12\n
|
||||
A: power/active_duration=32728176\n
|
||||
A: power/async=enabled\n
|
||||
A: power/autosuspend=0\n
|
||||
A: power/autosuspend_delay_ms=0\n
|
||||
A: power/connected_duration=32728176\n
|
||||
A: power/control=auto\n
|
||||
A: power/level=auto\n
|
||||
A: power/runtime_active_kids=2\n
|
||||
A: power/runtime_active_time=32728177\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
|
||||
A: power/wakeup_active_count=\n
|
||||
A: power/wakeup_count=\n
|
||||
A: power/wakeup_expire_count=\n
|
||||
A: power/wakeup_last_time_ms=\n
|
||||
A: power/wakeup_max_time_ms=\n
|
||||
A: power/wakeup_total_time_ms=\n
|
||||
A: product=xHCI Host Controller\n
|
||||
A: quirks=0x0\n
|
||||
A: removable=unknown\n
|
||||
A: rx_lanes=1\n
|
||||
A: serial=0000:00:14.0\n
|
||||
A: speed=480\n
|
||||
A: tx_lanes=1\n
|
||||
A: urbnum=1353\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:9D2F
|
||||
E: PCI_SUBSYS_ID=103C:8079
|
||||
E: PCI_SLOT_NAME=0000:00:14.0
|
||||
E: MODALIAS=pci:v00008086d00009D2Fsv0000103Csd00008079bc0Csc03i30
|
||||
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=Sunrise Point-LP USB 3.0 xHCI Controller (EliteBook 840 G3)
|
||||
A: ari_enabled=0\n
|
||||
A: broken_parity_status=0\n
|
||||
A: class=0x0c0330\n
|
||||
H: config=86802F9D060490022130030C00008000040022E10000000000000000000000000000000000000000000000003C1079800000000070000000000000000B010000FD01348088C60F8000000000000000005F6ECE0F000000000000000000000000306000000000000000000000000000000180C2C1080000000000000000000000050087000480E0FE0000000022000000090014F01000400100000000C10A080000080400001800008F40020000010400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000B30F400800000000
|
||||
A: consistent_dma_mask_bits=64\n
|
||||
A: d3cold_allowed=1\n
|
||||
A: dbc=disabled\n
|
||||
A: device=0x9d2f\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=122\n
|
||||
A: local_cpulist=0-3\n
|
||||
A: local_cpus=f\n
|
||||
A: modalias=pci:v00008086d00009D2Fsv0000103Csd00008079bc0Csc03i30\n
|
||||
A: msi_bus=1\n
|
||||
A: msi_irqs/122=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 32 128 1\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 14 2112 14\nxHCI ring segments 34 44 4096 44\nbuffer-2048 0 0 2048 0\nbuffer-512 0 0 512 0\nbuffer-128 0 32 128 1\nbuffer-32 0 0 32 0\n
|
||||
A: power/async=enabled\n
|
||||
A: power/control=auto\n
|
||||
A: power/runtime_active_kids=1\n
|
||||
A: power/runtime_active_time=32728973\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
|
||||
A: power/wakeup_active_count=0\n
|
||||
A: power/wakeup_count=0\n
|
||||
A: power/wakeup_expire_count=0\n
|
||||
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=0x00000000e1220000 0x00000000e122ffff 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=0x21\n
|
||||
A: subsystem_device=0x8079\n
|
||||
A: subsystem_vendor=0x103c\n
|
||||
A: vendor=0x8086\n
|
||||
|
||||
Binary file not shown.
@@ -1,15 +1,9 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import traceback
|
||||
import sys
|
||||
import gi
|
||||
|
||||
gi.require_version('FPrint', '2.0')
|
||||
from gi.repository import FPrint, GLib
|
||||
|
||||
# Exit with error on any exception, included those happening in async callbacks
|
||||
sys.excepthook = lambda *args: (traceback.print_exception(*args), sys.exit(1))
|
||||
|
||||
ctx = GLib.main_context_default()
|
||||
|
||||
c = FPrint.Context()
|
||||
@@ -37,7 +31,7 @@ d.clear_storage_sync()
|
||||
template = FPrint.Print.new(d)
|
||||
|
||||
def enroll_progress(*args):
|
||||
assert d.get_finger_status() & FPrint.FingerStatusFlags.NEEDED
|
||||
assert d.get_finger_status() == FPrint.FingerStatusFlags.NEEDED
|
||||
print('enroll progress: ' + str(args))
|
||||
|
||||
def identify_done(dev, res):
|
||||
|
||||
@@ -1,30 +1,31 @@
|
||||
P: /devices/pci0000:00/0000:00:14.0/usb3/3-9
|
||||
N: bus/usb/003/004=12010002EF000040C627AC6300010102030109022000010103A0320904000002FF0000040705830240000007050102400000
|
||||
E: DEVNAME=/dev/bus/usb/003/004
|
||||
P: /devices/pci0000:00/0000:00:14.0/usb1/1-3
|
||||
N: bus/usb/001/023=12010002EF000040C627966400010102030109022000010103A0320904000002FF0000040705830240000007050102400000
|
||||
E: DEVNAME=/dev/bus/usb/001/023
|
||||
E: DEVTYPE=usb_device
|
||||
E: DRIVER=usb
|
||||
E: PRODUCT=27c6/63ac/100
|
||||
E: PRODUCT=27c6/6496/100
|
||||
E: TYPE=239/0/0
|
||||
E: BUSNUM=003
|
||||
E: DEVNUM=004
|
||||
E: BUSNUM=001
|
||||
E: DEVNUM=023
|
||||
E: MAJOR=189
|
||||
E: MINOR=259
|
||||
E: MINOR=22
|
||||
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=63ac
|
||||
E: ID_MODEL_ID=6496
|
||||
E: ID_REVISION=0100
|
||||
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_SERIAL=Goodix_Technology_Co.__Ltd._Goodix_USB2.0_MISC_XXXX_MOC_B0
|
||||
E: ID_SERIAL_SHORT=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_PATH=pci-0000:00:14.0-usb-0:9
|
||||
E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_9
|
||||
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
|
||||
A: authorized=1\n
|
||||
A: avoid_reset_quirk=0\n
|
||||
A: bConfigurationValue=1\n
|
||||
@@ -37,34 +38,30 @@ A: bNumConfigurations=1\n
|
||||
A: bNumInterfaces= 1\n
|
||||
A: bcdDevice=0100\n
|
||||
A: bmAttributes=a0\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
|
||||
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
|
||||
L: driver=../../../../../bus/usb/drivers/usb
|
||||
L: firmware_node=../../../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:13/device:14/device:1f
|
||||
A: idProduct=63ac\n
|
||||
L: firmware_node=../../../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:1c/device:1d/device:20
|
||||
A: idProduct=6496\n
|
||||
A: idVendor=27c6\n
|
||||
A: ltm_capable=no\n
|
||||
A: manufacturer=Goodix Technology Co., Ltd.\n
|
||||
A: maxchild=0\n
|
||||
L: port=../3-0:1.0/usb3-port9
|
||||
A: power/active_duration=702588\n
|
||||
A: power/async=enabled\n
|
||||
L: port=../1-0:1.0/usb1-port3
|
||||
A: power/active_duration=22667\n
|
||||
A: power/autosuspend=2\n
|
||||
A: power/autosuspend_delay_ms=2000\n
|
||||
A: power/connected_duration=78973756\n
|
||||
A: power/connected_duration=917616\n
|
||||
A: power/control=auto\n
|
||||
A: power/level=auto\n
|
||||
A: power/persist=1\n
|
||||
A: power/runtime_active_kids=0\n
|
||||
A: power/runtime_active_time=707156\n
|
||||
A: power/runtime_enabled=enabled\n
|
||||
A: power/runtime_active_time=22809\n
|
||||
A: power/runtime_status=active\n
|
||||
A: power/runtime_suspended_time=78265226\n
|
||||
A: power/runtime_usage=0\n
|
||||
A: power/runtime_suspended_time=894564\n
|
||||
A: power/wakeup=disabled\n
|
||||
A: power/wakeup_abort_count=\n
|
||||
A: power/wakeup_active=\n
|
||||
@@ -76,34 +73,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=fixed\n
|
||||
A: removable=removable\n
|
||||
A: rx_lanes=1\n
|
||||
A: serial=UID4C77C784_XXXX_MOC_B0\n
|
||||
A: serial=XXXX_MOC_B0\n
|
||||
A: speed=12\n
|
||||
A: tx_lanes=1\n
|
||||
A: urbnum=5759\n
|
||||
A: urbnum=298\n
|
||||
A: version= 2.00\n
|
||||
|
||||
P: /devices/pci0000:00/0000:00:14.0/usb3
|
||||
N: bus/usb/003/001=12010002090001406B1D020015050302010109021900010100E0000904000001090000000705810304000C
|
||||
E: DEVNAME=/dev/bus/usb/003/001
|
||||
P: /devices/pci0000:00/0000:00:14.0/usb1
|
||||
N: bus/usb/001/001=12010002090001406B1D020017050302010109021900010100E0000904000001090000000705810304000C
|
||||
E: DEVNAME=/dev/bus/usb/001/001
|
||||
E: DEVTYPE=usb_device
|
||||
E: DRIVER=usb
|
||||
E: PRODUCT=1d6b/2/515
|
||||
E: PRODUCT=1d6b/2/517
|
||||
E: TYPE=9/0/1
|
||||
E: BUSNUM=003
|
||||
E: BUSNUM=001
|
||||
E: DEVNUM=001
|
||||
E: MAJOR=189
|
||||
E: MINOR=256
|
||||
E: MINOR=0
|
||||
E: SUBSYSTEM=usb
|
||||
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=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_ID=1d6b
|
||||
E: ID_MODEL=xHCI_Host_Controller
|
||||
E: ID_MODEL_ENC=xHCI\x20Host\x20Controller
|
||||
E: ID_MODEL_ID=0002
|
||||
E: ID_REVISION=0515
|
||||
E: ID_SERIAL=Linux_5.15.0-57-generic_xhci-hcd_xHCI_Host_Controller_0000:00:14.0
|
||||
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_SERIAL_SHORT=0000:00:14.0
|
||||
E: ID_BUS=usb
|
||||
E: ID_USB_INTERFACES=:090000:
|
||||
@@ -126,35 +123,31 @@ A: bMaxPacketSize0=64\n
|
||||
A: bMaxPower=0mA\n
|
||||
A: bNumConfigurations=1\n
|
||||
A: bNumInterfaces= 1\n
|
||||
A: bcdDevice=0515\n
|
||||
A: bcdDevice=0517\n
|
||||
A: bmAttributes=e0\n
|
||||
A: busnum=3\n
|
||||
A: configuration=
|
||||
H: descriptors=12010002090001406B1D020015050302010109021900010100E0000904000001090000000705810304000C
|
||||
A: dev=189:256\n
|
||||
A: busnum=1\n
|
||||
A: configuration=\n
|
||||
H: descriptors=12010002090001406B1D020017050302010109021900010100E0000904000001090000000705810304000C
|
||||
A: dev=189:0\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:13/device:14
|
||||
L: firmware_node=../../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:1c/device:1d
|
||||
A: idProduct=0002\n
|
||||
A: idVendor=1d6b\n
|
||||
A: interface_authorized_default=1\n
|
||||
A: ltm_capable=no\n
|
||||
A: manufacturer=Linux 5.15.0-57-generic xhci-hcd\n
|
||||
A: manufacturer=Linux 5.17.12-300.fc36.x86_64 xhci-hcd\n
|
||||
A: maxchild=12\n
|
||||
A: power/active_duration=78971960\n
|
||||
A: power/async=enabled\n
|
||||
A: power/active_duration=164289796\n
|
||||
A: power/autosuspend=0\n
|
||||
A: power/autosuspend_delay_ms=0\n
|
||||
A: power/connected_duration=78974992\n
|
||||
A: power/connected_duration=164360220\n
|
||||
A: power/control=auto\n
|
||||
A: power/level=auto\n
|
||||
A: power/runtime_active_kids=2\n
|
||||
A: power/runtime_active_time=78973899\n
|
||||
A: power/runtime_enabled=enabled\n
|
||||
A: power/runtime_active_time=164331876\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
|
||||
@@ -171,52 +164,48 @@ A: rx_lanes=1\n
|
||||
A: serial=0000:00:14.0\n
|
||||
A: speed=480\n
|
||||
A: tx_lanes=1\n
|
||||
A: urbnum=1824\n
|
||||
A: urbnum=2097\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:51ED
|
||||
E: PCI_SUBSYS_ID=1028:0B00
|
||||
E: PCI_ID=8086:9DED
|
||||
E: PCI_SUBSYS_ID=17AA:2292
|
||||
E: PCI_SLOT_NAME=0000:00:14.0
|
||||
E: MODALIAS=pci:v00008086d000051EDsv00001028sd00000B00bc0Csc03i30
|
||||
E: MODALIAS=pci:v00008086d00009DEDsv000017AAsd00002292bc0Csc03i30
|
||||
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=8680ED51060490020130030C0000800004002A8F6200000000000000000000000000000000000000000000002810000B000000007000000000000000FF010000FD0134A089C27F8000000000000000003F6DD80F000000000000000000000000316000000000000000000000000000000180C2C1080000000000000000000000059087003808E0FE000000000000000009B014F01000400100000000C10A080000080E00001800008F50020000010000090000018680C00009001014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000B50F100112000000
|
||||
H: config=8680ED9D060490021130030C00008000040022EA000000000000000000000000000000000000000000000000AA179222000000007000000000000000FF010000FD0134808FC6FF8300000000000000007F6DDC0F00000000F507312600000000316000000000000000000000000000000180C2C1080000000000000000000000059087001803E0FE0000000000000000090014F01000400100000000C10A080000080E00001800008F40020000010000000000000000000008000000040000000000000000000000000000000000000000000000000000000800000004000000000000000000000000000000000000000000000000000000B50F320112000000
|
||||
A: consistent_dma_mask_bits=64\n
|
||||
A: d3cold_allowed=1\n
|
||||
A: dbc=disabled\n
|
||||
A: device=0x51ed\n
|
||||
A: device=0x9ded\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: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
|
||||
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
|
||||
A: msi_bus=1\n
|
||||
A: msi_irqs/167=msi\n
|
||||
A: msi_irqs/128=msi\n
|
||||
A: numa_node=-1\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: 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: power/control=auto\n
|
||||
A: power/runtime_active_kids=1\n
|
||||
A: power/runtime_active_time=78974886\n
|
||||
A: power/runtime_enabled=enabled\n
|
||||
A: power/runtime_active_time=164332777\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
|
||||
@@ -227,9 +216,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=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: 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: vendor=0x8086\n
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
<ignore_dl_open_leaks>
|
||||
Memcheck:Leak
|
||||
fun:malloc
|
||||
...
|
||||
fun:dlopen*
|
||||
}
|
||||
|
||||
{
|
||||
<ignore-gusb-get-string-desc-uninitialized-memory>
|
||||
Memcheck:Param
|
||||
socketcall.sendto(msg)
|
||||
...
|
||||
fun:send
|
||||
...
|
||||
fun:g_usb_device_get_string_descriptor
|
||||
...
|
||||
}
|
||||
|
||||
{
|
||||
<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.project_source_root())
|
||||
envs.set('MESON_BUILD_ROOT', meson.project_build_root())
|
||||
envs.prepend('LD_LIBRARY_PATH', meson.project_build_root() / 'libfprint')
|
||||
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'))
|
||||
|
||||
# Set FP_DEVICE_EMULATION so that drivers can adapt (e.g. to use fixed
|
||||
# random numbers rather than proper ones)
|
||||
@@ -19,17 +19,8 @@ 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',
|
||||
@@ -39,7 +30,6 @@ drivers_tests = [
|
||||
'elanspi',
|
||||
'synaptics',
|
||||
'upektc_img',
|
||||
'upektc_img-tcs1s',
|
||||
'uru4000-msv2',
|
||||
'uru4000-4500',
|
||||
'vfs0050',
|
||||
@@ -49,46 +39,34 @@ drivers_tests = [
|
||||
'goodixmoc',
|
||||
'nb1010',
|
||||
'egis0570',
|
||||
'fpcmoc',
|
||||
]
|
||||
|
||||
if get_option('introspection')
|
||||
conf = configuration_data()
|
||||
conf.set('SRCDIR', meson.project_source_root())
|
||||
conf.set('BUILDDIR', meson.project_build_root())
|
||||
conf.set('SRCDIR', meson.source_root())
|
||||
conf.set('BUILDDIR', meson.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', meson.project_build_root() / 'libfprint')
|
||||
envs.prepend('GI_TYPELIB_PATH', join_paths(meson.build_root(), 'libfprint'))
|
||||
virtual_devices_tests = [
|
||||
'virtual-image',
|
||||
'virtual-device',
|
||||
]
|
||||
|
||||
unittest_inspector = find_program('unittest_inspector.py')
|
||||
umockdev_test_name = 'umockdev-test.py'
|
||||
umockdev_test = find_program(umockdev_test_name)
|
||||
|
||||
foreach vdtest: virtual_devices_tests
|
||||
driver_name = '_'.join(vdtest.split('-'))
|
||||
if driver_name in drivers
|
||||
python3 = find_program('python3')
|
||||
base_args = files(vdtest + '.py')
|
||||
suite = ['virtual-driver']
|
||||
|
||||
r = run_command(unittest_inspector, files(vdtest + '.py'), check: true)
|
||||
r = run_command(unittest_inspector, files(vdtest + '.py'))
|
||||
unit_tests = r.stdout().strip().split('\n')
|
||||
|
||||
if r.returncode() == 0 and unit_tests.length() > 0
|
||||
@@ -112,31 +90,6 @@ 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'),
|
||||
@@ -145,7 +98,6 @@ if get_option('introspection')
|
||||
endif
|
||||
endforeach
|
||||
|
||||
driver_tests_enabled = false
|
||||
foreach driver_test: drivers_tests
|
||||
driver_name = driver_test.split('-')[0]
|
||||
driver_envs = envs
|
||||
@@ -153,44 +105,14 @@ 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: [
|
||||
umockdev_test.full_path(),
|
||||
meson.current_source_dir() / driver_test,
|
||||
],
|
||||
find_program('umockdev-test.py'),
|
||||
args: join_paths(meson.current_source_dir(), driver_test),
|
||||
env: driver_envs,
|
||||
suite: ['drivers'],
|
||||
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'),
|
||||
@@ -198,17 +120,6 @@ 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',
|
||||
@@ -248,7 +159,7 @@ endif
|
||||
unit_tests_deps = { 'fpi-assembling' : [cairo_dep] }
|
||||
|
||||
test_config = configuration_data()
|
||||
test_config.set_quoted('SOURCE_ROOT', meson.project_source_root())
|
||||
test_config.set_quoted('SOURCE_ROOT', meson.source_root())
|
||||
test_config_h = configure_file(output: 'test-config.h', configuration: test_config)
|
||||
|
||||
foreach test_name: unit_tests
|
||||
@@ -281,28 +192,13 @@ foreach test_name: unit_tests
|
||||
sources: [basename + '.c', test_config_h],
|
||||
dependencies: [ libfprint_private_dep ] + extra_deps,
|
||||
c_args: common_cflags,
|
||||
link_whole: test_utils,
|
||||
install: installed_tests,
|
||||
install_dir: installed_tests_execdir,
|
||||
link_with: test_utils,
|
||||
)
|
||||
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
|
||||
@@ -310,13 +206,12 @@ envs.set('UDEV_HWDB', udev_hwdb.full_path())
|
||||
envs.set('UDEV_HWDB_CHECK_CONTENTS', default_drivers_are_enabled ? '1' : '0')
|
||||
test('udev-hwdb',
|
||||
find_program('test-generated-hwdb.sh'),
|
||||
depends: udev_hwdb,
|
||||
env: envs)
|
||||
|
||||
gdb = find_program('gdb', required: false)
|
||||
if gdb.found()
|
||||
libfprint_wrapper = [
|
||||
gdb.full_path(),
|
||||
gdb.path(),
|
||||
'-batch',
|
||||
'-ex', 'run',
|
||||
'--args',
|
||||
@@ -333,27 +228,17 @@ 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.project_source_root(),
|
||||
files('libfprint.supp')[0])
|
||||
python_suppressions = '@0@/@1@'.format(meson.project_source_root(),
|
||||
python_suppressions = '@0@/@1@'.format(meson.source_root(),
|
||||
files('valgrind-python.supp')[0])
|
||||
libfprint_wrapper = [
|
||||
valgrind.full_path(),
|
||||
valgrind.path(),
|
||||
'--tool=memcheck',
|
||||
'--leak-check=full',
|
||||
'--leak-resolution=high',
|
||||
'--error-exitcode=1',
|
||||
'--errors-for-leak-kinds=definite',
|
||||
'--track-origins=yes',
|
||||
'--show-leak-kinds=definite,possible',
|
||||
'--show-error-list=yes',
|
||||
'--gen-suppressions=all',
|
||||
'--suppressions=' + libfprint_suppressions,
|
||||
'--suppressions=' + glib_suppressions,
|
||||
'--suppressions=' + python_suppressions,
|
||||
]
|
||||
add_test_setup('valgrind',
|
||||
timeout_multiplier: 15,
|
||||
timeout_multiplier: 10,
|
||||
exe_wrapper: libfprint_wrapper,
|
||||
env: [
|
||||
'G_SLICE=always-malloc',
|
||||
|
||||
@@ -51,7 +51,7 @@ d.clear_storage_sync()
|
||||
template = FPrint.Print.new(d)
|
||||
|
||||
def enroll_progress(*args):
|
||||
assert d.get_finger_status() & FPrint.FingerStatusFlags.NEEDED
|
||||
#assert d.get_finger_status() == FPrint.FingerStatusFlags.NEEDED
|
||||
print('enroll progress: ' + str(args))
|
||||
|
||||
# List, enroll, list, verify, delete, list
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#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)
|
||||
@@ -30,28 +29,12 @@ 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);
|
||||
|
||||
@@ -72,7 +55,6 @@ 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);
|
||||
|
||||
@@ -90,7 +72,6 @@ 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);
|
||||
|
||||
@@ -109,7 +90,6 @@ 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);
|
||||
|
||||
@@ -138,7 +118,6 @@ 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);
|
||||
|
||||
@@ -170,7 +149,6 @@ 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);
|
||||
|
||||
@@ -209,7 +187,6 @@ fpi_device_fake_identify (FpDevice *device)
|
||||
else
|
||||
{
|
||||
fpi_device_identify_complete (device, fake_dev->ret_error);
|
||||
g_clear_object (&fake_dev->ret_print);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,7 +196,6 @@ 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);
|
||||
|
||||
@@ -239,7 +215,6 @@ 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);
|
||||
|
||||
@@ -257,7 +232,6 @@ 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);
|
||||
|
||||
@@ -276,7 +250,6 @@ 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);
|
||||
|
||||
@@ -294,7 +267,6 @@ 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);
|
||||
}
|
||||
@@ -304,7 +276,6 @@ 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));
|
||||
@@ -315,7 +286,6 @@ 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));
|
||||
|
||||
@@ -233,33 +233,50 @@ test_device_has_storage (void)
|
||||
}
|
||||
|
||||
static void
|
||||
test_device_identify_cancelled (void)
|
||||
test_device_persistent_data (void)
|
||||
{
|
||||
g_autoptr(GCancellable) cancellable = NULL;
|
||||
g_autoptr(GPtrArray) prints = NULL;
|
||||
g_autoptr(GError) error = NULL;
|
||||
g_autoptr(FptContext) tctx = fpt_context_new_with_virtual_device (FPT_VIRTUAL_DEVICE_IMAGE);
|
||||
|
||||
fp_device_open_sync (tctx->device, NULL, NULL);
|
||||
|
||||
prints = g_ptr_array_new ();
|
||||
cancellable = g_cancellable_new ();
|
||||
g_cancellable_cancel (cancellable);
|
||||
g_assert_false (fp_device_identify_sync (tctx->device, prints, cancellable,
|
||||
NULL, NULL, NULL, NULL, &error));
|
||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED);
|
||||
}
|
||||
|
||||
static void
|
||||
test_device_identify_null_prints (void)
|
||||
{
|
||||
g_autoptr(GVariant) initial = NULL;
|
||||
g_autoptr(GVariant) loaded = NULL;
|
||||
g_autoptr(GError) error = NULL;
|
||||
g_autoptr(FptContext) tctx = fpt_context_new_with_virtual_device (FPT_VIRTUAL_DEVICE_IMAGE);
|
||||
guint8 *data = (guint8 *) 0xdeadbeef;
|
||||
gsize length = 1;
|
||||
|
||||
fp_device_open_sync (tctx->device, NULL, NULL);
|
||||
g_assert_false (fp_device_identify_sync (tctx->device, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, &error));
|
||||
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_DATA_INVALID);
|
||||
initial = g_variant_ref_sink (g_variant_new ("(s)", "stored data"));
|
||||
|
||||
g_assert_true (fp_device_get_persistent_data (tctx->device, &data, &length, &error));
|
||||
g_assert_cmpint (length, ==, 0);
|
||||
g_assert_null (data);
|
||||
g_assert_no_error (error);
|
||||
|
||||
/* Use the fact that this is a property that we can poke from the outside. */
|
||||
g_object_set (tctx->device, "fpi-persistent-data", initial, NULL);
|
||||
|
||||
/* Works now */
|
||||
g_assert_true (fp_device_get_persistent_data (tctx->device, &data, &length, &error));
|
||||
g_assert_cmpint (length, !=, 0);
|
||||
g_assert_nonnull (data);
|
||||
g_assert_no_error (error);
|
||||
|
||||
/* We can't load the data, as data has been set already. */
|
||||
g_assert_false (fp_device_set_persistent_data (tctx->device, data, length, &error));
|
||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_EXISTS);
|
||||
g_clear_pointer (&error, g_error_free);
|
||||
|
||||
/* Abuse that we can "load" again if the data is set to NULL.
|
||||
* This is an implementation detail and just a lack of error checking. */
|
||||
g_object_set (tctx->device, "fpi-persistent-data", NULL, NULL);
|
||||
|
||||
/* Incomplete data, causes parsing error */
|
||||
g_assert_false (fp_device_set_persistent_data (tctx->device, data, 5, &error));
|
||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA);
|
||||
g_clear_pointer (&error, g_error_free);
|
||||
|
||||
g_assert_true (fp_device_set_persistent_data (tctx->device, data, length, &error));
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_object_get (tctx->device, "fpi-persistent-data", &loaded, NULL);
|
||||
g_assert_cmpvariant (initial, loaded);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -282,8 +299,7 @@ main (int argc, char *argv[])
|
||||
g_test_add_func ("/device/sync/supports_identify", test_device_supports_identify);
|
||||
g_test_add_func ("/device/sync/supports_capture", test_device_supports_capture);
|
||||
g_test_add_func ("/device/sync/has_storage", test_device_has_storage);
|
||||
g_test_add_func ("/device/sync/identify/cancelled", test_device_identify_cancelled);
|
||||
g_test_add_func ("/device/sync/identify/null-prints", test_device_identify_null_prints);
|
||||
g_test_add_func ("/device/persistent_data", test_device_persistent_data);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
@@ -30,10 +30,8 @@
|
||||
#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 */
|
||||
|
||||
@@ -71,9 +69,7 @@ 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};
|
||||
@@ -1116,7 +1112,6 @@ test_driver_enroll_update_nbis_wrong_device (void)
|
||||
fake_dev = FPI_DEVICE_FAKE (device);
|
||||
|
||||
template_print = make_fake_nbis_print (device);
|
||||
g_clear_pointer (&template_print->device_id, g_free);
|
||||
template_print->device_id = g_strdup ("wrong_device");
|
||||
fake_dev->ret_print = template_print;
|
||||
|
||||
@@ -1143,7 +1138,6 @@ test_driver_enroll_update_nbis_wrong_driver (void)
|
||||
fake_dev = FPI_DEVICE_FAKE (device);
|
||||
|
||||
template_print = make_fake_nbis_print (device);
|
||||
g_clear_pointer (&template_print->driver, g_free);
|
||||
template_print->driver = g_strdup ("wrong_driver");
|
||||
fake_dev->ret_print = template_print;
|
||||
|
||||
@@ -2392,11 +2386,6 @@ test_driver_identify_warmup_cooldown (void)
|
||||
g_assert_true (identify_data->called);
|
||||
g_assert_error (identify_data->error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_TOO_HOT);
|
||||
|
||||
/* Try to identify again, and ensure that we fail early */
|
||||
fp_device_identify_sync (device, prints, NULL, NULL, NULL, NULL, NULL, &error);
|
||||
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_TOO_HOT);
|
||||
g_clear_error (&error);
|
||||
|
||||
/* Now, wait for it to cool down again;
|
||||
* WARM should be reached after about 2s
|
||||
* COLD after 5s but give it some more slack. */
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
if [ ! -x "$UDEV_HWDB" ]; then
|
||||
echo "E: UDEV_HWDB (${UDEV_HWDB}) unset or not executable."
|
||||
exit 1
|
||||
fi
|
||||
[ -x "$UDEV_HWDB" ] || exit 1
|
||||
|
||||
if [ "$UDEV_HWDB_CHECK_CONTENTS" == 1 ]; then
|
||||
generated_rules=$(mktemp "${TMPDIR:-/tmp}/libfprint-XXXXXX.hwdb")
|
||||
@@ -13,10 +10,6 @@ else
|
||||
fi
|
||||
|
||||
$UDEV_HWDB > "$generated_rules"
|
||||
if [ $? != 0 ]; then
|
||||
echo "E: UDEV_HWDB (${UDEV_HWDB}) failed to run without error."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$UDEV_HWDB_CHECK_CONTENTS" != 1 ]; then
|
||||
exit 77
|
||||
@@ -24,7 +17,7 @@ fi
|
||||
|
||||
if ! diff -u "$MESON_SOURCE_ROOT/data/autosuspend.hwdb" "$generated_rules"; then
|
||||
echo "E: Autosuspend file needs to be re-generated!"
|
||||
echo " ninja -C $MESON_BUILD_ROOT sync-udev-hwdb"
|
||||
echo " ninja -C $MESON_BUILD_ROOT libfprint/sync-udev-hwdb"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
[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@
|
||||
@@ -14,7 +14,7 @@ if len(sys.argv) != 2:
|
||||
# Check that umockdev is available
|
||||
try:
|
||||
umockdev_version = subprocess.check_output(['umockdev-run', '--version'])
|
||||
version = tuple(int(_) for _ in umockdev_version.split(b'.')[:3])
|
||||
version = tuple(int(_) for _ in umockdev_version.split(b'.'))
|
||||
if version < (0, 13, 2):
|
||||
print('umockdev is too old for test to be reliable, expect random failures!')
|
||||
print('Please update umockdev to at least 0.13.2.')
|
||||
|
||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 74 KiB |
File diff suppressed because one or more lines are too long
@@ -40,20 +40,6 @@
|
||||
fun:_Py*
|
||||
}
|
||||
|
||||
{
|
||||
ignore__py_addr32
|
||||
Memcheck:Addr32
|
||||
...
|
||||
fun:_Py*
|
||||
}
|
||||
|
||||
{
|
||||
ignore__py_addr32
|
||||
Memcheck:Addr32
|
||||
...
|
||||
fun:Py*
|
||||
}
|
||||
|
||||
{
|
||||
ignore_py_leaks
|
||||
Memcheck:Leak
|
||||
|
||||
@@ -22,9 +22,6 @@ except Exception as e:
|
||||
|
||||
FPrint = None
|
||||
|
||||
# Exit with error on any exception, included those happening in async callbacks
|
||||
sys.excepthook = lambda *args: (traceback.print_exception(*args), sys.exit(1))
|
||||
|
||||
ctx = GLib.main_context_default()
|
||||
|
||||
|
||||
@@ -59,17 +56,6 @@ 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()
|
||||
@@ -84,28 +70,26 @@ 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._driver_name = 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)
|
||||
|
||||
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)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
shutil.rmtree(cls.tmpdir)
|
||||
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()
|
||||
@@ -114,13 +98,8 @@ 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):
|
||||
@@ -256,11 +235,10 @@ class VirtualDeviceBase(unittest.TestCase):
|
||||
self.assertEqual(self.dev.get_finger_status(), FPrint.FingerStatusFlags.NONE)
|
||||
|
||||
self.assertEqual(self._enrolled.get_device_stored(),
|
||||
bool(self.dev.get_features() & FPrint.DeviceFeature.STORAGE))
|
||||
self.dev.has_storage())
|
||||
self.assertEqual(self._enrolled.props.driver, self.dev.get_driver())
|
||||
self.assertEqual(self._enrolled.props.device_id, self.dev.get_device_id())
|
||||
self.assertEqual(self._enrolled.props.device_stored,
|
||||
bool(self.dev.get_features() & FPrint.DeviceFeature.STORAGE))
|
||||
self.assertEqual(self._enrolled.props.device_stored, self.dev.has_storage())
|
||||
self.assertEqual(self._enrolled.props.fpi_data.unpack(), nick)
|
||||
self.assertIsNone(self._enrolled.props.image)
|
||||
|
||||
@@ -344,112 +322,10 @@ class VirtualDeviceBase(unittest.TestCase):
|
||||
else:
|
||||
self.assertFalse(match)
|
||||
|
||||
if (isinstance(scan_nick, str) and not
|
||||
self.dev.get_features() & FPrint.DeviceFeature.STORAGE):
|
||||
if isinstance(scan_nick, str) and not self.dev.has_storage():
|
||||
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):
|
||||
@@ -458,8 +334,7 @@ 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(),
|
||||
self.DEFAULT_ENROLL_STEPS)
|
||||
self.assertEqual(self.dev.get_nr_enroll_stages(), 5)
|
||||
self.assertFalse(self.dev.supports_identify())
|
||||
self.assertFalse(self.dev.supports_capture())
|
||||
self.assertFalse(self.dev.has_storage())
|
||||
@@ -717,7 +592,7 @@ class VirtualDevice(VirtualDeviceBase):
|
||||
self.send_command('SCAN', 'another-id')
|
||||
verify_match, verify_fp = self.dev.verify_sync(enrolled)
|
||||
self.assertFalse(verify_match)
|
||||
if self.dev.get_features() & FPrint.DeviceFeature.STORAGE:
|
||||
if self.dev.has_storage():
|
||||
self.assertIsNone(verify_fp)
|
||||
else:
|
||||
self.assertFalse(verify_fp.equal(enrolled))
|
||||
@@ -820,6 +695,69 @@ 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)
|
||||
|
||||
|
||||
@@ -21,9 +21,6 @@ except Exception as e:
|
||||
|
||||
FPrint = None
|
||||
|
||||
# Exit with error on any exception, included those happening in async callbacks
|
||||
sys.excepthook = lambda *args: (traceback.print_exception(*args), sys.exit(1))
|
||||
|
||||
def load_image(img):
|
||||
png = cairo.ImageSurface.create_from_png(img)
|
||||
|
||||
@@ -46,15 +43,12 @@ def load_image(img):
|
||||
|
||||
return img
|
||||
|
||||
if 'FP_PRINTS_PATH' in os.environ:
|
||||
prints_path = os.environ['FP_PRINTS_PATH']
|
||||
else:
|
||||
if 'MESON_SOURCE_ROOT' in os.environ:
|
||||
if hasattr(os.environ, 'MESON_SOURCE_ROOT'):
|
||||
root = os.environ['MESON_SOURCE_ROOT']
|
||||
else:
|
||||
else:
|
||||
root = os.path.join(os.path.dirname(__file__), '..')
|
||||
|
||||
prints_path = os.path.join(root, 'examples', 'prints')
|
||||
imgdir = os.path.join(root, 'examples', 'prints')
|
||||
|
||||
ctx = GLib.main_context_default()
|
||||
|
||||
@@ -79,12 +73,10 @@ 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(prints_path, '*.png')):
|
||||
for f in glob.glob(os.path.join(imgdir, '*.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)
|
||||
@@ -242,8 +234,7 @@ class VirtualImage(unittest.TestCase):
|
||||
self.assertEqual(self.dev.get_finger_status(), FPrint.FingerStatusFlags.NONE)
|
||||
self.assertEqual(self._enrolled.props.driver, self.dev.get_driver())
|
||||
self.assertEqual(self._enrolled.props.device_id, self.dev.get_device_id())
|
||||
self.assertEqual(self._enrolled.props.device_stored,
|
||||
bool(self.dev.get_features() & FPrint.DeviceFeature.STORAGE))
|
||||
self.assertEqual(self._enrolled.props.device_stored, self.dev.has_storage())
|
||||
self.assertIsNone(self._enrolled.get_image())
|
||||
|
||||
return self._enrolled
|
||||
|
||||
Reference in New Issue
Block a user