This also changes the code to keep the connection open and adds
automatic mainloop iteration to ensure the driver processes the request.
This is important so we will not deadlock when we send multiple
requests.
Add commands to disable automatic finger reporting for images and to
send a specific finger report. This is useful to test more code paths
inside the image-device code.
Add fpi_ssm_new_full() that allows to pass a name to the state-machine
constructor, not to change all the drivers, provide a fpi_ssm_new() macro
that stringifies the nr_parameters value (usually an enum value) as the name
so that we can use it for better debugging.
The IRQ handler will re-register itself automatically. However, if this
happens after the callback is called, then the check whether the IRQ
handler is running fails.
Re-start the IRQ handler before calling the callback. This way the state
changes happening from the callback will see the correct IRQ handler
registration state.
See: #205
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.