Commit graph

36 commits

Author SHA1 Message Date
Vasily Khoruzhick 4cf5f92a52 lib: re-add partial image flag
And activate perimeter points removal if this flag is set

This flag should be set for aes1610, aesx660, aes2501, aes2550
and upektc_img since these sensors may produce incomplete image.

Fixes: #142
2020-06-04 09:34:31 -07:00
Marco Trevisan (Treviño) 587131a6bd drivers: Use more fpi_ssm_usb_transfer_cb when possible
Replace all the transfer callbacks where we just switch to the next state or
fail with fpi_ssm_usb_transfer_cb.
2019-11-27 21:02:20 +01:00
Marco Trevisan (Treviño) 2642fc6560 fpi-usb-transfer: Take ownership of the transfer when submitting it
When a transfer is completed, we automatically unref it since we can't
consider it valid anymore since this point.

Update the drivers not to free the transfer after submitting anymore.
2019-11-27 21:02:19 +01:00
Marco Trevisan (Treviño) a855c0cc79 fpi-ssm: Take ownership of the SSM when completing it
When a machine is completed, we automatically free it since we can't
consider it valid anymore since this point.

Update the drivers not to free the SSM on completion callback anymore.
2019-11-27 21:02:19 +01:00
Marco Trevisan (Treviño) 1b23f0efe1 drivers: Use clearer messages using parameters 2019-11-26 12:18:57 +00:00
Marco Trevisan (Treviño) 7bc62821ee ssm: Make possible to set data via function
Use the same approach of GTask, making possible to set the data from a
function. Givent the fact that a SSM has now a device parameter, it's
generally not needed to pass an extra data value.

In such case make it possible to set it and to define a destroy-notify
function to handle its destruction when freeing the SSM.
2019-11-20 20:38:06 +01:00
Marco Trevisan (Treviño) d1fb1e26f3 Uncrustify everything except for nbis 2019-11-20 20:38:06 +01:00
Bastien Nocera f25d0a0dc9 lib: Remove num_stripes from fpi_assemble_frames() 2019-11-20 13:53:45 +01:00
Benjamin Berg 0a47df7bb7 aesx660: Port aes1660 and aes2660 drivers to new API 2019-11-20 13:53:45 +01:00
Benjamin Berg 4cec28416e lib: Remove state from fp_img_driver activate handler
The state was always AWAIT_FINGER and it was never used by any driver
(except for error checking). So remove it, in particular as a correct
state change will be done after activation anyway.

The only driver with code that actually did anything based on this was
the URU4000 driver. However, all it did was an explicit state change
execution. This is not necessary, as the state_change handler is called
anyway (i.e. we now only write the AWAIT_FINGER register once rather
than twice).

Manual changes plus:

@ init @
identifier driver_name;
identifier activate_func;
@@
struct fp_img_driver driver_name = {
    ...,
    .activate = activate_func,
    ...,
};
@ remove_arg @
identifier dev;
identifier state;
identifier init.activate_func;
@@
activate_func (
	struct fp_img_dev *dev
-	, enum fp_imgdev_state state
	)
{
	<...
-	if (state != IMGDEV_STATE_AWAIT_FINGER_ON) { ... }
	...>
}
2019-06-18 18:19:38 +02:00
Bastien Nocera 551616c3ab aesx660: Fix memory leak in process_stripe_data()
libfprint/drivers/aesx660.c:292:10: warning: Potential leak of memory pointed to by 'stripe'
                return 0;
                       ^
