Commit graph

1273 commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
88a38c38af virtual-device: Add support for sleeping and sending errors on list and delete 2021-01-26 16:54:14 +01:00
Marco Trevisan (Treviño)
7ffcc2f9e7 virtual-device: Make possible to inject sleep events while verifying/identifying
Each command should be separated by SLEEP to be considered as something
we want to perform during the current operation, otherwise will be used
by next operation consuming it.
2021-01-26 16:53:24 +01:00
Marco Trevisan (Treviño)
1dae6796f7 virtual-device: Report finger presency when we receive a 'SCAN' event 2021-01-26 04:49:50 +01:00
Marco Trevisan (Treviño)
0bb0492025 virtual-device: Mark finger as needed only after we start scanning
In case we sent a sleep event to the device we may want to wait it to
emit the finger needed state before the timeout is completed.

So add a function to manage this for all the scan cases
2021-01-26 04:49:50 +01:00
Marco Trevisan (Treviño)
3db0858fb0 tests/virtual-device: Add a class function to wait for a timeout 2021-01-26 04:49:50 +01:00
Marco Trevisan (Treviño)
2382506491 virtual-device: Add checks for verify reports 2021-01-26 04:49:50 +01:00
Benjamin Berg
08f4be707c uru4000: Call irq stop handler immediately if the transfer is cancelled
The irq handler may already be stopped if stop_irq_handler is called. In
that case, we should immediately call the handler rather than just never
calling it.

This fixes deactivation when the device is unexpectedly unplugged.

Closes: #355
2021-01-25 16:56:12 +00:00
Marco Trevisan (Treviño)
3693c39bc5 virtual-device: Make cancellation support toggable
We may want to have the device to sleep while releasing an operation,
this will allow to do it.
2021-01-25 17:40:49 +01:00
Marco Trevisan (Treviño)
993109a7f8 virtual-device: Implement cancel vfunc, to stop timeouts 2021-01-25 17:40:49 +01:00
Marco Trevisan (Treviño)
18db20d160 virtual-device: Add support for sleep command
It can be used to delay operations, simulating a busy device.
2021-01-25 17:40:48 +01:00
Marco Trevisan (Treviño)
89b4c4ee75 virtual-device: Test unplug operation while we're verifying 2021-01-25 17:40:15 +01:00
Marco Trevisan (Treviño)
153b24a95a virtual-device: Use identify function for verify tests when possible 2021-01-25 17:40:15 +01:00
Marco Trevisan (Treviño)
8c45c0952e virtual-device: Split verify check function in two parts to be reusable
We can so inject further operations in the middle, such as for the
finger status check
2021-01-25 17:40:15 +01:00
Marco Trevisan (Treviño)
c3ece8621d virtual-device: Implement UNPLUG operation 2021-01-25 17:40:15 +01:00
Marco Trevisan (Treviño)
67cb61cc18 tests/virtual-device: Add identification tests
Reusing most of the logic of the `check_verify` utility function
2021-01-25 17:40:15 +01:00
Marco Trevisan (Treviño)
33ffadf402 tests/virtual-device: Cleanup device storage on teardown 2021-01-25 17:40:15 +01:00
Marco Trevisan (Treviño)
162a83e484 tests/virtual-device: Add ability to enroll with a retry step and test it 2021-01-25 17:40:15 +01:00
Marco Trevisan (Treviño)
dfb27222eb tests/virtual-device: Add function that figures out the command from type 2021-01-25 17:40:15 +01:00
Marco Trevisan (Treviño)
81e53c422d virtual-device: Add support for changing the device scan type 2021-01-25 17:40:15 +01:00
Marco Trevisan (Treviño)
be0b4ae2bb tests/virtual-device: Trigger new scans when we got progress callback 2021-01-25 17:40:15 +01:00
Marco Trevisan (Treviño)
56bcf1ffdd virtual-device: Add command to change the number of enroll stages
As per this don't use the class value anymore at enroll phase, as it may
differ.
2021-01-25 17:40:15 +01:00
Marco Trevisan (Treviño)
665de7813b fpi-device: Ensure we're receiving a valid number of enroll stages 2021-01-25 17:40:15 +01:00
Marco Trevisan (Treviño)
a291d17f26 virtual-device: Properly cleanup the virtual devices data
Ensure we call the parent finalize function and cleanup local data
2021-01-25 17:40:15 +01:00
Marco Trevisan (Treviño)
e8886dbc6b virtual-device: Support all the configured enrolling stages 2021-01-25 17:40:15 +01:00
Marco Trevisan (Treviño)
3d6fb15b5c virtual-device: Add API to change current finger status 2021-01-25 17:40:15 +01:00
Marco Trevisan (Treviño)
43d0dfdd8f virtual-device-storage: Set needed finger state on enroll and verify 2021-01-25 17:40:15 +01:00
Marco Trevisan (Treviño)
50f522583e virtual-device: Set needed finger state on enroll and verify 2021-01-25 17:40:15 +01:00
Marco Trevisan (Treviño)
f0443ba2f3 virtual-device: Add support for reporting device Retry "errors" 2021-01-25 17:40:15 +01:00
Marco Trevisan (Treviño)
546f35132c tests/virtual-device: Use FPrint.DeviceError values to send errors 2021-01-25 17:40:15 +01:00
Marco Trevisan (Treviño)
ce9527d2cb virtual-device: Wait for delayed commands to be processed
This allows to mimick the image device better, so that we can start an
operation and send the commands within some delay.
2021-01-25 17:40:13 +01:00
Benjamin Berg
89890dbd1f build: Explicitly mark libfprint as a shared library
While meson suggests to always use 'library' this leads to some unwanted
behaviors when it comes to generate pkg-config files for it, as they
will include `Libs.Private` / `Required.private` fields that should not
be really part of a shared library as libfprint is meant to be used.
2021-01-21 17:36:41 +01:00
fengqiangguo
e0c41c5444 goodixmoc: Fix some big/little endian support issues
Goodix driver is not working fine in BigEndian architectures. This
commit fixes some of these issues.

