Use the device session data to store all the informations we care about
while a device is claimed, and make its cleanup easier.
Keep just one instance of the current context, given we use it only during
claim and release, and those are mutually exclusive operations.
Allocate SessionData using g_malloc(). There are no benefits to using
GSlice for a seldom used structure. This also allows use to use
g_clear_pointer() to free the struct.
Fix linking error as the "store" global variable gets redeclared in
each C file that includes the header. Move the actual declaration to
main.c.
Fixes:
/usr/bin/ld: ./.libs/libfprintd.a(device.o):/builds/libfprint/fprintd/src/storage.h:51: multiple definition of `store'; main.o:/builds/libfprint/fprintd/src/storage.h:51: first defined here
This API was added to libfprint to allow drivers to report the match
result early before the operation has been completed. No driver makes
use of this facility yet and instead drivers try to finish the
operation early for quick result reporting. This primarily means not
waiting for finger removal.
Once drivers are updated, fprintd reactivity will regress unless the
early match callback is implemented as they would only get an operation
finished callback when the whole of the operation was finished,
including finger removal and finishing up USB communications.
See: https://gitlab.freedesktop.org/libfprint/fprintd/issues/35
The state directory will generally be the same as the hardcoded one.
However, being able to override it is important for testing purposes, so
add the option.
Some devices require storing the print on the device, to support this,
try deleting prints from the device before deleting them from local
storage.
To handle these devices, add a new API that requires the device to be
claimed rather than allowing deletion without claiming the device first.
Also add appropriate fallbacks so that the old API will continue to
work, but warn about its use.
When creating the FprintManager object the devices will be enumerated.
This operation calls the mainloop recursively. We do not want to receive
any client requests before the initial enumeration has happened. Because
of this, move the registration of the common name to happen after the
enumeration has finished.
The new libfprint version has support for devices that store data on the
sensor. In that case, the on-sensor storage might fill up when the user
tries to enroll a new print.
The strategy introduced here to handle this is to try and delete prints
from the device that we do not know about (assuming, it is e.g. from an
old installation and unusable).
It can also happen that we are not able to garbage collect old prints.
If that happens, a new error code "enroll-data-full" will be returned
signalling the situation to the enrolling application.
For sensors with internal storage we may want to garbage collect prints.
Adding this API means we can list all local prints, allowing us to find
out whether there are prints on the device's storage with no
corresponding print on the host.
fprintd's API docs say that "retry" errors for verification
"the verification is still ongoing" and that "[the] user should retry
scanning their finger.
Unfortunately, retry errors are fatal in libfprint. Make fprintd restart
operations when "retry" is the error for either identification or
verification purposes.
We need to also make sure that a "*Stop" D-Bus call will return as
normal if called while we're stopping a verification or identification
in order to restart it.
Closes: #22
--localstatedir (and --prefix) will now be ignored in favour of this
hardcoded path. This is in preparation for a change to use systemd's
StateDirectory feature.
Otherwise you could get into a state where the daemon could not start
because the directory listed as a ReadWritePaths in the .service file is
missing.
Spotted by Will Thompson.
See: !5
Fix a possible crash when an fprintd client disappears. If the client
requested for the device to be released, then, without waiting for the
reply of that release, disappeared from the bus, we would try to close
it a second time, accessing a function pointer that didn't exist
anymore.
See https://bugzilla.redhat.com/show_bug.cgi?id=1515720