summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Semenov <zemen17@gmail.com>2016-01-19 14:26:29 +0300
committerVasily Khoruzhick <anarsoul@gmail.com>2016-11-05 20:58:18 -0700
commit49a46668ad2f45d26d3b6d6168ada620c54290ab (patch)
tree7842ae5736ea013e987cf9778af7d4bfad2ac5be
parent76269decdd405a0ae919a24c1ba3061c44bf80b2 (diff)
lib: Add VFS0050 driver
New driver for 138a:0050 device https://bugs.freedesktop.org/show_bug.cgi?id=91616
-rw-r--r--configure.ac13
-rw-r--r--libfprint/Makefile.am6
-rw-r--r--libfprint/core.c3
-rw-r--r--libfprint/drivers/driver_ids.h1
-rw-r--r--libfprint/drivers/vfs0050.c791
-rw-r--r--libfprint/drivers/vfs0050.h382
-rw-r--r--libfprint/fp_internal.h3
7 files changed, 1198 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 707f587..58ea9e9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@ AC_SUBST(lt_major)
AC_SUBST(lt_revision)
AC_SUBST(lt_age)
-all_drivers="upekts upektc upeksonly vcom5s uru4000 fdu2000 aes1610 aes1660 aes2501 aes2550 aes2660 aes3500 aes4000 vfs101 vfs301 vfs5011 upektc_img etes603"
+all_drivers="upekts upektc upeksonly vcom5s uru4000 fdu2000 aes1610 aes1660 aes2501 aes2550 aes2660 aes3500 aes4000 vfs101 vfs301 vfs5011 upektc_img etes603 vfs0050"
require_imaging='no'
require_aeslib='no'
@@ -48,6 +48,7 @@ enable_vfs301='no'
enable_vfs5011='no'
enable_upektc_img='no'
enable_etes603='no'
+enable_vfs0050='no'
AC_ARG_WITH([drivers],[AS_HELP_STRING([--with-drivers],
[List of drivers to enable])],
@@ -150,6 +151,10 @@ for driver in `echo ${drivers} | sed -e 's/,/ /g' -e 's/,$//g'`; do
AC_DEFINE([ENABLE_ETES603], [], [Build EgisTec ES603 driver])
enable_etes603="yes"
;;
+ vfs0050)
+ AC_DEFINE([ENABLE_VFS0050], [], [Build Validity VFS0050 driver])
+ enable_vfs0050="yes"
+ ;;
esac
done
@@ -175,6 +180,7 @@ AM_CONDITIONAL([ENABLE_VFS301], [test "$enable_vfs301" = "yes"])
AM_CONDITIONAL([ENABLE_VFS5011], [test "$enable_vfs5011" = "yes"])
AM_CONDITIONAL([ENABLE_UPEKTC_IMG], [test "$enable_upektc_img" = "yes"])
AM_CONDITIONAL([ENABLE_ETES603], [test "$enable_etes603" = "yes"])
+AM_CONDITIONAL([ENABLE_VFS0050], [test "$enable_vfs0050" = "yes"])
PKG_CHECK_MODULES(LIBUSB, [libusb-1.0 >= 0.9.1])
@@ -396,6 +402,11 @@ if test x$enable_etes603 != xno ; then
else
AC_MSG_NOTICE([ etes603 driver disabled])
fi
+if test x$enable_vfs0050 != xno ; then
+ AC_MSG_NOTICE([** vfs0050 driver enabled])
+else
+ AC_MSG_NOTICE([ vfs0050 driver disabled])
+fi
if test x$require_aeslib != xno ; then
AC_MSG_NOTICE([** aeslib helper functions enabled])
else
diff --git a/libfprint/Makefile.am b/libfprint/Makefile.am
index ea6e678..a7fb162 100644
--- a/libfprint/Makefile.am
+++ b/libfprint/Makefile.am
@@ -21,6 +21,7 @@ VFS301_SRC = drivers/vfs301.c drivers/vfs301_proto.c drivers/vfs301_proto.h dri
VFS5011_SRC = drivers/vfs5011.c drivers/vfs5011_proto.h
UPEKTC_IMG_SRC = drivers/upektc_img.c drivers/upektc_img.h
ETES603_SRC = drivers/etes603.c
+VFS0050_SRC = drivers/vfs0050.c drivers/vfs0050.h
EXTRA_DIST = \
$(UPEKE2_SRC) \
@@ -42,6 +43,7 @@ EXTRA_DIST = \
$(VFS5011_SRC) \
$(UPEKTC_IMG_SRC) \
$(ETES603_SRC) \
+ $(VFS0050_SRC) \
drivers/aesx660.c \
drivers/aesx660.h \
drivers/aes3k.c \
@@ -184,6 +186,10 @@ if ENABLE_ETES603
DRIVER_SRC += $(ETES603_SRC)
endif
+if ENABLE_VFS0050
+DRIVER_SRC += $(VFS0050_SRC)
+endif
+
if REQUIRE_PIXMAN
OTHER_SRC += pixman.c
libfprint_la_CFLAGS += $(IMAGING_CFLAGS)
diff --git a/libfprint/core.c b/libfprint/core.c
index 2ae7649..8b6fe43 100644
--- a/libfprint/core.c
+++ b/libfprint/core.c
@@ -398,6 +398,9 @@ static struct fp_img_driver * const img_drivers[] = {
#ifdef ENABLE_ETES603
&etes603_driver,
#endif
+#ifdef ENABLE_VFS0050
+ &vfs0050_driver,
+#endif
/*#ifdef ENABLE_FDU2000
&fdu2000_driver,
#endif
diff --git a/libfprint/drivers/driver_ids.h b/libfprint/drivers/driver_ids.h
index 4d8414c..8143d01 100644
--- a/libfprint/drivers/driver_ids.h
+++ b/libfprint/drivers/driver_ids.h
@@ -40,6 +40,7 @@ enum {
UPEKTC_IMG_ID = 17,
ETES603_ID = 18,
VFS5011_ID = 19,
+ VFS0050_ID = 20,
};
#endif
diff --git a/libfprint/drivers/vfs0050.c b/libfprint/drivers/vfs0050.c
new file mode 100644
index 0000000..31d793c
--- /dev/null
+++ b/libfprint/drivers/vfs0050.c
@@ -0,0 +1,791 @@
+/*
+ * Validity VFS0050 driver for libfprint
+ * Copyright (C) 2015-2016 Konstantin Semenov <zemen17@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#define FP_COMPONENT "vfs0050"
+
+#include <errno.h>
+#include <string.h>
+#include <fp_internal.h>
+#include <assembling.h>
+#include "driver_ids.h"
+
+#include "vfs0050.h"
+
+/* USB functions */
+
+/* Callback for async_write */
+static void async_write_callback(struct libusb_transfer *transfer)
+{
+ struct fpi_ssm *ssm = transfer->user_data;
+ struct fp_img_dev *idev = ssm->priv;
+
+ int transferred = transfer->actual_length, error =
+ transfer->status, len = transfer->length;
+
+ if (error != 0) {
+ fp_err("USB write transfer: %s", libusb_error_name(error));
+ fpi_imgdev_session_error(idev, -EIO);
+ fpi_ssm_mark_aborted(ssm, -EIO);
+ return;
+ }
+
+ if (transferred != len) {
+ fp_err("Written only %d of %d bytes", transferred, len);
+ fpi_imgdev_session_error(idev, -EIO);
+ fpi_ssm_mark_aborted(ssm, -EIO);
+ return;
+ }
+
+ fpi_ssm_next_state(ssm);
+}
+
+/* Send data to EP1, the only out endpoint */
+static void async_write(struct fpi_ssm *ssm, void *data, int len)
+{
+ struct fp_img_dev *idev = ssm->priv;
+ struct libusb_device_handle *udev = idev->udev;
+ struct vfs_dev_t *vdev = idev->priv;
+
+ vdev->transfer = libusb_alloc_transfer(0);
+ vdev->transfer->flags |= LIBUSB_TRANSFER_FREE_TRANSFER;
+ libusb_fill_bulk_transfer(vdev->transfer, udev, 0x01, data, len,
+ async_write_callback, ssm, VFS_USB_TIMEOUT);
+ libusb_submit_transfer(vdev->transfer);
+}
+
+/* Callback for async_read */
+static void async_read_callback(struct libusb_transfer *transfer)
+{
+ struct fpi_ssm *ssm = transfer->user_data;
+ struct fp_img_dev *idev = ssm->priv;
+
+ int transferred = transfer->actual_length, error =
+ transfer->status, len = transfer->length;
+ int ep = transfer->endpoint;
+
+ if (error != 0) {
+ fp_err("USB read transfer on endpoint %d: %s", ep - 0x80,
+ libusb_error_name(error));
+ fpi_imgdev_session_error(idev, -EIO);
+ fpi_ssm_mark_aborted(ssm, -EIO);
+ return;
+ }
+
+ if (transferred != len) {
+ fp_err("Received %d instead of %d bytes", transferred, len);
+ fpi_imgdev_session_error(idev, -EIO);
+ fpi_ssm_mark_aborted(ssm, -EIO);
+ return;
+ }
+
+ fpi_ssm_next_state(ssm);
+}
+
+/* Receive data from the given ep and compare with expected */
+static void async_read(struct fpi_ssm *ssm, int ep, void *data, int len)
+{
+ struct fp_img_dev *idev = ssm->priv;
+ struct libusb_device_handle *udev = idev->udev;
+ struct vfs_dev_t *vdev = idev->priv;
+
+ ep |= LIBUSB_ENDPOINT_IN;
+
+ vdev->transfer = libusb_alloc_transfer(0);
+ vdev->transfer->flags |= LIBUSB_TRANSFER_FREE_TRANSFER;
+
+ /* 0x83 is the only interrupt endpoint */
+ if (ep == EP3_IN)
+ libusb_fill_interrupt_transfer(vdev->transfer, udev, ep, data,
+ len, async_read_callback, ssm,
+ VFS_USB_TIMEOUT);
+ else
+ libusb_fill_bulk_transfer(vdev->transfer, udev, ep, data, len,
+ async_read_callback, ssm,
+ VFS_USB_TIMEOUT);
+ libusb_submit_transfer(vdev->transfer);
+}
+
+/* Callback for async_read */
+static void async_abort_callback(struct libusb_transfer *transfer)
+{
+ struct fpi_ssm *ssm = transfer->user_data;
+ struct fp_img_dev *idev = ssm->priv;
+
+ int transferred = transfer->actual_length, error = transfer->status;
+ int ep = transfer->endpoint;
+
+ /* In normal case endpoint is empty */
+ if (error == LIBUSB_TRANSFER_TIMED_OUT) {
+ fpi_ssm_next_state(ssm);
+ return;
+ }
+
+ if (error != 0) {
+ fp_err("USB write transfer: %s", libusb_error_name(error));
+ fpi_imgdev_session_error(idev, -EIO);
+ fpi_ssm_mark_aborted(ssm, -EIO);
+ return;
+ }
+
+ /* Don't stop process, only print warning */
+ if (transferred > 0)
+ fp_warn("Endpoint %d had extra %d bytes", ep - 0x80,
+ transferred);
+
+ fpi_ssm_jump_to_state(ssm, ssm->cur_state);
+}
+
+/* Receive data from the given ep and compare with expected */
+static void async_abort(struct fpi_ssm *ssm, int ep)
+{
+ struct fp_img_dev *idev = ssm->priv;
+ struct libusb_device_handle *udev = idev->udev;
+ struct vfs_dev_t *vdev = idev->priv;
+
+ int len = VFS_USB_BUFFER_SIZE;
+ unsigned char *data = g_malloc(VFS_USB_BUFFER_SIZE);
+
+ ep |= LIBUSB_ENDPOINT_IN;
+
+ vdev->transfer = libusb_alloc_transfer(0);
+ vdev->transfer->flags |=
+ LIBUSB_TRANSFER_FREE_TRANSFER | LIBUSB_TRANSFER_FREE_BUFFER;
+
+ /* 0x83 is the only interrupt endpoint */
+ if (ep == EP3_IN)
+ libusb_fill_interrupt_transfer(vdev->transfer, udev, ep, data,
+ len, async_abort_callback, ssm,
+ VFS_USB_ABORT_TIMEOUT);
+ else
+ libusb_fill_bulk_transfer(vdev->transfer, udev, ep, data, len,
+ async_abort_callback, ssm,
+ VFS_USB_ABORT_TIMEOUT);
+ libusb_submit_transfer(vdev->transfer);
+}
+
+/* Image processing functions */
+
+/* Pixel getter for fpi_assemble_lines */
+static unsigned char vfs0050_get_pixel(struct fpi_line_asmbl_ctx *ctx,
+ GSList * line, unsigned int x)
+{
+ return ((struct vfs_line *)line->data)->data[x];
+}
+
+/* Deviation getter for fpi_assemble_lines */
+static int vfs0050_get_difference(struct fpi_line_asmbl_ctx *ctx,
+ GSList * line_list_1, GSList * line_list_2)
+{
+ struct vfs_line *line1 = line_list_1->data;
+ struct vfs_line *line2 = line_list_2->data;
+ const int shift = (VFS_IMAGE_WIDTH - VFS_NEXT_LINE_WIDTH) / 2 - 1;
+ int res = 0;
+ for (int i = 0; i < VFS_NEXT_LINE_WIDTH; ++i) {
+ int x =
+ (int)line1->next_line_part[i] - (int)line2->data[shift + i];
+ res += x * x;
+ }
+ return res;
+}
+
+#define VFS_NOISE_THRESHOLD 40
+
+/* Checks whether line is noise or not using hardware parameters */
+static char is_noise(struct vfs_line *line)
+{
+ int val1 = line->noise_hash_1;
+ int val2 = line->noise_hash_2;
+ if (val1 > VFS_NOISE_THRESHOLD
+ && val1 < 256 - VFS_NOISE_THRESHOLD
+ && val2 > VFS_NOISE_THRESHOLD && val2 < 256 - VFS_NOISE_THRESHOLD)
+ return 1;
+ return 0;
+}
+
+/* Parameters for fpi_assemble_lines */
+static struct fpi_line_asmbl_ctx assembling_ctx = {
+ .line_width = VFS_IMAGE_WIDTH,
+ .max_height = VFS_MAX_HEIGHT,
+ .resolution = 10,
+ .median_filter_size = 25,
+ .max_search_offset = 100,
+ .get_deviation = vfs0050_get_difference,
+ .get_pixel = vfs0050_get_pixel,
+};
+
+/* Processes image before submitting */
+static struct fp_img *prepare_image(struct vfs_dev_t *vdev)
+{
+ int height = vdev->bytes / VFS_LINE_SIZE;
+
+ /* Noise cleaning. IMHO, it works pretty well
+ I've not detected cases when it doesn't work or cuts a part of the finger
+ Noise arises at the end of scan when some water remains on the scanner */
+ while (height > 0) {
+ if (!is_noise(vdev->lines_buffer + height - 1))
+ break;
+ --height;
+ }
+ if (height > VFS_MAX_HEIGHT)
+ height = VFS_MAX_HEIGHT;
+
+ /* If image is not good enough */
+ if (height < VFS_IMAGE_WIDTH)
+ return NULL;
+
+ /* Building GSList */
+ GSList *lines = NULL;
+ for (int i = height - 1; i >= 0; --i)
+ lines = g_slist_prepend(lines, vdev->lines_buffer + i);
+
+ /* Perform line assembling */
+ struct fp_img *img = fpi_assemble_lines(&assembling_ctx, lines, height);
+
+ g_slist_free(lines);
+ return img;
+}
+
+/* Processes and submits image after fingerprint received */
+static void submit_image(struct fp_img_dev *idev)
+{
+ struct vfs_dev_t *vdev = idev->priv;
+
+ /* We were not asked to submit image actually */
+ if (!vdev->active)
+ return;
+
+ struct fp_img *img = prepare_image(vdev);
+
+ if (!img)
+ fpi_imgdev_abort_scan(idev, FP_VERIFY_RETRY_TOO_SHORT);
+ else
+ fpi_imgdev_image_captured(idev, img);
+
+ /* Finger not on the scanner */
+ fpi_imgdev_report_finger_status(idev, 0);
+}
+
+/* Proto functions */
+
+/* SSM loop for clear_ep2 */
+static void clear_ep2_ssm(struct fpi_ssm *ssm)
+{
+ struct fp_img_dev *idev = ssm->priv;
+
+ short result;
+ char command04 = 0x04;
+
+ switch (ssm->cur_state) {
+ case SUBSM1_COMMAND_04:
+ async_write(ssm, &command04, sizeof(command04));
+ break;
+
+ case SUBSM1_RETURN_CODE:
+ async_read(ssm, 1, &result, sizeof(result));
+ break;
+
+ case SUBSM1_ABORT_2:
+ async_abort(ssm, 2);
+ break;
+
+ default:
+ fp_err("Unknown SUBSM1 state");
+ fpi_imgdev_session_error(idev, -EIO);
+ fpi_ssm_mark_aborted(ssm, -EIO);
+ }
+}
+
+/* Send command to clear EP2 */
+static void clear_ep2(struct fpi_ssm *ssm)
+{
+ struct fp_img_dev *idev = ssm->priv;
+
+ struct fpi_ssm *subsm =
+ fpi_ssm_new(idev->dev, clear_ep2_ssm, SUBSM1_STATES);
+ subsm->priv = idev;
+ fpi_ssm_start_subsm(ssm, subsm);
+}
+
+static void send_control_packet_ssm(struct fpi_ssm *ssm)
+{
+ struct fp_img_dev *idev = ssm->priv;
+ struct vfs_dev_t *vdev = idev->priv;
+
+ short result;
+ unsigned char *commit_result = NULL;
+
+ switch (ssm->cur_state) {
+ case SUBSM2_SEND_CONTROL:
+ async_write(ssm, vdev->control_packet, VFS_CONTROL_PACKET_SIZE);
+ break;
+
+ case SUBSM2_RETURN_CODE:
+ async_read(ssm, 1, &result, sizeof(result));
+ break;
+
+ case SUBSM2_SEND_COMMIT:
+ /* next_receive_* packets could be sent only in pair */
+ if (vdev->control_packet == next_receive_1) {
+ vdev->control_packet = next_receive_2;
+ fpi_ssm_jump_to_state(ssm, SUBSM2_SEND_CONTROL);
+ break;
+ }
+ /* commit_out in Windows differs in each commit, but I send the same each time */
+ async_write(ssm, commit_out, sizeof(commit_out));
+ break;
+
+ case SUBSM2_COMMIT_RESPONSE:
+ commit_result = g_malloc(VFS_COMMIT_RESPONSE_SIZE);
+ async_read(ssm, 1, commit_result, VFS_COMMIT_RESPONSE_SIZE);
+ break;
+
+ case SUBSM2_READ_EMPTY_INTERRUPT:
+ /* I don't know how to check result, it could be different */
+ g_free(commit_result);
+
+ async_read(ssm, 3, vdev->interrupt, VFS_INTERRUPT_SIZE);
+ break;
+
+ case SUBSM2_ABORT_3:
+ /* Check that interrupt is empty */
+ if (memcmp
+ (vdev->interrupt, empty_interrupt, VFS_INTERRUPT_SIZE)) {
+ fp_err("Unknown SUBSM2 state");
+ fpi_imgdev_session_error(idev, -EIO);
+ fpi_ssm_mark_aborted(ssm, -EIO);
+ break;
+ }
+ async_abort(ssm, 3);
+ break;
+
+ case SUBSM2_CLEAR_EP2:
+ /* After turn_on Windows doesn't clear EP2 */
+ if (vdev->control_packet != turn_on)
+ clear_ep2(ssm);
+ else
+ fpi_ssm_next_state(ssm);
+ break;
+
+ default:
+ fp_err("Unknown SUBSM2 state");
+ fpi_imgdev_session_error(idev, -EIO);
+ fpi_ssm_mark_aborted(ssm, -EIO);
+ }
+}
+
+/* Send device state control packet */
+static void send_control_packet(struct fpi_ssm *ssm)
+{
+ struct fp_img_dev *idev = ssm->priv;
+
+ struct fpi_ssm *subsm =
+ fpi_ssm_new(idev->dev, send_control_packet_ssm, SUBSM2_STATES);
+ subsm->priv = idev;
+ fpi_ssm_start_subsm(ssm, subsm);
+}
+
+/* Clears all fprint data */
+static void clear_data(struct vfs_dev_t *vdev)
+{
+ g_free(vdev->lines_buffer);
+ vdev->lines_buffer = NULL;
+ vdev->memory = vdev->bytes = 0;
+}
+
+/* After receiving interrupt from EP3 */
+static void interrupt_callback(struct libusb_transfer *transfer)
+{
+ struct fpi_ssm *ssm = transfer->user_data;
+ struct fp_img_dev *idev = ssm->priv;
+ struct vfs_dev_t *vdev = idev->priv;
+
+ char *interrupt = vdev->interrupt;
+ int error = transfer->status, transferred = transfer->actual_length;
+
+ vdev->wait_interrupt = 0;
+
+ /* When we have cancelled transfer, error is ok actually */
+ if (!vdev->active && error == LIBUSB_TRANSFER_CANCELLED)
+ return;
+
+ if (error != 0) {
+ fp_err("USB read interrupt transfer: %s",
+ libusb_error_name(error));
+ fpi_imgdev_session_error(idev, -EIO);
+ fpi_ssm_mark_aborted(ssm, -EIO);
+ return;
+ }
+
+ /* Interrupt size is VFS_INTERRUPT_SIZE bytes in all known cases */
+ if (transferred != VFS_INTERRUPT_SIZE) {
+ fp_err("Unknown interrupt size %d", transferred);
+ /* Abort ssm */
+ fpi_imgdev_session_error(idev, -EIO);
+ fpi_ssm_mark_aborted(ssm, -EIO);
+ return;
+ }
+
+ /* Standard interrupts */
+ if (memcmp(interrupt, interrupt1, VFS_INTERRUPT_SIZE) == 0 ||
+ memcmp(interrupt, interrupt2, VFS_INTERRUPT_SIZE) == 0 ||
+ memcmp(interrupt, interrupt3, VFS_INTERRUPT_SIZE) == 0) {
+ /* Go to the next ssm stage */
+ fpi_ssm_next_state(ssm);
+ return;
+ }
+
+ /* When finger is on the scanner before turn_on */
+ if (interrupt[0] == 0x01) {
+ fp_warn("Finger is already on the scanner");
+
+ /* Go to the next ssm stage */
+ fpi_ssm_next_state(ssm);
+ return;
+ }
+
+ /* Unknown interrupt; abort the session */
+ fp_err("Unknown interrupt '%02x:%02x:%02x:%02x:%02x'!",
+ interrupt[0] & 0xff, interrupt[1] & 0xff, interrupt[2] & 0xff,
+ interrupt[3] & 0xff, interrupt[4] & 0xff);
+
+ /* Abort ssm */
+ fpi_imgdev_session_error(idev, -EIO);
+ fpi_ssm_mark_aborted(ssm, -EIO);
+}
+
+static void receive_callback(struct libusb_transfer *transfer)
+{
+ struct fpi_ssm *ssm = transfer->user_data;
+ struct fp_img_dev *idev = ssm->priv;
+ struct vfs_dev_t *vdev = idev->priv;
+
+ int transferred = transfer->actual_length, error = transfer->status;
+
+ if (error != 0 && error != LIBUSB_TRANSFER_TIMED_OUT) {
+ fp_err("USB read transfer: %s", libusb_error_name(error));
+
+ fpi_imgdev_session_error(idev, -EIO);
+ fpi_ssm_mark_aborted(ssm, -EIO);
+ return;
+ }
+
+ /* Check if fingerprint data is over */
+ if (transferred == 0) {
+ fpi_ssm_next_state(ssm);
+ } else {
+ vdev->bytes += transferred;
+
+ /* We need more data */
+ fpi_ssm_jump_to_state(ssm, ssm->cur_state);
+ }
+}
+
+/* Stub to keep SSM alive when waiting an interrupt */
+static void wait_interrupt(void *data)
+{
+ struct fpi_ssm *ssm = data;
+ struct fp_img_dev *idev = ssm->priv;
+ struct vfs_dev_t *vdev = idev->priv;
+
+ /* Keep sleeping while this flag is on */
+ if (vdev->wait_interrupt)
+ fpi_ssm_jump_to_state(ssm, ssm->cur_state);
+}
+
+/* SSM stub to prepare device to another scan after orange light was on */
+static void another_scan(void *data)
+{
+ struct fpi_ssm *ssm = data;
+ fpi_ssm_jump_to_state(ssm, SSM_TURN_ON);
+}
+
+/* Another SSM stub to continue after waiting for probable vdev->active changes */
+static void scan_completed(void *data)
+{
+ struct fpi_ssm *ssm = data;
+ fpi_ssm_next_state(ssm);
+}
+
+/* Main SSM loop */
+static void activate_ssm(struct fpi_ssm *ssm)
+{
+ struct fp_img_dev *idev = ssm->priv;
+ struct libusb_device_handle *udev = idev->udev;
+ struct vfs_dev_t *vdev = idev->priv;
+
+ switch (ssm->cur_state) {
+ case SSM_INITIAL_ABORT_1:
+ async_abort(ssm, 1);
+ break;
+
+ case SSM_INITIAL_ABORT_2:
+ async_abort(ssm, 2);
+ break;
+
+ case SSM_INITIAL_ABORT_3:
+ async_abort(ssm, 3);
+ break;
+
+ case SSM_CLEAR_EP2:
+ clear_ep2(ssm);
+ break;
+
+ case SSM_TURN_OFF:
+ /* Set control_packet argument */
+ vdev->control_packet = turn_off;
+
+ send_control_packet(ssm);
+ break;
+
+ case SSM_TURN_ON:
+ if (!vdev->active) {
+ /* The only correct exit */
+ fpi_ssm_mark_completed(ssm);
+
+ if (vdev->need_report) {
+ fpi_imgdev_deactivate_complete(idev);
+ vdev->need_report = 0;
+ }
+ break;
+ }
+ /* Set control_packet argument */
+ vdev->control_packet = turn_on;
+
+ send_control_packet(ssm);
+ break;
+
+ case SSM_ASK_INTERRUPT:
+ /* Activated, light must be blinking now */
+
+ /* If we first time here, report that activate completed */
+ if (vdev->need_report) {
+ fpi_imgdev_activate_complete(idev, 0);
+ vdev->need_report = 0;
+ }
+
+ /* Asyncronously enquire an interrupt */
+ vdev->transfer = libusb_alloc_transfer(0);
+ vdev->transfer->flags |= LIBUSB_TRANSFER_FREE_TRANSFER;
+ libusb_fill_interrupt_transfer(vdev->transfer, udev, 0x83,
+ vdev->interrupt,
+ VFS_INTERRUPT_SIZE,
+ interrupt_callback, ssm, 0);
+ libusb_submit_transfer(vdev->transfer);
+
+ /* This flag could be turned off only in callback function */
+ vdev->wait_interrupt = 1;
+
+ /* I've put it here to be sure that data is cleared */
+ clear_data(vdev);
+
+ fpi_ssm_next_state(ssm);
+ break;
+
+ case SSM_WAIT_INTERRUPT:
+ /* Check if user had interrupted the process */
+ if (!vdev->active) {
+ libusb_cancel_transfer(vdev->transfer);
+ fpi_ssm_jump_to_state(ssm, SSM_CLEAR_EP2);
+ break;
+ }
+
+ if (vdev->wait_interrupt)
+ fpi_timeout_add(VFS_SSM_TIMEOUT, wait_interrupt, ssm);
+ break;
+
+ case SSM_RECEIVE_FINGER:
+ if (vdev->memory == 0) {
+ /* Initialize fingerprint buffer */
+ g_free(vdev->lines_buffer);
+ vdev->memory = VFS_USB_BUFFER_SIZE;
+ vdev->lines_buffer = g_malloc(vdev->memory);
+ vdev->bytes = 0;
+
+ /* Finger is on the scanner */
+ fpi_imgdev_report_finger_status(idev, 1);
+ }
+
+ /* Increase buffer size while it's insufficient */
+ while (vdev->bytes + VFS_USB_BUFFER_SIZE > vdev->memory) {
+ vdev->memory <<= 1;
+ vdev->lines_buffer =
+ (struct vfs_line *)g_realloc(vdev->lines_buffer,
+ vdev->memory);
+ }
+
+ /* Receive chunk of data */
+ vdev->transfer = libusb_alloc_transfer(0);
+ vdev->transfer->flags |= LIBUSB_TRANSFER_FREE_TRANSFER;
+ libusb_fill_bulk_transfer(vdev->transfer, udev, 0x82,
+ (void *)vdev->lines_buffer +
+ vdev->bytes, VFS_USB_BUFFER_SIZE,
+ receive_callback, ssm,
+ VFS_USB_TIMEOUT);
+ libusb_submit_transfer(vdev->transfer);
+ break;
+
+ case SSM_SUBMIT_IMAGE:
+ submit_image(idev);
+ clear_data(vdev);
+
+ /* Wait for probable vdev->active changing */
+ fpi_timeout_add(VFS_SSM_TIMEOUT, scan_completed, ssm);
+ break;
+
+ case SSM_NEXT_RECEIVE:
+ if (!vdev->active) {
+ /* It's the last scan */
+ fpi_ssm_jump_to_state(ssm, SSM_CLEAR_EP2);
+ break;
+ }
+
+ /* Set control_packet argument */
+ vdev->control_packet = next_receive_1;
+
+ send_control_packet(ssm);
+ break;
+
+ case SSM_WAIT_ANOTHER_SCAN:
+ /* Orange light is on now */
+ fpi_timeout_add(VFS_SSM_ORANGE_TIMEOUT, another_scan, ssm);
+ break;
+
+ default:
+ fp_err("Unknown state");
+ fpi_imgdev_session_error(idev, -EIO);
+ fpi_ssm_mark_aborted(ssm, -EIO);
+ }
+}
+
+/* Driver functions */
+
+/* Callback for dev_activate ssm */
+static void dev_activate_callback(struct fpi_ssm *ssm)
+{
+ struct fp_img_dev *idev = ssm->priv;
+ struct vfs_dev_t *vdev = idev->priv;
+
+ vdev->ssm_active = 0;
+
+ fpi_ssm_free(ssm);
+}
+
+/* Activate device */
+static int dev_activate(struct fp_img_dev *idev, enum fp_imgdev_state state)
+{
+ struct vfs_dev_t *vdev = idev->priv;
+
+ /* Initialize flags */
+ vdev->active = 1;
+ vdev->need_report = 1;
+ vdev->ssm_active = 1;
+
+ struct fpi_ssm *ssm = fpi_ssm_new(idev->dev, activate_ssm, SSM_STATES);
+ ssm->priv = idev;
+ fpi_ssm_start(ssm, dev_activate_callback);
+ return 0;
+}
+
+/* Deactivate device */
+static void dev_deactivate(struct fp_img_dev *idev)
+{
+ struct vfs_dev_t *vdev = idev->priv;
+
+ if (!vdev->ssm_active) {
+ fpi_imgdev_deactivate_complete(idev);
+ return;
+ }
+
+ /* Initialize flags */
+ vdev->active = 0;
+ vdev->need_report = 1;
+}
+
+/* Callback for dev_open ssm */
+static void dev_open_callback(struct fpi_ssm *ssm)
+{
+ /* Notify open complete */
+ fpi_imgdev_open_complete((struct fp_img_dev *)ssm->priv, 0);
+ fpi_ssm_free(ssm);
+}
+
+/* Open device */
+static int dev_open(struct fp_img_dev *idev, unsigned long driver_data)
+{
+ /* Claim usb interface */
+ int error = libusb_claim_interface(idev->udev, 0);
+ if (error < 0) {
+ /* Interface not claimed, return error */
+ fp_err("could not claim interface 0");
+ return error;
+ }
+
+ /* Initialize private structure */
+ struct vfs_dev_t *vdev = g_malloc0(sizeof(struct vfs_dev_t));
+ idev->priv = vdev;
+
+ /* Clearing previous device state */
+ struct fpi_ssm *ssm = fpi_ssm_new(idev->dev, activate_ssm, SSM_STATES);
+ ssm->priv = idev;
+ fpi_ssm_start(ssm, dev_open_callback);
+ return 0;
+}
+
+/* Close device */
+static void dev_close(struct fp_img_dev *idev)
+{
+ /* Release private structure */
+ g_free(idev->priv);
+
+ /* Release usb interface */
+ libusb_release_interface(idev->udev, 0);
+
+ /* Notify close complete */
+ fpi_imgdev_close_complete(idev);
+}
+
+/* Usb id table of device */
+static const struct usb_id id_table[] = {
+ {.vendor = 0x138a,.product = 0x0050},
+ {0, 0, 0,},
+};
+
+/* Device driver definition */
+struct fp_img_driver vfs0050_driver = {
+ /* Driver specification */
+ .driver = {
+ .id = VFS0050_ID,
+ .name = FP_COMPONENT,
+ .full_name = "Validity VFS0050",
+ .id_table = id_table,
+ .scan_type = FP_SCAN_TYPE_SWIPE,
+ },
+
+ /* Image specification */
+ .flags = 0,
+ .img_width = VFS_IMAGE_WIDTH,
+ .img_height = -1,
+ .bz3_threshold = 24,
+
+ /* Routine specification */
+ .open = dev_open,
+ .close = dev_close,
+ .activate = dev_activate,
+ .deactivate = dev_deactivate,
+};
diff --git a/libfprint/drivers/vfs0050.h b/libfprint/drivers/vfs0050.h
new file mode 100644
index 0000000..81407dd
--- /dev/null
+++ b/libfprint/drivers/vfs0050.h
@@ -0,0 +1,382 @@
+/*
+ * Validity VFS0050 driver for libfprint
+ * Copyright (C) 2015-2016 Konstantin Semenov <zemen17@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* Timeout for all send/recv operations, except interrupt waiting and abort */
+#define VFS_USB_TIMEOUT 100
+/* Timeout for usb abort */
+#define VFS_USB_ABORT_TIMEOUT 20
+/* Default timeout for SSM timers */
+#define VFS_SSM_TIMEOUT 100
+/* Timeout for orange light */
+#define VFS_SSM_ORANGE_TIMEOUT 400
+/* Buffer size for abort and fprint receiving */
+#define VFS_USB_BUFFER_SIZE 65536
+
+/* Line size from scanner including metainformation: line number, narrow stripe from the center, etc */
+#define VFS_LINE_SIZE 148
+/* Width of narrow stripe from the center */
+#define VFS_NEXT_LINE_WIDTH 32
+/* Image width from scanner */
+#define VFS_IMAGE_WIDTH 100
+/* Maximum image height after assembling */
+#define VFS_MAX_HEIGHT 3000
+
+/* Size of control packets: turn_on, turn_off, next_receive_* */
+#define VFS_CONTROL_PACKET_SIZE 125
+/* Size of result of commit */
+#define VFS_COMMIT_RESPONSE_SIZE 1106
+/* Size of interrupt from EP3 */
+#define VFS_INTERRUPT_SIZE 5
+/* EP3 endpoint */
+#define EP3_IN 0x83
+
+/* Fingerprint horizontal line */
+struct vfs_line {
+ /* It must be always 0x01 */
+ unsigned char _0x01;
+ /* It must be always 0xfe */
+ unsigned char _0xfe;
+
+ /* line number starting from some number in Little-Endian */
+ unsigned short id;
+
+ /* Some hashes which are useful to detect noise */
+ unsigned char noise_hash_1;
+ unsigned char noise_hash_2;
+
+ /* The first byte of _somedata is always 0x00, the second is strange useless cyclic line number */
+ unsigned short _somedata;
+
+ /* Fingerprint image */
+ unsigned char data[VFS_IMAGE_WIDTH];
+
+ /* Narrow fingerprint part from the center used for variable speed lines assembling */
+ unsigned char next_line_part[VFS_NEXT_LINE_WIDTH];
+
+ /* scan_data is 0xfb except some rare cases, it's skipped */
+ unsigned char scan_data[8];
+} __attribute__ ((__packed__));
+
+/* The main driver structure */
+struct vfs_dev_t {
+ /* One if we were asked to read fingerprint, zero otherwise */
+ char active;
+
+ /* Control packet parameter for send_control_packet */
+ unsigned char *control_packet;
+
+ /* For dev_deactivate to check whether ssm still running or not */
+ char ssm_active;
+
+ /* Current async transfer */
+ struct libusb_transfer *transfer;
+
+ /* Should we call fpi_imgdev_activate_complete or fpi_imgdev_deactivate_complete */
+ char need_report;
+
+ /* Should we wait more for interrupt */
+ char wait_interrupt;
+
+ /* Received fingerprint raw lines */
+ struct vfs_line *lines_buffer;
+
+ /* Current number of received bytes and current memory used by data */
+ int bytes, memory;
+
+ /* USB buffer for fingerprint */
+ char *usb_buffer;
+
+ /* Received interrupt data */
+ unsigned char interrupt[8];
+};
+
+/* SSM states for clear_ep2 */
+enum SUBSM1 {
+ SUBSM1_COMMAND_04,
+ SUBSM1_RETURN_CODE,
+ SUBSM1_ABORT_2,
+
+ SUBSM1_STATES,
+};
+
+/* SSM states for control */
+enum SUBSM2 {
+ SUBSM2_SEND_CONTROL,
+ SUBSM2_RETURN_CODE, /* If next_receive, send another control packet */
+
+ SUBSM2_SEND_COMMIT,
+ SUBSM2_COMMIT_RESPONSE,
+ SUBSM2_READ_EMPTY_INTERRUPT,
+ SUBSM2_ABORT_3,
+ SUBSM2_CLEAR_EP2,
+
+ SUBSM2_STATES,
+};
+
+/* SSM states for activate_ssm */
+enum SSM_STATE {
+ SSM_INITIAL_ABORT_1,
+ SSM_INITIAL_ABORT_2,
+ SSM_INITIAL_ABORT_3,
+ SSM_CLEAR_EP2,
+ SSM_TURN_OFF,
+
+ /* Here the device is turned off; if not active, complete ssm */
+ SSM_TURN_ON,
+
+ SSM_ASK_INTERRUPT,
+ SSM_WAIT_INTERRUPT,
+
+ SSM_RECEIVE_FINGER,
+ SSM_SUBMIT_IMAGE,
+
+ /* If not active, jump to CLEAR_EP2 */
+ SSM_NEXT_RECEIVE,
+ SSM_WAIT_ANOTHER_SCAN,
+ /* Jump to TURN_ON */
+
+ SSM_STATES
+};
+
+/* Blocks of data from USB sniffer */
+
+/* Turns on the light */
+static unsigned char turn_on[] = {
+ 0x39, 0x20, 0xBF, 0x02, 0x00, 0xF4, 0x01, 0x00, 0x00, 0x01, 0xD1, 0x00,
+ 0x20, 0xD1, 0xD1, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0x01, 0x00,
+ 0x00, 0x01, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xF4, 0x01, 0x00,
+ 0x00, 0x02, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xF4, 0x01, 0x00, 0x00, 0x02, 0xD1, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00,
+};
+
+/* Power off */
+static unsigned char turn_off[] = {
+ 0x39, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00,
+};
+
+/* Turns on orange light */
+static unsigned char next_receive_1[] = {
+ 0x39, 0xB8, 0x0B, 0x00, 0x00, 0xB8, 0x0B, 0x00, 0x00, 0x01, 0xD1, 0x00,
+ 0x20, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xD1, 0xD1, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x02, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xB8, 0x0B, 0x00, 0x00, 0x02, 0xD1, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00,
+};
+
+/* Packet directly after next_receive_1 */
+static unsigned char next_receive_2[] = {
+ 0x39, 0xE8, 0x03, 0x00, 0x00, 0xE8, 0x03, 0x00, 0x00, 0x01, 0xD1, 0x00,
+ 0x20, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xD1, 0xD1, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x02, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xE8, 0x03, 0x00, 0x00, 0x02, 0xD1, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00,
+};
+
+/* Commit message */
+static unsigned char commit_out[] = {
+ 0x02, 0x94, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x00, 0x2C, 0x03, 0x00,
+ 0x30, 0x1B, 0x00, 0x00,
+ 0x00, 0x20, 0x00, 0x08, 0x00, 0x20, 0x03, 0x00, 0x30, 0x3D, 0x10, 0x00,
+ 0x00, 0x20, 0x00, 0x08,
+ 0x00, 0x18, 0x03, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08,
+ 0x00, 0x24, 0x03, 0x00,
+ 0x30, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x00, 0x28, 0x03, 0x00,
+ 0x30, 0x08, 0x00, 0x00,
+ 0x00, 0x20, 0x00, 0x08, 0x00, 0x30, 0x03, 0x00, 0x30, 0x00, 0x00, 0x00,
+ 0x00, 0x20, 0x00, 0x08,
+ 0x00, 0x38, 0x03, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08,
+ 0x00, 0x3C, 0x03, 0x00,
+ 0x30, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x00, 0x44, 0x03, 0x00,
+ 0x30, 0x14, 0x00, 0x00,
+ 0x00, 0x20, 0x00, 0x08, 0x00, 0x48, 0x03, 0x00, 0x30, 0x01, 0x04, 0x02,
+ 0x00, 0x20, 0x00, 0x08,
+ 0x00, 0x4C, 0x03, 0x00, 0x30, 0x01, 0x0C, 0x02, 0x00, 0x20, 0x00, 0x08,
+ 0x00, 0x54, 0x03, 0x00,
+ 0x30, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x00, 0x5C, 0x03, 0x00,
+ 0x30, 0x90, 0x01, 0x02,
+ 0x00, 0x20, 0x00, 0x08, 0x00, 0x60, 0x03, 0x00, 0x30, 0x2C, 0x01, 0x19,
+ 0x00, 0x20, 0x00, 0x08,
+ 0x00, 0x64, 0x03, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08,
+ 0x00, 0x6C, 0x03, 0x00,
+ 0x30, 0x1E, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x00, 0x70, 0x03, 0x00,
+ 0x30, 0x21, 0x80, 0x00,
+ 0x00, 0x20, 0x00, 0x08, 0x00, 0x78, 0x03, 0x00, 0x30, 0x09, 0x00, 0x02,
+ 0x00, 0x20, 0x00, 0x08,
+ 0x00, 0x7C, 0x03, 0x00, 0x30, 0x0B, 0x00, 0x19, 0x00, 0x20, 0x00, 0x08,
+ 0x00, 0x80, 0x03, 0x00,
+ 0x30, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x00, 0x84, 0x03, 0x00,
+ 0x30, 0x3A, 0x00, 0x00,
+ 0x00, 0x20, 0x00, 0x08, 0x00, 0x88, 0x03, 0x00, 0x30, 0x14, 0x00, 0x00,
+ 0x00, 0x20, 0x00, 0x08,
+ 0x00, 0x8C, 0x03, 0x00, 0x30, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08,
+ 0x00, 0x90, 0x03, 0x00,
+ 0x30, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x00, 0x94, 0x03, 0x00,
+ 0x30, 0x08, 0x00, 0x00,
+ 0x00, 0x20, 0x00, 0x08, 0x00, 0x98, 0x03, 0x00, 0x30, 0x00, 0x00, 0xA1,
+ 0x01, 0x20, 0x00, 0x08,
+ 0x00, 0x9C, 0x03, 0x00, 0x30, 0x00, 0x00, 0xA1, 0x01, 0x20, 0x00, 0x08,
+ 0x00, 0xA8, 0x03, 0x00,
+ 0x30, 0x64, 0x01, 0x00, 0x00, 0x20, 0x00, 0x08, 0x00, 0xAC, 0x03, 0x00,
+ 0x30, 0x64, 0x01, 0x00,
+ 0x00, 0x20, 0x00, 0x08, 0x00, 0xB0, 0x03, 0x00, 0x30, 0x00, 0x01, 0x00,
+ 0x00, 0x20, 0x00, 0x08,
+ 0x00, 0xB4, 0x03, 0x00, 0x30, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x08,
+ 0x00, 0xB8, 0x03, 0x00,
+ 0x30, 0x05, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x00, 0xBC, 0x03, 0x00,
+ 0x30, 0x05, 0x00, 0x00,
+ 0x00, 0x20, 0x00, 0x08, 0x00, 0xC0, 0x03, 0x00, 0x30, 0x00, 0x00, 0x00,
+ 0x00, 0x20, 0x00, 0x08,
+ 0x00, 0x84, 0x03, 0x00, 0x30, 0x3B, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08,
+ 0x00, 0x08, 0x07, 0x00,
+ 0x30, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x00, 0x0C, 0x07, 0x00,
+ 0x30, 0x00, 0x00, 0x00,
+ 0x00, 0x20, 0x00, 0x08, 0x00, 0x14, 0x07, 0x00, 0x30, 0x20, 0x00, 0x00,
+ 0x00, 0x20, 0x00, 0x08,
+ 0x00, 0x1C, 0x07, 0x00, 0x30, 0x1A, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08,
+ 0x00, 0x70, 0x0D, 0x00,
+ 0x30, 0x01, 0x00, 0x00, 0x00, 0x25, 0x00, 0x28, 0x00, 0x10, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x02, 0x00, 0x90, 0x00, 0x00, 0x00, 0x2B, 0xFF, 0x2B, 0xFF, 0x2B,
+ 0xED, 0x00, 0x00, 0x2B,
+ 0xFB, 0x00, 0x00, 0x2B, 0xC5, 0x00, 0x00, 0x2B, 0x05, 0x80, 0x70, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x24, 0xD3, 0x2E, 0xC0, 0x2C, 0x3B, 0x08, 0xF0, 0x3B, 0x09, 0x24,
+ 0xBB, 0x3B, 0x0B, 0x24,
+ 0xAA, 0x3B, 0x1F, 0xF8, 0x00, 0x3B, 0x3F, 0xF0, 0x00, 0x3B, 0x35, 0xC0,
+ 0x00, 0x38, 0x80, 0x2C,
+ 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x38, 0x80, 0x2C, 0x70, 0x00,
+ 0x00, 0x00, 0x00, 0xC0,
+ 0x3A, 0x80, 0x2C, 0x70, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x3B, 0x0A, 0x80,
+ 0x2E, 0x83, 0x24, 0xDB,
+ 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0xC3, 0x2C, 0x31, 0x83, 0x2C, 0x70,
+ 0x00, 0x00, 0x00, 0x00,
+ 0xCB, 0x33, 0x1B, 0x83, 0x2C, 0x70, 0x00, 0x00, 0x00, 0x00, 0xCB, 0x31,
+ 0x83, 0x2C, 0x70, 0x00,
+ 0x00, 0x00, 0x00, 0xCB, 0x00, 0x33, 0x1E, 0x83, 0x2E, 0x25, 0xFF, 0xC4,
+ 0x00, 0x2F, 0x06, 0x84,
+ 0x2E, 0x00, 0x00, 0x10, 0x20, 0x29, 0x00, 0x04, 0x00, 0x10, 0x00, 0x00,
+ 0x00, 0x23, 0x00, 0x00,
+ 0x00, 0x21, 0x00, 0x10, 0x00, 0x48, 0x03, 0x00, 0x30, 0xFF, 0xF0, 0xFF,
+ 0xFF, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x04, 0x00, 0x00, 0x21, 0x00, 0x10, 0x00, 0x4C, 0x03, 0x00,
+ 0x30, 0xFF, 0xF0, 0xFF,
+ 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x21, 0x00, 0x10,
+ 0x00, 0x20, 0x03, 0x00,
+ 0x30, 0x7F, 0x00, 0xFC, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x80, 0x10, 0x00,
+ 0x00, 0x20, 0x00, 0x08,
+ 0x00, 0x24, 0x03, 0x00, 0x30, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08,
+ 0x00, 0x1C, 0x07, 0x00,
+ 0x30, 0x1A, 0x00, 0x00, 0x00, 0x21, 0x00, 0x10, 0x00, 0x20, 0x03, 0x00,
+ 0x30, 0xC3, 0xFF, 0xFF,
+ 0xFF, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08,
+ 0x00, 0x80, 0x03, 0x00,
+ 0x30, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x84, 0x00, 0x31, 0x65, 0x77,
+ 0x77, 0x77, 0x78, 0x88,
+ 0x77, 0x77, 0x76, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x77, 0x67,
+ 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x76, 0x67, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x77, 0x66, 0x66,
+ 0x66, 0x66, 0x67, 0x66, 0x66, 0x66, 0x66, 0x66, 0x76, 0x76, 0x66, 0x56,
+ 0x66, 0x66, 0x56, 0x55,
+ 0x65, 0x66, 0x66, 0x66, 0x65, 0x66, 0x66, 0x55, 0x66, 0x66, 0x65, 0x66,
+ 0x76, 0x76, 0x77, 0x77,
+ 0x66, 0x66, 0x66, 0x76, 0x67, 0x66, 0x77, 0x67, 0x66, 0x66, 0x66, 0x56,
+ 0x65, 0x66, 0x65, 0x66,
+ 0x66, 0x55, 0x55, 0x54, 0x55, 0x65, 0x66, 0x66, 0x66, 0x76, 0x77, 0x87,
+ 0x88, 0x77, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x65, 0x66, 0x55, 0x55, 0x65, 0x56, 0x55,
+ 0x55, 0x55, 0x54, 0x45,
+ 0x54, 0x55, 0x55, 0x55, 0x66, 0x66, 0x66, 0x66, 0x66, 0x77, 0x77, 0x77,
+ 0x66, 0x26, 0x00, 0x28,
+ 0x00, 0xFF, 0x00, 0x0F, 0x00, 0xF0, 0xF0, 0x0F, 0x00, 0x20, 0x00, 0x00,
+ 0x00, 0x30, 0x01, 0x02,
+ 0x00, 0x2C, 0x01, 0x28, 0x00, 0x20, 0x80, 0x00, 0x00, 0x0A, 0x00, 0x02,
+ 0x00, 0x0B, 0x00, 0x19,
+ 0x00, 0x40, 0x1F, 0x10, 0x27, 0x00, 0x0F, 0x03, 0x00,
+};
+
+/* Known interrupts */
+
+static unsigned char empty_interrupt[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+static unsigned char interrupt1[] = {
+ 0x02, 0x00, 0x0E, 0x00, 0xF0,
+};
+
+static unsigned char interrupt2[] = {
+ 0x02, 0x04, 0x0A, 0x00, 0xF0,
+};
+
+static unsigned char interrupt3[] = {
+ 0x02, 0x00, 0x0A, 0x00, 0xF0,
+};
diff --git a/libfprint/fp_internal.h b/libfprint/fp_internal.h
index 2324b27..5970e31 100644
--- a/libfprint/fp_internal.h
+++ b/libfprint/fp_internal.h
@@ -305,6 +305,9 @@ extern struct fp_img_driver upektc_img_driver;
#ifdef ENABLE_ETES603
extern struct fp_img_driver etes603_driver;
#endif
+#ifdef ENABLE_VFS0050
+extern struct fp_img_driver vfs0050_driver;
+#endif
extern libusb_context *fpi_usb_ctx;
extern GSList *opened_devices;