Commit graph

77 commits

Author SHA1 Message Date
Benjamin Berg 7fcce7891a spi-transfer: Add SPI transfer helper routines
These routines assume that any messages is composed of a write and/or
read part. While the API allows sending and receiving as part of one
messages/transfer, it does not permit full duplex operation where data is
both send and received at the same time.
2021-04-08 16:52:20 +00:00
Matthew Mirvish b0d9d00762 Add support for udev based device discovery
This is primarily useful for SPI devices. These devices sometimes needs
a combination of an SPI and HID device, so discovery is a bit more
complicated.
2021-04-08 17:08:53 +02:00
Julius Piso e0de8c67b6 Added driver for validity vfs7552 2021-03-12 11:29:43 +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
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
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
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 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
Benjamin Berg 55a2bb5536 Generate a hwdb instead of udev rules
We only use the rules/hwdb to enable auto-suspend. So, instead of
shipping our own rules, we can just use the existing autosuspend rules
and ship a hwdb that sets the appropriate flag.

Closes: #336
2021-01-19 14:21:44 +01:00
Benjamin Berg 2d10d864d8 nbis: Disable array-parameter and array-bounds warnings
NBIS just does weird things and while the array-parameter warning is
easy to fix, the other is not trivial. So disable these warnings so that
we can still build using newer GCC versions.
2020-12-09 15:53:26 +01:00
boger.wang eb2aaaaa20 drivers: add goodix moc sensor driver support 2020-09-01 16:39:06 +08:00
Laurent Bigonville 3d68cddfe7 Properly set the dependencies in the pkg-config file
The public API uses gio and gobject header, ensure that these are in the
list of Required pkg-config modules, otherwise they are added to
Required.private which is not OK.
2020-03-20 11:13:06 +00:00
Benjamin Berg 96fba323b9 meson: Fix linking issue of libfprint with newer gcc
It appears the order of linking is relevant in this case, change it to
fix some linking issues.

It may be that there are better solutions to this problem.
2020-03-20 12:05:14 +01:00
Marco Trevisan (Treviño) 2ae8b74e60 meson: Add fpi-compat.h to the private headers 2020-02-27 06:03:21 +01:00
Benjamin Berg e19a1a6550 meson: Create include directories in build tree
Without this we get warnings like the following:

  cc1: warning: .../_build/libfprint/nbis/libfprint-include: No such file or directory [-Wmissing-include-dirs]
2020-02-10 11:41:40 +01:00
Marco Trevisan (Treviño) 2c9e252ca4 meson: Use versioned name for autosuspend udev rules
Given distros may have the previous value around, let's rename this too
2020-01-23 17:25:38 +01:00
Marco Trevisan (Treviño) 23fab3a20a Change SONAME and all the library paths to libfprint-2
To avoid conflicts with previous libfprint version and make sure that the
target version is the correct one (plus to allow parallel install in some
distros), let's use a versioned naming for the library keeping the abi
version in sync.

Fixes #223
2020-01-23 17:09:58 +01:00
Marco Trevisan (Treviño) bfc75de778 libfprint: Make sure we install fp-enums.h in the right folder
Since we were not explictly setting the install_dir, it was endind up in
$PREFIX/include by default, while we use our project name as subfolder.
2019-12-17 15:42:56 +01:00
Marco Trevisan (Treviño) f3f768e738 meson: Fix syntax for fpi_enums generation call 2019-12-17 15:42:32 +01:00
Marco Trevisan (Treviño) dbb26c5ade meson: Define enum dependency and ensure we generate them before using
Avoid setting the headers as sources everywhere, but instead use a dependency
to manage the headers creation in time
2019-12-17 14:38:20 +01:00
Marco Trevisan (Treviño) 806ad10673 meson: Add fp-image-device to public headers 2019-12-17 14:38:19 +01:00
Marco Trevisan (Treviño) 4562f9dae3 meson: Use soversion everywhere
Don't repeat the 2 version number hard-coding it, so we can easily track
updates
2019-12-17 14:38:19 +01:00
Marco Trevisan (Treviño) c57defda92 meson: Use more meson's project_name()
Not that libfprint is long to write, but in case we'll ever change the
basename, we do it once.
2019-12-17 14:38:19 +01:00
Marco Trevisan (Treviño) c806993cb9 meson: Don't install fpi-enums 2019-12-17 14:38:19 +01:00
Marco Trevisan (Treviño) d255a91e97 meson: List deps in multiple lines, to have better diffs on changes 2019-12-17 14:38:19 +01:00
Marco Trevisan (Treviño) 9ebb3fd231 meson: Parse all private headers
So we don't have to list each one in case we add new enums.
Also, as per previous commit we can reorder them alphabetically.
2019-12-17 14:38:19 +01:00
Benjamin Berg bfd68bbc01 meson: Add missing dependency on fp-enum.h for private library
The private library needs to indirectly include fp-enum.h. This
dependency was not listed anyway, resulting in a race condition during
the build process.
2019-12-16 11:42:51 +01:00
Marco Trevisan (Treviño) 24d388f923 meson: Split single-line dependencies to reduce the diff on changes
Make it more readable and in case we add something else, it's easier to track
2019-12-14 17:20:47 +01:00
Marco Trevisan (Treviño) 6f2b1f97da fprint: Move drivers to private internal library
This allows us to finally remove fpi_get_driver_types from the exported list
of symbols.
2019-12-12 19:03:57 +01:00
Marco Trevisan (Treviño) 5bed81025e meson: Use files to track the map file presence 2019-12-11 20:07:13 +01:00
Marco Trevisan (Treviño) d7100e41df fp-image, fp-print: Move private methods to own code units 2019-12-11 20:07:13 +01:00
Marco Trevisan (Treviño) ae7021e529 fp-image-device: Move fpi code into its own unit that can be compiled a part
In order to be able to test the private device code (used by drivers) we
need to have that split a part in a different .c file so that we can compile
it alone and link with it both the shared library and the test executables.

