2007-10-08 15:46:42 +00:00
|
|
|
/*
|
|
|
|
* Internal/private definitions for libfprint
|
2008-02-04 10:23:11 +00:00
|
|
|
* Copyright (C) 2007-2008 Daniel Drake <dsd@gentoo.org>
|
2007-10-08 15:46:42 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __FPRINT_INTERNAL_H__
|
|
|
|
#define __FPRINT_INTERNAL_H__
|
|
|
|
|
2007-10-13 14:52:50 +00:00
|
|
|
#include <config.h>
|
2007-10-08 15:46:42 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2007-10-12 14:27:23 +00:00
|
|
|
#include <glib.h>
|
2008-01-30 14:16:35 +00:00
|
|
|
#include <libusb.h>
|
2007-10-08 15:55:50 +00:00
|
|
|
|
|
|
|
#include <fprint.h>
|
|
|
|
|
2012-09-26 10:41:13 +00:00
|
|
|
#define array_n_elements(array) (sizeof(array) / sizeof(array[0]))
|
|
|
|
|
2007-10-26 23:06:53 +00:00
|
|
|
#define container_of(ptr, type, member) ({ \
|
|
|
|
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
|
|
|
|
(type *)( (char *)__mptr - offsetof(type,member) );})
|
|
|
|
|
2007-10-10 14:51:50 +00:00
|
|
|
enum fpi_log_level {
|
2012-08-13 17:41:42 +00:00
|
|
|
FPRINT_LOG_LEVEL_DEBUG,
|
|
|
|
FPRINT_LOG_LEVEL_INFO,
|
|
|
|
FPRINT_LOG_LEVEL_WARNING,
|
|
|
|
FPRINT_LOG_LEVEL_ERROR,
|
2007-10-10 14:51:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void fpi_log(enum fpi_log_level, const char *component, const char *function,
|
|
|
|
const char *format, ...);
|
|
|
|
|
|
|
|
#ifndef FP_COMPONENT
|
|
|
|
#define FP_COMPONENT NULL
|
|
|
|
#endif
|
|
|
|
|
2007-10-13 14:52:50 +00:00
|
|
|
#ifdef ENABLE_LOGGING
|
2007-10-10 14:51:50 +00:00
|
|
|
#define _fpi_log(level, fmt...) fpi_log(level, FP_COMPONENT, __FUNCTION__, fmt)
|
2007-10-13 14:52:50 +00:00
|
|
|
#else
|
|
|
|
#define _fpi_log(level, fmt...)
|
|
|
|
#endif
|
2007-10-10 14:51:50 +00:00
|
|
|
|
2007-10-13 14:52:50 +00:00
|
|
|
#ifdef ENABLE_DEBUG_LOGGING
|
2012-08-13 17:41:42 +00:00
|
|
|
#define fp_dbg(fmt...) _fpi_log(FPRINT_LOG_LEVEL_DEBUG, fmt)
|
2007-10-13 14:52:50 +00:00
|
|
|
#else
|
|
|
|
#define fp_dbg(fmt...)
|
|
|
|
#endif
|
|
|
|
|
2012-08-13 17:41:42 +00:00
|
|
|
#define fp_info(fmt...) _fpi_log(FPRINT_LOG_LEVEL_INFO, fmt)
|
|
|
|
#define fp_warn(fmt...) _fpi_log(FPRINT_LOG_LEVEL_WARNING, fmt)
|
|
|
|
#define fp_err(fmt...) _fpi_log(FPRINT_LOG_LEVEL_ERROR, fmt)
|
2007-10-10 14:51:50 +00:00
|
|
|
|
2008-02-10 18:35:01 +00:00
|
|
|
#ifndef NDEBUG
|
2008-02-04 10:23:11 +00:00
|
|
|
#define BUG_ON(condition) \
|
|
|
|
if ((condition)) fp_err("BUG at %s:%d", __FILE__, __LINE__)
|
|
|
|
#else
|
|
|
|
#define BUG_ON(condition)
|
|
|
|
#endif
|
|
|
|
|
2008-02-10 18:35:01 +00:00
|
|
|
#define BUG() BUG_ON(1)
|
|
|
|
|
2008-02-04 10:23:11 +00:00
|
|
|
enum fp_dev_state {
|
|
|
|
DEV_STATE_INITIAL = 0,
|
|
|
|
DEV_STATE_ERROR,
|
|
|
|
DEV_STATE_INITIALIZING,
|
|
|
|
DEV_STATE_INITIALIZED,
|
|
|
|
DEV_STATE_DEINITIALIZING,
|
|
|
|
DEV_STATE_DEINITIALIZED,
|
|
|
|
DEV_STATE_ENROLL_STARTING,
|
|
|
|
DEV_STATE_ENROLLING,
|
|
|
|
DEV_STATE_ENROLL_STOPPING,
|
|
|
|
DEV_STATE_VERIFY_STARTING,
|
|
|
|
DEV_STATE_VERIFYING,
|
|
|
|
DEV_STATE_VERIFY_DONE,
|
|
|
|
DEV_STATE_VERIFY_STOPPING,
|
|
|
|
DEV_STATE_IDENTIFY_STARTING,
|
|
|
|
DEV_STATE_IDENTIFYING,
|
|
|
|
DEV_STATE_IDENTIFY_DONE,
|
|
|
|
DEV_STATE_IDENTIFY_STOPPING,
|
|
|
|
};
|
|
|
|
|
2008-10-30 15:02:52 +00:00
|
|
|
struct fp_driver **fprint_get_drivers (void);
|
|
|
|
|
2007-10-08 16:01:08 +00:00
|
|
|
struct fp_dev {
|
2007-10-23 22:24:21 +00:00
|
|
|
struct fp_driver *drv;
|
2008-03-10 11:35:58 +00:00
|
|
|
libusb_device_handle *udev;
|
2007-10-28 22:02:04 +00:00
|
|
|
uint32_t devtype;
|
2007-10-08 16:01:08 +00:00
|
|
|
void *priv;
|
2007-10-08 18:53:50 +00:00
|
|
|
|
|
|
|
int nr_enroll_stages;
|
2007-10-12 14:27:23 +00:00
|
|
|
|
2008-02-04 10:23:11 +00:00
|
|
|
/* read-only to drivers */
|
|
|
|
struct fp_print_data *verify_data;
|
|
|
|
|
|
|
|
/* drivers should not mess with any of the below */
|
|
|
|
enum fp_dev_state state;
|
|
|
|
|
2007-10-12 14:27:23 +00:00
|
|
|
int __enroll_stage;
|
2008-02-26 18:04:54 +00:00
|
|
|
|
|
|
|
/* 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;
|
2008-02-04 10:23:11 +00:00
|
|
|
fp_verify_cb verify_cb;
|
2008-02-26 18:04:54 +00:00
|
|
|
void *verify_cb_data;
|
|
|
|
fp_verify_stop_cb verify_stop_cb;
|
|
|
|
void *verify_stop_cb_data;
|
2008-02-04 10:23:11 +00:00
|
|
|
fp_identify_cb identify_cb;
|
2008-02-26 18:04:54 +00:00
|
|
|
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;
|
2007-10-08 16:01:08 +00:00
|
|
|
};
|
|
|
|
|
2008-02-10 18:35:01 +00:00
|
|
|
enum fp_imgdev_state {
|
|
|
|
IMGDEV_STATE_INACTIVE,
|
|
|
|
IMGDEV_STATE_AWAIT_FINGER_ON,
|
|
|
|
IMGDEV_STATE_CAPTURE,
|
|
|
|
IMGDEV_STATE_AWAIT_FINGER_OFF,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum fp_imgdev_action {
|
|
|
|
IMG_ACTION_NONE = 0,
|
|
|
|
IMG_ACTION_ENROLL,
|
|
|
|
IMG_ACTION_VERIFY,
|
|
|
|
IMG_ACTION_IDENTIFY,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum fp_imgdev_enroll_state {
|
|
|
|
IMG_ACQUIRE_STATE_NONE = 0,
|
|
|
|
IMG_ACQUIRE_STATE_ACTIVATING,
|
|
|
|
IMG_ACQUIRE_STATE_AWAIT_FINGER_ON,
|
|
|
|
IMG_ACQUIRE_STATE_AWAIT_IMAGE,
|
|
|
|
IMG_ACQUIRE_STATE_AWAIT_FINGER_OFF,
|
|
|
|
IMG_ACQUIRE_STATE_DONE,
|
|
|
|
IMG_ACQUIRE_STATE_DEACTIVATING,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum fp_imgdev_verify_state {
|
|
|
|
IMG_VERIFY_STATE_NONE = 0,
|
2012-08-28 18:42:05 +00:00
|
|
|
IMG_VERIFY_STATE_ACTIVATING
|
2008-02-10 18:35:01 +00:00
|
|
|
};
|
|
|
|
|
2007-10-26 23:06:53 +00:00
|
|
|
struct fp_img_dev {
|
|
|
|
struct fp_dev *dev;
|
2008-03-10 11:35:58 +00:00
|
|
|
libusb_device_handle *udev;
|
2008-02-10 18:35:01 +00:00
|
|
|
enum fp_imgdev_action action;
|
|
|
|
int action_state;
|
|
|
|
|
|
|
|
struct fp_print_data *acquire_data;
|
|
|
|
struct fp_img *acquire_img;
|
|
|
|
int action_result;
|
|
|
|
|
|
|
|
/* FIXME: better place to put this? */
|
|
|
|
size_t identify_match_offset;
|
|
|
|
|
2007-10-26 23:06:53 +00:00
|
|
|
void *priv;
|
|
|
|
};
|
|
|
|
|
2007-11-02 17:04:19 +00:00
|
|
|
int fpi_imgdev_capture(struct fp_img_dev *imgdev, int unconditional,
|
|
|
|
struct fp_img **image);
|
|
|
|
int fpi_imgdev_get_img_width(struct fp_img_dev *imgdev);
|
|
|
|
int fpi_imgdev_get_img_height(struct fp_img_dev *imgdev);
|
|
|
|
|
2007-10-08 15:46:42 +00:00
|
|
|
struct usb_id {
|
|
|
|
uint16_t vendor;
|
|
|
|
uint16_t product;
|
|
|
|
unsigned long driver_data;
|
|
|
|
};
|
|
|
|
|
2007-10-23 22:24:21 +00:00
|
|
|
enum fp_driver_type {
|
|
|
|
DRIVER_PRIMITIVE = 0,
|
|
|
|
DRIVER_IMAGING = 1,
|
|
|
|
};
|
|
|
|
|
2007-10-08 15:46:42 +00:00
|
|
|
struct fp_driver {
|
2007-10-28 22:02:04 +00:00
|
|
|
const uint16_t id;
|
2007-10-08 15:46:42 +00:00
|
|
|
const char *name;
|
|
|
|
const char *full_name;
|
|
|
|
const struct usb_id * const id_table;
|
2007-10-23 22:24:21 +00:00
|
|
|
enum fp_driver_type type;
|
2008-11-20 14:40:01 +00:00
|
|
|
enum fp_scan_type scan_type;
|
2007-10-23 22:24:21 +00:00
|
|
|
|
|
|
|
void *priv;
|
2007-10-08 16:01:08 +00:00
|
|
|
|
|
|
|
/* Device operations */
|
2010-08-17 22:14:18 +00:00
|
|
|
int (*discover)(struct libusb_device_descriptor *dsc, uint32_t *devtype);
|
2008-02-26 18:04:54 +00:00
|
|
|
int (*open)(struct fp_dev *dev, unsigned long driver_data);
|
|
|
|
void (*close)(struct fp_dev *dev);
|
2008-02-04 10:23:11 +00:00
|
|
|
int (*enroll_start)(struct fp_dev *dev);
|
|
|
|
int (*enroll_stop)(struct fp_dev *dev);
|
|
|
|
int (*verify_start)(struct fp_dev *dev);
|
|
|
|
int (*verify_stop)(struct fp_dev *dev, gboolean iterating);
|
|
|
|
int (*identify_start)(struct fp_dev *dev);
|
|
|
|
int (*identify_stop)(struct fp_dev *dev, gboolean iterating);
|
2007-10-08 15:46:42 +00:00
|
|
|
};
|
|
|
|
|
2007-10-31 13:12:04 +00:00
|
|
|
enum fp_print_data_type fpi_driver_get_data_type(struct fp_driver *drv);
|
|
|
|
|
2007-10-26 23:06:53 +00:00
|
|
|
/* flags for fp_img_driver.flags */
|
|
|
|
#define FP_IMGDRV_SUPPORTS_UNCONDITIONAL_CAPTURE (1 << 0)
|
|
|
|
|
2007-10-23 22:24:21 +00:00
|
|
|
struct fp_img_driver {
|
|
|
|
struct fp_driver driver;
|
2007-10-26 23:06:53 +00:00
|
|
|
uint16_t flags;
|
2007-10-27 13:45:14 +00:00
|
|
|
int img_width;
|
|
|
|
int img_height;
|
2007-11-09 14:57:42 +00:00
|
|
|
int bz3_threshold;
|
2007-10-23 22:24:21 +00:00
|
|
|
|
|
|
|
/* Device operations */
|
2008-02-26 18:04:54 +00:00
|
|
|
int (*open)(struct fp_img_dev *dev, unsigned long driver_data);
|
|
|
|
void (*close)(struct fp_img_dev *dev);
|
2008-02-10 18:35:01 +00:00
|
|
|
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);
|
2007-10-23 22:24:21 +00:00
|
|
|
};
|
|
|
|
|
2008-08-10 19:21:58 +00:00
|
|
|
#ifdef ENABLE_UPEKTS
|
2007-10-23 22:24:21 +00:00
|
|
|
extern struct fp_driver upekts_driver;
|
2008-08-10 19:21:58 +00:00
|
|
|
#endif
|
2010-08-17 18:36:56 +00:00
|
|
|
#ifdef ENABLE_UPEKE2
|
|
|
|
extern struct fp_driver upeke2_driver;
|
|
|
|
#endif
|
2008-08-10 19:21:58 +00:00
|
|
|
#ifdef ENABLE_UPEKTC
|
2007-11-16 18:15:43 +00:00
|
|
|
extern struct fp_img_driver upektc_driver;
|
2008-08-10 19:21:58 +00:00
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_UPEKSONLY
|
2008-07-09 02:23:21 +00:00
|
|
|
extern struct fp_img_driver upeksonly_driver;
|
2008-08-10 19:21:58 +00:00
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_URU4000
|
2007-10-23 22:24:21 +00:00
|
|
|
extern struct fp_img_driver uru4000_driver;
|
2008-08-10 19:21:58 +00:00
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_AES1610
|
2007-11-22 17:25:27 +00:00
|
|
|
extern struct fp_img_driver aes1610_driver;
|
2008-08-10 19:21:58 +00:00
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_AES2501
|
2007-11-07 17:49:10 +00:00
|
|
|
extern struct fp_img_driver aes2501_driver;
|
2008-08-10 19:21:58 +00:00
|
|
|
#endif
|
2012-10-08 22:20:44 +00:00
|
|
|
#ifdef ENABLE_AES2550
|
|
|
|
extern struct fp_img_driver aes2550_driver;
|
|
|
|
#endif
|
2008-08-10 19:21:58 +00:00
|
|
|
#ifdef ENABLE_AES4000
|
2007-10-27 17:12:16 +00:00
|
|
|
extern struct fp_img_driver aes4000_driver;
|
2008-08-10 19:21:58 +00:00
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_FDU2000
|
2007-12-27 01:09:32 +00:00
|
|
|
extern struct fp_img_driver fdu2000_driver;
|
2008-08-10 19:21:58 +00:00
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_VCOM5S
|
2008-03-19 23:29:30 +00:00
|
|
|
extern struct fp_img_driver vcom5s_driver;
|
2008-08-10 19:21:58 +00:00
|
|
|
#endif
|
2011-03-30 12:20:22 +00:00
|
|
|
#ifdef ENABLE_VFS101
|
|
|
|
extern struct fp_img_driver vfs101_driver;
|
|
|
|
#endif
|
2012-07-22 19:44:34 +00:00
|
|
|
#ifdef ENABLE_VFS301
|
|
|
|
extern struct fp_img_driver vfs301_driver;
|
|
|
|
#endif
|
2007-10-23 22:24:21 +00:00
|
|
|
|
2008-07-03 04:27:37 +00:00
|
|
|
extern libusb_context *fpi_usb_ctx;
|
2008-02-26 18:04:54 +00:00
|
|
|
extern GSList *opened_devices;
|
|
|
|
|
2007-10-23 22:24:21 +00:00
|
|
|
void fpi_img_driver_setup(struct fp_img_driver *idriver);
|
2007-10-08 15:46:42 +00:00
|
|
|
|
2007-10-27 17:10:06 +00:00
|
|
|
#define fpi_driver_to_img_driver(drv) \
|
|
|
|
container_of((drv), struct fp_img_driver, driver)
|
|
|
|
|
2007-10-08 15:55:50 +00:00
|
|
|
struct fp_dscv_dev {
|
2008-03-10 11:35:58 +00:00
|
|
|
struct libusb_device *udev;
|
2007-10-23 22:24:21 +00:00
|
|
|
struct fp_driver *drv;
|
2007-10-25 14:00:30 +00:00
|
|
|
unsigned long driver_data;
|
2007-10-30 22:15:45 +00:00
|
|
|
uint32_t devtype;
|
2007-10-08 15:55:50 +00:00
|
|
|
};
|
|
|
|
|
2007-10-31 13:12:04 +00:00
|
|
|
struct fp_dscv_print {
|
|
|
|
uint16_t driver_id;
|
|
|
|
uint32_t devtype;
|
|
|
|
enum fp_finger finger;
|
|
|
|
char *path;
|
|
|
|
};
|
|
|
|
|
2007-10-28 22:02:04 +00:00
|
|
|
enum fp_print_data_type {
|
|
|
|
PRINT_DATA_RAW = 0, /* memset-imposed default */
|
|
|
|
PRINT_DATA_NBIS_MINUTIAE,
|
|
|
|
};
|
|
|
|
|
2007-10-08 17:24:29 +00:00
|
|
|
struct fp_print_data {
|
2007-10-28 22:02:04 +00:00
|
|
|
uint16_t driver_id;
|
|
|
|
uint32_t devtype;
|
|
|
|
enum fp_print_data_type type;
|
2007-10-08 17:24:29 +00:00
|
|
|
size_t length;
|
2007-10-28 22:02:04 +00:00
|
|
|
unsigned char data[0];
|
2007-10-08 17:24:29 +00:00
|
|
|
};
|
|
|
|
|
2007-10-28 22:02:04 +00:00
|
|
|
struct fpi_print_data_fp1 {
|
|
|
|
char prefix[3];
|
|
|
|
uint16_t driver_id;
|
|
|
|
uint32_t devtype;
|
|
|
|
unsigned char data_type;
|
|
|
|
unsigned char data[0];
|
|
|
|
} __attribute__((__packed__));
|
|
|
|
|
2007-11-13 14:32:31 +00:00
|
|
|
void fpi_data_exit(void);
|
2007-10-12 14:27:23 +00:00
|
|
|
struct fp_print_data *fpi_print_data_new(struct fp_dev *dev, size_t length);
|
2007-10-31 13:12:04 +00:00
|
|
|
gboolean fpi_print_data_compatible(uint16_t driver_id1, uint32_t devtype1,
|
|
|
|
enum fp_print_data_type type1, uint16_t driver_id2, uint32_t devtype2,
|
|
|
|
enum fp_print_data_type type2);
|
2007-10-08 17:24:29 +00:00
|
|
|
|
2007-11-17 12:46:00 +00:00
|
|
|
struct fp_minutiae {
|
|
|
|
int alloc;
|
|
|
|
int num;
|
|
|
|
struct fp_minutia **list;
|
|
|
|
};
|
|
|
|
|
2007-10-27 11:07:11 +00:00
|
|
|
/* bit values for fp_img.flags */
|
2012-08-28 18:42:05 +00:00
|
|
|
#define FP_IMG_V_FLIPPED (1<<0)
|
|
|
|
#define FP_IMG_H_FLIPPED (1<<1)
|
2007-10-27 11:07:11 +00:00
|
|
|
#define FP_IMG_COLORS_INVERTED (1<<2)
|
2007-11-17 12:46:00 +00:00
|
|
|
#define FP_IMG_BINARIZED_FORM (1<<3)
|
|
|
|
|
|
|
|
#define FP_IMG_STANDARDIZATION_FLAGS (FP_IMG_V_FLIPPED | FP_IMG_H_FLIPPED \
|
|
|
|
| FP_IMG_COLORS_INVERTED)
|
2007-10-27 11:07:11 +00:00
|
|
|
|
2007-10-26 23:06:53 +00:00
|
|
|
struct fp_img {
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
size_t length;
|
2007-10-27 11:07:11 +00:00
|
|
|
uint16_t flags;
|
2007-11-17 12:46:00 +00:00
|
|
|
struct fp_minutiae *minutiae;
|
|
|
|
unsigned char *binarized;
|
2007-10-26 23:06:53 +00:00
|
|
|
unsigned char data[0];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct fp_img *fpi_img_new(size_t length);
|
2007-10-27 17:10:06 +00:00
|
|
|
struct fp_img *fpi_img_new_for_imgdev(struct fp_img_dev *dev);
|
2007-10-26 23:06:53 +00:00
|
|
|
struct fp_img *fpi_img_resize(struct fp_img *img, size_t newsize);
|
|
|
|
gboolean fpi_img_is_sane(struct fp_img *img);
|
2007-11-17 12:46:00 +00:00
|
|
|
int fpi_img_detect_minutiae(struct fp_img *img);
|
|
|
|
int fpi_img_to_print_data(struct fp_img_dev *imgdev, struct fp_img *img,
|
2007-10-27 21:48:09 +00:00
|
|
|
struct fp_print_data **ret);
|
2007-10-27 23:21:49 +00:00
|
|
|
int fpi_img_compare_print_data(struct fp_print_data *enrolled_print,
|
|
|
|
struct fp_print_data *new_print);
|
2007-11-20 22:13:18 +00:00
|
|
|
int fpi_img_compare_print_data_to_gallery(struct fp_print_data *print,
|
2008-02-10 18:35:01 +00:00
|
|
|
struct fp_print_data **gallery, int match_threshold, size_t *match_offset);
|
2012-11-22 07:12:38 +00:00
|
|
|
struct fp_img *fpi_im_resize(struct fp_img *img, unsigned int w_factor, unsigned int h_factor);
|
2007-10-26 23:06:53 +00:00
|
|
|
|
2008-02-16 12:44:50 +00:00
|
|
|
/* polling and timeouts */
|
|
|
|
|
2008-02-26 22:40:38 +00:00
|
|
|
void fpi_poll_init(void);
|
2008-02-16 12:44:50 +00:00
|
|
|
void fpi_poll_exit(void);
|
|
|
|
|
|
|
|
typedef void (*fpi_timeout_fn)(void *data);
|
|
|
|
|
2008-03-03 23:23:50 +00:00
|
|
|
struct fpi_timeout;
|
|
|
|
struct fpi_timeout *fpi_timeout_add(unsigned int msec, fpi_timeout_fn callback,
|
|
|
|
void *data);
|
|
|
|
void fpi_timeout_cancel(struct fpi_timeout *timeout);
|
2008-02-16 12:44:50 +00:00
|
|
|
|
2008-02-04 10:23:11 +00:00
|
|
|
/* async drv <--> lib comms */
|
|
|
|
|
|
|
|
struct fpi_ssm;
|
|
|
|
typedef void (*ssm_completed_fn)(struct fpi_ssm *ssm);
|
|
|
|
typedef void (*ssm_handler_fn)(struct fpi_ssm *ssm);
|
|
|
|
|
|
|
|
/* sequential state machine: state machine that iterates sequentially over
|
|
|
|
* a predefined series of states. can be aborted by either completion or
|
|
|
|
* abortion error conditions. */
|
|
|
|
struct fpi_ssm {
|
|
|
|
struct fp_dev *dev;
|
2008-02-18 17:54:15 +00:00
|
|
|
struct fpi_ssm *parentsm;
|
2008-02-04 10:23:11 +00:00
|
|
|
void *priv;
|
|
|
|
int nr_states;
|
|
|
|
int cur_state;
|
|
|
|
gboolean completed;
|
|
|
|
int error;
|
|
|
|
ssm_completed_fn callback;
|
|
|
|
ssm_handler_fn handler;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* for library and drivers */
|
|
|
|
struct fpi_ssm *fpi_ssm_new(struct fp_dev *dev, ssm_handler_fn handler,
|
|
|
|
int nr_states);
|
|
|
|
void fpi_ssm_free(struct fpi_ssm *machine);
|
|
|
|
void fpi_ssm_start(struct fpi_ssm *machine, ssm_completed_fn callback);
|
2008-02-18 17:54:15 +00:00
|
|
|
void fpi_ssm_start_subsm(struct fpi_ssm *parent, struct fpi_ssm *child);
|
2008-02-04 10:23:11 +00:00
|
|
|
int fpi_ssm_has_completed(struct fpi_ssm *machine);
|
|
|
|
|
|
|
|
/* for drivers */
|
|
|
|
void fpi_ssm_next_state(struct fpi_ssm *machine);
|
2008-02-15 18:09:14 +00:00
|
|
|
void fpi_ssm_jump_to_state(struct fpi_ssm *machine, int state);
|
2008-02-04 10:23:11 +00:00
|
|
|
void fpi_ssm_mark_completed(struct fpi_ssm *machine);
|
|
|
|
void fpi_ssm_mark_aborted(struct fpi_ssm *machine, int error);
|
|
|
|
|
2008-02-26 18:04:54 +00:00
|
|
|
void fpi_drvcb_open_complete(struct fp_dev *dev, int status);
|
|
|
|
void fpi_drvcb_close_complete(struct fp_dev *dev);
|
2008-02-04 10:23:11 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
void fpi_drvcb_enroll_stopped(struct fp_dev *dev);
|
|
|
|
|
|
|
|
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);
|
|
|
|
void fpi_drvcb_verify_stopped(struct fp_dev *dev);
|
|
|
|
|
|
|
|
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);
|
|
|
|
void fpi_drvcb_identify_stopped(struct fp_dev *dev);
|
|
|
|
|
2008-02-10 18:35:01 +00:00
|
|
|
/* for image drivers */
|
2008-02-26 18:04:54 +00:00
|
|
|
void fpi_imgdev_open_complete(struct fp_img_dev *imgdev, int status);
|
|
|
|
void fpi_imgdev_close_complete(struct fp_img_dev *imgdev);
|
2008-02-10 18:35:01 +00:00
|
|
|
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,
|
|
|
|
gboolean present);
|
|
|
|
void fpi_imgdev_image_captured(struct fp_img_dev *imgdev, struct fp_img *img);
|
|
|
|
void fpi_imgdev_session_error(struct fp_img_dev *imgdev, int error);
|
|
|
|
|
2007-10-08 15:46:42 +00:00
|
|
|
#endif
|
|
|
|
|