main/libfprint: upgrade to 0.6.0

This commit is contained in:
Timo Teräs 2015-04-22 09:22:06 +03:00
parent 1b0c364535
commit 8df8ecc843
5 changed files with 48 additions and 171 deletions

View File

@ -0,0 +1,39 @@
From 9f408bf51b7740e87c3d0b90e5adc5de3c37c052 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Tue, 7 Oct 2014 08:18:41 +0300
Subject: imgdev: fix enum mismatch for dev_change_state() call
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This bug has existed long time, but it was uncovered by commit
e215b0509448 which enabled multiple enrollment rounds.
In practice this broke (at least) URU4000 driver state machine
causing it to enter indefinite loop - due to the invalid state
change callback.
Patch originally posted at:
http://lists.freedesktop.org/archives/fprint/2014-June/000603.html
Test and verification results:
http://lists.freedesktop.org/archives/fprint/2014-June/000607.html
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
diff --git a/libfprint/imgdev.c b/libfprint/imgdev.c
index f960ee3..3b5d3f3 100644
--- a/libfprint/imgdev.c
+++ b/libfprint/imgdev.c
@@ -159,7 +159,7 @@ void fpi_imgdev_report_finger_status(struct fp_img_dev *imgdev,
r > 0 && r != FP_ENROLL_COMPLETE && r != FP_ENROLL_FAIL) {
imgdev->action_result = 0;
imgdev->action_state = IMG_ACQUIRE_STATE_AWAIT_FINGER_ON;
- dev_change_state(imgdev, IMG_ACQUIRE_STATE_AWAIT_FINGER_ON);
+ dev_change_state(imgdev, IMGDEV_STATE_AWAIT_FINGER_ON);
}
break;
case IMG_ACTION_VERIFY:
--
cgit v0.10.2

View File

@ -1,87 +0,0 @@
From 7e1646c382bbd6dc21a167bf7f0e45afa5ea217e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Tue, 4 Dec 2012 10:50:30 +0200
Subject: [PATCH 1/3] uru4000: fix race condition on waiting power up irq
It can come before we finish reading the status register on some
cases. Arm the irq handler early, and fix the state machine to
handle early irq properly.
https://bugs.freedesktop.org/show_bug.cgi?id=57834
---
libfprint/drivers/uru4000.c | 31 ++++++++++++++++++++-----------
1 file changed, 20 insertions(+), 11 deletions(-)
diff --git a/libfprint/drivers/uru4000.c b/libfprint/drivers/uru4000.c
index 541245a..07e26a4 100644
--- a/libfprint/drivers/uru4000.c
+++ b/libfprint/drivers/uru4000.c
@@ -994,16 +994,19 @@ static void init_scanpwr_irq_cb(struct fp_img_dev *dev, int status,
uint16_t type, void *user_data)
{
struct fpi_ssm *ssm = user_data;
+ struct uru4k_dev *urudev = dev->priv;
if (status)
fpi_ssm_mark_aborted(ssm, status);
else if (type != IRQDATA_SCANPWR_ON)
fp_dbg("ignoring interrupt");
- else if (ssm->cur_state != INIT_AWAIT_SCAN_POWER)
- fp_err("ignoring scanpwr interrupt due to being in wrong state %d",
- ssm->cur_state);
- else
+ else if (ssm->cur_state != INIT_AWAIT_SCAN_POWER) {
+ fp_dbg("early scanpwr interrupt");
+ urudev->scanpwr_irq_timeouts = -1;
+ } else {
+ fp_dbg("late scanpwr interrupt");
fpi_ssm_next_state(ssm);
+ }
}
static void init_scanpwr_timeout(void *user_data)
@@ -1053,14 +1056,21 @@ static void init_run_state(struct fpi_ssm *ssm)
fpi_ssm_next_state(ssm);
break;
case INIT_POWERUP: ;
+ if (!IRQ_HANDLER_IS_RUNNING(urudev)) {
+ fpi_ssm_mark_aborted(ssm, -EIO);
+ break;
+ }
+ urudev->irq_cb_data = ssm;
+ urudev->irq_cb = init_scanpwr_irq_cb;
+
struct fpi_ssm *powerupsm = fpi_ssm_new(dev->dev, powerup_run_state,
POWERUP_NUM_STATES);
powerupsm->priv = dev;
fpi_ssm_start_subsm(ssm, powerupsm);
break;
case INIT_AWAIT_SCAN_POWER:
- if (!IRQ_HANDLER_IS_RUNNING(urudev)) {
- fpi_ssm_mark_aborted(ssm, -EIO);
+ if (urudev->scanpwr_irq_timeouts < 0) {
+ fpi_ssm_next_state(ssm);
break;
}
@@ -1073,13 +1083,12 @@ static void init_run_state(struct fpi_ssm *ssm)
fpi_ssm_mark_aborted(ssm, -ETIME);
break;
}
-
- urudev->irq_cb_data = ssm;
- urudev->irq_cb = init_scanpwr_irq_cb;
break;
case INIT_DONE:
- fpi_timeout_cancel(urudev->scanpwr_irq_timeout);
- urudev->scanpwr_irq_timeout = NULL;
+ if (urudev->scanpwr_irq_timeout) {
+ fpi_timeout_cancel(urudev->scanpwr_irq_timeout);
+ urudev->scanpwr_irq_timeout = NULL;
+ }
urudev->irq_cb_data = NULL;
urudev->irq_cb = NULL;
fpi_ssm_next_state(ssm);
--
1.8.0.1

