lib: Remove all deprecated API
This commit is contained in:
parent
5fcd41b962
commit
45d7046f99
6 changed files with 0 additions and 729 deletions
|
@ -31,8 +31,6 @@
|
||||||
<xi:include href="xml/drv.xml"/>
|
<xi:include href="xml/drv.xml"/>
|
||||||
<xi:include href="xml/dev.xml"/>
|
<xi:include href="xml/dev.xml"/>
|
||||||
<xi:include href="xml/print_data.xml"/>
|
<xi:include href="xml/print_data.xml"/>
|
||||||
<!-- FIXME https://bugs.freedesktop.org/show_bug.cgi?id=106550 -->
|
|
||||||
<xi:include href="xml/dscv_print.xml"/>
|
|
||||||
<xi:include href="xml/img.xml"/>
|
<xi:include href="xml/img.xml"/>
|
||||||
</part>
|
</part>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<FILE>events</FILE>
|
<FILE>events</FILE>
|
||||||
<TITLE>Initialisation and events handling</TITLE>
|
<TITLE>Initialisation and events handling</TITLE>
|
||||||
LIBFPRINT_DEPRECATED
|
LIBFPRINT_DEPRECATED
|
||||||
fp_set_debug
|
|
||||||
fp_init
|
fp_init
|
||||||
fp_exit
|
fp_exit
|
||||||
fp_pollfd
|
fp_pollfd
|
||||||
|
@ -28,9 +27,6 @@ fp_dscv_dev_get_driver
|
||||||
fp_dscv_dev_get_devtype
|
fp_dscv_dev_get_devtype
|
||||||
fp_dscv_dev_get_driver_id
|
fp_dscv_dev_get_driver_id
|
||||||
fp_dscv_dev_supports_print_data
|
fp_dscv_dev_supports_print_data
|
||||||
fp_dscv_dev_supports_dscv_print
|
|
||||||
fp_dscv_dev_for_print_data
|
|
||||||
fp_dscv_dev_for_dscv_print
|
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
|
@ -59,7 +55,6 @@ fp_dev_get_devtype
|
||||||
fp_dev_supports_print_data
|
fp_dev_supports_print_data
|
||||||
fp_dev_supports_imaging
|
fp_dev_supports_imaging
|
||||||
fp_dev_supports_identification
|
fp_dev_supports_identification
|
||||||
fp_dev_supports_dscv_print
|
|
||||||
fp_dev_get_img_width
|
fp_dev_get_img_width
|
||||||
fp_dev_get_img_height
|
fp_dev_get_img_height
|
||||||
|
|
||||||
|
@ -102,27 +97,11 @@ fp_finger
|
||||||
fp_print_data
|
fp_print_data
|
||||||
fp_print_data_get_data
|
fp_print_data_get_data
|
||||||
fp_print_data_from_data
|
fp_print_data_from_data
|
||||||
fp_print_data_save
|
|
||||||
fp_print_data_load
|
|
||||||
fp_print_data_delete
|
|
||||||
fp_print_data_from_dscv_print
|
|
||||||
fp_print_data_free
|
fp_print_data_free
|
||||||
fp_print_data_get_driver_id
|
fp_print_data_get_driver_id
|
||||||
fp_print_data_get_devtype
|
fp_print_data_get_devtype
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
|
||||||
<INCLUDE>fprint.h</INCLUDE>
|
|
||||||
<FILE>dscv_print</FILE>
|
|
||||||
fp_dscv_print
|
|
||||||
fp_discover_prints
|
|
||||||
fp_dscv_prints_free
|
|
||||||
fp_dscv_print_get_driver_id
|
|
||||||
fp_dscv_print_get_devtype
|
|
||||||
fp_dscv_print_get_finger
|
|
||||||
fp_dscv_print_delete
|
|
||||||
</SECTION>
|
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
<INCLUDE>fprint.h</INCLUDE>
|
<INCLUDE>fprint.h</INCLUDE>
|
||||||
<FILE>img</FILE>
|
<FILE>img</FILE>
|
||||||
|
|
|
@ -162,14 +162,6 @@ struct fp_dscv_dev {
|
||||||
uint32_t devtype;
|
uint32_t devtype;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* fp_dscv_print structure definition */
|
|
||||||
struct fp_dscv_print {
|
|
||||||
uint16_t driver_id;
|
|
||||||
uint32_t devtype;
|
|
||||||
enum fp_finger finger;
|
|
||||||
char *path;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* fp_minutia structure definition */
|
/* fp_minutia structure definition */
|
||||||
struct fp_minutia {
|
struct fp_minutia {
|
||||||
int x;
|
int x;
|
||||||
|
@ -206,7 +198,6 @@ struct fp_driver **fprint_get_drivers (void);
|
||||||
enum fp_print_data_type fpi_driver_get_data_type(struct fp_driver *drv);
|
enum fp_print_data_type fpi_driver_get_data_type(struct fp_driver *drv);
|
||||||
|
|
||||||
/* Defined in fpi-data.c */
|
/* Defined in fpi-data.c */
|
||||||
void fpi_data_exit(void);
|
|
||||||
gboolean fpi_print_data_compatible(uint16_t driver_id1, uint32_t devtype1,
|
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 type1, uint16_t driver_id2, uint32_t devtype2,
|
||||||
enum fp_print_data_type type2);
|
enum fp_print_data_type type2);
|
||||||
|
|
|
@ -416,88 +416,6 @@ API_EXPORTED int fp_dscv_dev_supports_print_data(struct fp_dscv_dev *dev,
|
||||||
print->type);
|
print->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* fp_dscv_dev_supports_dscv_print:
|
|
||||||
* @dev: the discovered device
|
|
||||||
* @print: the discovered print for compatibility checking
|
|
||||||
*
|
|
||||||
* Determines if a specific #fp_dscv_print discovered print appears to be
|
|
||||||
* compatible with a discovered device.
|
|
||||||
*
|
|
||||||
* Returns: 1 if the print is compatible with the device, 0 otherwise
|
|
||||||
*
|
|
||||||
* Deprecated: Do not use.
|
|
||||||
*/
|
|
||||||
API_EXPORTED int fp_dscv_dev_supports_dscv_print(struct fp_dscv_dev *dev,
|
|
||||||
struct fp_dscv_print *print)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail(dev, 0);
|
|
||||||
g_return_val_if_fail(print, 0);
|
|
||||||
|
|
||||||
return fpi_print_data_compatible(dev->drv->id, dev->devtype, 0,
|
|
||||||
print->driver_id, print->devtype, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fp_dscv_dev_for_print_data:
|
|
||||||
* @devs: a list of discovered devices
|
|
||||||
* @print: the print under inspection
|
|
||||||
*
|
|
||||||
* Searches a list of discovered devices for a device that appears to be
|
|
||||||
* compatible with a #fp_print_data stored print.
|
|
||||||
*
|
|
||||||
* Returns: the first discovered device that appears to support the print, or
|
|
||||||
* %NULL if no apparently compatible devices could be found
|
|
||||||
*
|
|
||||||
* Deprecated: Do not use.
|
|
||||||
*/
|
|
||||||
API_EXPORTED struct fp_dscv_dev *fp_dscv_dev_for_print_data(struct fp_dscv_dev **devs,
|
|
||||||
struct fp_print_data *print)
|
|
||||||
{
|
|
||||||
struct fp_dscv_dev *ddev;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
g_return_val_if_fail(devs, NULL);
|
|
||||||
g_return_val_if_fail(print, NULL);
|
|
||||||
|
|
||||||
for (i = 0; (ddev = devs[i]); i++)
|
|
||||||
if (fp_dscv_dev_supports_print_data(ddev, print))
|
|
||||||
return ddev;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fp_dscv_dev_for_dscv_print:
|
|
||||||
* @devs: a list of discovered devices
|
|
||||||
* @print: the print under inspection
|
|
||||||
*
|
|
||||||
* Searches a list of discovered devices for a device that appears to be
|
|
||||||
* compatible with a #fp_dscv_print discovered print.
|
|
||||||
*
|
|
||||||
* Returns: the first discovered device that appears to support the print, or
|
|
||||||
* %NULL if no apparently compatible devices could be found
|
|
||||||
*
|
|
||||||
* Deprecated: Do not use.
|
|
||||||
*/
|
|
||||||
API_EXPORTED struct fp_dscv_dev *fp_dscv_dev_for_dscv_print(struct fp_dscv_dev **devs,
|
|
||||||
struct fp_dscv_print *print)
|
|
||||||
{
|
|
||||||
struct fp_dscv_dev *ddev;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
g_return_val_if_fail(devs, NULL);
|
|
||||||
g_return_val_if_fail(print, NULL);
|
|
||||||
|
|
||||||
for (i = 0; (ddev = devs[i]); i++) {
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
if (fp_dscv_dev_supports_dscv_print(ddev, print))
|
|
||||||
return ddev;
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fp_dev_get_driver:
|
* fp_dev_get_driver:
|
||||||
* @dev: the struct #fp_dev device
|
* @dev: the struct #fp_dev device
|
||||||
|
@ -564,28 +482,6 @@ API_EXPORTED int fp_dev_supports_print_data(struct fp_dev *dev,
|
||||||
data->type);
|
data->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* fp_dev_supports_dscv_print:
|
|
||||||
* @dev: the struct #fp_dev device
|
|
||||||
* @print: the discovered print
|
|
||||||
*
|
|
||||||
* Determines if a #fp_dscv_print discovered print appears to be compatible
|
|
||||||
* with a certain device.
|
|
||||||
*
|
|
||||||
* Returns: 1 if the print is compatible with the device, 0 if not
|
|
||||||
*
|
|
||||||
* Deprecated: Do not use.
|
|
||||||
*/
|
|
||||||
API_EXPORTED int fp_dev_supports_dscv_print(struct fp_dev *dev,
|
|
||||||
struct fp_dscv_print *print)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail(dev, 0);
|
|
||||||
g_return_val_if_fail(print, 0);
|
|
||||||
|
|
||||||
return fpi_print_data_compatible(dev->drv->id, dev->devtype,
|
|
||||||
0, print->driver_id, print->devtype, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fp_driver_get_name:
|
* fp_driver_get_name:
|
||||||
* @drv: the driver
|
* @drv: the driver
|
||||||
|
@ -826,7 +722,6 @@ API_EXPORTED void fp_exit(void)
|
||||||
opened_devices = NULL;
|
opened_devices = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
fpi_data_exit();
|
|
||||||
fpi_poll_exit();
|
fpi_poll_exit();
|
||||||
g_slist_free(registered_drivers);
|
g_slist_free(registered_drivers);
|
||||||
registered_drivers = NULL;
|
registered_drivers = NULL;
|
||||||
|
|
|
@ -61,10 +61,6 @@ struct fpi_print_data_item_fp2 {
|
||||||
* to convert print data into byte strings, and to reconstruct stored prints
|
* to convert print data into byte strings, and to reconstruct stored prints
|
||||||
* from such data at a later point. You are welcome to store these byte strings
|
* from such data at a later point. You are welcome to store these byte strings
|
||||||
* in any fashion that suits you.
|
* in any fashion that suits you.
|
||||||
*
|
|
||||||
* The provided API to store data on disk is deprecated and should not be
|
|
||||||
* used anymore. This API stored the prints in the current user's home
|
|
||||||
* directory.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -77,51 +73,9 @@ struct fpi_print_data_item_fp2 {
|
||||||
* See #fp_print_data for the public API counterpart.
|
* See #fp_print_data for the public API counterpart.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *base_store = NULL;
|
|
||||||
|
|
||||||
static void storage_setup(void)
|
|
||||||
{
|
|
||||||
const char *homedir;
|
|
||||||
|
|
||||||
homedir = g_getenv("HOME");
|
|
||||||
if (!homedir)
|
|
||||||
homedir = g_get_home_dir();
|
|
||||||
if (!homedir)
|
|
||||||
return;
|
|
||||||
|
|
||||||
base_store = g_build_filename(homedir, ".fprint/prints", NULL);
|
|
||||||
g_mkdir_with_parents(base_store, DIR_PERMS);
|
|
||||||
/* FIXME handle failure */
|
|
||||||
}
|
|
||||||
|
|
||||||
void fpi_data_exit(void)
|
|
||||||
{
|
|
||||||
g_free(base_store);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define FP_FINGER_IS_VALID(finger) \
|
#define FP_FINGER_IS_VALID(finger) \
|
||||||
((finger) >= LEFT_THUMB && (finger) <= RIGHT_LITTLE)
|
((finger) >= LEFT_THUMB && (finger) <= RIGHT_LITTLE)
|
||||||
|
|
||||||
/* for debug messages only */
|
|
||||||
static const char *finger_num_to_str(enum fp_finger finger)
|
|
||||||
{
|
|
||||||
const char *names[] = {
|
|
||||||
[LEFT_THUMB] = "left thumb",
|
|
||||||
[LEFT_INDEX] = "left index",
|
|
||||||
[LEFT_MIDDLE] = "left middle",
|
|
||||||
[LEFT_RING] = "left ring",
|
|
||||||
[LEFT_LITTLE] = "left little",
|
|
||||||
[RIGHT_THUMB] = "right thumb",
|
|
||||||
[RIGHT_INDEX] = "right index",
|
|
||||||
[RIGHT_MIDDLE] = "right middle",
|
|
||||||
[RIGHT_RING] = "right ring",
|
|
||||||
[RIGHT_LITTLE] = "right little",
|
|
||||||
};
|
|
||||||
if (!FP_FINGER_IS_VALID(finger))
|
|
||||||
return "UNKNOWN";
|
|
||||||
return names[finger];
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct fp_print_data *print_data_new(uint16_t driver_id,
|
static struct fp_print_data *print_data_new(uint16_t driver_id,
|
||||||
uint32_t devtype, enum fp_print_data_type type)
|
uint32_t devtype, enum fp_print_data_type type)
|
||||||
{
|
{
|
||||||
|
@ -321,105 +275,6 @@ API_EXPORTED struct fp_print_data *fp_print_data_from_data(unsigned char *buf,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *get_path_to_storedir(uint16_t driver_id, uint32_t devtype)
|
|
||||||
{
|
|
||||||
char idstr[5];
|
|
||||||
char devtypestr[9];
|
|
||||||
|
|
||||||
g_snprintf(idstr, sizeof(idstr), "%04x", driver_id);
|
|
||||||
g_snprintf(devtypestr, sizeof(devtypestr), "%08x", devtype);
|
|
||||||
|
|
||||||
return g_build_filename(base_store, idstr, devtypestr, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *__get_path_to_print(uint16_t driver_id, uint32_t devtype,
|
|
||||||
enum fp_finger finger)
|
|
||||||
{
|
|
||||||
char *dirpath;
|
|
||||||
char *path;
|
|
||||||
char fingername[2];
|
|
||||||
|
|
||||||
g_snprintf(fingername, 2, "%x", finger);
|
|
||||||
|
|
||||||
dirpath = get_path_to_storedir(driver_id, devtype);
|
|
||||||
path = g_build_filename(dirpath, fingername, NULL);
|
|
||||||
g_free(dirpath);
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *get_path_to_print(struct fp_dev *dev, enum fp_finger finger)
|
|
||||||
{
|
|
||||||
return __get_path_to_print(dev->drv->id, dev->devtype, finger);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fp_print_data_save:
|
|
||||||
* @data: the stored print to save to disk
|
|
||||||
* @finger: the finger that this print corresponds to
|
|
||||||
*
|
|
||||||
* Saves a stored print to disk, assigned to a specific finger. Even though
|
|
||||||
* you are limited to storing only the 10 human fingers, this is a
|
|
||||||
* per-device-type limit. For example, you can store the users right index
|
|
||||||
* finger from a DigitalPersona scanner, and you can also save the right index
|
|
||||||
* finger from a UPEK scanner. When you later come to load the print, the right
|
|
||||||
* one will be automatically selected.
|
|
||||||
*
|
|
||||||
* This function will unconditionally overwrite a fingerprint previously
|
|
||||||
* saved for the same finger and device type. The print is saved in a hidden
|
|
||||||
* directory beneath the current user's home directory.
|
|
||||||
*
|
|
||||||
* Returns: 0 on success, non-zero on error.
|
|
||||||
*
|
|
||||||
* Deprecated: Data storage should be handled outside of libfprint.
|
|
||||||
* See <link linkend="libfprint-Stored-prints.description">stored prints description</link>
|
|
||||||
* for more information.
|
|
||||||
*/
|
|
||||||
API_EXPORTED int fp_print_data_save(struct fp_print_data *data,
|
|
||||||
enum fp_finger finger)
|
|
||||||
{
|
|
||||||
GError *err = NULL;
|
|
||||||
char *path;
|
|
||||||
char *dirpath;
|
|
||||||
unsigned char *buf;
|
|
||||||
size_t len;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
if (!base_store)
|
|
||||||
storage_setup();
|
|
||||||
|
|
||||||
fp_dbg("save %s print from driver %04x", finger_num_to_str(finger),
|
|
||||||
data->driver_id);
|
|
||||||
len = fp_print_data_get_data(data, &buf);
|
|
||||||
if (!len)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
path = __get_path_to_print(data->driver_id, data->devtype, finger);
|
|
||||||
dirpath = g_path_get_dirname(path);
|
|
||||||
r = g_mkdir_with_parents(dirpath, DIR_PERMS);
|
|
||||||
if (r < 0) {
|
|
||||||
fp_err("couldn't create storage directory");
|
|
||||||
free(buf);
|
|
||||||
g_free(path);
|
|
||||||
g_free(dirpath);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
fp_dbg("saving to %s", path);
|
|
||||||
g_file_set_contents(path, buf, len, &err);
|
|
||||||
free(buf);
|
|
||||||
g_free(dirpath);
|
|
||||||
g_free(path);
|
|
||||||
if (err) {
|
|
||||||
r = err->code;
|
|
||||||
fp_err("save failed: %s", err->message);
|
|
||||||
g_error_free(err);
|
|
||||||
/* FIXME interpret error codes */
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean fpi_print_data_compatible(uint16_t driver_id1, uint32_t devtype1,
|
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 type1, uint16_t driver_id2, uint32_t devtype2,
|
||||||
enum fp_print_data_type type2)
|
enum fp_print_data_type type2)
|
||||||
|
@ -442,132 +297,6 @@ gboolean fpi_print_data_compatible(uint16_t driver_id1, uint32_t devtype1,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int load_from_file(char *path, struct fp_print_data **data)
|
|
||||||
{
|
|
||||||
gsize length;
|
|
||||||
gchar *contents;
|
|
||||||
GError *err = NULL;
|
|
||||||
struct fp_print_data *fdata;
|
|
||||||
|
|
||||||
fp_dbg("from %s", path);
|
|
||||||
g_file_get_contents(path, &contents, &length, &err);
|
|
||||||
if (err) {
|
|
||||||
int r = err->code;
|
|
||||||
fp_err("%s load failed: %s", path, err->message);
|
|
||||||
g_error_free(err);
|
|
||||||
/* FIXME interpret more error codes */
|
|
||||||
if (r == G_FILE_ERROR_NOENT)
|
|
||||||
return -ENOENT;
|
|
||||||
else
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
fdata = fp_print_data_from_data(contents, length);
|
|
||||||
g_free(contents);
|
|
||||||
if (!fdata)
|
|
||||||
return -EIO;
|
|
||||||
*data = fdata;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fp_print_data_load:
|
|
||||||
* @dev: the device you are loading the print for
|
|
||||||
* @finger: the finger of the file you are loading
|
|
||||||
* @data: output location to put the corresponding stored print. Must be
|
|
||||||
* freed with fp_print_data_free() after use.
|
|
||||||
|
|
||||||
* Loads a previously stored print from disk. The print must have been saved
|
|
||||||
* earlier using the fp_print_data_save() function.
|
|
||||||
*
|
|
||||||
* A return code of -ENOENT indicates that the fingerprint requested could not
|
|
||||||
* be found. Other error codes (both positive and negative) are possible for
|
|
||||||
* obscure error conditions (e.g. corruption).
|
|
||||||
*
|
|
||||||
* Returns: 0 on success, non-zero on error
|
|
||||||
*
|
|
||||||
* Deprecated: Data storage should be handled outside of libfprint.
|
|
||||||
* See <link linkend="libfprint-Stored-prints.description">stored prints description</link>
|
|
||||||
* for more information.
|
|
||||||
*/
|
|
||||||
API_EXPORTED int fp_print_data_load(struct fp_dev *dev,
|
|
||||||
enum fp_finger finger, struct fp_print_data **data)
|
|
||||||
{
|
|
||||||
gchar *path;
|
|
||||||
struct fp_print_data *fdata = NULL;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
if (!base_store)
|
|
||||||
storage_setup();
|
|
||||||
|
|
||||||
path = get_path_to_print(dev, finger);
|
|
||||||
r = load_from_file(path, &fdata);
|
|
||||||
g_free(path);
|
|
||||||
if (r)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
if (!fp_dev_supports_print_data(dev, fdata)) {
|
|
||||||
fp_err("print data is not compatible!");
|
|
||||||
fp_print_data_free(fdata);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
*data = fdata;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fp_print_data_delete:
|
|
||||||
* @dev: the device that the print belongs to
|
|
||||||
* @finger: the finger of the file you are deleting
|
|
||||||
|
|
||||||
* Removes a stored print from disk previously saved with fp_print_data_save().
|
|
||||||
*
|
|
||||||
* Returns: 0 on success, negative on error
|
|
||||||
*
|
|
||||||
* Deprecated: Data storage should be handled outside of libfprint.
|
|
||||||
* See <link linkend="libfprint-Stored-prints.description">stored prints description</link>
|
|
||||||
* for more information.
|
|
||||||
*/
|
|
||||||
API_EXPORTED int fp_print_data_delete(struct fp_dev *dev,
|
|
||||||
enum fp_finger finger)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
gchar *path = get_path_to_print(dev, finger);
|
|
||||||
|
|
||||||
fp_dbg("remove finger %d at %s", finger, path);
|
|
||||||
r = g_unlink(path);
|
|
||||||
g_free(path);
|
|
||||||
if (r < 0)
|
|
||||||
fp_dbg("unlink failed with error %d", r);
|
|
||||||
|
|
||||||
/* FIXME: cleanup empty directory */
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fp_print_data_from_dscv_print:
|
|
||||||
* @print: the discovered print
|
|
||||||
* @data: output location to point to the corresponding stored print. Must
|
|
||||||
* be freed with fp_print_data_free() after use.
|
|
||||||
|
|
||||||
* Attempts to load a stored print based on a #fp_dscv_print
|
|
||||||
* discovered print record.
|
|
||||||
*
|
|
||||||
* A return code of -ENOENT indicates that the file referred to by the
|
|
||||||
* discovered print could not be found. Other error codes (both positive and
|
|
||||||
* negative) are possible for obscure error conditions (e.g. corruption).
|
|
||||||
*
|
|
||||||
* Returns: 0 on success, non-zero on error.
|
|
||||||
*
|
|
||||||
* Deprecated: Do not use.
|
|
||||||
*/
|
|
||||||
API_EXPORTED int fp_print_data_from_dscv_print(struct fp_dscv_print *print,
|
|
||||||
struct fp_print_data **data)
|
|
||||||
{
|
|
||||||
return load_from_file(print->path, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fp_print_data_free:
|
* fp_print_data_free:
|
||||||
* @data: the stored print to destroy. If NULL, function simply returns.
|
* @data: the stored print to destroy. If NULL, function simply returns.
|
||||||
|
@ -609,292 +338,3 @@ API_EXPORTED uint32_t fp_print_data_get_devtype(struct fp_print_data *data)
|
||||||
{
|
{
|
||||||
return data->devtype;
|
return data->devtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* SECTION:dscv_print
|
|
||||||
* @title: Print discovery (deprecated)
|
|
||||||
* @short_description: Print discovery functions
|
|
||||||
*
|
|
||||||
* The [stored print](libfprint-Stored-prints.html) documentation detailed a simple API
|
|
||||||
* for storing per-device prints for a single user, namely
|
|
||||||
* fp_print_data_save(). It also detailed a load function,
|
|
||||||
* fp_print_data_load(), but usage of this function is limited to scenarios
|
|
||||||
* where you know which device you would like to use, and you know which
|
|
||||||
* finger you are looking to verify.
|
|
||||||
*
|
|
||||||
* In other cases, it would be more useful to be able to enumerate all
|
|
||||||
* previously saved prints, potentially even before device discovery. These
|
|
||||||
* functions are designed to offer this functionality to you.
|
|
||||||
*
|
|
||||||
* Discovered prints are stored in a #fp_dscv_print structure, and you
|
|
||||||
* can use functions documented below to access some information about these
|
|
||||||
* prints. You can determine if a discovered print appears to be compatible
|
|
||||||
* with a device using functions such as fp_dscv_dev_supports_dscv_print() and
|
|
||||||
* fp_dev_supports_dscv_print().
|
|
||||||
*
|
|
||||||
* When you are ready to use the print, you can load it into memory in the form
|
|
||||||
* of a stored print by using the fp_print_data_from_dscv_print() function.
|
|
||||||
*
|
|
||||||
* You may have noticed the use of the word "appears" in the above paragraphs.
|
|
||||||
* libfprint performs print discovery simply by examining the file and
|
|
||||||
* directory structure of libfprint's private data store. It does not examine
|
|
||||||
* the actual prints themselves. Just because a print has been discovered
|
|
||||||
* and appears to be compatible with a certain device does not necessarily mean
|
|
||||||
* that it is usable; when you come to load or use it, under unusual
|
|
||||||
* circumstances it may turn out that the print is corrupt or not for the
|
|
||||||
* device that it appeared to be. Also, it is possible that the print may have
|
|
||||||
* been deleted by the time you come to load it.
|
|
||||||
*
|
|
||||||
* Note that this portion of the library is deprecated. All that it offers is
|
|
||||||
* already implementable using publicly available functions, and its usage is
|
|
||||||
* unnecessarily restrictive in terms of how it stores data.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static GSList *scan_dev_store_dir(char *devpath, uint16_t driver_id,
|
|
||||||
uint32_t devtype, GSList *list)
|
|
||||||
{
|
|
||||||
GError *err = NULL;
|
|
||||||
const gchar *ent;
|
|
||||||
struct fp_dscv_print *print;
|
|
||||||
|
|
||||||
GDir *dir = g_dir_open(devpath, 0, &err);
|
|
||||||
if (!dir) {
|
|
||||||
fp_err("opendir %s failed: %s", devpath, err->message);
|
|
||||||
g_error_free(err);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((ent = g_dir_read_name(dir))) {
|
|
||||||
/* ent is an 1 hex character fp_finger code */
|
|
||||||
guint64 val;
|
|
||||||
enum fp_finger finger;
|
|
||||||
gchar *endptr;
|
|
||||||
|
|
||||||
if (*ent == 0 || strlen(ent) != 1)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
val = g_ascii_strtoull(ent, &endptr, 16);
|
|
||||||
if (endptr == ent || !FP_FINGER_IS_VALID(val)) {
|
|
||||||
fp_dbg("skipping print file %s", ent);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
finger = (enum fp_finger) val;
|
|
||||||
print = g_malloc(sizeof(*print));
|
|
||||||
print->driver_id = driver_id;
|
|
||||||
print->devtype = devtype;
|
|
||||||
print->path = g_build_filename(devpath, ent, NULL);
|
|
||||||
print->finger = finger;
|
|
||||||
list = g_slist_prepend(list, print);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_dir_close(dir);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GSList *scan_driver_store_dir(char *drvpath, uint16_t driver_id,
|
|
||||||
GSList *list)
|
|
||||||
{
|
|
||||||
GError *err = NULL;
|
|
||||||
const gchar *ent;
|
|
||||||
|
|
||||||
GDir *dir = g_dir_open(drvpath, 0, &err);
|
|
||||||
if (!dir) {
|
|
||||||
fp_err("opendir %s failed: %s", drvpath, err->message);
|
|
||||||
g_error_free(err);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((ent = g_dir_read_name(dir))) {
|
|
||||||
/* ent is an 8 hex character devtype */
|
|
||||||
guint64 val;
|
|
||||||
uint32_t devtype;
|
|
||||||
gchar *endptr;
|
|
||||||
gchar *path;
|
|
||||||
|
|
||||||
if (*ent == 0 || strlen(ent) != 8)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
val = g_ascii_strtoull(ent, &endptr, 16);
|
|
||||||
if (endptr == ent) {
|
|
||||||
fp_dbg("skipping devtype %s", ent);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
devtype = (uint32_t) val;
|
|
||||||
path = g_build_filename(drvpath, ent, NULL);
|
|
||||||
list = scan_dev_store_dir(path, driver_id, devtype, list);
|
|
||||||
g_free(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_dir_close(dir);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fp_discover_prints:
|
|
||||||
*
|
|
||||||
* Scans the users home directory and returns a list of prints that were
|
|
||||||
* previously saved using fp_print_data_save().
|
|
||||||
*
|
|
||||||
* Returns: a %NULL-terminated list of discovered prints, must be freed with
|
|
||||||
* fp_dscv_prints_free() after use.
|
|
||||||
*
|
|
||||||
* Deprecated: Do not use.
|
|
||||||
*/
|
|
||||||
API_EXPORTED struct fp_dscv_print **fp_discover_prints(void)
|
|
||||||
{
|
|
||||||
GDir *dir;
|
|
||||||
const gchar *ent;
|
|
||||||
GError *err = NULL;
|
|
||||||
GSList *tmplist = NULL;
|
|
||||||
GSList *elem;
|
|
||||||
GPtrArray *array;
|
|
||||||
|
|
||||||
if (!base_store)
|
|
||||||
storage_setup();
|
|
||||||
|
|
||||||
dir = g_dir_open(base_store, 0, &err);
|
|
||||||
if (!dir) {
|
|
||||||
fp_err("opendir %s failed: %s", base_store, err->message);
|
|
||||||
g_error_free(err);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((ent = g_dir_read_name(dir))) {
|
|
||||||
/* ent is a 4 hex digit driver_id */
|
|
||||||
gchar *endptr;
|
|
||||||
gchar *path;
|
|
||||||
guint64 val;
|
|
||||||
uint16_t driver_id;
|
|
||||||
|
|
||||||
if (*ent == 0 || strlen(ent) != 4)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
val = g_ascii_strtoull(ent, &endptr, 16);
|
|
||||||
if (endptr == ent) {
|
|
||||||
fp_dbg("skipping drv id %s", ent);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
driver_id = (uint16_t) val;
|
|
||||||
path = g_build_filename(base_store, ent, NULL);
|
|
||||||
tmplist = scan_driver_store_dir(path, driver_id, tmplist);
|
|
||||||
g_free(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_dir_close(dir);
|
|
||||||
|
|
||||||
if (tmplist == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
array = g_ptr_array_new();
|
|
||||||
for (elem = tmplist; elem != NULL; elem = elem->next)
|
|
||||||
g_ptr_array_add(array, elem->data);
|
|
||||||
g_ptr_array_add(array, NULL);
|
|
||||||
|
|
||||||
g_slist_free(tmplist);
|
|
||||||
return (struct fp_dscv_print **) g_ptr_array_free(array, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fp_dscv_prints_free:
|
|
||||||
* @prints: the list of discovered prints. If NULL, function simply
|
|
||||||
* returns.
|
|
||||||
*
|
|
||||||
* Frees a list of discovered prints. This function also frees the discovered
|
|
||||||
* prints themselves, so make sure you do not use any discovered prints
|
|
||||||
* after calling this function.
|
|
||||||
*
|
|
||||||
* Deprecated: Do not use.
|
|
||||||
*/
|
|
||||||
API_EXPORTED void fp_dscv_prints_free(struct fp_dscv_print **prints)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
struct fp_dscv_print *print;
|
|
||||||
|
|
||||||
if (!prints)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (i = 0; (print = prints[i]); i++) {
|
|
||||||
if (print)
|
|
||||||
g_free(print->path);
|
|
||||||
g_free(print);
|
|
||||||
}
|
|
||||||
g_free(prints);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fp_dscv_print_get_driver_id:
|
|
||||||
* @print: the discovered print
|
|
||||||
*
|
|
||||||
* Gets the [driver ID](advanced-topics.html#driver_id) for a discovered print. The driver ID
|
|
||||||
* indicates which driver the print originally came from. The print is only
|
|
||||||
* usable with a device controlled by that driver.
|
|
||||||
*
|
|
||||||
* Returns: the driver ID of the driver compatible with the print
|
|
||||||
*
|
|
||||||
* Deprecated: Do not use.
|
|
||||||
*/
|
|
||||||
API_EXPORTED uint16_t fp_dscv_print_get_driver_id(struct fp_dscv_print *print)
|
|
||||||
{
|
|
||||||
return print->driver_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fp_dscv_print_get_devtype:
|
|
||||||
* @print: the discovered print
|
|
||||||
*
|
|
||||||
* Gets the [devtype](advanced-topics.html#device-types) for a discovered print. The devtype
|
|
||||||
* represents which type of device under the parent driver is compatible
|
|
||||||
* with the print.
|
|
||||||
*
|
|
||||||
* Returns: the devtype of the device range compatible with the print
|
|
||||||
*
|
|
||||||
* Deprecated: Do not use.
|
|
||||||
*/
|
|
||||||
API_EXPORTED uint32_t fp_dscv_print_get_devtype(struct fp_dscv_print *print)
|
|
||||||
{
|
|
||||||
return print->devtype;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fp_dscv_print_get_finger:
|
|
||||||
* @print: discovered print
|
|
||||||
*
|
|
||||||
* Gets the finger code for a discovered print.
|
|
||||||
*
|
|
||||||
* Returns: a finger code from #fp_finger
|
|
||||||
*
|
|
||||||
* Deprecated: Do not use.
|
|
||||||
*/
|
|
||||||
API_EXPORTED enum fp_finger fp_dscv_print_get_finger(struct fp_dscv_print *print)
|
|
||||||
{
|
|
||||||
return print->finger;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fp_dscv_print_delete:
|
|
||||||
* @print: the discovered print to remove from disk
|
|
||||||
*
|
|
||||||
* Removes a discovered print from disk. After successful return of this
|
|
||||||
* function, functions such as fp_dscv_print_get_finger() will continue to
|
|
||||||
* operate as before, however calling fp_print_data_from_dscv_print() will
|
|
||||||
* fail for obvious reasons.
|
|
||||||
*
|
|
||||||
* Returns: 0 on success, negative on error
|
|
||||||
*
|
|
||||||
* Deprecated: Do not use.
|
|
||||||
*/
|
|
||||||
API_EXPORTED int fp_dscv_print_delete(struct fp_dscv_print *print)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
fp_dbg("remove at %s", print->path);
|
|
||||||
r = g_unlink(print->path);
|
|
||||||
if (r < 0)
|
|
||||||
fp_dbg("unlink failed with error %d", r);
|
|
||||||
|
|
||||||
/* FIXME: cleanup empty directory */
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -46,14 +46,6 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
struct fp_dscv_dev;
|
struct fp_dscv_dev;
|
||||||
|
|
||||||
/**
|
|
||||||
* fp_dscv_print:
|
|
||||||
*
|
|
||||||
* #fp_dscv_print is an opaque structure type. You must access it using the
|
|
||||||
* functions in this section.
|
|
||||||
*/
|
|
||||||
struct fp_dscv_print;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fp_dev:
|
* fp_dev:
|
||||||
*
|
*
|
||||||
|
@ -147,20 +139,6 @@ uint16_t fp_dscv_dev_get_driver_id(struct fp_dscv_dev *dev);
|
||||||
uint32_t fp_dscv_dev_get_devtype(struct fp_dscv_dev *dev);
|
uint32_t fp_dscv_dev_get_devtype(struct fp_dscv_dev *dev);
|
||||||
int fp_dscv_dev_supports_print_data(struct fp_dscv_dev *dev,
|
int fp_dscv_dev_supports_print_data(struct fp_dscv_dev *dev,
|
||||||
struct fp_print_data *print);
|
struct fp_print_data *print);
|
||||||
int fp_dscv_dev_supports_dscv_print(struct fp_dscv_dev *dev,
|
|
||||||
struct fp_dscv_print *print) LIBFPRINT_DEPRECATED;
|
|
||||||
struct fp_dscv_dev *fp_dscv_dev_for_print_data(struct fp_dscv_dev **devs,
|
|
||||||
struct fp_print_data *print) LIBFPRINT_DEPRECATED;
|
|
||||||
struct fp_dscv_dev *fp_dscv_dev_for_dscv_print(struct fp_dscv_dev **devs,
|
|
||||||
struct fp_dscv_print *print) LIBFPRINT_DEPRECATED;
|
|
||||||
|
|
||||||
/* Print discovery */
|
|
||||||
struct fp_dscv_print **fp_discover_prints(void) LIBFPRINT_DEPRECATED;
|
|
||||||
void fp_dscv_prints_free(struct fp_dscv_print **prints) LIBFPRINT_DEPRECATED;
|
|
||||||
uint16_t fp_dscv_print_get_driver_id(struct fp_dscv_print *print) LIBFPRINT_DEPRECATED;
|
|
||||||
uint32_t fp_dscv_print_get_devtype(struct fp_dscv_print *print) LIBFPRINT_DEPRECATED;
|
|
||||||
enum fp_finger fp_dscv_print_get_finger(struct fp_dscv_print *print) LIBFPRINT_DEPRECATED;
|
|
||||||
int fp_dscv_print_delete(struct fp_dscv_print *print) LIBFPRINT_DEPRECATED;
|
|
||||||
|
|
||||||
/* Device handling */
|
/* Device handling */
|
||||||
struct fp_dev *fp_dev_open(struct fp_dscv_dev *ddev);
|
struct fp_dev *fp_dev_open(struct fp_dscv_dev *ddev);
|
||||||
|
@ -169,7 +147,6 @@ struct fp_driver *fp_dev_get_driver(struct fp_dev *dev);
|
||||||
int fp_dev_get_nr_enroll_stages(struct fp_dev *dev);
|
int fp_dev_get_nr_enroll_stages(struct fp_dev *dev);
|
||||||
uint32_t fp_dev_get_devtype(struct fp_dev *dev);
|
uint32_t fp_dev_get_devtype(struct fp_dev *dev);
|
||||||
int fp_dev_supports_print_data(struct fp_dev *dev, struct fp_print_data *data);
|
int fp_dev_supports_print_data(struct fp_dev *dev, struct fp_print_data *data);
|
||||||
int fp_dev_supports_dscv_print(struct fp_dev *dev, struct fp_dscv_print *print) LIBFPRINT_DEPRECATED;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fp_capture_result:
|
* fp_capture_result:
|
||||||
|
@ -274,14 +251,6 @@ int fp_identify_finger(struct fp_dev *dev,
|
||||||
struct fp_print_data **print_gallery, size_t *match_offset);
|
struct fp_print_data **print_gallery, size_t *match_offset);
|
||||||
|
|
||||||
/* Data handling */
|
/* Data handling */
|
||||||
int fp_print_data_load(struct fp_dev *dev, enum fp_finger finger,
|
|
||||||
struct fp_print_data **data) LIBFPRINT_DEPRECATED;
|
|
||||||
int fp_print_data_from_dscv_print(struct fp_dscv_print *print,
|
|
||||||
struct fp_print_data **data) LIBFPRINT_DEPRECATED;
|
|
||||||
int fp_print_data_save(struct fp_print_data *data, enum fp_finger finger)
|
|
||||||
LIBFPRINT_DEPRECATED;
|
|
||||||
int fp_print_data_delete(struct fp_dev *dev, enum fp_finger finger)
|
|
||||||
LIBFPRINT_DEPRECATED;
|
|
||||||
void fp_print_data_free(struct fp_print_data *data);
|
void fp_print_data_free(struct fp_print_data *data);
|
||||||
size_t fp_print_data_get_data(struct fp_print_data *data, unsigned char **ret);
|
size_t fp_print_data_get_data(struct fp_print_data *data, unsigned char **ret);
|
||||||
struct fp_print_data *fp_print_data_from_data(unsigned char *buf,
|
struct fp_print_data *fp_print_data_from_data(unsigned char *buf,
|
||||||
|
@ -354,7 +323,6 @@ void fp_set_pollfd_notifiers(fp_pollfd_added_cb added_cb,
|
||||||
/* Library */
|
/* Library */
|
||||||
int fp_init(void);
|
int fp_init(void);
|
||||||
void fp_exit(void);
|
void fp_exit(void);
|
||||||
void fp_set_debug(int level) LIBFPRINT_DEPRECATED;
|
|
||||||
|
|
||||||
/* Asynchronous I/O */
|
/* Asynchronous I/O */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue