At the end of enroll, the image device would put the driver into the
AWAIT_FINGER_ON state and then deactivate the device afterwards. Doing
this adds additional complexity to drivers which would need to handle
both cancellation and normal deactivation from that state.
Only put the device into the AWAIT_FINGER_ON state when we know that
another enroll stage is needed. This avoids the critical state
transition simplifying the driver state machine.
Fixes: #203
Fixes: 689aff0232
During calibration, the internal state was stored as INACTIVE. This is
not true though, the device is actively running state machines.
Move the state update to the start of the operation, therefore ensuring
we don't deactivate without completing the SSM.
Note that this will prevent a crash, but the driver still does not
behave quite correctly when such a state change does happen. However,
this is just a safety measure as the state change should not happen in
the first place.
See: #203
These were probably added in previous iterations, but they are not uneeded
anymore as the GSource embeds already a callback function.
So make just this clearer in the dispatch function.
Now that nbis is a static library it should be possible to compile it
without any fprint-built dependency, although since it included fp_internal
there was a compile-time dependency on the fp-enums that can be generated at
later times.
So:
- Move nbis-helpers to nbis includes (and remove inclusion in fp_internal)
- Move the Minutiae definitions inside a standalone fpi-minutiae header
- Include fpi-minutiae.h in fp_internal.h
- Include nbis-hepers.h and fpi-minutiae.h in nbis' lfs.h
- Adapt missing definitions in libfprint
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.
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.
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.
Properly follow function signature using a temporary gsize variable address
to make the function use the same pointer type and avoid troubles at
deferencing it, while use automatic-casting to switch to signed one if
transfer succeeded.
The code tried to only write the RGB bytes of FORMAT_RGB24, however, the
in-memory layout is different on big-endian which would result in the
wrong bytes being written.
Fix this by simply also writing the byte we do not care about.
Add a GCancellable parameter to fpi_ssm_nex_state_delayed and
fpi_ssm_jump_to_state_delayed() so that it's possible to cancel an action
from the caller and in case the driver wants to cancel a delayed operation
when a device action has been cancelled.
This allows to have an automatic cleanup of the timeout source when the
the callback is reached and to avoid to do further state changes in the
middle.
Since GSource data can be automatically cleaned up on source destruction, we
can mimic this for the devices timeout easily as well.
Add an extra parameter, and let's use this cocci file to adapt all the
drivers like magic:
@@
expression e1, e2, e3, e4;
@@
fpi_device_add_timeout (e1, e2, e3, e4
+ , NULL
)
When using fpi_usb_transfer_submit_sync we still need to unref the transfer
once done with it, so let's use an auto pointer so we free it also on
errors and early returns without having to handle this manually.
In rare occasions it could happen that the driver was reading
insufficient data. Fix this by using g_input_stream_read_all_async
which will ensure that incomplete data will not be misinterpreted.
This fixes rare test failures seen in fprintd.
Seems like the older uncrustify versions did not find these indentation
issues. Fix them.
Old versions of uncrustify will leave things as is, so this is not a
problem if developers are using an old version of uncrustify.
Using floating point causes architecture dependent results due to
accuracy/rounding differences. It is not hard to switch to fixed point,
and while this does cause quite different rounding errors, the
difference is small.
Fixes: #200
The test suite needs to compare greyscale images and was picking an
undefined byte in the pixel data on big-endian. Select a byte that works
on any endian instead.
See: #200
g_variant_new_from_data() allows to destroy some other user_data passed as
parameter that might be different from the aligned_data itself.
But since in this case they match, pass it to be set as g_free parameter
or it won't be free'd.
When we notify the enroll progress with a print, this needs to be unreffed
once we're done, but this only was happening in case of error.
Since it's not up to the callback function to free it, let's do it at the
end of the function.
As per this, clarify the docs for FpEnrollProgress marking it as transfer
none.