From 2babfa062572b93ad11923ec5aaa343491ac18e7 Mon Sep 17 00:00:00 2001 From: Dave Date: Tue, 9 Apr 2019 02:30:07 -0400 Subject: [PATCH] elan: Simplify calibration check for ELAN_0C42 Check for the mean calibration being outside of range to know whether we require a recalibration. Continue with the usual checks if the calibration value is within range. --- libfprint/drivers/elan.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libfprint/drivers/elan.c b/libfprint/drivers/elan.c index 1299795..3314d8d 100644 --- a/libfprint/drivers/elan.c +++ b/libfprint/drivers/elan.c @@ -603,6 +603,14 @@ static int elan_need_calibration(struct elan_dev *elandev) g_assert(frame_size != 0); + if (elandev->dev_type == ELAN_0C42) { + if (calib_mean > 5500 || + calib_mean < 2500) { + fp_dbg("Forcing needed recalibration"); + return 1; + } + } + for (int i = 0; i < frame_size; i++) bg_mean += elandev->background[i]; bg_mean /= frame_size;