2018-12-12 16:19:20 +01:00
Bastien Nocera 192c4f3cfc aesx660: Use constants for buffer sizes 2018-09-27 14:49:50 +02:00
Bastien Nocera 49ba59369a aesx660: Remove home-grown min() implementation
And use GLib's.
2018-09-27 14:49:50 +02:00
Bastien Nocera 10ae8ffb55 drivers: Simplify libusb_alloc_transfer(0) calls
By using our new, never-failing, USB allocation wrapper. As it can never
fail, we can also remove all the error paths for the allocations
failing.
2018-09-19 17:06:17 +02:00
Bastien Nocera 0c3a22758b drivers: Simplify FP_INSTANCE_DATA(FP_DEV()) calls
When fp_dev is already available, don't use the fp_img_dev struct to get
to fp_dev with FP_DEV(), use the fp_dev directly.
2018-09-18 18:30:42 +02:00
Bastien Nocera 9cc859a318 drivers: Diminish fpi_ssm_get_user_data() usage
Can't remove it yet, as libusb transfers and timeouts don't pass the
fp_dev or fp_img_dev separately.
2018-09-18 18:30:42 +02:00
Bastien Nocera e397571f83 lib: Add more args to fpi_ssm callbacks
Pass the struct fp_dev and user_data to fpi_ssm callbacks, so that we
might be able to get rid of the fpi_ssm_get_user_data(), and
fpi_ssm_get_dev() as most drivers just get those from the ssm anyway
in their callbacks.
2018-09-18 13:46:39 +02:00
Bastien Nocera d34d7c26de lib: Remove fpi_ssm_set_user_data()
And pass the user_data in fpi_ssm_new() instead.
2018-09-18 13:45:33 +02:00
Bastien Nocera 3f64b2ea5a lib: Remove fpi_imgdev_get_usb_dev()
We now use fpi_get_usb_dev(FP_DEV()) instead.
2018-09-15 01:12:18 +02:00
Bastien Nocera 57b38a2876 lib: Remove fpi_imgdev_get_dev()
This is now handled by FP_DEV()
2018-09-15 01:12:18 +02:00
Bastien Nocera 058f91909d lib: Remove fp_img_dev->priv
And use the new instance data helper.
2018-09-15 01:12:18 +02:00
Bastien Nocera 603aab0a81 lib: Rename fpi_ssm_mark_aborted to fpi_ssm_mark_failed 2018-09-05 16:29:26 +02:00
Bastien Nocera 48b9e6c517 lib: Typedef fpi_ssm 2018-09-05 15:40:34 +02:00
Bastien Nocera f40f231a63 lib: Make fp_img_dev structure opaque 2018-05-29 13:34:18 +02:00
Bastien Nocera 2e035a7f45 lib: Make fpi_ssm opaque for drivers
We shouldn't access fpi_ssm struct fields directly in drivers, so add
accessor and setter functions for the common uses.
2018-05-29 13:34:18 +02:00
Bastien Nocera 19dfb138a6 drivers: Use new drivers_api.h in drivers 2018-05-29 13:34:18 +02:00
Bastien Nocera 994061af44 drivers: Simplify headers
Remove all the headers already included through "fp_internal.h" such as
<libusb.h> and <errno.h>, include "assembling.h" and "driver_ids.h" there
as well to avoid doing it in (almost) every driver.
2018-05-24 17:02:15 +02:00
Bastien Nocera 32fcfde86b lib: Use GLib and libusb directly for debug output
Use GLib internally to output debug information, and tell about
libusb's LIBUSB_DEBUG envvar for libusb debug.

fp_set_debug() is now a no-op.

https://bugs.freedesktop.org/show_bug.cgi?id=106552
2018-05-23 19:13:08 +02:00
Bastien Nocera 363a1b3371 lib: Replace empty fp_dbg() calls
GLib won't like them, so use G_DEBUG_HERE() instead.
2018-05-23 19:11:07 +02:00
Bastien Nocera c376c6fb02 lib: Fix type mismatch warnings in debug output 2018-05-23 19:11:05 +02:00
Vasily Khoruzhick e40f7bd1f7 lib: move frame assembling routines into a separate file and make them usable by non-aes drivers
Frame assembling routines are not aes-specific, so move them into a separate file
and add an accessor for peeking a pixel.
2015-12-16 13:24:38 -08:00
Vasily Khoruzhick 985e8c4577 aes1660: set partial flag on an image
Sensor width seems to be only 128 pixels and that's not enough
for scanning whole finger surface. Lower bz3_threshold to 25,
since for wrong finger score never goes above 10, but sometimes
for right finger score is below 40.
2015-12-16 13:24:38 -08:00
Vasily Khoruzhick 061a457658 aeslib: improve frame-assembling routines
Some scanners provide hardware assistance in frame assemling, i.e.
horizontal and vertical offset to previous frame is provided. This
commit improves code to utilise that assistance. Sensors without
hardware assistance will use software algorithm, which was also
improved to do search in horizontal direction.
2015-01-31 13:18:23 +03:00
Vasily Khoruzhick 82ae7c1c09 aesx660: fix spelling of define name 2015-01-31 13:18:23 +03:00
Patrick Marlier 6d65bfcf80 lib: g_malloc never fails
Or rather, it never returns errors and aborts instead if
memory cannot be allocated, so remove code that handled
failures.

https://bugs.freedesktop.org/show_bug.cgi?id=57869
2013-06-26 14:18:40 +02:00
Vasily Khoruzhick c1da647aed lib: add AES1660/AES2660 common routines
https://bugs.freedesktop.org/show_bug.cgi?id=57426
2012-11-29 09:59:52 +01:00