From eccc63455580ff14b91b383dc9a783ff76feb99e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Mon, 3 Dec 2012 09:57:25 +0200 Subject: [PATCH 2/3] imgdev: fix cancelling of enrollment from stage_completed callback Re-check device state after fpi_drvcb_enroll_stage_completed(). If enrollment was cancelled after non-completing stage, we must not restart acquire as it would confuse the internal state machine. --- libfprint/imgdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libfprint/imgdev.c b/libfprint/imgdev.c index 14e41ae..b0d6ff4 100644 --- a/libfprint/imgdev.c +++ b/libfprint/imgdev.c @@ -146,6 +146,9 @@ void fpi_imgdev_report_finger_status(struct fp_img_dev *imgdev, fp_dbg("reporting enroll result"); fpi_drvcb_enroll_stage_completed(imgdev->dev, r, data, img); if (r > 0 && r != FP_ENROLL_COMPLETE && r != FP_ENROLL_FAIL) { + /* the callback above can cancel enrollment */ + if (imgdev->action != IMG_ACTION_ENROLL) + break; imgdev->action_result = 0; imgdev->action_state = IMG_ACQUIRE_STATE_AWAIT_FINGER_ON; dev_change_state(imgdev, IMG_ACQUIRE_STATE_AWAIT_FINGER_ON); -- 1.8.0.1