Zephyr API Documentation 4.3.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Biometrics

Interfaces for biometric sensors. More...

Topics

 Biometrics emulator test helpers
 Biometrics emulator test control functions.

Files

file  biometrics.h
 Main header file for biometrics driver API.

Data Structures

struct  biometric_capabilities
 Biometric sensor capabilities. More...
struct  biometric_match_result
 Result from a biometric match operation. More...
struct  biometric_capture_result
 Result from an enrollment capture operation. More...

Macros

#define BIOMETRIC_STORAGE_DEVICE   BIT(0)
 Biometric storage modes.
#define BIOMETRIC_STORAGE_HOST   BIT(1)
 Store on host system.

Enumerations

enum  biometric_sensor_type { BIOMETRIC_TYPE_FINGERPRINT , BIOMETRIC_TYPE_IRIS , BIOMETRIC_TYPE_FACE , BIOMETRIC_TYPE_VOICE }
 Biometrics sensor types. More...
enum  biometric_match_mode { BIOMETRIC_MATCH_VERIFY , BIOMETRIC_MATCH_IDENTIFY }
 Biometric matching modes. More...
enum  biometric_led_state { BIOMETRIC_LED_OFF , BIOMETRIC_LED_ON , BIOMETRIC_LED_BLINK , BIOMETRIC_LED_BREATHE }
 Biometric LED states. More...
enum  biometric_attribute {
  BIOMETRIC_ATTR_MATCH_THRESHOLD , BIOMETRIC_ATTR_ENROLLMENT_QUALITY , BIOMETRIC_ATTR_SECURITY_LEVEL , BIOMETRIC_ATTR_TIMEOUT_MS ,
  BIOMETRIC_ATTR_ANTI_SPOOF_LEVEL , BIOMETRIC_ATTR_IMAGE_QUALITY , BIOMETRIC_ATTR_COMMON_COUNT , BIOMETRIC_ATTR_PRIV_START = BIOMETRIC_ATTR_COMMON_COUNT ,
  BIOMETRIC_ATTR_MAX = INT16_MAX
}
 Biometric attribute types. More...

Functions

int biometric_get_capabilities (const struct device *dev, struct biometric_capabilities *caps)
 Get biometric sensor capabilities.
int biometric_attr_set (const struct device *dev, enum biometric_attribute attr, int32_t val)
 Set a biometric sensor attribute.
int biometric_attr_get (const struct device *dev, enum biometric_attribute attr, int32_t *val)
 Get a biometric sensor attribute.
int biometric_enroll_start (const struct device *dev, uint16_t template_id)
 Start biometric enrollment.
int biometric_enroll_capture (const struct device *dev, k_timeout_t timeout, struct biometric_capture_result *result)
 Capture enrollment samples.
int biometric_enroll_finalize (const struct device *dev)
 Finalize enrollment.
int biometric_enroll_abort (const struct device *dev)
 Abort enrollment.
int biometric_template_store (const struct device *dev, uint16_t id, const uint8_t *data, size_t size)
 Store biometric template.
int biometric_template_read (const struct device *dev, uint16_t id, uint8_t *data, size_t size)
 Read biometric template.
int biometric_template_delete (const struct device *dev, uint16_t id)
 Delete biometric template.
int biometric_template_delete_all (const struct device *dev)
 Delete all biometric templates.
int biometric_template_list (const struct device *dev, uint16_t *ids, size_t max_count, size_t *actual_count)
 List stored template IDs.
int biometric_match (const struct device *dev, enum biometric_match_mode mode, uint16_t template_id, k_timeout_t timeout, struct biometric_match_result *result)
 Perform biometric matching.
int biometric_led_control (const struct device *dev, enum biometric_led_state state)
 Control biometric sensor LED.

Detailed Description

Interfaces for biometric sensors.

Since
4.4
Version
0.1.0

Macro Definition Documentation

◆ BIOMETRIC_STORAGE_DEVICE

#define BIOMETRIC_STORAGE_DEVICE   BIT(0)

#include <zephyr/drivers/biometrics.h>

Biometric storage modes.

Store on sensor device

◆ BIOMETRIC_STORAGE_HOST

#define BIOMETRIC_STORAGE_HOST   BIT(1)

#include <zephyr/drivers/biometrics.h>

Store on host system.

Enumeration Type Documentation

◆ biometric_attribute

#include <zephyr/drivers/biometrics.h>

Biometric attribute types.