Redefine fp_image_device_get_instance_private for private usage, not to move
the private struct as part of FpDevice.
2019-12-11 20:07:12 +01:00
Marco Trevisan (Treviño) d9de941a47 fp-device: Move fpi code into its own unit that can be compiled a part
In order to be able to test the private device code (used by drivers) we
need to have that split a part in a different .c file so that we can compile
it alone and link with it both the shared library and the test executables.

Redefine fp_device_get_instance_private for private usage, not to move
the private struct as part of FpDevice.
2019-12-11 20:07:12 +01:00
Marco Trevisan (Treviño) 7114d97f25 libfprint: Introduce libfprint_private static library
Split the library into a private part with all the symbols that we can use
for unit-test all the fpi functions.
2019-12-10 20:19:55 +01:00
Marco Trevisan (Treviño) b2e55308d6 meson: Move generated source to fpi- prefix and use more readable code
Instead of concatenating strings, use an array of strings and finally join
them using newline.
2019-12-04 18:52:20 +01:00
Marco Trevisan (Treviño) 6a090656b6 nbis: Add a global include file with all the definitions ignoring erros
The nbis headers are full of redundant declarations, we can't fix them all
now, so in the mean time let's use an header using pragma to ignore such
errors.

Add the error to nbis private include folder that should be used only by
headers of libfprint-nbis.
2019-12-04 18:44:39 +01:00
Marco Trevisan (Treviño) e1d181887f meson: Add the include directories to deps
So we don't have to repeat them everywhere.
2019-12-04 16:57:39 +01:00
Benjamin Berg e143f12e57 meson: Build nbis separately to allow changing flags
As nbis is an external source bundle, it does not necessarily make sense
to enable/fix all warnings to the extend we do for our own library code.

As such, separate the build process into multiple stages.
2019-12-04 16:06:24 +01:00
Marco Trevisan (Treviño) 7e70344b4a meson: Use add_project_arguments for common cflags
We were passing around the common cflags and setting them for each library
or executable, but this is just a repetition given we can just use
add_project_arguments for this.
2019-12-04 16:06:24 +01:00
Marco Trevisan (Treviño) 099fa9f005 meson: Use preferred syntax everywhere
Meson files are normally using 4-spaces to indent and functions use first
parameter on the same line while others at next indentation level, not
following the parenthesis indentation.

So adapt libfprint to follow the meson standard.
2019-11-25 18:59:46 +01:00
Vincent Huang ac65cf455e synaptics: Add synaptics driver
Heavily modified by Benjamin Berg <bberg@redhat.com> to port it to the
new libfprint API and adjust the coding style to follow more closely
other drivers.
2019-11-20 13:53:45 +01:00
Benjamin Berg b8bb08649d lib: Add byte data reader/writer helpers
These helpers are directly copied from GStreamer and stripped down quite
a bit to e.g. always assume the machine does not support unaligned
access.
2019-11-20 13:53:45 +01:00
Benjamin Berg 2b6f22b84d virtual_image: Add new virtual image driver 2019-11-20 11:03:09 +01:00
Benjamin Berg 689aff0232 lib: Major rewrite of the libfprint core and API
This is a rewrite of the core based on GObject and Gio. This commit
breaks the build in a lot of ways, but basic functionality will start
working again with the next commits.
2019-11-20 11:03:09 +01:00
Benjamin Berg 01ec1c5777 build: Add dependency to GUsb rather than libusb
We will use GUsb rather than libusb directly in the future. This should
simplify a lot of the integration work and changes such as supporting
hotplugging. It will also require quite a lot of internal changes.
2019-11-18 15:39:35 +01:00
Benjamin Berg ec8dd6410e build: Make glib a libfprint dependency
We are going to use GLib types in the public API now.
2019-11-18 15:39:35 +01:00
worldofpeace 5b615e33a0 build: Don't hardcode /bin/echo
So that the shell builtin is used instead when available.
2019-09-20 15:01:52 +02:00
Benjamin Berg 3b32baccf6 fdu2000: Remove driver as it has been defunct for long
The driver was never ported to the new asynchronous model, meaning it
has been defunct since some time in 2008. Remove the driver, as
seemingly no one has complained about this and we have no proper way to
even verify a port is correct.
2019-06-18 15:54:57 +00:00
Benjamin Berg 66891274a7 build: Remove header files from nbis_sources
There is no need to list them in the sources.
2019-06-12 16:10:04 +02:00