aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2013-06-10 09:00:36 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2013-06-10 09:00:36 +0000
commit55f4034796572dd68aeff19321f45e38e47c6138 (patch)
tree0d2436b4da547a92571ca0c1ad050e590515396c /main
parent42e1e28e320493ac91aa09852a9898eec792831f (diff)
downloadaports-55f4034796572dd68aeff19321f45e38e47c6138.tar.bz2
aports-55f4034796572dd68aeff19321f45e38e47c6138.tar.xz
main/libfprint: moved from testing
Diffstat (limited to 'main')
-rw-r--r--main/libfprint/0001-uru4000-fix-race-condition-on-waiting-power-up-irq.patch87
-rw-r--r--main/libfprint/0002-uru4000-fix-cancelling-of-imaging-from-error-callbac.patch45
-rw-r--r--main/libfprint/0003-imgdev-fix-cancelling-of-enrollment-from-stage_compl.patch34
-rw-r--r--main/libfprint/APKBUILD55
4 files changed, 221 insertions, 0 deletions
diff --git a/main/libfprint/0001-uru4000-fix-race-condition-on-waiting-power-up-irq.patch b/main/libfprint/0001-uru4000-fix-race-condition-on-waiting-power-up-irq.patch
new file mode 100644
index 0000000000..88e20518c2
--- /dev/null
+++ b/main/libfprint/0001-uru4000-fix-race-condition-on-waiting-power-up-irq.patch
@@ -0,0 +1,87 @@
+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
+
diff --git a/main/libfprint/0002-uru4000-fix-cancelling-of-imaging-from-error-callbac.patch b/main/libfprint/0002-uru4000-fix-cancelling-of-imaging-from-error-callbac.patch
new file mode 100644
index 0000000000..fc5d3f491d
--- /dev/null
+++ b/main/libfprint/0002-uru4000-fix-cancelling-of-imaging-from-error-callbac.patch
@@ -0,0 +1,45 @@
+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
+
diff --git a/main/libfprint/0003-imgdev-fix-cancelling-of-enrollment-from-stage_compl.patch b/main/libfprint/0003-imgdev-fix-cancelling-of-enrollment-from-stage_compl.patch
new file mode 100644
index 0000000000..303090c7ea
--- /dev/null
+++ b/main/libfprint/0003-imgdev-fix-cancelling-of-enrollment-from-stage_compl.patch
@@ -0,0 +1,34 @@
+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
+
diff --git a/main/libfprint/APKBUILD b/main/libfprint/APKBUILD
new file mode 100644
index 0000000000..879c91169d
--- /dev/null
+++ b/main/libfprint/APKBUILD
@@ -0,0 +1,55 @@
+# Contributor: Timo Teräs <timo.teras@iki.fi>
+# Maintainer: Timo Teräs <timo.teras@iki.fi>
+pkgname=libfprint
+pkgver=0.5.0
+pkgrel=0
+pkgdesc="fingerprint reader and identification library"
+url="http://www.freedesktop.org/wiki/Software/fprint/libfprint"
+arch="all"
+license="LGPL-2.1"
+depends=""
+depends_dev="libusb-dev"
+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-uru4000-fix-race-condition-on-waiting-power-up-irq.patch
+ 0002-uru4000-fix-cancelling-of-imaging-from-error-callbac.patch
+ 0003-imgdev-fix-cancelling-of-enrollment-from-stage_compl.patch
+ "
+
+_builddir="$srcdir"/libfprint-$pkgver
+prepare() {
+ local i
+ cd "$_builddir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+}
+
+build() {
+ cd "$_builddir"
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --localstatedir=/var \
+ --disable-dependency-tracking \
+ --enable-fast-install \
+ --with-pic \
+ || return 1
+ make || return 1
+}
+
+package() {
+ cd "$_builddir"
+ make DESTDIR="$pkgdir" install || return 1
+ rm -f "$pkgdir"/usr/lib/*.la
+}
+
+md5sums="65d118369a47a93be623816f54cdb847 libfprint-0.5.0.tar.xz
+2a184777defbdb90a8c0ef32f6246b49 0001-uru4000-fix-race-condition-on-waiting-power-up-irq.patch
+8e5f6cd2a4967a818729f6fb7e992881 0002-uru4000-fix-cancelling-of-imaging-from-error-callbac.patch
+9c3e6511cd4ac0cdc889e170ed22d954 0003-imgdev-fix-cancelling-of-enrollment-from-stage_compl.patch"