From 6440a7d12f39993098879fbd802c879a61bedbca Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Wed, 21 Apr 2021 21:23:53 +0200 Subject: [PATCH] device: Add new FP_DEVICE_ERROR_TOO_HOT This error code will be thrown if we refuse an operation to protect the device from overheating. --- libfprint/fp-device.h | 2 ++ libfprint/fpi-device.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/libfprint/fp-device.h b/libfprint/fp-device.h index d2d50ca..5b41c89 100644 --- a/libfprint/fp-device.h +++ b/libfprint/fp-device.h @@ -135,6 +135,7 @@ typedef enum { * @FP_DEVICE_ERROR_DATA_FULL: No space on device available for operation * @FP_DEVICE_ERROR_DATA_DUPLICATE: Enrolling template duplicates storaged templates * @FP_DEVICE_ERROR_REMOVED: The device has been removed. + * @FP_DEVICE_ERROR_TOO_HOT: The device might be getting too hot * * Error codes for device operations. More specific errors from other domains * such as #G_IO_ERROR or #G_USB_DEVICE_ERROR may also be reported. @@ -152,6 +153,7 @@ typedef enum { FP_DEVICE_ERROR_DATA_DUPLICATE, /* Leave some room to add more DATA related errors */ FP_DEVICE_ERROR_REMOVED = 0x100, + FP_DEVICE_ERROR_TOO_HOT, } FpDeviceError; GQuark fp_device_retry_quark (void); diff --git a/libfprint/fpi-device.c b/libfprint/fpi-device.c index 914af05..fbce24c 100644 --- a/libfprint/fpi-device.c +++ b/libfprint/fpi-device.c @@ -179,6 +179,10 @@ fpi_device_error_new (FpDeviceError error) msg = "This device has been removed from the system."; break; + case FP_DEVICE_ERROR_TOO_HOT: + msg = "Device disabled to prevent overheating."; + break; + default: g_warning ("Unsupported error, returning general error instead!"); error = FP_DEVICE_ERROR_GENERAL;