Commit graph

47 commits

Author SHA1 Message Date
Marco Trevisan (Treviño) d1fb1e26f3 Uncrustify everything except for nbis 2019-11-20 20:38:06 +01:00
Benjamin Berg e372311afe upekts: Port upekts driver to new API 2019-11-20 13:53:45 +01:00
Bastien Nocera 61483a4c47 lib: Make the fp_print_data structure private
And add a couple of helpers for the upekts driver to use.
2018-11-29 17:32:37 +01:00
Bastien Nocera 1035f733aa lib: Split off async functions
And don't add the new fpi-async.h to the driver imports, it will only
be used by the upekts driver.
2018-09-28 15:12:39 +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 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 7dfc8f3364 lib: Remove fpi_ssm_get_dev()
Usually by passing the dev it from an fpi_ssm callback, or simply
using that callback argument.
2018-09-18 14:02:23 +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 4f75e63e25 lib: Remove fp_dev->priv
Not precise enough, and it was only used in upekts to get/set the
instance private struct and keep it around, so add a new, more precisely
defined field to fp_dev for that.
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 350b0a38e2 drivers: De-duplicate udf_crc() helper
Was in both the upektc_img and upekts drivers
2018-09-04 14:05:37 +02:00
Bastien Nocera c284858d06 upekts: Fix enrollment never finishing on some upekts devices
Add support for more device status codes, brought back from the
now-removed UPEKE2 driver.

See 3bf55a3e07/libfprint/drivers/upeke2.c (L1013)
2018-06-19 11:11:04 +02:00
Bastien Nocera d83d92adf2 lib: Make fp_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 f433a4d67c upekts: Fix compilation warning
libfprint/drivers/upekts.c: In function ‘alloc_send_cmd_transfer’:
libfprint/drivers/upekts.c:161:2: warning: ‘strncpy’ output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation]
  strncpy(buf, "Ciao", 4);
  ^~~~~~~~~~~~~~~~~~~~~~~

Replace with memcpy() to only copy the 4 bytes we need.

https://bugs.freedesktop.org/show_bug.cgi?id=106281
2018-05-25 13:19:31 +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 c376c6fb02 lib: Fix type mismatch warnings in debug output 2018-05-23 19:11:05 +02:00
Bastien Nocera a0bbbd7d32 drivers: Print USB error when libusb_claim_interface() fails
https://bugs.freedesktop.org/show_bug.cgi?id=98594
2016-11-05 00:10:17 +01:00
Vasily Khoruzhick e215b05094 imgdev: perform 5 scans for enrollment
This feature dramatically improves matching rate on devices with small
sensors.
2013-08-19 11:13:49 +03:00
Vasily Khoruzhick ea6d5ba6d6 lib: Fix mess with driver IDs
ID is just a some magic number to make fingerprint from one scanner model
incompatible with another scanner model. Get rid of "magic", declare enum
and use it.

https://bugs.freedesktop.org/show_bug.cgi?id=56956
2012-11-16 17:57:47 +01:00
Daniel Drake d482228325 upekts: Don't choke on non-zero bytes in command response
Alon Bar-Lev's device behaves differently, but seems to work fine with
upekts even if we ignore the difference.
2008-11-20 19:59:43 +00:00
Bastien Nocera 29044d9ca9 Export scan type for each driver
For each driver, export the scan type supported by the devices it
handles. This allows front-ends to direct the user better.
2008-11-20 14:53:01 +00:00
Vasily Khoruzhick 40e7ac195a Adapting to latest libusb
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
2008-04-06 23:52:04 +01:00
Azzie 1ab52617c7 Update for latest libusb constant names 2008-03-29 18:11:17 +00:00
Daniel Drake 4e884807a7 Update for libusb API rework 2008-03-10 13:33:23 +00:00
Daniel Drake 88e9f4a5f8 Public async API implementation
Involved some internal overhaul/reorganisation. Nice side effect is that
the synchronous API is now expressed purely in terms of the public async
API.
2008-03-01 13:02:17 +00:00
Daniel Drake aeeec97fb2 upekts: port to asynchronous model 2008-02-16 12:48:25 +00:00
Daniel Drake bf7093d607 Port to libusb-0.9.0 (synchronous I/O)
Straightforward port to libusb-0.9.0 sync I/O functions, to give libusb-1.0
a bit of a test drive and to create a reference point for later.
2008-01-30 14:16:35 +00:00
Daniel Drake 5485f8031d Return images through enroll/verify path
Added new API functions to obtain images, even when scans are bad, perhaps
a useful way to show the user just how good/bad the scan actually was.

