Top | ![]() |
![]() |
![]() |
![]() |
The methods that are available for drivers to manipulate a device. See FpDeviceClass for more information. Also note that most of these are not relevant for image based devices, see FpImageDeviceClass in that case.
Also see the public FpDevice routines.
void (*FpTimeoutFunc) (FpDevice *device
,gpointer user_data
);
The prototype of the callback function for fpi_device_add_timeout()
.
device |
The FpDevice passed to |
|
user_data |
the data passed to |
GUsbDevice *
fpi_device_get_usb_device (FpDevice *device
);
Get the GUsbDevice for this FpDevice. Only permissible to call if the
FpDevice is of type FP_DEVICE_TYPE_USB
.
const gchar *
fpi_device_get_virtual_env (FpDevice *device
);
Get the value of the environment variable that caused the virtual FpDevice to be
generated. Only permissible to call if the FpDevice is of type FP_DEVICE_TYPE_VIRTUAL
.
FpiDeviceAction
fpi_device_get_current_action (FpDevice *device
);
Get the currently ongoing action or FPI_DEVICE_ACTION_NONE
if there
is no operation at this time.
This is useful for drivers that might share code paths between different actions (e.g. verify and identify) and want to find out again later which action was started in the beginning.
GError *
fpi_device_retry_new (FpDeviceRetry error
);
Create a new retry error code for use with fpi_device_verify_complete()
and similar calls.
GError *
fpi_device_error_new (FpDeviceError error
);
Create a new error code for use with fpi_device_verify_complete()
and
similar calls.
GError * fpi_device_retry_new_msg (FpDeviceRetry error
,const gchar *msg
,...
);
Create a new retry error code for use with fpi_device_verify_complete()
and similar calls.
error |
The FpDeviceRetry error value describing the issue |
|
msg |
Custom message to use with printf-style formatting |
|
... |
args for |
GError * fpi_device_error_new_msg (FpDeviceError error
,const gchar *msg
,...
);
Create a new error code for use with fpi_device_verify_complete()
and similar calls.
error |
The FpDeviceRetry error value describing the issue |
|
msg |
Custom message to use with printf-style formatting |
|
... |
args for |
void fpi_device_get_enroll_data (FpDevice *device
,FpPrint **print
);
Get data for enrollment.
void fpi_device_get_capture_data (FpDevice *device
,gboolean *wait_for_finger
);
Get data for capture.
void fpi_device_get_verify_data (FpDevice *device
,FpPrint **print
);
Get data for verify.
void fpi_device_get_identify_data (FpDevice *device
,GPtrArray **prints
);
Get data for identify.
device |
The FpDevice |
|
prints |
The gallery of prints. |
[out][transfer none][element-type FpPrint] |
void fpi_device_get_delete_data (FpDevice *device
,FpPrint **print
);
Get data for delete.
GCancellable *
fpi_device_get_cancellable (FpDevice *device
);
Retrieve the GCancellable that may cancel the currently ongoing operation. This
is primarily useful to pass directly to e.g. fpi_usb_transfer_submit()
for cancellable
transfers.
In many cases the cancel vfunc may be more convenient to react to cancellation in some
way.
gboolean
fpi_device_action_is_cancelled (FpDevice *device
);
Checks whether the current action has been cancelled by the user.
This is equivalent to first getting the cancellable using
fpi_device_get_cancellable()
and then checking whether it has been
cancelled (if it is non-NULL).
GSource * fpi_device_add_timeout (FpDevice *device
,gint interval
,FpTimeoutFunc func
,gpointer user_data
,GDestroyNotify destroy_notify
);
Register a timeout to run. Drivers should always make sure that timers are cancelled when appropriate.
device |
The FpDevice |
|
interval |
The interval in milliseconds |
|
func |
The FpTimeoutFunc to call on timeout |
|
user_data |
User data to pass to the callback. |
[nullable] |
destroy_notify |
GDestroyNotify for |
[nullable] |
void fpi_device_set_nr_enroll_stages (FpDevice *device
,gint enroll_stages
);
Updates the reported number of enroll stages that the device needs. If all supported devices have the same number of stages, then the value can simply be set in the class.
void fpi_device_set_scan_type (FpDevice *device
,FpScanType scan_type
);
Updates the the scan type of the device from the default. If all supported devices have the same scan type, then the value can simply be set in the class.
void fpi_device_action_error (FpDevice *device
,GError *error
);
Finish an ongoing action with an error. This is the same as calling
the corresponding complete function such as fpi_device_open_complete()
with an error set. If possible, use the correct complete function as
that results in improved error detection.
void fpi_device_probe_complete (FpDevice *device
,const gchar *device_id
,const gchar *device_name
,GError *error
);
Finish an ongoing probe operation. If error is NULL
success is assumed.
device |
The FpDevice |
|
device_id |
Unique ID for the device or |
|
device_name |
Human readable name or |
|
error |
The GError or |
void fpi_device_open_complete (FpDevice *device
,GError *error
);
Finish an ongoing open operation. If error is NULL
success is assumed.
void fpi_device_close_complete (FpDevice *device
,GError *error
);
Finish an ongoing close operation. If error is NULL
success is assumed.
void fpi_device_enroll_complete (FpDevice *device
,FpPrint *print
,GError *error
);
Finish an ongoing enroll operation. The FpPrint can be stored by the caller for later verification.
device |
The FpDevice |
|
The FpPrint or |
[nullable][transfer full] | |
error |
The GError or |
void fpi_device_verify_complete (FpDevice *device
,GError *error
);
Finish an ongoing verify operation. The returned print should be representing the new scan and not the one passed for verification.
Note that error
should only be set for actual errors. In the case
of retry errors, report these using fpi_device_verify_report()
and then call this function without any error argument.
void fpi_device_identify_complete (FpDevice *device
,GError *error
);
Finish an ongoing identify operation. The match that was identified is
returned in match
. The print
parameter returns the newly created scan
that was used for matching.
void fpi_device_capture_complete (FpDevice *device
,FpImage *image
,GError *error
);
Finish an ongoing capture operation.
void fpi_device_delete_complete (FpDevice *device
,GError *error
);
Finish an ongoing delete operation.
void fpi_device_enroll_progress (FpDevice *device
,gint completed_stages
,FpPrint *print
,GError *error
);
Notify about the progress of the enroll operation. This is important for UI interaction.
The passed error may be used if a scan needs to be retried, use fpi_device_retry_new()
.
device |
The FpDevice |
|
completed_stages |
The number of stages that are completed at this point |
|
The FpPrint for the newly completed stage or |
[transfer floating] | |
error |
The GError or |
[transfer full] |
void fpi_device_verify_report (FpDevice *device
,FpiMatchResult result
,FpPrint *print
,GError *error
);
Report the result of a verify operation. Note that the passed error
must be
a retry error with the FP_DEVICE_RETRY
domain. For all other error cases,
the error should passed to fpi_device_verify_complete()
.
device |
The FpDevice |
|
result |
The FpiMatchResult of the operation |
|
(transfer floating) The scanned FpPrint |
||
error |
A GError if result is |
void fpi_device_identify_report (FpDevice *device
,FpPrint *match
,FpPrint *print
,GError *error
);
Report the result of a identify operation. Note that the passed error
must be
a retry error with the FP_DEVICE_RETRY
domain. For all other error cases,
the error should passed to fpi_device_identify_complete()
.
device |
The FpDevice |
|
match |
The FpPrint from the gallery that matched. |
[transfer none] |
The scanned FpPrint. |
[transfer floating] | |
error |
A GError if result is |
typedef struct { /* Static information about the driver. */ const gchar *id; const gchar *full_name; FpDeviceType type; const FpIdEntry *id_table; /* Defaults for device properties */ gint nr_enroll_stages; FpScanType scan_type; /* Callbacks */ gint (*usb_discover) (GUsbDevice *usb_device); void (*probe) (FpDevice *device); void (*open) (FpDevice *device); void (*close) (FpDevice *device); void (*enroll) (FpDevice *device); void (*verify) (FpDevice *device); void (*identify) (FpDevice *device); void (*capture) (FpDevice *device); void (*list) (FpDevice *device); void (*delete) (FpDevice * device); void (*cancel) (FpDevice *device); } FpDeviceClass;
NOTE: If your driver is image based, then you should subclass FpImageDevice instead. FpImageDevice based drivers use a different way of interacting with libfprint.
These are the main entry points for drivers to implement. Drivers may not implement all of these entry points if they do not support the operation (or a default implementation is sufficient).
Drivers must eventually call the corresponding function to finish the
operation. It is also acceptable to call the generic
fpi_device_action_error()
function but doing so is not recommended in most
usecases.
Drivers must also handle cancellation properly for any long running operation (i.e. any operation that requires capturing). It is entirely fine to ignore cancellation requests for short operations (e.g. open/close).
This API is solely intended for drivers. It is purely internal and neither API nor ABI stable.
ID string for the driver. Should be a valid C identifier and should match the drivers file name. |
||
Human readable description of the driver |
||
FpDeviceType |
The type of driver |
|
const FpIdEntry * |
The table of IDs to bind the driver to |
|
The number of enroll stages supported devices need; use
|
||
FpScanType |
The scan type of supported devices; use
|
|
Class method to check whether a USB device is supported by the driver. Should return 0 if the device is unsupported and a positive score otherwise. The default score is 50 and the driver with the highest score will be loaded. |
||
Called immediately for all devices. Most drivers will not need to implement this. Drivers should setup the device identifier from the probe callback which will be used to verify the compatibility of stored FpPrint's. It is permissible to temporarily open the USB device if this is required for the operation. If an error is returned, then the device will be destroyed again immediately and never reported to the API user. |
||
Open the device for further operations. Any of the normal actions are guaranteed to only happen when the device is open (this includes delete). |
||
Close the device again |
||
Start an enroll operation |
||
Start a verify operation |
||
Start an identify operation |
||
Start a capture operation |
||
List prints stored on the device |
||
Delete a print from the device |
||
Called on cancellation, this is a convenience to not need to handle
the GCancellable directly by using |
Current active action of the device. A driver can retrieve the action.
No action is active. |
||
Probe device for support and information. |
||
Device is currently being opened. |
||
Device is currently being closed. |
||
Device is currently enrolling. |
||
Device is currently verifying. |
||
Device is currently identifying. |
||
Device is currently capturing an image. |
||
Device stored prints are being queried. |
||
Device stored print is being deleted. |
struct FpIdEntry { union { struct { guint pid; guint vid; }; const gchar *virtual_envvar; }; guint64 driver_data; };
An entry in the table of supported hardware. For USB devices, the product ID
and vendor ID should be provided. The optional driver_data
field defaults
to 0 and can be used as a simple flag for device quirks.