libfprint
Enumerations | Functions
Stored prints

Stored prints are represented by a structure named fp_print_data. More...

Enumerations

enum  fp_finger {
  LEFT_THUMB = 1, LEFT_INDEX, LEFT_MIDDLE, LEFT_RING,
  LEFT_LITTLE, RIGHT_THUMB, RIGHT_INDEX, RIGHT_MIDDLE,
  RIGHT_RING, RIGHT_LITTLE
}
 Numeric codes used to refer to fingers (and thumbs) of a human. More...
 

Functions

size_t fp_print_data_get_data (struct fp_print_data *data, unsigned char **ret)
 Convert a stored print into a unified representation inside a data buffer. More...
 
struct fp_print_data * fp_print_data_from_data (unsigned char *buf, size_t buflen)
 Load a stored print from a data buffer. More...
 
int fp_print_data_save (struct fp_print_data *data, enum fp_finger finger)
 Saves a stored print to disk, assigned to a specific finger. More...
 
int fp_print_data_load (struct fp_dev *dev, enum fp_finger finger, struct fp_print_data **data)
 Loads a previously stored print from disk. More...
 
int fp_print_data_delete (struct fp_dev *dev, enum fp_finger finger)
 Removes a stored print from disk previously saved with fp_print_data_save(). More...
 
int fp_print_data_from_dscv_print (struct fp_dscv_print *print, struct fp_print_data **data)
 Attempts to load a stored print based on a discovered print record. More...
 
void fp_print_data_free (struct fp_print_data *data)
 Frees a stored print. More...
 
uint16_t fp_print_data_get_driver_id (struct fp_print_data *data)
 Gets the driver ID for a stored print. More...
 
uint32_t fp_print_data_get_devtype (struct fp_print_data *data)
 Gets the devtype for a stored print. More...
 

Detailed Description

Stored prints are represented by a structure named fp_print_data.

Stored prints are originally obtained from an enrollment function such as fp_enroll_finger().

This page documents the various operations you can do with a stored print. Note that by default, "stored prints" are not actually stored anywhere except in RAM. For the simple scenarios, libfprint provides a simple API for you to save and load the stored prints referring to a single user in their home directory. For more advanced users, libfprint provides APIs for you to convert print data to a byte string, and to reconstruct stored prints from such data at a later point. You are welcome to store these byte strings in any fashion that suits you.

Enumeration Type Documentation

enum fp_finger

Numeric codes used to refer to fingers (and thumbs) of a human.

These are purposely not available as strings, to avoid getting the library tangled up in localization efforts.

Enumerator
LEFT_INDEX 

thumb (left hand)

LEFT_MIDDLE 

index finger (left hand)

LEFT_RING 

middle finger (left hand)

LEFT_LITTLE 

ring finger (left hand)

RIGHT_THUMB 

little finger (left hand)

RIGHT_INDEX 

thumb (right hand)

RIGHT_MIDDLE 

index finger (right hand)

RIGHT_RING 

middle finger (right hand)

RIGHT_LITTLE 

ring finger (right hand)

Function Documentation

size_t fp_print_data_get_data ( struct fp_print_data *  data,
unsigned char **  ret 
)

Convert a stored print into a unified representation inside a data buffer.

You can then store this data buffer in any way that suits you, and load it back at some later time using fp_print_data_from_data().

Parameters
datathe stored print
retoutput location for the data buffer. Must be freed with free() after use.
Returns
the size of the freshly allocated buffer, or 0 on error.

Referenced by fp_print_data_save().

struct fp_print_data* fp_print_data_from_data ( unsigned char *  buf,
size_t  buflen 
)

Load a stored print from a data buffer.

The contents of said buffer must be the untouched contents of a buffer previously supplied to you by the fp_print_data_get_data() function.

Parameters
bufthe data buffer
buflenthe length of the buffer
Returns
the stored print represented by the data, or NULL on error. Must be freed with fp_print_data_free() after use.
int fp_print_data_save ( struct fp_print_data *  data,
enum fp_finger  finger 
)

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.

Parameters
datathe stored print to save to disk
fingerthe finger that this print corresponds to
Returns
0 on success, non-zero on error.

References fp_print_data_get_data().

int fp_print_data_load ( struct fp_dev *  dev,
enum fp_finger  finger,
struct fp_print_data **  data 
)

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).

Parameters
devthe device you are loading the print for
fingerthe finger of the file you are loading
dataoutput location to put the corresponding stored print. Must be freed with fp_print_data_free() after use.
Returns
0 on success, non-zero on error

References fp_dev_supports_print_data(), and fp_print_data_free().

int fp_print_data_delete ( struct fp_dev *  dev,
enum fp_finger  finger 
)

Removes a stored print from disk previously saved with fp_print_data_save().

Parameters
devthe device that the print belongs to
fingerthe finger of the file you are deleting
Returns
0 on success, negative on error
int fp_print_data_from_dscv_print ( struct fp_dscv_print *  print,
struct fp_print_data **  data 
)

Attempts to load a stored print based on a 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).

Parameters
printthe discovered print
dataoutput location to point to the corresponding stored print. Must be freed with fp_print_data_free() after use.
Returns
0 on success, non-zero on error.
void fp_print_data_free ( struct fp_print_data *  data)

Frees a stored print.

Must be called when you are finished using the print.

Parameters
datathe stored print to destroy. If NULL, function simply returns.

Referenced by fp_print_data_load().

uint16_t fp_print_data_get_driver_id ( struct fp_print_data *  data)

Gets the driver ID for a stored print.

The driver ID indicates which driver the print originally came from. The print is only usable with a device controlled by that driver.

Parameters
datathe stored print
Returns
the driver ID of the driver compatible with the print
uint32_t fp_print_data_get_devtype ( struct fp_print_data *  data)

Gets the devtype for a stored print.

The devtype represents which type of device under the parent driver is compatible with the print.

Parameters
datathe stored print
Returns
the devtype of the device range compatible with the print