Related: #236
2021-01-21 16:21:06 +00:00
Marco Trevisan (Treviño)
3b83157e9b build: Skip the hwdb test if not all drivers are really enabled 2021-01-21 15:55:44 +00:00
Marco Trevisan (Treviño)
57f836a0f6 udev-hwdb: Generate autosuspend list using a sorted list 2021-01-21 15:55:44 +00:00
Marco Trevisan (Treviño)
170924ee4f test-generated-hwdb: Just use diff to compare for being more informative 2021-01-21 15:55:44 +00:00
Benjamin Berg
63bfaf4f60 tests: Add trailing newline to busname/devname sysfs attributes
libusb 1.0.24 now expects busnum/devnum to be \n terminated. Update the
device descriptions accordingly.

https://github.com/martinpitt/umockdev/issues/115
2021-01-21 11:28:47 +00:00
Marco Trevisan (Treviño)
2f6adce2fa data: Keep using versioned libname for hwdb file 2021-01-21 01:17:02 +01:00
Marco Trevisan (Treviño)
018641ad20 build: Ensure we process the data dir 2021-01-21 00:58:08 +01:00
Benjamin Berg
8ded064e65 tests: Add test based on the new virtual devices
Co-authored-by: Marco Trevisan (Treviño) <mail@3v1n0.net>
2021-01-20 23:21:41 +01:00
Benjamin Berg
3f7a638eed virtual-device: Add non-image mock devices
There are two variants one with storage and identify support and the
other without storage.

It implements the following commands:
 * INSERT id
 * REMOVE id
 * SCAN id
 * ERROR error-code
 * LIST (returns saved print)

