From da28731adc75ad7197042980cdcf4780c1a5e4ea Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Thu, 5 Aug 2021 16:43:47 +0200 Subject: [PATCH] device: Add feature flag for continuous scanning support Devices that are considered to never run hot will have FEATURE_ALWAYS_ON set. If set, the UI can safely assume that it is fine to run fingerprint authentication in the background without other user interaction. Closes: #346 --- libfprint/fp-device.h | 2 ++ libfprint/fpi-device.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/libfprint/fp-device.h b/libfprint/fp-device.h index 5b41c89..c920b00 100644 --- a/libfprint/fp-device.h +++ b/libfprint/fp-device.h @@ -58,6 +58,7 @@ typedef enum { * @FP_DEVICE_FEATURE_STORAGE_DELETE: Supports deleting stored templates * @FP_DEVICE_FEATURE_STORAGE_CLEAR: Supports clearing the whole storage * @FP_DEVICE_FEATURE_DUPLICATES_CHECK: Natively supports duplicates detection + * @FP_DEVICE_FEATURE_ALWAYS_ON: Whether the device can run continuously */ typedef enum /*< flags >*/ { FP_DEVICE_FEATURE_NONE = 0, @@ -69,6 +70,7 @@ typedef enum /*< flags >*/ { FP_DEVICE_FEATURE_STORAGE_DELETE = 1 << 5, FP_DEVICE_FEATURE_STORAGE_CLEAR = 1 << 6, FP_DEVICE_FEATURE_DUPLICATES_CHECK = 1 << 7, + FP_DEVICE_FEATURE_ALWAYS_ON = 1 << 8, } FpDeviceFeature; /** diff --git a/libfprint/fpi-device.c b/libfprint/fpi-device.c index fbce24c..5704622 100644 --- a/libfprint/fpi-device.c +++ b/libfprint/fpi-device.c @@ -80,6 +80,9 @@ fpi_device_class_auto_initialize_features (FpDeviceClass *device_class) if (device_class->delete && (device_class->list || device_class->clear_storage)) device_class->features |= FP_DEVICE_FEATURE_STORAGE; + + if (device_class->temp_hot_seconds < 0) + device_class->features |= FP_DEVICE_FEATURE_ALWAYS_ON; } /**