View File

@ -1,45 +0,0 @@
From 045d3c92c22cfc12acd3fe1b2d43bab819758c98 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Mon, 3 Dec 2012 09:51:27 +0200
Subject: [PATCH 2/3] uru4000: fix cancelling of imaging from error callback
Call error callback before resetting img_transfer to NULL. This
variable is internally used to detect if we are still in imaging
loop and the call to execute_state_change() needs to be postponed.
Since this is the final thing imaging_complete() we can't reset
img_transfer until just before this call.
https://bugs.freedesktop.org/show_bug.cgi?id=57829
---
libfprint/drivers/uru4000.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/libfprint/drivers/uru4000.c b/libfprint/drivers/uru4000.c
index 07e26a4..ccaa87f 100644
--- a/libfprint/drivers/uru4000.c
+++ b/libfprint/drivers/uru4000.c
@@ -789,15 +789,18 @@ static void imaging_complete(struct fpi_ssm *ssm)
int r = ssm->error;
fpi_ssm_free(ssm);
+ /* Report error before exiting imaging loop - the error handler
+ * can request state change, which needs to be postponed to end of
+ * this function. */
+ if (r)
+ fpi_imgdev_session_error(dev, r);
+
g_free(urudev->img_data);
urudev->img_data = NULL;
libusb_free_transfer(urudev->img_transfer);
urudev->img_transfer = NULL;
- if (r)
- fpi_imgdev_session_error(dev, r);
-
r = execute_state_change(dev);
if (r)
fpi_imgdev_session_error(dev, r);
--
1.8.0.1

View File

@ -1,34 +0,0 @@
From 72bf2bc90e5e5fccc10f77859dbba666d055df9f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Mon, 3 Dec 2012 09:57:25 +0200
Subject: [PATCH 3/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.
https://bugs.freedesktop.org/show_bug.cgi?id=57829
---
libfprint/imgdev.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libfprint/imgdev.c b/libfprint/imgdev.c
index 14e41ae..1ed3f6d 100644
--- a/libfprint/imgdev.c
+++ b/libfprint/imgdev.c
@@ -145,7 +145,10 @@ void fpi_imgdev_report_finger_status(struct fp_img_dev *imgdev,
case IMG_ACTION_ENROLL:
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 can cancel enrollment, so recheck current
+ * action and the status to see if retry is needed */
+ if (imgdev->action == IMG_ACTION_ENROLL &&
+ r > 0 && r != FP_ENROLL_COMPLETE && r != FP_ENROLL_FAIL) {
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

View File

@ -1,8 +1,8 @@
# Contributor: Timo Teräs <timo.teras@iki.fi>
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=libfprint
pkgver=0.5.1
pkgrel=3
pkgver=0.6.0
pkgrel=0
pkgdesc="fingerprint reader and identification library"
url="http://www.freedesktop.org/wiki/Software/fprint/libfprint"
arch="all"
@ -13,6 +13,7 @@ makedepends="$depends_dev nss-dev glib-dev gdk-pixbuf-dev"
install=""
subpackages="$pkgname-dev"
source="http://people.freedesktop.org/~hadess/libfprint-$pkgver.tar.xz
0001-imgdev-fix-enum-mismatch.patch
"
_builddir="$srcdir"/libfprint-$pkgver
@ -49,6 +50,9 @@ package() {
rm -f "$pkgdir"/usr/lib/*.la
}
md5sums="f52ac662d89fb82a441dacb0bac36c13 libfprint-0.5.1.tar.xz"
sha256sums="6d12563b91888b84b71eee6d2e113d8e9e9940c6a28a0915656b6f86b9568fb3 libfprint-0.5.1.tar.xz"
sha512sums="9bd071260671f832e4287415331df1724690c262491a8fb2390e1ec2ce0416cc60414ba8f1a11b20f2f8c8b5bd891dbb8ff61d98f9029a429c7af1c67d81faf9 libfprint-0.5.1.tar.xz"
md5sums="1e66f6e786348b46075368cc682450a8 libfprint-0.6.0.tar.xz
dc004f5eb118fa653746f9c9e0b3a810 0001-imgdev-fix-enum-mismatch.patch"
sha256sums="2583fcb7d542a918c023776f188067fcedec614e65494dd52bc4d661be803cbe libfprint-0.6.0.tar.xz
e96132d8917d58904e81a79c1d1901bf248cd2d61120231003ccac6f93832edc 0001-imgdev-fix-enum-mismatch.patch"
sha512sums="5f4f67f8dd377098776380b565bf19d6ab857fb11ab2ba2179b835368b52c1fc825c8e3dcebecb73eb5239a47725d8b2d33ece2812d5e05d93e397e6c97f90b2 libfprint-0.6.0.tar.xz
27c1fcfe8a5ceaa8bfe29ecb2389ff7839c8de2095101d5b55c9fff7e24b2875c589bb06f749a6ed5d04a3fa4392c9434f50758462cd12e520cbc2b0ba4aa3f5 0001-imgdev-fix-enum-mismatch.patch"