The INSERT/REMOVE/LIST commands are only available in the storage
driver. The SCAN command emulates presenting a finger.

These commands can be send ahead of time, and will be queued and
processed when appropriate. i.e. for INSERT/REMOVE that is immediately
when possible, for SCAN/ERROR processing is delayed.

The LIST command is always processed immediately.

Note that only a single command can be send per socket connection and
the command must be send in a single message. The socket will be closed
after the command has been processed.

Co-authored-by: Bastien Nocera <hadess@hadess.net>
Co-authored-by: Marco Trevisan (Treviño) <mail@3v1n0.net>
2021-01-20 23:21:41 +01:00
Benjamin Berg
253750ec08 virtual-device-listener: Add a device socket handler class
Instead of repeating the same code in both the virtual-image and the
virtual-device drivers, implement a class to handle the socket listening
an data reading.

Co-authored-by: Marco Trevisan (Treviño) <mail@3v1n0.net>
2021-01-20 23:21:04 +01:00
Benjamin Berg
5df14206d8 tests: Add support for creating other virtual readers
Add support for creating more virtual readers.

Co-authored-by: Bastien Nocera <hadess@hadess.net>
2021-01-20 23:21:04 +01:00
Marco Trevisan (Treviño)
2f2da87240 list-udev-hwdb: Add SPDX license to the generated file
And update it...
2021-01-20 22:03:40 +01:00
Marco Trevisan (Treviño)
533180a2e6 data: Use auto-generated but hardcoded autosuspend hwdb file
This solves various problems:
 1. It stays the same also if some drivers have been disabled
 2. It uses a stable path for being imported by systemd
 3. It is still checked for its validity by tests
 4. It can be auto-generated using a simple command
2021-01-20 21:17:42 +01:00
Marco Trevisan (Treviño)
99c269b3fe meson: Do not support drivers known to fail in Big Endian archs
When building in big endian architectures some device tests will fail,
as per this we're pretty sure that most of the drivers are not ready
to work in big-endian architectures.
Since we're aware of this, better to just stop supporting those drivers
instead of having each distribution to handle the problem.

So, add a list of supported drivers that is filled depending the
architecture type we're building on. Keep continue building those
drivers since we want to at least test-build them, but do not expose
them as libfprint drivers, so if a device in the system uses any of them
will be ignored.

At the same time, we keep track of the problem, so that we can fix the
drivers.

Related to #236
2021-01-20 18:29:05 +01:00
Benjamin Berg
66fc93eeff udev-hwdb: Prevent devices from being listed twice
The change to print a warning (for testing purposes) from commit
944e0d0383 (udev-rules: Print warning if an ID is supported) was
incorrect because it prevented duplicated to be suppressed if a device
is listed by two independent drivers.
2021-01-20 18:02:31 +01:00
Benjamin Berg
284f6f1ef8 ci: Add check that wiki and generator are in sync
Add a new test that checks that the unsupported list is not out of date.
As the wiki can be edited at any time, add this as a further optional
check into the CI pipeline.
2021-01-20 17:21:38 +01:00
Benjamin Berg
1f2d723485 Drop version from libfprint hwdb
As we are shipping a hwdb file now, we cannot have a collision with the
old libfprint version. Also, we are going to pull these rules into
systemd and they will not be installed via libfprint in the future. As
such, collisions will not happen again and it makes more sense like this
for systemd.
2021-01-20 17:21:38 +01:00
Benjamin Berg
f6179d6cc4 ci: Export hwdb into artefacts 2021-01-20 17:19:42 +01:00
Benjamin Berg
cbce56c142 meson: Always build hwdb file
We want systemd to pull our hwdb. In order to ease this, always build
the hwdb file, even if it is disabled.

Once systemd has merged the rules, downstream should turn off the rules
in libfprint. The default in libfprint will also be changed to not build
the hwdb (udev_rules option) eventually.
2021-01-19 14:22:05 +01:00