From f42cd6eefdcec6a3ade63b7b509d0054f99ee4af Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 11 Oct 2018 15:00:30 +0200 Subject: [PATCH] lib: Add fp_driver_supports_imaging() So we don't need to open a device before checking whether it supports imaging. --- doc/libfprint-sections.txt | 1 + libfprint/fpi-core.c | 18 ++++++++++++++++++ libfprint/fprint.h | 1 + 3 files changed, 20 insertions(+) diff --git a/doc/libfprint-sections.txt b/doc/libfprint-sections.txt index 502c6f44..9d70895a 100644 --- a/doc/libfprint-sections.txt +++ b/doc/libfprint-sections.txt @@ -40,6 +40,7 @@ fp_driver_get_name fp_driver_get_full_name fp_driver_get_driver_id fp_driver_get_scan_type +fp_driver_supports_imaging
diff --git a/libfprint/fpi-core.c b/libfprint/fpi-core.c index 46e664bd..eede91af 100644 --- a/libfprint/fpi-core.c +++ b/libfprint/fpi-core.c @@ -579,6 +579,24 @@ API_EXPORTED enum fp_scan_type fp_driver_get_scan_type(struct fp_driver *drv) return drv->scan_type; } +/** + * fp_driver_supports_imaging: + * @drv: the driver + * + * Determines if a driver has imaging capabilities. If a driver has imaging + * capabilities you are able to perform imaging operations such as retrieving + * scan images using fp_dev_img_capture(). However, not all drivers support + * imaging devices – some do all processing in hardware. This function will + * indicate which class a device in question falls into. + * + * Returns: 1 if the device is an imaging device, 0 if the device does not + * provide images to the host computer + */ +API_EXPORTED int fp_driver_supports_imaging(struct fp_driver *drv) +{ + return drv->capture_start != NULL; +} + /** * fp_dev_supports_imaging: * @dev: the fingerprint device diff --git a/libfprint/fprint.h b/libfprint/fprint.h index 0cf42bb9..6c348398 100644 --- a/libfprint/fprint.h +++ b/libfprint/fprint.h @@ -130,6 +130,7 @@ const char *fp_driver_get_name(struct fp_driver *drv); const char *fp_driver_get_full_name(struct fp_driver *drv); uint16_t fp_driver_get_driver_id(struct fp_driver *drv); enum fp_scan_type fp_driver_get_scan_type(struct fp_driver *drv); +int fp_driver_supports_imaging(struct fp_driver *drv); /* Device discovery */ struct fp_dscv_dev **fp_discover_devs(void);