From 25161286f5c9bde3a03eb181e8c4db8029f94001 Mon Sep 17 00:00:00 2001 From: Alexia Death Date: Sat, 26 Dec 2009 17:02:03 +0200 Subject: [PATCH] Only complete scan with MIN_ROWS in print Don't consider the scan complete unless theres at least MIN_ROWS recorded or very long blank read occurred. Typical problem spot: one brief touch before starting the actual scan. Happens most commonly if scan is started from before the first joint resulting in a gap after the inital touch. http://lists.reactivated.net/pipermail/fprint/2009-December/001406.html --- libfprint/drivers/upeksonly.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/libfprint/drivers/upeksonly.c b/libfprint/drivers/upeksonly.c index 84883f4c..9b9adbb8 100644 --- a/libfprint/drivers/upeksonly.c +++ b/libfprint/drivers/upeksonly.c @@ -31,6 +31,7 @@ #define IMG_WIDTH 288 #define NUM_BULK_TRANSFERS 24 #define MAX_ROWS 700 +#define MIN_ROWS 64 struct img_transfer_data { int idx; @@ -218,13 +219,22 @@ static void row_complete(struct fp_img_dev *dev) int total; compute_rows(lastrow, sdev->rowbuf, &diff, &total); + if (total < 52000) { sdev->num_blank = 0; } else { sdev->num_blank++; - if (sdev->num_blank > 500) { + /* Don't consider the scan complete unless theres at least + * MIN_ROWS recorded or very long blank read occurred. + * + * Typical problem spot: one brief touch before starting the + * actual scan. Happens most commonly if scan is started + * from before the first joint resulting in a gap after the inital touch. + */ + if ((sdev->num_blank > 500) + && ((sdev->num_rows > MIN_ROWS) || (sdev->num_blank > 5000))) { sdev->finger_removed = 1; - fp_dbg("detected finger removal"); + fp_dbg("detected finger removal. Blank rows: %d, Full rows: %d", sdev->num_blank, sdev->num_rows); handoff_img(dev); return; }