Enumerator
BIOMETRIC_ATTR_MATCH_THRESHOLD 

Minimum confidence score for match acceptance (sensor-specific range).

BIOMETRIC_ATTR_ENROLLMENT_QUALITY 

Minimum quality score for enrollment acceptance (sensor-specific range).

BIOMETRIC_ATTR_SECURITY_LEVEL 

Security level (1-10), higher values reduce false accepts.

BIOMETRIC_ATTR_TIMEOUT_MS 

Default operation timeout in milliseconds.

BIOMETRIC_ATTR_ANTI_SPOOF_LEVEL 

Anti-spoofing detection sensitivity (1-10).

BIOMETRIC_ATTR_IMAGE_QUALITY 

Last captured image quality score (sensor-specific range), read-only.

BIOMETRIC_ATTR_COMMON_COUNT 

Number of all common biometric attributes.

BIOMETRIC_ATTR_PRIV_START 

This and higher values are sensor specific.

Refer to the sensor header file.

BIOMETRIC_ATTR_MAX 

Maximum value describing a biometric attribute type.

◆ biometric_led_state

#include <zephyr/drivers/biometrics.h>

Biometric LED states.

Enumerator
BIOMETRIC_LED_OFF 

LED off.

BIOMETRIC_LED_ON 

LED on continuously.

BIOMETRIC_LED_BLINK 

LED blinking.

BIOMETRIC_LED_BREATHE 

LED breathing effect.

◆ biometric_match_mode

#include <zephyr/drivers/biometrics.h>

Biometric matching modes.

Enumerator
BIOMETRIC_MATCH_VERIFY 

Verify against specific template.

BIOMETRIC_MATCH_IDENTIFY 

Search entire database.

◆ biometric_sensor_type

#include <zephyr/drivers/biometrics.h>

Biometrics sensor types.

Enumerator
BIOMETRIC_TYPE_FINGERPRINT 

Fingerprint sensor.

BIOMETRIC_TYPE_IRIS 

Iris scanner.

BIOMETRIC_TYPE_FACE 

Face recognition.

BIOMETRIC_TYPE_VOICE 

Voice recognition.

Function Documentation

◆ biometric_attr_get()

int biometric_attr_get ( const struct device * dev,
enum biometric_attribute attr,
int32_t * val )

#include <zephyr/drivers/biometrics.h>

Get a biometric sensor attribute.

Parameters
devPointer to the biometric device
attrThe attribute to get
valPointer to store the attribute value
Return values
0Success
-ENOSYSNot supported by device
-EINVALInvalid attribute
-errnoNegative errno code on failure

◆ biometric_attr_set()

int biometric_attr_set ( const struct device * dev,
enum biometric_attribute attr,
int32_t val )

#include <zephyr/drivers/biometrics.h>

Set a biometric sensor attribute.

Parameters
devPointer to the biometric device
attrThe attribute to set
valThe value to set
Return values
0Success
-ENOSYSNot supported by device
-EINVALInvalid attribute or value
-errnoNegative errno code on failure

◆ biometric_enroll_abort()

int biometric_enroll_abort ( const struct device * dev)

#include <zephyr/drivers/biometrics.h>

Abort enrollment.

Cancels ongoing enrollment and resets enrollment state.

Parameters
devBiometric device
Return values
0on success
-EALREADYNo enrollment in progress
-errnocode on failure

◆ biometric_enroll_capture()

int biometric_enroll_capture ( const struct device * dev,
k_timeout_t timeout,
struct biometric_capture_result * result )

#include <zephyr/drivers/biometrics.h>

Capture enrollment samples.

Captures a sample for enrollment. This function blocks until a sample is captured or the timeout expires. Call this function multiple times (typically twice) to collect all required samples before finalizing enrollment.

Parameters
devBiometric device
timeoutTimeout for sample capture
resultOptional pointer to capture result structure for progress/quality info. Pass NULL if not needed.
Return values
0Sample successfully captured
-EINVALNo enrollment started or already have enough samples
-ETIMEDOUTTimeout waiting for sample
-errnoOther negative errno code on failure

◆ biometric_enroll_finalize()

int biometric_enroll_finalize ( const struct device * dev)

#include <zephyr/drivers/biometrics.h>

Finalize enrollment.

Completes enrollment and stores the template.

Parameters
devBiometric device
Return values
0on success
-EINVALInsufficient samples
-ENOSPCNo space to store template
-errnocode on failure

◆ biometric_enroll_start()

