Device operations: libfprint Reference Manual

## Device operations Device operations — Device operation functions |

## Functions

struct fp_dev * | FP_DEV ()
struct fp_img_dev * | FP_IMG_DEV ()
void | fp_dev_set_instance_data ()
void * | FP_INSTANCE_DATA ()
libusb_device_handle * | fpi_dev_get_usb_dev ()
struct fp_print_data * | fpi_dev_get_verify_data ()
void | fpi_dev_set_nr_enroll_stages ()

## Types and Values

struct | fp_img_dev

## Includes

    #include <fpi-dev.h>

## Description

Those macros and functions will help get access to and from struct fp_dev, and struct fp_img_dev types, as well as get and set the instance struct data, eg. the structure containing the data specific to each driver.

## Functions

### FP_DEV ()

    struct fp_dev *
    FP_DEV (struct fp_img_dev *dev);

Returns the struct fp_dev associated with `dev` , or `NULL` on failure.

#### Parameters

dev | a struct fp_img_dev |

#### Returns

a struct fp_dev or `NULL`

### FP_IMG_DEV ()

    struct fp_img_dev *
    FP_IMG_DEV (struct fp_dev *dev);

Returns a struct fp_img_dev associated with `dev` , or `NULL` on failure.

#### Parameters

dev | a struct fp_dev representing an imaging device. |

#### Returns

a struct fp_img_dev or `NULL`

### fp_dev_set_instance_data ()

    void
    fp_dev_set_instance_data (struct fp_dev *dev,
                              void *instance_data);

Set the instance data for a struct fp_dev. This is usually a structure private to the driver used to keep state and pass it as user_data to asynchronous functions.

The core does not do any memory management for this data, so the driver itself will have to create and free its own structure when appropriate.

#### Parameters

dev | a struct fp_dev |
instance_data | a pointer to the instance data |

### FP_INSTANCE_DATA ()

    void *
    FP_INSTANCE_DATA (struct fp_dev *dev);

Returns the instance data set using `fp_dev_set_instance_data()`.

#### Parameters

dev | a struct fp_dev |

### fpi_dev_get_usb_dev ()

    libusb_device_handle *
    fpi_dev_get_usb_dev (struct fp_dev *dev);

Returns the libusb_device_handle associated with `dev` or `NULL` if none are associated.

#### Parameters

dev | a struct fp_dev |

#### Returns

a libusb_device_handle pointer or `NULL`

### fpi_dev_get_verify_data ()

    struct fp_print_data *
    fpi_dev_get_verify_data (struct fp_dev *dev);

Returns the verify data associated with `dev` . This is usually only necessary for primitive devices which need to have access to the raw verify data as it might have been stored on disk.

#### Parameters

dev | a struct fp_dev |

#### Returns

a struct fp_print_data pointer or `NULL`

### fpi_dev_set_nr_enroll_stages ()

    void
    fpi_dev_set_nr_enroll_stages (struct fp_dev *dev,
                                  int nr_enroll_stages);

Sets the number of enroll stages that this device uses. This is usually only necessary for primitive devices which have a hard-coded number of enroll stages baked into their protocol.

#### Parameters

dev | a struct fp_dev |
nr_enroll_stages | the number of enroll stages |

## Types and Values

### struct fp_img_dev

    struct fp_img_dev;

fp_img_dev is an opaque structure type. You must access it using the appropriate functions.