Drivers and examples updated accordingly.
2007-11-15 09:54:39 +00:00
Daniel Drake a76f55db0d upekts relicensing
Pavel Machek and Timo Hoenig agreed to relicense their work. Thanks guys,
I look forward to working together.
2007-11-15 09:54:35 +00:00
Daniel Drake 07a81b07be upekts: initialise and deinitialise device during verify/capture
Otherwise it heats up, and verify retries fail because we didn't end the
session.
2007-10-31 22:46:50 +00:00
Daniel Drake 6f633cc771 Use glib's byte order functions 2007-10-29 23:06:06 +00:00
Daniel Drake 294f9ad447 Improve print_data structure and on-disk format
Drivers now have an ID number. These will be assigned by me and documented
on the wiki. 0 cannot be used.

Drivers now define a devtype for each device they initialise. This is to
cope with the situation where a driver can support varying devices where
their print data is incompatible (i.e. image scaling is totally changed).
This doesn't apply to any existing supported devices.

Print data no longer includes driver name, and includes driver ID instead.

Paths to saved print data now include driver ID and devtype, and no longer
include driver name.

APIs exposed for converting a print_data into a blob which can then
be loaded back again later. Useful for systems who don't want to use
my simple storage system (which is only aimed at a single user).

File format is now defined and will be documented on the wiki. The header
is larger as we can no longer rely on directory paths in all scenarios.

Print data compat check now checks devtype and driver ID.
2007-10-28 22:13:51 +00:00
Daniel Drake 0aac3706d7 upekts: release interface on error condition and normal exit 2007-10-25 15:36:13 +01:00
Daniel Drake 0ac74ef649 Pass driver_data from ID table to driver init function 2007-10-25 15:00:30 +01:00
Daniel Drake 2709c6dc8c Basic image driver foundations
The basic model is that image drivers declare a fp_img_driver structure
rather than a fp_driver struct. fp_img_driver will contain primitive imaging
operations such as 'scan finger and return image'. The imgdev layer will
generically implement the primitive fp_driver operations, and the imgdev
layer will fix up the enroll/verify/etc pointers at driver registration
time.

Removed const from all fp_driver declarations, as these are now modified
dynamically in the case of imaging drivers.
2007-10-23 23:27:21 +01:00
Daniel Drake 801fcfc07c upekts: fix memory corruption
Found by valgrind
2007-10-16 14:34:47 +01:00
Daniel Drake 3b8f8c195c upekts: support large messages
Add support for messages with a length greater than 255.
Also picked out a few more retry codes.
2007-10-16 13:41:23 +01:00
Daniel Drake bf9ce44f43 upekts: verify implementation
We can now verify live fingerprints using the verify example.
Error handling during verification needs to be improved.
2007-10-15 22:09:46 +01:00
Daniel Drake f59112d57c Unhide fprint_data buffer from drivers
May as well keep things out in the open.
2007-10-15 22:07:22 +01:00
Daniel Drake 39271b4fe5 Enrollment: improved error reporting
Convert enrollment function to return a signed integer, which is negative
on error or corresponds into fp_enroll_result otherwise.
Now we can treat a 'FAIL' condition differently from an actual error: fail
means that enrollment didn't complete because the data was nonsense or
whatever (e.g. scanned a different finger for each stage?).

Updated upekts accordingly.
2007-10-14 00:51:20 +01:00
Daniel Drake ab5b1ca8e9 upekts: communication handling and enrollment implementation
This completes an enrollment implementation for the upekts driver.
It's based on code from libthinkfinger, but as there seemed to be many
unknown details there, I spent some time analysing the bus messages in
more detail and have effectively rewritten almost all of the borrowed code.

Note that libthinkfinger is GPL licensed, so that reflects on this code too.
At release time I will ask them if they are OK for me to relicense it.
2007-10-13 17:13:25 +01:00
Daniel Drake 046bdc0bda Initial driver registration mechanism
Also added the basis of the upekts driver, which is the first I'll
implement.
2007-10-08 17:16:51 +01:00