int biometric_enroll_start ( const struct device * dev,
uint16_t template_id )

#include <zephyr/drivers/biometrics.h>

Start biometric enrollment.

Begins enrollment for a new template. After calling this, use biometric_enroll_capture() to capture samples, then biometric_enroll_finalize() to complete, or biometric_enroll_abort() to cancel.

Parameters
devBiometric device
template_idTemplate ID to assign (1-based: valid range is 1 to max_templates)
Return values
0on success
-EINVALInvalid template_id or enrollment in progress
-ENOSPCNo space for new template
-errnocode on failure

◆ biometric_get_capabilities()

int biometric_get_capabilities ( const struct device * dev,
struct biometric_capabilities * caps )

#include <zephyr/drivers/biometrics.h>

Get biometric sensor capabilities.

Parameters
devPointer to the biometric device
capsPointer to capabilities structure to populate
Return values
0Success
-errnoNegative errno code on failure

◆ biometric_led_control()

int biometric_led_control ( const struct device * dev,
enum biometric_led_state state )

#include <zephyr/drivers/biometrics.h>

Control biometric sensor LED.

Controls LED state for user feedback during operations.

Parameters
devBiometric device
stateDesired LED state
Return values
0on success
-ENOSYSNot supported by device
-EINVALInvalid state
-errnocode on failure

◆ biometric_match()

int biometric_match ( const struct device * dev,
enum biometric_match_mode mode,
uint16_t template_id,
k_timeout_t timeout,
struct biometric_match_result * result )

#include <zephyr/drivers/biometrics.h>

Perform biometric matching.

Captures a sample and performs matching. This function blocks until matching completes or timeout expires. For BIOMETRIC_MATCH_VERIFY, verifies against template_id. For BIOMETRIC_MATCH_IDENTIFY, searches all templates.

Parameters
devBiometric device
modeVerify or identify mode
template_idTemplate ID for verify mode (ignored in identify mode)
timeoutTimeout for sample capture and matching
resultOptional pointer to match result structure for detailed info. Pass NULL if only match/no-match status is needed.
Return values
0Match successful
-ETIMEDOUTTimeout waiting for sample
-ENOENTNo match found
-errnoOther negative errno code on failure

◆ biometric_template_delete()

int biometric_template_delete ( const struct device * dev,
uint16_t id )

#include <zephyr/drivers/biometrics.h>

Delete biometric template.

Parameters
devPointer to the biometric device
idTemplate ID to delete
Return values
0Success
-EINVALInvalid template_id
-ENOENTTemplate not found
-errnoNegative errno code on failure

◆ biometric_template_delete_all()

int biometric_template_delete_all ( const struct device * dev)

#include <zephyr/drivers/biometrics.h>

Delete all biometric templates.

Parameters
devPointer to the biometric device
Return values
0Success
-errnoNegative errno code on failure

◆ biometric_template_list()

int biometric_template_list ( const struct device * dev,
uint16_t * ids,
size_t max_count,
size_t * actual_count )

#include <zephyr/drivers/biometrics.h>

List stored template IDs.

Parameters
devPointer to the biometric device
idsPointer to array to populate with template IDs
max_countMaximum number of IDs array can hold
actual_countPointer to store actual number of IDs returned
Return values
0Success
-ENOSYSNot supported by device
-errnoNegative errno code on failure

◆ biometric_template_read()

int biometric_template_read ( const struct device * dev,
uint16_t id,
uint8_t * data,
size_t size )

#include <zephyr/drivers/biometrics.h>

Read biometric template.

Retrieves template data. The data buffer must be allocated by caller with sufficient size (check capabilities for template_size).

Parameters
devPointer to the biometric device
idTemplate ID to read
dataPointer to buffer for template data
sizeSize of data buffer
Return values
>=0Number of bytes written
-EINVALInvalid template_id or buffer too small
-ENOENTTemplate not found
-ENOSYSNot supported by device
-errnoNegative errno code on failure

◆ biometric_template_store()

int biometric_template_store ( const struct device * dev,
uint16_t id,
const uint8_t * data,
size_t size )

#include <zephyr/drivers/biometrics.h>

Store biometric template.

Stores a pre-generated template. Used for host-based storage systems or restoring backed-up templates.

Parameters
devPointer to the biometric device
idTemplate ID
dataPointer to template data
sizeSize of template data in bytes
Return values
0Success
-EINVALInvalid template data
-ENOSPCStorage full
-ENOSYSNot supported by device
-errnoNegative errno code on failure