Commit 88e9f4a5 authored by Daniel Drake's avatar Daniel Drake

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.
parent 83f9da1b
......@@ -54,12 +54,14 @@ libfprint_la_LIBADD = -lm $(LIBUSB_LIBS) $(GLIB_LIBS) $(IMAGEMAGICK_LIBS) $(CRYP
libfprint_la_SOURCES = \
fp_internal.h \
async.c \
core.c \
data.c \
drv.c \
img.c \
imgdev.c \
poll.c \
sync.c \
aeslib.c \
aeslib.h \
$(DRIVER_SRC) \
......
This diff is collapsed.
This diff is collapsed.
......@@ -907,7 +907,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
}
dev->priv = g_malloc0(sizeof(struct aes2501_dev));
fpi_imgdev_init_complete(dev, 0);
fpi_imgdev_open_complete(dev, 0);
return 0;
}
......@@ -915,7 +915,7 @@ static void dev_deinit(struct fp_img_dev *dev)
{
g_free(dev->priv);
libusb_release_interface(dev->udev, 0);
fpi_imgdev_deinit_complete(dev);
fpi_imgdev_close_complete(dev);
}
static const struct usb_id id_table[] = {
......@@ -934,8 +934,8 @@ struct fp_img_driver aes2501_driver = {
.img_height = -1,
.img_width = 192,
.init = dev_init,
.deinit = dev_deinit,
.open = dev_init,
.close = dev_deinit,
.activate = dev_activate,
.deactivate = dev_deactivate,
};
......
......@@ -213,7 +213,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
dev->priv = g_malloc0(sizeof(struct aes4k_dev));
if (r == 0)
fpi_imgdev_init_complete(dev, 0);
fpi_imgdev_open_complete(dev, 0);
return r;
}
......@@ -222,7 +222,7 @@ static void dev_deinit(struct fp_img_dev *dev)
{
g_free(dev->priv);
libusb_release_interface(dev->udev, 0);
fpi_imgdev_deinit_complete(dev);
fpi_imgdev_close_complete(dev);
}
static const struct usb_id id_table[] = {
......@@ -245,8 +245,8 @@ struct fp_img_driver aes4000_driver = {
/* temporarily lowered until image quality improves */
.bz3_threshold = 9,
.init = dev_init,
.deinit = dev_deinit,
.open = dev_init,
.close = dev_deinit,
.activate = dev_activate,
.deactivate = dev_deactivate,
};
......
......@@ -840,7 +840,7 @@ static int dev_init(struct fp_dev *dev, unsigned long driver_data)
dev->priv = upekdev;
dev->nr_enroll_stages = 3;
fpi_drvcb_init_complete(dev, 0);
fpi_drvcb_open_complete(dev, 0);
return 0;
}
......@@ -848,7 +848,7 @@ static void dev_exit(struct fp_dev *dev)
{
libusb_release_interface(dev->udev, 0);
g_free(dev->priv);
fpi_drvcb_deinit_complete(dev);
fpi_drvcb_close_complete(dev);
}
static const unsigned char enroll_init[] = {
......@@ -1415,8 +1415,8 @@ struct fp_driver upekts_driver = {
.name = FP_COMPONENT,
.full_name = "UPEK TouchStrip",
.id_table = id_table,
.init = dev_init,
.deinit = dev_exit,
.open = dev_init,
.close = dev_exit,
.enroll_start = enroll_start,
.enroll_stop = enroll_stop,
.verify_start = verify_start,
......
......@@ -1096,7 +1096,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
urudev->interface = iface_desc->bInterfaceNumber;
AES_set_encrypt_key(crkey, 128, &urudev->aeskey);
dev->priv = urudev;
fpi_imgdev_init_complete(dev, 0);
fpi_imgdev_open_complete(dev, 0);
return 0;
}
......@@ -1105,7 +1105,7 @@ static void dev_deinit(struct fp_img_dev *dev)
struct uru4k_dev *urudev = dev->priv;
libusb_release_interface(dev->udev, urudev->interface);
g_free(urudev);
fpi_imgdev_deinit_complete(dev);
fpi_imgdev_close_complete(dev);
}
static const struct usb_id id_table[] = {
......@@ -1142,8 +1142,8 @@ struct fp_img_driver uru4000_driver = {
.img_height = 289,
.img_width = 384,
.init = dev_init,
.deinit = dev_deinit,
.open = dev_init,
.close = dev_deinit,
.activate = dev_activate,
.deactivate = dev_deactivate,
.change_state = dev_change_state,
......
......@@ -19,277 +19,11 @@
#define FP_COMPONENT "drv"
#include <config.h>
#include <errno.h>
#include "fp_internal.h"
/* Lib-driver: start device initialisation */
int fpi_drv_init(struct fp_dev *dev, unsigned long driver_data)
{
struct fp_driver *drv = dev->drv;
if (!drv->init) {
fpi_drvcb_init_complete(dev, 0);
return 0;
}
dev->state = DEV_STATE_INITIALIZING;
return drv->init(dev, driver_data);
}
/* Driver-lib: device initialisation complete */
void fpi_drvcb_init_complete(struct fp_dev *dev, int status)
{
fp_dbg("status %d", status);
BUG_ON(dev->state != DEV_STATE_INITIALIZING);
dev->state = (status) ? DEV_STATE_ERROR : DEV_STATE_INITIALIZED;
}
/* Lib-driver: start device deinitialisation */
void fpi_drv_deinit(struct fp_dev *dev)
{
struct fp_driver *drv = dev->drv;
if (!drv->deinit) {
fpi_drvcb_deinit_complete(dev);
return;
}
dev->state = DEV_STATE_DEINITIALIZING;
drv->deinit(dev);
}
/* Driver-lib: device deinitialisation complete */
void fpi_drvcb_deinit_complete(struct fp_dev *dev)
{
fp_dbg("");
BUG_ON(dev->state != DEV_STATE_DEINITIALIZING);
dev->state = DEV_STATE_DEINITIALIZED;
}
/* Lib-driver: start enrollment */
int fpi_drv_enroll_start(struct fp_dev *dev, fp_enroll_stage_cb callback)
{
struct fp_driver *drv = dev->drv;
int r;
fp_dbg("");
if (!drv->enroll_start)
return -ENOTSUP;
dev->state = DEV_STATE_ENROLL_STARTING;
dev->enroll_cb = callback;
r = drv->enroll_start(dev);
if (r < 0) {
dev->enroll_cb = NULL;
dev->state = DEV_STATE_ERROR;
}
return r;
}
/* Driver-lib: enrollment has now started, expect results soon */
void fpi_drvcb_enroll_started(struct fp_dev *dev, int status)
{
fp_dbg("status %d", status);
BUG_ON(dev->state != DEV_STATE_ENROLL_STARTING);
dev->state = (status) ? DEV_STATE_ERROR : DEV_STATE_ENROLLING;
}
/* Driver-lib: an enroll stage has completed */
void fpi_drvcb_enroll_stage_completed(struct fp_dev *dev, int result,
struct fp_print_data *data, struct fp_img *img)
{
BUG_ON(dev->state != DEV_STATE_ENROLLING);
fp_dbg("result %d", result);
if (!dev->enroll_cb) {
fp_dbg("ignoring enroll result as no callback is subscribed");
return;
}
if (result == FP_ENROLL_COMPLETE && !data) {
fp_err("BUG: complete but no data?");
result = FP_ENROLL_FAIL;
}
dev->enroll_cb(dev, result, data, img);
}
/* Lib-driver: stop enrollment */
int fpi_drv_enroll_stop(struct fp_dev *dev)
{
struct fp_driver *drv = dev->drv;
fp_dbg("");
dev->enroll_cb = NULL;
if (!drv->enroll_start)
return -ENOTSUP;
if (!drv->enroll_stop) {
dev->state = DEV_STATE_INITIALIZED;
return 0;
}
dev->state = DEV_STATE_ENROLL_STOPPING;
return drv->enroll_stop(dev);
}
/* Driver-lib: enrollment has stopped */
void fpi_drvcb_enroll_stopped(struct fp_dev *dev)
{
fp_dbg("");
BUG_ON(dev->state != DEV_STATE_ENROLL_STOPPING);
dev->state = DEV_STATE_INITIALIZED;
}
/* Lib-driver: start verification */
int fpi_drv_verify_start(struct fp_dev *dev, fp_verify_cb callback,
struct fp_print_data *data)
{
struct fp_driver *drv = dev->drv;
int r;
fp_dbg("");
if (!drv->verify_start)
return -ENOTSUP;
dev->state = DEV_STATE_VERIFY_STARTING;
dev->verify_cb = callback;
dev->verify_data = data;
r = drv->verify_start(dev);
if (r < 0) {
dev->verify_cb = NULL;
dev->state = DEV_STATE_ERROR;
}
return r;
}
/* Driver-lib: verification has started, expect results soon */
void fpi_drvcb_verify_started(struct fp_dev *dev, int status)
{
fp_dbg("");
BUG_ON(dev->state != DEV_STATE_VERIFY_STARTING);
dev->state = (status) ? DEV_STATE_ERROR : DEV_STATE_VERIFYING;
}
/* Driver-lib: report a verify result (which might mark completion) */
void fpi_drvcb_report_verify_result(struct fp_dev *dev, int result,
struct fp_img *img)
{
fp_dbg("result %d", result);
BUG_ON(dev->state != DEV_STATE_VERIFYING);
if (result < 0 || result == FP_VERIFY_NO_MATCH
|| result == FP_VERIFY_MATCH) {
dev->state = DEV_STATE_VERIFY_DONE;
}
if (!dev->verify_cb) {
fp_dbg("ignoring verify result as no callback is subscribed");
return;
}
dev->verify_cb(dev, result, img);
}
/* Lib-driver: stop verification */
int fpi_drv_verify_stop(struct fp_dev *dev)
{
struct fp_driver *drv = dev->drv;
gboolean iterating = (dev->state == DEV_STATE_VERIFYING);
fp_dbg("");
BUG_ON(dev->state != DEV_STATE_ERROR
&& dev->state != DEV_STATE_VERIFYING
&& dev->state != DEV_STATE_VERIFY_DONE);
dev->verify_cb = NULL;
if (!drv->verify_start)
return -ENOTSUP;
if (!drv->verify_stop) {
dev->state = DEV_STATE_INITIALIZED;
return 0;
}
dev->state = DEV_STATE_VERIFY_STOPPING;
return drv->verify_stop(dev, iterating);
}
/* Driver-lib: verification has stopped */
void fpi_drvcb_verify_stopped(struct fp_dev *dev)
{
fp_dbg("");
BUG_ON(dev->state != DEV_STATE_VERIFY_STOPPING);
dev->state = DEV_STATE_INITIALIZED;
}
/* Lib-driver: start identification */
int fpi_drv_identify_start(struct fp_dev *dev, fp_identify_cb callback,
struct fp_print_data **gallery)
{
struct fp_driver *drv = dev->drv;
int r;
fp_dbg("");
if (!drv->identify_start)
return -ENOTSUP;
dev->state = DEV_STATE_IDENTIFY_STARTING;
dev->identify_cb = callback;
dev->identify_data = gallery;
r = drv->identify_start(dev);
if (r < 0) {
dev->identify_cb = NULL;
dev->state = DEV_STATE_ERROR;
}
return r;
}
/* Driver-lib: identification has started, expect results soon */
void fpi_drvcb_identify_started(struct fp_dev *dev, int status)
{
fp_dbg("");
BUG_ON(dev->state != DEV_STATE_IDENTIFY_STARTING);
dev->state = (status) ? DEV_STATE_ERROR : DEV_STATE_IDENTIFYING;
}
/* Driver-lib: report a verify result (which might mark completion) */
void fpi_drvcb_report_identify_result(struct fp_dev *dev, int result,
size_t match_offset, struct fp_img *img)
{
fp_dbg("result %d", result);
BUG_ON(dev->state != DEV_STATE_IDENTIFYING
&& dev->state != DEV_STATE_ERROR);
if (result < 0 || result == FP_VERIFY_NO_MATCH
|| result == FP_VERIFY_MATCH) {
dev->state = DEV_STATE_IDENTIFY_DONE;
}
if (!dev->identify_cb) {
fp_dbg("ignoring verify result as no callback is subscribed");
return;
}
dev->identify_cb(dev, result, match_offset, img);
}
/* Lib-driver: stop identification */
int fpi_drv_identify_stop(struct fp_dev *dev)
{
struct fp_driver *drv = dev->drv;
gboolean iterating = (dev->state == DEV_STATE_IDENTIFYING);
fp_dbg("");
BUG_ON(dev->state != DEV_STATE_IDENTIFYING
&& dev->state != DEV_STATE_IDENTIFY_DONE);
dev->identify_cb = NULL;
if (!drv->identify_start)
return -ENOTSUP;
if (!drv->identify_stop) {
dev->state = DEV_STATE_INITIALIZED;
return 0;
}
dev->state = DEV_STATE_IDENTIFY_STOPPING;
return drv->identify_stop(dev, iterating);
}
/* Driver-lib: identification has stopped */
void fpi_drvcb_identify_stopped(struct fp_dev *dev)
{
fp_dbg("");
BUG_ON(dev->state != DEV_STATE_IDENTIFY_STOPPING);
dev->state = DEV_STATE_INITIALIZED;
}
/* SSM: sequential state machine
* Asynchronous driver design encourages some kind of state machine behind it.
* In most cases, the state machine is entirely linear - you only go to the
......
......@@ -91,15 +91,6 @@ enum fp_dev_state {
DEV_STATE_IDENTIFY_STOPPING,
};
typedef void (*fp_enroll_stage_cb)(struct fp_dev *dev, int result,
struct fp_print_data *data, struct fp_img *img);
typedef void (*fp_verify_cb)(struct fp_dev *dev, int result,
struct fp_img *img);
typedef void (*fp_identify_cb)(struct fp_dev *dev, int result,
size_t match_offset, struct fp_img *img);
struct fp_dev {
struct fp_driver *drv;
libusb_dev_handle *udev;
......@@ -114,15 +105,29 @@ struct fp_dev {
/* drivers should not mess with any of the below */
enum fp_dev_state state;
/* FIXME: convert this to generic state operational data mechanism? */
int __enroll_stage;
fp_enroll_stage_cb enroll_cb;
void *enroll_data;
void *sync_verify_data;
/* async I/O callbacks and data */
/* FIXME: convert this to generic state operational data mechanism? */
fp_dev_open_cb open_cb;
void *open_cb_data;
fp_dev_close_cb close_cb;
void *close_cb_data;
fp_enroll_stage_cb enroll_stage_cb;
void *enroll_stage_cb_data;
fp_enroll_stop_cb enroll_stop_cb;
void *enroll_stop_cb_data;
fp_verify_cb verify_cb;
void *identify_data;
void *sync_identify_data;
void *verify_cb_data;
fp_verify_stop_cb verify_stop_cb;
void *verify_stop_cb_data;
fp_identify_cb identify_cb;
void *identify_cb_data;
fp_identify_stop_cb identify_stop_cb;
void *identify_stop_cb_data;
/* FIXME: better place to put this? */
struct fp_print_data **identify_gallery;
};
enum fp_imgdev_state {
......@@ -197,8 +202,8 @@ struct fp_driver {
/* Device operations */
int (*discover)(const struct usb_id *usb_id, uint32_t *devtype);
int (*init)(struct fp_dev *dev, unsigned long driver_data);
void (*deinit)(struct fp_dev *dev);
int (*open)(struct fp_dev *dev, unsigned long driver_data);
void (*close)(struct fp_dev *dev);
int (*enroll_start)(struct fp_dev *dev);
int (*enroll_stop)(struct fp_dev *dev);
int (*verify_start)(struct fp_dev *dev);
......@@ -221,8 +226,8 @@ struct fp_img_driver {
int bz3_threshold;
/* Device operations */
int (*init)(struct fp_img_dev *dev, unsigned long driver_data);
void (*deinit)(struct fp_img_dev *dev);
int (*open)(struct fp_img_dev *dev, unsigned long driver_data);
void (*close)(struct fp_img_dev *dev);
int (*activate)(struct fp_img_dev *dev, enum fp_imgdev_state state);
int (*change_state)(struct fp_img_dev *dev, enum fp_imgdev_state state);
void (*deactivate)(struct fp_img_dev *dev);
......@@ -236,6 +241,8 @@ extern struct fp_img_driver aes2501_driver;
extern struct fp_img_driver aes4000_driver;
extern struct fp_img_driver fdu2000_driver;
extern GSList *opened_devices;
void fpi_img_driver_setup(struct fp_img_driver *idriver);
#define fpi_driver_to_img_driver(drv) \
......@@ -363,37 +370,27 @@ void fpi_ssm_jump_to_state(struct fpi_ssm *machine, int state);
void fpi_ssm_mark_completed(struct fpi_ssm *machine);
void fpi_ssm_mark_aborted(struct fpi_ssm *machine, int error);
int fpi_drv_init(struct fp_dev *dev, unsigned long driver_data);
void fpi_drvcb_init_complete(struct fp_dev *dev, int status);
void fpi_drv_deinit(struct fp_dev *dev);
void fpi_drvcb_deinit_complete(struct fp_dev *dev);
void fpi_drvcb_open_complete(struct fp_dev *dev, int status);
void fpi_drvcb_close_complete(struct fp_dev *dev);
int fpi_drv_enroll_start(struct fp_dev *dev, fp_enroll_stage_cb callback);
void fpi_drvcb_enroll_started(struct fp_dev *dev, int status);
void fpi_drvcb_enroll_stage_completed(struct fp_dev *dev, int result,
struct fp_print_data *data, struct fp_img *img);
int fpi_drv_enroll_stop(struct fp_dev *dev);
void fpi_drvcb_enroll_stopped(struct fp_dev *dev);
int fpi_drv_verify_start(struct fp_dev *dev, fp_verify_cb callback,
struct fp_print_data *data);
void fpi_drvcb_verify_started(struct fp_dev *dev, int status);
void fpi_drvcb_report_verify_result(struct fp_dev *dev, int result,
struct fp_img *img);
int fpi_drv_verify_stop(struct fp_dev *dev);
void fpi_drvcb_verify_stopped(struct fp_dev *dev);
int fpi_drv_identify_start(struct fp_dev *dev, fp_identify_cb callback,
struct fp_print_data **gallery);
void fpi_drvcb_identify_started(struct fp_dev *dev, int status);
void fpi_drvcb_report_identify_result(struct fp_dev *dev, int result,
size_t match_offset, struct fp_img *img);
int fpi_drv_identify_stop(struct fp_dev *dev);
void fpi_drvcb_identify_stopped(struct fp_dev *dev);
/* for image drivers */
void fpi_imgdev_init_complete(struct fp_img_dev *imgdev, int status);
void fpi_imgdev_deinit_complete(struct fp_img_dev *imgdev);
void fpi_imgdev_open_complete(struct fp_img_dev *imgdev, int status);
void fpi_imgdev_close_complete(struct fp_img_dev *imgdev);
void fpi_imgdev_activate_complete(struct fp_img_dev *imgdev, int status);
void fpi_imgdev_deactivate_complete(struct fp_img_dev *imgdev);
void fpi_imgdev_report_finger_status(struct fp_img_dev *imgdev,
......
......@@ -274,5 +274,42 @@ int fp_handle_events(void);
int fp_init(void);
void fp_exit(void);
/* Asynchronous I/O */
typedef void (*fp_dev_open_cb)(struct fp_dev *dev, int status, void *user_data);
int fp_async_dev_open(struct fp_dscv_dev *ddev, fp_dev_open_cb callback,
void *user_data);
typedef void (*fp_dev_close_cb)(struct fp_dev *dev, void *user_data);
void fp_async_dev_close(struct fp_dev *dev, fp_dev_close_cb callback,
void *user_data);
typedef void (*fp_enroll_stage_cb)(struct fp_dev *dev, int result,
struct fp_print_data *print, struct fp_img *img, void *user_data);
int fp_async_enroll_start(struct fp_dev *dev, fp_enroll_stage_cb callback,
void *user_data);
typedef void (*fp_enroll_stop_cb)(struct fp_dev *dev, void *user_data);
int fp_async_enroll_stop(struct fp_dev *dev, fp_enroll_stop_cb callback,
void *user_data);
typedef void (*fp_verify_cb)(struct fp_dev *dev, int result,
struct fp_img *img, void *user_data);
int fp_async_verify_start(struct fp_dev *dev, struct fp_print_data *data,
fp_verify_cb callback, void *user_data);
typedef void (*fp_verify_stop_cb)(struct fp_dev *dev, void *user_data);
int fp_async_verify_stop(struct fp_dev *dev, fp_verify_stop_cb callback,
void *user_data);
typedef void (*fp_identify_cb)(struct fp_dev *dev, int result,
size_t match_offset, struct fp_img *img, void *user_data);
int fp_async_identify_start(struct fp_dev *dev, struct fp_print_data **gallery,
fp_identify_cb callback, void *user_data);
typedef void (*fp_identify_stop_cb)(struct fp_dev *dev, void *user_data);
int fp_async_identify_stop(struct fp_dev *dev, fp_identify_stop_cb callback,
void *user_data);
#endif
......@@ -27,7 +27,7 @@
#define MIN_ACCEPTABLE_MINUTIAE 10
#define BOZORTH3_DEFAULT_THRESHOLD 40
static int img_dev_init(struct fp_dev *dev, unsigned long driver_data)
static int img_dev_open(struct fp_dev *dev, unsigned long driver_data)
{
struct fp_img_dev *imgdev = g_malloc0(sizeof(*imgdev));
struct fp_img_driver *imgdrv = fpi_driver_to_img_driver(dev->drv);
......@@ -40,12 +40,12 @@ static int img_dev_init(struct fp_dev *dev, unsigned long driver_data)
/* for consistency in driver code, allow udev access through imgdev */
imgdev->udev = dev->udev;
if (imgdrv->init) {
r = imgdrv->init(imgdev, driver_data);
if (imgdrv->open) {
r = imgdrv->open(imgdev, driver_data);
if (r)
goto err;
} else {
fpi_drvcb_init_complete(dev, 0);
fpi_drvcb_open_complete(dev, 0);
}
return 0;
......@@ -54,25 +54,25 @@ err:
return r;
}
void fpi_imgdev_init_complete(struct fp_img_dev *imgdev, int status)
void fpi_imgdev_open_complete(struct fp_img_dev *imgdev, int status)
{
fpi_drvcb_init_complete(imgdev->dev, status);
fpi_drvcb_open_complete(imgdev->dev, status);
}
static void img_dev_deinit(struct fp_dev *dev)
static void img_dev_close(struct fp_dev *dev)
{
struct fp_img_dev *imgdev = dev->priv;
struct fp_img_driver *imgdrv = fpi_driver_to_img_driver(dev->drv);
if (imgdrv->deinit)
imgdrv->deinit(imgdev);
if (imgdrv->close)
imgdrv->close(imgdev);
else
fpi_drvcb_deinit_complete(dev);
fpi_drvcb_close_complete(dev);
}
void fpi_imgdev_deinit_complete(struct fp_img_dev *imgdev)
void fpi_imgdev_close_complete(struct fp_img_dev *imgdev)
{
fpi_drvcb_deinit_complete(imgdev->dev);
fpi_drvcb_close_complete(imgdev->dev);
g_free(imgdev);
}
......@@ -173,6 +173,9 @@ void fpi_imgdev_report_finger_status(struct fp_img_dev *imgdev,
gboolean present)
{
int r = imgdev->action_result;
struct fp_print_data *data = imgdev->acquire_data;
struct fp_img *img = imgdev->acquire_img;
fp_dbg(present ? "finger on sensor" : "finger removed");
if (present && imgdev->action_state == IMG_ACQUIRE_STATE_AWAIT_FINGER_ON) {
......@@ -185,25 +188,29 @@ void fpi_imgdev_report_finger_status(struct fp_img_dev *imgdev,
return;
}
/* clear these before reporting results to avoid complications with
* call cascading in and out of the library */
imgdev->acquire_img = NULL;
imgdev->acquire_data = NULL;
/* finger removed, report results */
switch (imgdev->action) {
case IMG_ACTION_ENROLL:
fpi_drvcb_enroll_stage_completed(imgdev->dev, r, imgdev->acquire_data,
imgdev->acquire_img);
fp_dbg("reporting enroll result");
fpi_drvcb_enroll_stage_completed(imgdev->dev, r, data, img);
break;
case IMG_ACTION_VERIFY:
fpi_drvcb_report_verify_result(imgdev->dev, r, imgdev->acquire_img);
fp_print_data_free(imgdev->acquire_data);
fpi_drvcb_report_verify_result(imgdev->dev, r, img);
fp_print_data_free(data);
break;
case IMG_ACTION_IDENTIFY:
fpi_drvcb_report_identify_result(imgdev->dev, r,
imgdev->identify_match_offset, imgdev->acquire_img);
fp_print_data_free(imgdev->acquire_data);
imgdev->identify_match_offset, img);
fp_print_data_free(data);
default:
fp_err("unhandled action %d", imgdev->action);
break;
}
imgdev->acquire_img = NULL;
imgdev->acquire_data = NULL;
}
static void verify_process_img(struct fp_img_dev *imgdev)
......@@ -237,7 +244,7 @@ static void identify_process_img(struct fp_img_dev *imgdev)
match_score = BOZORTH3_DEFAULT_THRESHOLD;
r = fpi_img_compare_print_data_to_gallery(imgdev->acquire_data,
imgdev->dev->identify_data, match_score, &match_offset);
imgdev->dev->identify_gallery, match_score, &match_offset);
imgdev->action_result = r;
imgdev->identify_match_offset = match_offset;
......@@ -486,8 +493,8 @@ static int img_dev_identify_stop(struct fp_dev *dev, gboolean iterating)
void fpi_img_driver_setup(struct fp_img_driver *idriver)
{
idriver->driver.type = DRIVER_IMAGING;
idriver->driver.init = img_dev_init;
idriver->driver.deinit = img_dev_deinit;
idriver->driver.open = img_dev_open;
idriver->driver.close = img_dev_close;
idriver->driver.enroll_start = img_dev_enroll_start;
idriver->driver.enroll_stop = img_dev_enroll_stop;
idriver->driver.verify_start = img_dev_verify_start;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment