New upstream version 0.8.1

This commit is contained in:
Laurent Bigonville
2018-06-21 12:54:13 +02:00
101 changed files with 4411 additions and 59327 deletions
-2760
View File
File diff suppressed because it is too large Load Diff
-96
View File
@@ -1,96 +0,0 @@
Copyright notices
=================
If you make a contribution substantial enough to add or update a copyright
notice on a file, such notice must be mirrored in the AUTHORS file. This is
to make it easy for people to comply to section 6 of the LGPL, which states
that a "work that uses the Library" must include copyright notices from
this library. By providing them all in one place, hopefully we save such
users some time.
USB
===
At the time of development, there are no known consumer fingerprint readers
which do not operate over the USB bus. Therefore the library is designed around
the fact that each driver drivers USB devices, and each device is a USB device.
If we were to ever support a non-USB device, some rearchitecting would be
needed, but this would not be a substantial task.
GLib
====
Although the library uses GLib internally, libfprint is designed to provide
a completely neutral interface to it's application users. So, the public
APIs should never return GLib data types or anything like that.
Two-faced-ness
==============
Like any decent library, this one is designed to provide a stable and
documented API to it's users: applications. Clear distinction is made between
data available internally in the library, and data/functions available to
the applications.
This library is confused a little by the fact that there is another 'interface'
at hand: the internal interface provided to drivers. So, we effectively end
up with 2 APIs:
1. The external-facing API for applications
2. The internal API for fingerprint drivers
Non-static functions which are intended for internal use only are prepended
with the "fpi_" prefix.
API stability
=============
No API stability has been promised to anyone: go wild, there's no issue with
breaking APIs at this point in time.
Portability
===========
libfprint is primarily written for Linux. However, I'm interested in
supporting efforts to port this to other operating systems too.
You should ensure code is portable wherever possible. Try and use GLib rather
than OS-specific features.
Endianness must be considered in all code. libfprint must support both big-
and little-endian systems.
Coding Style
============
This project follows Linux kernel coding style but with a tab width of 4.
Documentation
=============
All additions of public API functions must be accompanied with doxygen
comments.
All changes which potentially change the behaviour of the public API must
be reflected by updating the appropriate doxygen comments.
Contributing
============
Patches should be sent to the fprint bugzilla:
https://bugs.freedesktop.org/enter_bug.cgi?product=libfprint
Information about libfprint development repositories can be found here:
http://www.freedesktop.org/wiki/Software/fprint/libfprint
If you're looking for ideas for things to work on, look at the TODO file or
grep the source code for FIXMEs.
+52
View File
@@ -0,0 +1,52 @@
# Contributing to libfprint
## GLib
Although the library uses GLib internally, libfprint is designed to provide
a completely neutral interface to it's application users. So, the public
APIs should never return GLib data types or anything like that.
## Two-faced-ness
Like any decent library, this one is designed to provide a stable and
documented API to its users: applications. Clear distinction is made between
data available internally in the library, and data/functions available to
the applications.
This library is confused a little by the fact that there is another 'interface'
at hand: the internal interface provided to drivers. So, we effectively end
up with 2 APIs:
1. The [external-facing API for applications](libfprint/fprint.h)
2. The [internal API for fingerprint drivers](libfprint/drivers_api.h)
Non-static functions which are intended for internal use only are prepended
with the "fpi_" prefix.
## Documentation
All additions of public API functions must be accompanied with gtk-doc
comments.
All changes which potentially change the behaviour of the public API must
be reflected by updating the appropriate gtk-doc comments.
## Contributing
Patches should be sent as merge requests to the gitlab page:
https://gitlab.freedesktop.org/libfprint/libfprint/merge_requests
Drivers are not usually written by libfprint developers, but when they
are, we require:
- 3 stand-alone devices. Not in a laptop or another embedded device, as
space is scarce, unless the device has special integration with that
hardware.
- specifications of the protocol.
If you are an end-user, you can file a feature request with the "Driver Request"
tag on [libfprint's issue page](https://gitlab.freedesktop.org/libfprint/libfprint/issues?scope=all&utf8=%E2%9C%93&state=opened&label_name[]=Driver%20Request),
or subscribe to an existing feature request there.
If you are an enterprising hacker, please file a new merge request with
the driver patches integrated.
+5 -233
View File
@@ -1,234 +1,6 @@
Installation Instructions libfprint uses the Meson build system. See
************************* http://mesonbuild.com/Quick-guide.html for details on how to
compile libfprint.
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006 Free Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You need `configure.ac' if
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
Running `configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that the
`configure' script does not know about. Run `./configure --help' for
details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
installed the package for one architecture, use `make distclean' before
reconfiguring for another architecture.
Installation Names
==================
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' cannot figure out automatically,
but needs to determine by the type of machine the package will run on.
Usually, assuming the package is built to be run on the _same_
architectures, `configure' can figure that out, but if it prints a
message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share, you
can create a site shell script called `config.site' that gives default
values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf bug. Until the bug is fixed you can use this workaround:
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
`configure' recognizes the following options to control how it operates.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.
The "meson configure" command will give you a list of available
command-line options.
-25
View File
@@ -1,25 +0,0 @@
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = THANKS TODO HACKING libfprint.pc.in
DISTCLEANFILES = ChangeLog libfprint.pc
SUBDIRS = libfprint doc
if BUILD_EXAMPLES
SUBDIRS += examples
endif
DIST_SUBDIRS = libfprint doc examples
DISTCHECK_CONFIGURE_FLAGS = --with-drivers=all --enable-examples-build --enable-x11-examples-build --with-udev-rules-dir='$${libdir}/udev/rules.d-distcheck'
pkgconfigdir=$(libdir)/pkgconfig
pkgconfig_DATA=libfprint.pc
.PHONY: ChangeLog dist-up
ChangeLog:
git --git-dir $(top_srcdir)/.git log > ChangeLog || touch ChangeLog
dist-hook: ChangeLog
dist-up: dist
rsync $(distdir).tar.bz2 frs.sourceforge.net:uploads/
-915
View File
@@ -1,915 +0,0 @@
# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
@BUILD_EXAMPLES_TRUE@am__append_1 = examples
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
$(am__configure_deps) $(am__DIST_COMMON)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = libfprint.pc
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
install-data-recursive install-dvi-recursive \
install-exec-recursive install-html-recursive \
install-info-recursive install-pdf-recursive \
install-ps-recursive install-recursive installcheck-recursive \
installdirs-recursive pdf-recursive ps-recursive \
tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(pkgconfigdir)"
DATA = $(pkgconfig_DATA)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
am__recursive_targets = \
$(RECURSIVE_TARGETS) \
$(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
cscope distdir dist dist-all distcheck
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
$(LISP)config.h.in
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
CSCOPE = cscope
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(srcdir)/libfprint.pc.in AUTHORS COPYING ChangeLog INSTALL \
NEWS README THANKS TODO compile config.guess config.sub \
depcomp install-sh ltmain.sh missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
if test -d "$(distdir)"; then \
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -rf "$(distdir)" \
|| { sleep 5 && rm -rf "$(distdir)"; }; \
else :; fi
am__post_remove_distdir = $(am__remove_distdir)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
GZIP_ENV = --best
DIST_ARCHIVES = $(distdir).tar.xz
DIST_TARGETS = dist-xz
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_CFLAGS = @AM_CFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CRYPTO_CFLAGS = @CRYPTO_CFLAGS@
CRYPTO_LIBS = @CRYPTO_LIBS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
IMAGING_CFLAGS = @IMAGING_CFLAGS@
IMAGING_LIBS = @IMAGING_LIBS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
LIBUSB_LIBS = @LIBUSB_LIBS@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
XV_CFLAGS = @XV_CFLAGS@
XV_LIBS = @XV_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_age = @lt_age@
lt_major = @lt_major@
lt_revision = @lt_revision@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
udev_rulesdir = @udev_rulesdir@
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = THANKS TODO HACKING libfprint.pc.in
DISTCLEANFILES = ChangeLog libfprint.pc
SUBDIRS = libfprint doc $(am__append_1)
DIST_SUBDIRS = libfprint doc examples
DISTCHECK_CONFIGURE_FLAGS = --with-drivers=all --enable-examples-build --enable-x11-examples-build --with-udev-rules-dir='$${libdir}/udev/rules.d-distcheck'
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libfprint.pc
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
am--refresh: Makefile
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
config.h: stamp-h1
@test -f $@ || rm -f stamp-h1
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
libfprint.pc: $(top_builddir)/config.status $(srcdir)/libfprint.pc.in
cd $(top_builddir) && $(SHELL) ./config.status $@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool config.lt
install-pkgconfigDATA: $(pkgconfig_DATA)
@$(NORMAL_INSTALL)
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
done
uninstall-pkgconfigDATA:
@$(NORMAL_UNINSTALL)
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir)
# This directory's subdirectories are mostly independent; you can cd
# into them and run 'make' without going through this Makefile.
# To change the values of 'make' variables: instead of editing Makefiles,
# (1) if the variable is set in 'config.status', edit 'config.status'
# (which will cause the Makefiles to be regenerated when you run 'make');
# (2) otherwise, pass the desired values on the 'make' command line.
$(am__recursive_targets):
@fail=; \
if $(am__make_keepgoing); then \
failcom='fail=yes'; \
else \
failcom='exit 1'; \
fi; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-recursive
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-recursive
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscope: cscope.files
test ! -s cscope.files \
|| $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
clean-cscope:
-rm -f cscope.files
cscope.files: clean-cscope cscopelist
cscopelist: cscopelist-recursive
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
distdir: $(DISTFILES)
@case `sed 15q $(srcdir)/NEWS` in \
*"$(VERSION)"*) : ;; \
*) \
echo "NEWS not updated; not releasing" 1>&2; \
exit 1;; \
esac
$(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
$(am__make_dryrun) \
|| test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
-test -n "$(am__skip_mode_fix)" \
|| find "$(distdir)" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
$(am__post_remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
$(am__post_remove_distdir)
dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
$(am__post_remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__post_remove_distdir)
dist-tarZ: distdir
@echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__post_remove_distdir)
dist-shar: distdir
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
$(am__post_remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__post_remove_distdir)
dist dist-all:
$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
$(am__post_remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lz*) \
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir)
chmod u+w $(distdir)
mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build/sub \
&& ../../configure \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
--srcdir=../.. --prefix="$$dc_install_base" \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
&& cd "$$am__cwd" \
|| exit 1
$(am__post_remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@test -n '$(distuninstallcheck_dir)' || { \
echo 'ERROR: trying to run $@ with an empty' \
'$$(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
$(am__cd) '$(distuninstallcheck_dir)' || { \
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile $(DATA) config.h
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(pkgconfigdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-hdr \
distclean-libtool distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am: install-pkgconfigDATA
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-pkgconfigDATA
.MAKE: $(am__recursive_targets) all install-am install-strip
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
am--refresh check check-am clean clean-cscope clean-generic \
clean-libtool cscope cscopelist-am ctags ctags-am dist \
dist-all dist-bzip2 dist-gzip dist-hook dist-lzip dist-shar \
dist-tarZ dist-xz dist-zip distcheck distclean \
distclean-generic distclean-hdr distclean-libtool \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-pkgconfigDATA install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am tags tags-am uninstall uninstall-am \
uninstall-pkgconfigDATA
.PRECIOUS: Makefile
.PHONY: ChangeLog dist-up
ChangeLog:
git --git-dir $(top_srcdir)/.git log > ChangeLog || touch ChangeLog
dist-hook: ChangeLog
dist-up: dist
rsync $(distdir).tar.bz2 frs.sourceforge.net:uploads/
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
+26
View File
@@ -1,6 +1,32 @@
This file lists notable changes in each release. For the full history of all This file lists notable changes in each release. For the full history of all
changes, see ChangeLog. changes, see ChangeLog.
2018-06-12: v0.8.1 release
- Brown paperbag release to install the udev rules file in the correct
directory if the udev pkg-config file doesn't have a trailing slash
2018-06-12: v0.8.0 release
- Port to meson as the build system
- Port documentation to gtk-doc
* Drivers:
- Add Elan driver
- Increase threshold to detect encryption on URU4000 devices
- Remove already replaced UPEKE2 driver
- Fix possible crash caused by vfs5011 when no lines were captured
* Library:
- Fix a number of memory and file descriptor leaks and warnings
- Make NSS (and URU4000) driver optional
- Fix assembling of frames for non-reverse and non reverse stripes
- Split internal private header to clarify drivers API
- Simplify logging system, now all the builds can be used to output
debug information
- Mark fp_dscv_print functions as deprecated
* Udev rules:
- Add some unsupported devices to the whitelist
2017-05-14: v0.7.0 release 2017-05-14: v0.7.0 release
* Drivers: * Drivers:
- Add VFS0050 driver - Add VFS0050 driver
+3 -3
View File
@@ -2,7 +2,7 @@ libfprint
========= =========
libfprint is part of the fprint project: libfprint is part of the fprint project:
http://www.reactivated.net/fprint https://fprint.freedesktop.org/
libfprint was originally developed as part of an academic project at the libfprint was originally developed as part of an academic project at the
University of Manchester with the aim of hiding differences between different University of Manchester with the aim of hiding differences between different
@@ -22,7 +22,7 @@ university computers and the project is not hosted at the university either.
For more information on libfprint, supported devices, API documentation, etc., For more information on libfprint, supported devices, API documentation, etc.,
see the homepage: see the homepage:
http://www.reactivated.net/fprint/Libfprint https://fprint.freedesktop.org/
libfprint is licensed under the GNU LGPL version 2.1. See the COPYING file libfprint is licensed under the GNU LGPL version 2.1. See the COPYING file
for the license text. for the license text.
@@ -37,5 +37,5 @@ libfprint includes code from NIST's NBIS software distribution:
http://fingerprint.nist.gov/NBIS/index.html http://fingerprint.nist.gov/NBIS/index.html
We include bozorth3 from the US export controlled distribution. We have We include bozorth3 from the US export controlled distribution. We have
determined that it is fine to ship bozorth3 in an open source project, determined that it is fine to ship bozorth3 in an open source project,
see http://reactivated.net/fprint/wiki/US_export_control see https://fprint.freedesktop.org/us-export-control.html
Vendored
-1433
View File
File diff suppressed because it is too large Load Diff
-347
View File
@@ -1,347 +0,0 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:
-1530
View File
File diff suppressed because it is too large Load Diff
-142
View File
@@ -1,142 +0,0 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Default visibility */
#undef API_EXPORTED
/* Build AuthenTec AES1610 driver */
#undef ENABLE_AES1610
/* Build AuthenTec AES1660 driver */
#undef ENABLE_AES1660
/* Build AuthenTec AES2501 driver */
#undef ENABLE_AES2501
/* Build AuthenTec AES2550/AES2810 driver */
#undef ENABLE_AES2550
/* Build AuthenTec AES1660 driver */
#undef ENABLE_AES2660
/* Build AuthenTec AES3500 driver */
#undef ENABLE_AES3500
/* Build AuthenTec AES4000 driver */
#undef ENABLE_AES4000
/* Debug message logging */
#undef ENABLE_DEBUG_LOGGING
/* Build EgisTec ES603 driver */
#undef ENABLE_ETES603
/* Build Secugen FDU 2000 driver */
#undef ENABLE_FDU2000
/* Message logging */
#undef ENABLE_LOGGING
/* Build UPEK Eikon 2 */
#undef ENABLE_UPEKE2
/* Build UPEK TouchStrip sensor-only driver */
#undef ENABLE_UPEKSONLY
/* Build UPEK TouchChip driver */
#undef ENABLE_UPEKTC
/* Build Upek TouchChip Fingerprint Coprocessor driver */
#undef ENABLE_UPEKTC_IMG
/* Build UPEK TouchStrip driver */
#undef ENABLE_UPEKTS
/* Build Digital Persona U.are.U 4000 driver */
#undef ENABLE_URU4000
/* Build Veridicom 5thSense driver */
#undef ENABLE_VCOM5S
/* Build Validity VFS0050 driver */
#undef ENABLE_VFS0050
/* Build Validity VFS101 driver */
#undef ENABLE_VFS101
/* Build Validity VFS301/VFS300 driver */
#undef ENABLE_VFS301
/* Build Validity VFS5011 driver */
#undef ENABLE_VFS5011
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* defined if XV video overlay is available */
#undef HAVE_XV
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
/* Use GNU extensions */
#undef _GNU_SOURCE
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
#endif
Vendored
-1782
View File
File diff suppressed because it is too large Load Diff
Vendored
-19749
View File
File diff suppressed because it is too large Load Diff
-428
View File
@@ -1,428 +0,0 @@
AC_INIT([libfprint], [0.7.0])
AM_INIT_AUTOMAKE([1.11 no-dist-gzip dist-xz check-news subdir-objects])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([libfprint/core.c])
AC_CONFIG_HEADERS([config.h])
# Enable silent build when available (Automake 1.11)
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AC_PREREQ([2.50])
AC_PROG_CC
AC_PROG_LIBTOOL
AC_C_INLINE
AM_PROG_CC_C_O
AC_PROG_CXX
AC_DEFINE([_GNU_SOURCE], [], [Use GNU extensions])
# Library versioning
lt_major="0"
lt_revision="0"
lt_age="0"
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 vfs0050"
require_imaging='no'
require_aeslib='no'
require_aesX660='no'
require_aes3k='no'
enable_upeke2='no'
enable_upekts='no'
enable_upektc='no'
enable_upeksonly='no'
enable_vcom5s='no'
enable_uru4000='no'
enable_fdu2000='no'
enable_aes1610='no'
enable_aes1660='no'
enable_aes2501='no'
enable_aes2550='no'
enable_aes2660='no'
enable_aes3500='no'
enable_aes4000='no'
enable_vfs101='no'
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])],
[drivers="$withval"],
[drivers="$all_drivers"])
if test "x$drivers" = "xall" ; then
drivers=$all_drivers
fi
for driver in `echo ${drivers} | sed -e 's/,/ /g' -e 's/,$//g'`; do
case ${driver} in
upekts)
AC_DEFINE([ENABLE_UPEKTS], [], [Build UPEK TouchStrip driver])
enable_upekts="yes"
;;
upeke2)
AC_DEFINE([ENABLE_UPEKE2], [], [Build UPEK Eikon 2])
enable_upeke2="yes"
;;
upektc)
AC_DEFINE([ENABLE_UPEKTC], [], [Build UPEK TouchChip driver])
enable_upektc="yes"
;;
upeksonly)
AC_DEFINE([ENABLE_UPEKSONLY], [], [Build UPEK TouchStrip sensor-only driver])
enable_upeksonly="yes"
;;
uru4000)
AC_DEFINE([ENABLE_URU4000], [], [Build Digital Persona U.are.U 4000 driver])
enable_uru4000="yes"
;;
fdu2000)
AC_DEFINE([ENABLE_FDU2000], [], [Build Secugen FDU 2000 driver])
enable_fdu2000="no"
# Driver not ported
;;
vcom5s)
AC_DEFINE([ENABLE_VCOM5S], [], [Build Veridicom 5thSense driver])
enable_vcom5s="yes"
;;
aes2501)
AC_DEFINE([ENABLE_AES2501], [], [Build AuthenTec AES2501 driver])
require_aeslib="yes"
enable_aes2501="yes"
;;
aes2550)
AC_DEFINE([ENABLE_AES2550], [], [Build AuthenTec AES2550/AES2810 driver])
require_aeslib="yes"
enable_aes2550="yes"
;;
aes1610)
AC_DEFINE([ENABLE_AES1610], [], [Build AuthenTec AES1610 driver])
require_aeslib="yes"
enable_aes1610="yes"
;;
aes1660)
AC_DEFINE([ENABLE_AES1660], [], [Build AuthenTec AES1660 driver])
require_aeslib="yes"
require_aesX660="yes"
enable_aes1660="yes"
;;
aes2660)
AC_DEFINE([ENABLE_AES2660], [], [Build AuthenTec AES1660 driver])
require_aeslib="yes"
require_aesX660="yes"
enable_aes2660="yes"
;;
aes3500)
AC_DEFINE([ENABLE_AES3500], [], [Build AuthenTec AES3500 driver])
require_aeslib="yes"
require_imaging="yes"
require_aes3k="yes"
enable_aes3500="yes"
;;
aes4000)
AC_DEFINE([ENABLE_AES4000], [], [Build AuthenTec AES4000 driver])
require_aeslib="yes"
require_imaging="yes"
require_aes3k="yes"
enable_aes4000="yes"
;;
vfs101)
AC_DEFINE([ENABLE_VFS101], [], [Build Validity VFS101 driver])
enable_vfs101="yes"
;;
vfs301)
AC_DEFINE([ENABLE_VFS301], [], [Build Validity VFS301/VFS300 driver])
enable_vfs301="yes"
;;
vfs5011)
AC_DEFINE([ENABLE_VFS5011], [], [Build Validity VFS5011 driver])
enable_vfs5011="yes"
;;
upektc_img)
AC_DEFINE([ENABLE_UPEKTC_IMG], [], [Build Upek TouchChip Fingerprint Coprocessor driver])
enable_upektc_img="yes"
;;
etes603)
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
AM_CONDITIONAL([ENABLE_UPEKTS], [test "$enable_upekts" = "yes"])
AM_CONDITIONAL([ENABLE_UPEKE2], [test "$enable_upeke2" = "yes"])
AM_CONDITIONAL([ENABLE_UPEKTC], [test "$enable_upektc" = "yes"])
AM_CONDITIONAL([ENABLE_UPEKSONLY], [test "$enable_upeksonly" = "yes"])
AM_CONDITIONAL([ENABLE_VCOM5S], [test "$enable_vcom5s" = "yes"])
AM_CONDITIONAL([ENABLE_URU4000], [test "$enable_uru4000" = "yes"])
AM_CONDITIONAL([ENABLE_FDU2000], [test "$enable_fdu2000" = "yes"])
AM_CONDITIONAL([ENABLE_AES1610], [test "$enable_aes1610" = "yes"])
AM_CONDITIONAL([ENABLE_AES1660], [test "$enable_aes1660" = "yes"])
AM_CONDITIONAL([ENABLE_AES2501], [test "$enable_aes2501" = "yes"])
AM_CONDITIONAL([ENABLE_AES2550], [test "$enable_aes2550" = "yes"])
AM_CONDITIONAL([ENABLE_AES2660], [test "$enable_aes2660" = "yes"])
AM_CONDITIONAL([ENABLE_AES3500], [test "$enable_aes3500" = "yes"])
AM_CONDITIONAL([ENABLE_AES4000], [test "$enable_aes4000" = "yes"])
AM_CONDITIONAL([REQUIRE_AESLIB], [test "$require_aeslib" = "yes"])
AM_CONDITIONAL([REQUIRE_AESX660], [test "$require_aesX660" = "yes"])
AM_CONDITIONAL([REQUIRE_AES3K], [test "$require_aes3k" = "yes"])
AM_CONDITIONAL([ENABLE_VFS101], [test "$enable_vfs101" = "yes"])
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])
AC_SUBST(LIBUSB_CFLAGS)
AC_SUBST(LIBUSB_LIBS)
# check for OpenSSL's libcrypto
PKG_CHECK_MODULES(CRYPTO, nss)
AC_SUBST(CRYPTO_CFLAGS)
AC_SUBST(CRYPTO_LIBS)
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.28])
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
pixman_found=no
AC_ARG_ENABLE(udev-rules,
AC_HELP_STRING([--enable-udev-rules],[Update the udev rules]),
[case "${enableval}" in
yes) ENABLE_UDEV_RULES=yes ;;
no) ENABLE_UDEV_RULES=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-udev-rules) ;;
esac],
[ENABLE_UDEV_RULES=yes]) dnl Default value
AM_CONDITIONAL(ENABLE_UDEV_RULES, test x$ENABLE_UDEV_RULES = "xyes")
if test $ENABLE_UDEV_RULES = no && test -d .git/ ; then
AC_MSG_ERROR(--disable-udev-rules can only be used when building from tarballs)
fi
AC_ARG_WITH(udev-rules-dir,
AS_HELP_STRING([--with-udev-rules-dir=DIR],[Installation path for udev rules @<:@auto@:>@]),
[ac_with_udev_rules_dir=$withval],
[ac_with_udev_rules_dir=""])
if test "${ac_with_udev_rules_dir}" = ""; then
ac_with_udev_rules_dir=`$PKG_CONFIG --variable=udevdir udev`/rules.d
fi
AC_MSG_NOTICE([installing udev rules in ${ac_with_udev_rules_dir}])
AC_SUBST([udev_rulesdir],[${ac_with_udev_rules_dir}])
if test "$require_imaging" = "yes"; then
PKG_CHECK_MODULES(IMAGING, pixman-1, [pixman_found=yes], [pixman_found=no])
if test "$pixman_found" != "yes"; then
AC_MSG_ERROR([pixman is required for imaging support])
fi
fi
AM_CONDITIONAL([REQUIRE_PIXMAN], [test "$pixman_found" = "yes"])
AC_SUBST(IMAGING_CFLAGS)
AC_SUBST(IMAGING_LIBS)
# Examples build
AC_ARG_ENABLE([examples-build], [AS_HELP_STRING([--enable-examples-build],
[build example applications (default n)])],
[build_examples=$enableval],
[build_examples='no'])
AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$build_examples" != "xno"])
# Examples build
AC_ARG_ENABLE([x11-examples-build], [AS_HELP_STRING([--enable-x11-examples-build],
[build X11 example applications (default n)])],
[build_x11_examples=$enableval],
[build_x11_examples='no'])
AM_CONDITIONAL([BUILD_X11_EXAMPLES], [test "x$build_x11_examples" != "xno"])
if test "x$build_x11_examples" != "xno"; then
# check for Xv extensions
# imported from Coriander
AC_DEFUN([AC_CHECK_XV],[
AC_SUBST(XV_CFLAGS)
AC_SUBST(XV_LIBS)
AC_MSG_CHECKING(for Xv extensions)
AC_TRY_COMPILE([
#include <X11/Xlib.h>
#include <X11/extensions/Xvlib.h>],[
int main(void) { (void) XvGetPortAttribute(0, 0, 0, 0); return 0; }
],xv=yes,xv=no);
AC_MSG_RESULT($xv)
if test x$xv = xyes; then
XV_LIBS="-lXv -lXext"
XV_CFLAGS=""
AC_DEFINE(HAVE_XV,1,[defined if XV video overlay is available])
else
AC_MSG_ERROR([XV is required for X11 examples])
fi
])
AC_CHECK_XV
fi
# Message logging
AC_ARG_ENABLE([log], [AS_HELP_STRING([--disable-log], [disable all logging])],
[log_enabled=$enableval],
[log_enabled='yes'])
if test "x$log_enabled" != "xno"; then
AC_DEFINE([ENABLE_LOGGING], 1, [Message logging])
fi
AC_ARG_ENABLE([debug-log], [AS_HELP_STRING([--enable-debug-log],
[enable debug logging (default n)])],
[debug_log_enabled=$enableval],
[debug_log_enabled='no'])
if test "x$debug_log_enabled" != "xno"; then
AC_DEFINE([ENABLE_DEBUG_LOGGING], 1, [Debug message logging])
fi
# Restore gnu89 inline semantics on gcc 4.3 and newer
saved_cflags="$CFLAGS"
CFLAGS="$CFLAGS -fgnu89-inline"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], inline_cflags="-fgnu89-inline", inline_cflags="")
CFLAGS="$saved_cflags"
AC_DEFINE([API_EXPORTED], [__attribute__((visibility("default")))], [Default visibility])
AM_CFLAGS="-std=gnu99 $inline_cflags -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration -Wno-pointer-sign -Wshadow"
AC_SUBST(AM_CFLAGS)
if test "$require_imaging" = "yes"; then
if test x$pixman_found != no; then
AC_MSG_NOTICE([** Using pixman for imaging])
fi
else
AC_MSG_NOTICE([ Imaging support disabled])
fi
if test x$enable_upekts != xno ; then
AC_MSG_NOTICE([** upekts driver enabled])
else
AC_MSG_NOTICE([ upekts driver disabled])
fi
if test x$enable_upeke2 != xno ; then
AC_MSG_NOTICE([** upeke2 driver enabled])
else
AC_MSG_NOTICE([ upeke2 driver disabled (handled by upektc_img driver)])
fi
if test x$enable_upektc != xno ; then
AC_MSG_NOTICE([** upektc driver enabled])
else
AC_MSG_NOTICE([ upektc driver disabled])
fi
if test x$enable_upeksonly != xno ; then
AC_MSG_NOTICE([** upeksonly driver enabled])
else
AC_MSG_NOTICE([ upeksonly driver disabled])
fi
if test x$enable_vcom5s != xno ; then
AC_MSG_NOTICE([** vcom5s driver enabled])
else
AC_MSG_NOTICE([ vcom5s driver disabled])
fi
if test x$enable_uru4000 != xno ; then
AC_MSG_NOTICE([** uru4000 driver enabled])
else
AC_MSG_NOTICE([ uru4000 driver disabled])
fi
if test x$enable_fdu2000 != xno ; then
AC_MSG_NOTICE([** fdu2000 driver enabled])
else
AC_MSG_NOTICE([ fdu2000 driver disabled (not ported)])
fi
if test x$enable_aes1610 != xno ; then
AC_MSG_NOTICE([** aes1610 driver enabled])
else
AC_MSG_NOTICE([ aes1610 driver disabled])
fi
if test x$enable_aes1660 != xno ; then
AC_MSG_NOTICE([** aes1660 driver enabled])
else
AC_MSG_NOTICE([ aes1660 driver disabled])
fi
if test x$enable_aes2501 != xno ; then
AC_MSG_NOTICE([** aes2501 driver enabled])
else
AC_MSG_NOTICE([ aes2501 driver disabled])
fi
if test x$enable_aes2550 != xno ; then
AC_MSG_NOTICE([** aes2550/aes2810 driver enabled])
else
AC_MSG_NOTICE([ aes2550/aes2810 driver disabled])
fi
if test x$enable_aes2660 != xno ; then
AC_MSG_NOTICE([** aes2660 driver enabled])
else
AC_MSG_NOTICE([ aes2660 driver disabled])
fi
if test x$enable_aes3500 != xno ; then
AC_MSG_NOTICE([** aes3500 driver enabled])
else
AC_MSG_NOTICE([ aes3500 driver disabled])
fi
if test x$enable_aes4000 != xno ; then
AC_MSG_NOTICE([** aes4000 driver enabled])
else
AC_MSG_NOTICE([ aes4000 driver disabled])
fi
if test x$enable_vfs101 != xno ; then
AC_MSG_NOTICE([** vfs101 driver enabled])
else
AC_MSG_NOTICE([ vfs101 driver disabled])
fi
if test x$enable_vfs301 != xno ; then
AC_MSG_NOTICE([** vfs301 driver enabled])
else
AC_MSG_NOTICE([ vfs301 driver disabled])
fi
if test x$enable_vfs5011 != xno ; then
AC_MSG_NOTICE([** vfs5011 driver enabled])
else
AC_MSG_NOTICE([ vfs5011 driver disabled])
fi
if test x$enable_upektc_img != xno ; then
AC_MSG_NOTICE([** upektc_img driver enabled])
else
AC_MSG_NOTICE([ upektc_img driver disabled])
fi
if test x$enable_etes603 != xno ; then
AC_MSG_NOTICE([** etes603 driver enabled])
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
AC_MSG_NOTICE([ aeslib helper functions disabled])
fi
if test x$require_aesX660 != xno ; then
AC_MSG_NOTICE([** aesX660 common routines enabled])
else
AC_MSG_NOTICE([ aesX660 common routines disabled])
fi
if test x$require_aes3k != xno ; then
AC_MSG_NOTICE([** aes3k common routines enabled])
else
AC_MSG_NOTICE([ aes3k common routines disabled])
fi
AC_CONFIG_FILES([libfprint.pc] [Makefile] [libfprint/Makefile] [examples/Makefile] [doc/Makefile])
AC_OUTPUT
-791
View File
@@ -1,791 +0,0 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2013-05-30.07; # UTC
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program 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 General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by 'PROGRAMS ARGS'.
object Object file output by 'PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputting dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
# Get the directory component of the given path, and save it in the
# global variables '$dir'. Note that this directory component will
# be either empty or ending with a '/' character. This is deliberate.
set_dir_from ()
{
case $1 in
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
*) dir=;;
esac
}
# Get the suffix-stripped basename of the given path, and save it the
# global variable '$base'.
set_base_from ()
{
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
}
# If no dependency file was actually created by the compiler invocation,
# we still have to create a dummy depfile, to avoid errors with the
# Makefile "include basename.Plo" scheme.
make_dummy_depfile ()
{
echo "#dummy" > "$depfile"
}
# Factor out some common post-processing of the generated depfile.
# Requires the auxiliary global variable '$tmpdepfile' to be set.
aix_post_process_depfile ()
{
# If the compiler actually managed to produce a dependency file,
# post-process it.
if test -f "$tmpdepfile"; then
# Each line is of the form 'foo.o: dependency.h'.
# Do two passes, one to just change these to
# $object: dependency.h
# and one to simply output
# dependency.h:
# which is needed to avoid the deleted-header problem.
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
} > "$depfile"
rm -f "$tmpdepfile"
else
make_dummy_depfile
fi
}
# A tabulation character.
tab=' '
# A newline character.
nl='
'
# Character ranges might be problematic outside the C locale.
# These definitions help.
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
lower=abcdefghijklmnopqrstuvwxyz
digits=0123456789
alpha=${upper}${lower}
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Avoid interferences from the environment.
gccflag= dashmflag=
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
# This is just like msvc7 but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvc7
fi
if test "$depmode" = xlc; then
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
gccflag=-qmakedep=gcc,-MF
depmode=gcc
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
## (see the conditional assignment to $gccflag above).
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say). Also, it might not be
## supported by the other compilers which use the 'gcc' depmode.
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The second -e expression handles DOS-style file names with drive
# letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the "deleted header file" problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
## Some versions of gcc put a space before the ':'. On the theory
## that the space means something, we add a space to the output as
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
| tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile"
;;
xlc)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
aix_post_process_depfile
;;
tcc)
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
# FIXME: That version still under development at the moment of writing.
# Make that this statement remains true also for stable, released
# versions.
# It will wrap lines (doesn't matter whether long or short) with a
# trailing '\', as in:
#
# foo.o : \
# foo.c \
# foo.h \
#
# It will put a trailing '\' even on the last line, and will use leading
# spaces rather than leading tabs (at least since its commit 0394caf7
# "Emit spaces for -MD").
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
# We have to change lines of the first kind to '$object: \'.
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
# And for each line of the second kind, we have to emit a 'dep.h:'
# dummy dependency, to avoid the deleted-header problem.
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
## The order of this option in the case statement is important, since the
## shell code in configure will try each of these formats in the order
## listed in this file. A plain '-MD' option would be understood by many
## compilers, so we must ensure this comes after the gcc and icc options.
pgcc)
# Portland's C compiler understands '-MD'.
# Will always output deps to 'file.d' where file is the root name of the
# source file under compilation, even if file resides in a subdirectory.
# The object file name does not affect the name of the '.d' file.
# pgcc 10.2 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using '\' :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
set_dir_from "$object"
# Use the source, not the object, to determine the base name, since
# that's sadly what pgcc will do too.
set_base_from "$source"
tmpdepfile=$base.d
# For projects that build the same source file twice into different object
# files, the pgcc approach of using the *source* file root name can cause
# problems in parallel builds. Use a locking strategy to avoid stomping on
# the same $tmpdepfile.
lockdir=$base.d-lock
trap "
echo '$0: caught signal, cleaning up...' >&2
rmdir '$lockdir'
exit 1
" 1 2 13 15
numtries=100
i=$numtries
while test $i -gt 0; do
# mkdir is a portable test-and-set.
if mkdir "$lockdir" 2>/dev/null; then
# This process acquired the lock.
"$@" -MD
stat=$?
# Release the lock.
rmdir "$lockdir"
break
else
# If the lock is being held by a different process, wait
# until the winning process is done or we timeout.
while test -d "$lockdir" && test $i -gt 0; do
sleep 1
i=`expr $i - 1`
done
fi
i=`expr $i - 1`
done
trap - 1 2 13 15
if test $i -le 0; then
echo "$0: failed to acquire lock after $numtries attempts" >&2
echo "$0: check lockdir '$lockdir'" >&2
exit 1
fi
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
# Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in 'foo.d' instead, so we check for that too.
# Subdirectories are respected.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
# Libtool generates 2 separate objects for the 2 libraries. These
# two compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir$base.o.d # libtool 1.5
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
# Same post-processing that is required for AIX mode.
aix_post_process_depfile
;;
msvc7)
if test "$libtool" = yes; then
showIncludes=-Wc,-showIncludes
else
showIncludes=-showIncludes
fi
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The first sed program below extracts the file names and escapes
# backslashes for cygpath. The second sed program outputs the file
# name when reading, but also accumulates all include files in the
# hold buffer in order to output them again at the end. This only
# works with sed implementations that can handle large buffers.
sed < "$tmpdepfile" -n '
/^Note: including file: *\(.*\)/ {
s//\1/
s/\\/\\\\/g
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/'"$tab"'/
G
p
}' >> "$depfile"
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
rm -f "$tmpdepfile"
;;
msvc7msys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for ':'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this sed invocation
# correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process the last invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed '1,2d' "$tmpdepfile" \
| tr ' ' "$nl" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E \
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
| sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
echo "$tab" >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:
-10
View File
@@ -1,10 +0,0 @@
EXTRA_DIST = doxygen.cfg
docs: doxygen.cfg
doxygen $^
docs-upload: docs
ln -s html api
ncftpput -f ~/.ncftp/reactivated -m -R httpdocs/fprint api/
rm -f api
-466
View File
@@ -1,466 +0,0 @@
# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = doc
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_CFLAGS = @AM_CFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CRYPTO_CFLAGS = @CRYPTO_CFLAGS@
CRYPTO_LIBS = @CRYPTO_LIBS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
IMAGING_CFLAGS = @IMAGING_CFLAGS@
IMAGING_LIBS = @IMAGING_LIBS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
LIBUSB_LIBS = @LIBUSB_LIBS@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
XV_CFLAGS = @XV_CFLAGS@
XV_LIBS = @XV_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_age = @lt_age@
lt_major = @lt_major@
lt_revision = @lt_revision@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
udev_rulesdir = @udev_rulesdir@
EXTRA_DIST = doxygen.cfg
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu doc/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
tags TAGS:
ctags CTAGS:
cscope cscopelist:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
cscopelist-am ctags-am distclean distclean-generic \
distclean-libtool distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags-am uninstall uninstall-am
.PRECIOUS: Makefile
docs: doxygen.cfg
doxygen $^
docs-upload: docs
ln -s html api
ncftpput -f ~/.ncftp/reactivated -m -R httpdocs/fprint api/
rm -f api
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
+115
View File
@@ -0,0 +1,115 @@
<?xml version="1.0"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<chapter id="advanced-topics" xmlns:xi="http://www.w3.org/2003/XInclude">
<title>Advanced Topics</title>
<refsect2 id="compatibility">
<title>Device and print compatibility</title>
<para>
Moving off generic conceptual ideas and onto libfprint-specific
implementation details, here are some introductory notes regarding how
libfprint copes with compatibility of fingerprints.
</para>
<para>
libfprint deals with a whole variety of different fingerprint readers and
the design includes considerations of compatibility and interoperability
between multiple devices. Your application should also be prepared to
work with more than one type of fingerprint reader and should consider that
enrolled fingerprint X may not be compatible with the device the user has
plugged in today.
</para>
<para>
libfprint implements the principle that fingerprints from different devices
are not necessarily compatible. For example, different devices may see
significantly different areas of fingerprint surface, and comparing images
between the devices would be unreliable. Also, devices can stretch and
distort images in different ways.
</para>
<para>
libfprint also implements the principle that in some cases, fingerprints
<emphasis>are</emphasis> compatible between different devices. If you go and buy two
identical fingerprint readers, it seems logical that you should be able
to enroll on one and verify on another without problems.
</para>
<para>
libfprint takes a fairly simplistic approach to these issues. Internally,
fingerprint hardware is driven by individual drivers. libfprint enforces
that a fingerprint that came from a device backed by driver X is never
compared to a fingerprint that came from a device backed by driver Y.
</para>
<para>
Additionally, libfprint is designed for the situation where a single driver
may support a range of devices which differ in imaging or scanning
properties. For example, a driver may support two ranges of devices which
even though are programmed over the same interface, one device sees
substantially less of the finger flesh, therefore images from the two
device types should be incompatible despite being from the same driver. To
implement this, each driver assigns a <emphasis>device type</emphasis> to each device
that it detects based on its imaging characteristics. libfprint ensures that
two prints being compared have the same device type.
</para>
<para>
In summary, libfprint represents fingerprints in several internal structures
and each representation will offer you a way of determining the
<ulink url="#driver_id">driver ID</ulink> and <ulink url="#device-types">devtype</ulink> of the print in
question. Prints are only compatible if the driver ID <emphasis role="strong">and</emphasis> devtypes
match. libfprint does offer you some "is this print compatible?" helper
functions, so you don't have to worry about these details too much.
</para>
</refsect2>
<refsect2 id="driver_id">
<title>Driver IDs</title>
<para>
Each driver is assigned a unique ID by the project maintainer. These
assignments are
<ulink url="https://gitlab.freedesktop.org/libfprint/libfprint/blob/master/libfprint/drivers/driver_ids.h">
documented in the sources</ulink> and will never change.
</para>
<para>
The only reason you may be interested in retrieving the driver ID for a
driver is for the purpose of checking if some print data is compatible
with a device. libfprint uses the driver ID as one way of checking that
the print you are trying to verify is compatible with the device in
question - it ensures that enrollment data from one driver is never fed to
another. Note that libfprint does provide you with helper functions to
determine whether a print is compatible with a device, so under most
circumstances, you don't have to worry about driver IDs at all.
</para>
</refsect2>
<refsect2 id="device-types">
<title>Device types</title>
<para>
Internally, the <ulink url="libfprint-Driver-operations.html#libfprint-Driver-operations.description">driver</ulink> behind a device assigns a 32-bit
<emphasis>devtype</emphasis> identifier to the device. This cannot be used as a unique
ID for a specific device as many devices under the same range may share
the same devtype. The devtype may even be 0 in all cases.
</para>
<para>
The only reason you may be interested in retrieving the devtype for a
device is for the purpose of checking if some print data is compatible
with a device. libfprint uses the devtype as one way of checking that the
print you are verifying is compatible with the device in question - the
devtypes must be equal. This effectively allows drivers to support more
than one type of device where the data from each one is not compatible with
the other. Note that libfprint does provide you with helper functions to
determine whether a print is compatible with a device, so under most
circumstances, you don't have to worry about devtypes at all.
</para>
</refsect2>
</chapter>
-1294
View File
File diff suppressed because it is too large Load Diff
+30
View File
@@ -0,0 +1,30 @@
<?xml version="1.0"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<chapter id="getting-started" xmlns:xi="http://www.w3.org/2003/XInclude">
<title>Getting Started</title>
<para>
libfprint includes several simple functional examples under the <computeroutput>examples/</computeroutput>
directory in the libfprint source distribution. Those are good starting
points.
</para>
<para>
Usually the first thing you want to do is determine which fingerprint
devices are present. This is done through <ulink url="libfprint-Device-discovery.html">device discovery</ulink>.
</para>
<para>
Once you have found a device you would like to operate, you should open it.
Refer to <ulink url="libfprint-Devices-operations.html">device operations</ulink>. This section also details enrollment,
image capture, and verification.
</para>
<para>
That should be enough to get you started, but do remember there are
documentation pages on other aspects of libfprint's API (see the modules
page).
</para>
</chapter>
+106
View File
@@ -0,0 +1,106 @@
<?xml version="1.0"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<chapter id="intro" xmlns:xi="http://www.w3.org/2003/XInclude">
<title>Introduction</title>
<para>
libfprint is an open source library to provide access to fingerprint
scanning devices. For more info, see the
<ulink url="https://fprint.freedesktop.org/">libfprint project homepage</ulink>.
</para>
<para>
This documentation is aimed at application developers who wish to integrate
fingerprint-related functionality into their software. libfprint has been
designed so that you only have to do this once by integrating your
software with libfprint, you'll be supporting all the fingerprint readers
that we have got our hands on. As such, the API is rather general (and
therefore hopefully easy to comprehend!), and does its best to hide the
technical details that required to operate the hardware.
</para>
<para>
This documentation is not aimed at developers wishing to develop and
contribute fingerprint device drivers to libfprint.
</para>
<para>
Feedback on this API and its associated documentation is appreciated. Was
anything unclear? Does anything seem unreasonably complicated? Is anything
missing? Let us know on the
<ulink url="https://lists.freedesktop.org/mailman/listinfo/fprint">mailing list</ulink>.
</para>
<refsect2 id="enrollment">
<title>Enrollment</title>
<para>
Before you dive into the API, it's worth introducing a couple of concepts.
</para>
<para>
The process of enrolling a finger is where you effectively scan your
finger for the purposes of teaching the system what your finger looks like.
This means that you scan your fingerprint, then the system processes it and
stores some data about your fingerprint to refer to later.
</para>
</refsect2>
<refsect2 id="verification">
<title>Verification</title>
<para>
Verification is what most people think of when they think about fingerprint
scanning. The process of verification is effectively performing a fresh
fingerprint scan, and then comparing that scan to a finger that was
previously enrolled.
</para>
<para>
As an example scenario, verification can be used to implement what people
would picture as fingerprint login (i.e. fingerprint replaces password).
For example:
</para>
<itemizedlist mark='dot'>
<listitem>
I enroll my fingerprint through some software that trusts I am who I say
I am. This is a prerequisite before I can perform fingerprint-based
login for my account.
</listitem>
<listitem>
Some time later, I want to login to my computer. I enter my username,
but instead of prompting me for a password, it asks me to scan my finger.
I scan my finger.
</listitem>
<listitem>
The system compares the finger I just scanned to the one that was
enrolled earlier. If the system decides that the fingerprints match,
I am successfully logged in. Otherwise, the system informs me that I am
not authorised to login as that user.
</listitem>
</itemizedlist>
</refsect2>
<refsect2 id="identification">
<title>Identification</title>
<para>
Identification is the process of comparing a freshly scanned fingerprint
to a <emphasis>collection</emphasis> of previously enrolled fingerprints. For example,
imagine there are 100 people in an organisation, and they all have enrolled
their fingerprints. One user walks up to a fingerprint scanner and scans
their finger. With <emphasis>no other knowledge</emphasis> of who that user might be,
the system examines their fingerprint, looks in the database, and determines
that the user is user number #61.
</para>
<para>
In other words, verification might be seen as a one-to-one fingerprint
comparison where you know the identity of the user that you wish to
authenticate, whereas identification is a one-to-many comparison where you
do not know the identity of the user that you wish to authenticate.
</para>
</refsect2>
</chapter>
+53
View File
@@ -0,0 +1,53 @@
<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
[
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
]>
<book id="index">
<bookinfo>
<title>libfprint Reference Manual</title>
<releaseinfo>
<para>This document is the API reference for the libfprint library.</para>
<para>
The latest version of libfprint, as well as the latest version of
this API reference, is <ulink role="online-location" url="https://www.freedesktop.org/wiki/Software/fprint/libfprint/">available online</ulink>.
</para>
</releaseinfo>
</bookinfo>
<part>
<title>Library Overview</title>
<xi:include href="intro.xml"/>
<xi:include href="advanced-topics.xml"/>
<xi:include href="getting-started.xml"/>
</part>
<part>
<title>API Documentation</title>
<xi:include href="xml/events.xml"/>
<xi:include href="xml/discovery.xml"/>
<xi:include href="xml/drv.xml"/>
<xi:include href="xml/dev.xml"/>
<xi:include href="xml/print_data.xml"/>
<!-- FIXME https://bugs.freedesktop.org/show_bug.cgi?id=106550 -->
<xi:include href="xml/dscv_print.xml"/>
<xi:include href="xml/img.xml"/>
</part>
<!--
<part>
<title>Writing Drivers</title>
</part>
-->
<index id="api-index">
<title>API Index</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
</index>
<index id="deprecated-api-index" role="deprecated">
<title>Index of deprecated API</title>
<xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
</index>
</book>
+136
View File
@@ -0,0 +1,136 @@
<INCLUDE>fprint.h</INCLUDE>
<SECTION>
<FILE>events</FILE>
<TITLE>Initialisation and events handling</TITLE>
fp_set_debug
fp_init
fp_exit
fp_pollfd
fp_handle_events_timeout
fp_handle_events
fp_get_next_timeout
fp_get_pollfds
fp_pollfd_added_cb
fp_pollfd_removed_cb
fp_set_pollfd_notifiers
</SECTION>
<SECTION>
<FILE>discovery</FILE>
<TITLE>Device discovery</TITLE>
fp_dscv_dev
fp_discover_devs
fp_dscv_devs_free
fp_dscv_dev_get_driver
fp_dscv_dev_get_devtype
fp_dscv_dev_get_driver_id
fp_dscv_dev_supports_print_data
fp_dscv_dev_supports_dscv_print
fp_dscv_dev_for_print_data
fp_dscv_dev_for_dscv_print
</SECTION>
<SECTION>
<FILE>drv</FILE>
fp_driver
fp_driver_get_name
fp_driver_get_full_name
fp_driver_get_driver_id
fp_driver_get_scan_type
</SECTION>
<SECTION>
<FILE>dev</FILE>
fp_dev
fp_scan_type
fp_capture_result
fp_enroll_result
fp_verify_result
fp_dev_get_driver
fp_dev_get_nr_enroll_stages
fp_dev_get_devtype
fp_dev_supports_print_data
fp_dev_supports_imaging
fp_dev_supports_identification
fp_dev_supports_dscv_print
fp_dev_get_img_width
fp_dev_get_img_height
fp_operation_stop_cb
fp_img_operation_cb
fp_dev_open_cb
fp_enroll_stage_cb
fp_identify_cb
fp_dev_open
fp_async_dev_open
fp_dev_close
fp_async_dev_close
fp_enroll_finger
fp_enroll_finger_img
fp_async_enroll_start
fp_async_enroll_stop
fp_verify_finger
fp_verify_finger_img
fp_async_verify_start
fp_async_verify_stop
fp_identify_finger
fp_identify_finger_img
fp_async_identify_start
fp_async_identify_stop
fp_dev_img_capture
fp_async_capture_start
fp_async_capture_stop
</SECTION>
<SECTION>
<FILE>print_data</FILE>
fp_finger
fp_print_data
fp_print_data
fp_print_data_get_data
fp_print_data_from_data
fp_print_data_save
fp_print_data_load
fp_print_data_delete
fp_print_data_from_dscv_print
fp_print_data_free
fp_print_data_get_driver_id
fp_print_data_get_devtype
</SECTION>
<SECTION>
<FILE>dscv_print</FILE>
fp_dscv_print
fp_discover_prints
fp_dscv_prints_free
fp_dscv_print_get_driver_id
fp_dscv_print_get_devtype
fp_dscv_print_get_finger
fp_dscv_print_delete
</SECTION>
<SECTION>
<FILE>img</FILE>
fp_img
fp_minutia
fp_img_free
fp_img_get_height
fp_img_get_width
fp_img_get_data
fp_img_save_to_file
fp_img_standardize
fp_img_binarize
fp_img_get_minutiae
</SECTION>
<SECTION>
<FILE>poll</FILE>
</SECTION>
+67
View File
@@ -0,0 +1,67 @@
subdir('xml')
private_headers = [
'config.h',
'aeslib.h',
'assembling.h',
'fp_internal.h',
# Drivers
'aes1660.h',
'aes2501.h',
'aes2550.h',
'aes2660.h',
'aes3k.h',
'aesx660.h',
'driver_ids.h',
'elan.h',
'upeksonly.h',
'upektc.h',
'upektc_img.h',
'vfs0050.h',
'vfs301_proto_fragments.h',
'vfs301_proto.h',
'vfs5011_proto.h',
# NBIS
'morph.h',
'sunrast.h',
'bozorth.h',
'defs.h',
'log.h',
'bz_array.h',
'lfs.h',
]
html_images = [
]
content_files = [
'intro.xml'
]
expand_content_files = content_files
glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix')
glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
docpath = join_paths(get_option('datadir'), 'gtk-doc', 'html')
gnome.gtkdoc('libfprint',
main_xml: 'libfprint-docs.xml',
src_dir: join_paths(meson.source_root(), 'libfprint'),
dependencies: libfprint_dep,
content_files: content_files,
expand_content_files: expand_content_files,
scan_args: [
'--rebuild-types',
'--ignore-decorators=API_EXPORTED',
'--ignore-headers=' + ' '.join(private_headers),
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
],
html_assets: html_images,
install: true)
+8
View File
@@ -0,0 +1,8 @@
<!ENTITY package "@PACKAGE@">
<!ENTITY package_bugreport "@PACKAGE_BUGREPORT@">
<!ENTITY package_name "@PACKAGE_NAME@">
<!ENTITY package_string "@PACKAGE_STRING@">
<!ENTITY package_tarname "@PACKAGE_TARNAME@">
<!ENTITY package_url "@PACKAGE_URL@">
<!ENTITY package_version "@PACKAGE_VERSION@">
<!ENTITY package_api_version "@PACKAGE_API_VERSION@">
+10
View File
@@ -0,0 +1,10 @@
ent_conf = configuration_data()
ent_conf.set('PACKAGE', 'libfprint')
ent_conf.set('PACKAGE_BUGREPORT', 'https://bugs.freedesktop.org/enter_bug.cgi?product=libfprint')
ent_conf.set('PACKAGE_NAME', 'libfprint')
ent_conf.set('PACKAGE_STRING', 'libfprint')
ent_conf.set('PACKAGE_TARNAME', 'libfprint-' + meson.project_version())
ent_conf.set('PACKAGE_URL', 'https://www.freedesktop.org/wiki/Software/fprint/libfprint/')
ent_conf.set('PACKAGE_VERSION', meson.project_version())
ent_conf.set('PACKAGE_API_VERSION', '1.0')
configure_file(input: 'gtkdocentities.ent.in', output: 'gtkdocentities.ent', configuration: ent_conf)
-26
View File
@@ -1,26 +0,0 @@
AM_CFLAGS = -I$(top_srcdir)
noinst_PROGRAMS = verify_live enroll verify img_capture cpp-test
verify_live_SOURCES = verify_live.c
verify_live_LDADD = ../libfprint/libfprint.la
enroll_SOURCES = enroll.c
enroll_LDADD = ../libfprint/libfprint.la
verify_SOURCES = verify.c
verify_LDADD = ../libfprint/libfprint.la
img_capture_SOURCES = img_capture.c
img_capture_LDADD = ../libfprint/libfprint.la
cpp_test_SOURCES = cpp-test.cpp
cpp_test_LDADD = ../libfprint/libfprint.la
if BUILD_X11_EXAMPLES
noinst_PROGRAMS += img_capture_continuous
img_capture_continuous_CFLAGS = $(X_CFLAGS) $(XV_CFLAGS)
img_capture_continuous_SOURCES = img_capture_continuous.c
img_capture_continuous_LDADD = ../libfprint/libfprint.la $(X_LIBS) $(X_PRE_LIBS) $(XV_LIBS) -lX11 $(X_EXTRA_LIBS);
endif
-733
View File
@@ -1,733 +0,0 @@
# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
noinst_PROGRAMS = verify_live$(EXEEXT) enroll$(EXEEXT) verify$(EXEEXT) \
img_capture$(EXEEXT) cpp-test$(EXEEXT) $(am__EXEEXT_1)
@BUILD_X11_EXAMPLES_TRUE@am__append_1 = img_capture_continuous
subdir = examples
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
@BUILD_X11_EXAMPLES_TRUE@am__EXEEXT_1 = \
@BUILD_X11_EXAMPLES_TRUE@ img_capture_continuous$(EXEEXT)
PROGRAMS = $(noinst_PROGRAMS)
am_cpp_test_OBJECTS = cpp-test.$(OBJEXT)
cpp_test_OBJECTS = $(am_cpp_test_OBJECTS)
cpp_test_DEPENDENCIES = ../libfprint/libfprint.la
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
am_enroll_OBJECTS = enroll.$(OBJEXT)
enroll_OBJECTS = $(am_enroll_OBJECTS)
enroll_DEPENDENCIES = ../libfprint/libfprint.la
am_img_capture_OBJECTS = img_capture.$(OBJEXT)
img_capture_OBJECTS = $(am_img_capture_OBJECTS)
img_capture_DEPENDENCIES = ../libfprint/libfprint.la
am__img_capture_continuous_SOURCES_DIST = img_capture_continuous.c
@BUILD_X11_EXAMPLES_TRUE@am_img_capture_continuous_OBJECTS = img_capture_continuous-img_capture_continuous.$(OBJEXT)
img_capture_continuous_OBJECTS = $(am_img_capture_continuous_OBJECTS)
am__DEPENDENCIES_1 =
@BUILD_X11_EXAMPLES_TRUE@img_capture_continuous_DEPENDENCIES = \
@BUILD_X11_EXAMPLES_TRUE@ ../libfprint/libfprint.la \
@BUILD_X11_EXAMPLES_TRUE@ $(am__DEPENDENCIES_1) \
@BUILD_X11_EXAMPLES_TRUE@ $(X_EXTRA_LIBS);
img_capture_continuous_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(img_capture_continuous_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
am_verify_OBJECTS = verify.$(OBJEXT)
verify_OBJECTS = $(am_verify_OBJECTS)
verify_DEPENDENCIES = ../libfprint/libfprint.la
am_verify_live_OBJECTS = verify_live.$(OBJEXT)
verify_live_OBJECTS = $(am_verify_live_OBJECTS)
verify_live_DEPENDENCIES = ../libfprint/libfprint.la
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
AM_V_CXX = $(am__v_CXX_@AM_V@)
am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
am__v_CXX_0 = @echo " CXX " $@;
am__v_CXX_1 =
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
am__v_CXXLD_0 = @echo " CXXLD " $@;
am__v_CXXLD_1 =
SOURCES = $(cpp_test_SOURCES) $(enroll_SOURCES) $(img_capture_SOURCES) \
$(img_capture_continuous_SOURCES) $(verify_SOURCES) \
$(verify_live_SOURCES)
DIST_SOURCES = $(cpp_test_SOURCES) $(enroll_SOURCES) \
$(img_capture_SOURCES) \
$(am__img_capture_continuous_SOURCES_DIST) $(verify_SOURCES) \
$(verify_live_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_CFLAGS = -I$(top_srcdir)
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CRYPTO_CFLAGS = @CRYPTO_CFLAGS@
CRYPTO_LIBS = @CRYPTO_LIBS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
IMAGING_CFLAGS = @IMAGING_CFLAGS@
IMAGING_LIBS = @IMAGING_LIBS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBUSB_CFLAGS = @LIBUSB_CFLAGS@
LIBUSB_LIBS = @LIBUSB_LIBS@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
XV_CFLAGS = @XV_CFLAGS@
XV_LIBS = @XV_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_age = @lt_age@
lt_major = @lt_major@
lt_revision = @lt_revision@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
udev_rulesdir = @udev_rulesdir@
verify_live_SOURCES = verify_live.c
verify_live_LDADD = ../libfprint/libfprint.la
enroll_SOURCES = enroll.c
enroll_LDADD = ../libfprint/libfprint.la
verify_SOURCES = verify.c
verify_LDADD = ../libfprint/libfprint.la
img_capture_SOURCES = img_capture.c
img_capture_LDADD = ../libfprint/libfprint.la
cpp_test_SOURCES = cpp-test.cpp
cpp_test_LDADD = ../libfprint/libfprint.la
@BUILD_X11_EXAMPLES_TRUE@img_capture_continuous_CFLAGS = $(X_CFLAGS) $(XV_CFLAGS)
@BUILD_X11_EXAMPLES_TRUE@img_capture_continuous_SOURCES = img_capture_continuous.c
@BUILD_X11_EXAMPLES_TRUE@img_capture_continuous_LDADD = ../libfprint/libfprint.la $(X_LIBS) $(X_PRE_LIBS) $(XV_LIBS) -lX11 $(X_EXTRA_LIBS);
all: all-am
.SUFFIXES:
.SUFFIXES: .c .cpp .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu examples/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-noinstPROGRAMS:
@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
cpp-test$(EXEEXT): $(cpp_test_OBJECTS) $(cpp_test_DEPENDENCIES) $(EXTRA_cpp_test_DEPENDENCIES)
@rm -f cpp-test$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(cpp_test_OBJECTS) $(cpp_test_LDADD) $(LIBS)
enroll$(EXEEXT): $(enroll_OBJECTS) $(enroll_DEPENDENCIES) $(EXTRA_enroll_DEPENDENCIES)
@rm -f enroll$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(enroll_OBJECTS) $(enroll_LDADD) $(LIBS)
img_capture$(EXEEXT): $(img_capture_OBJECTS) $(img_capture_DEPENDENCIES) $(EXTRA_img_capture_DEPENDENCIES)
@rm -f img_capture$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(img_capture_OBJECTS) $(img_capture_LDADD) $(LIBS)
img_capture_continuous$(EXEEXT): $(img_capture_continuous_OBJECTS) $(img_capture_continuous_DEPENDENCIES) $(EXTRA_img_capture_continuous_DEPENDENCIES)
@rm -f img_capture_continuous$(EXEEXT)
$(AM_V_CCLD)$(img_capture_continuous_LINK) $(img_capture_continuous_OBJECTS) $(img_capture_continuous_LDADD) $(LIBS)
verify$(EXEEXT): $(verify_OBJECTS) $(verify_DEPENDENCIES) $(EXTRA_verify_DEPENDENCIES)
@rm -f verify$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(verify_OBJECTS) $(verify_LDADD) $(LIBS)
verify_live$(EXEEXT): $(verify_live_OBJECTS) $(verify_live_DEPENDENCIES) $(EXTRA_verify_live_DEPENDENCIES)
@rm -f verify_live$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(verify_live_OBJECTS) $(verify_live_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpp-test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enroll.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/img_capture.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/img_capture_continuous-img_capture_continuous.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/verify.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/verify_live.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
img_capture_continuous-img_capture_continuous.o: img_capture_continuous.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(img_capture_continuous_CFLAGS) $(CFLAGS) -MT img_capture_continuous-img_capture_continuous.o -MD -MP -MF $(DEPDIR)/img_capture_continuous-img_capture_continuous.Tpo -c -o img_capture_continuous-img_capture_continuous.o `test -f 'img_capture_continuous.c' || echo '$(srcdir)/'`img_capture_continuous.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/img_capture_continuous-img_capture_continuous.Tpo $(DEPDIR)/img_capture_continuous-img_capture_continuous.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='img_capture_continuous.c' object='img_capture_continuous-img_capture_continuous.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(img_capture_continuous_CFLAGS) $(CFLAGS) -c -o img_capture_continuous-img_capture_continuous.o `test -f 'img_capture_continuous.c' || echo '$(srcdir)/'`img_capture_continuous.c
img_capture_continuous-img_capture_continuous.obj: img_capture_continuous.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(img_capture_continuous_CFLAGS) $(CFLAGS) -MT img_capture_continuous-img_capture_continuous.obj -MD -MP -MF $(DEPDIR)/img_capture_continuous-img_capture_continuous.Tpo -c -o img_capture_continuous-img_capture_continuous.obj `if test -f 'img_capture_continuous.c'; then $(CYGPATH_W) 'img_capture_continuous.c'; else $(CYGPATH_W) '$(srcdir)/img_capture_continuous.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/img_capture_continuous-img_capture_continuous.Tpo $(DEPDIR)/img_capture_continuous-img_capture_continuous.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='img_capture_continuous.c' object='img_capture_continuous-img_capture_continuous.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(img_capture_continuous_CFLAGS) $(CFLAGS) -c -o img_capture_continuous-img_capture_continuous.obj `if test -f 'img_capture_continuous.c'; then $(CYGPATH_W) 'img_capture_continuous.c'; else $(CYGPATH_W) '$(srcdir)/img_capture_continuous.c'; fi`
.cpp.o:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \
ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
+3 -1
View File
@@ -110,12 +110,14 @@ int main(void)
"Ctrl+C\n"); "Ctrl+C\n");
getchar(); getchar();
setenv ("G_MESSAGES_DEBUG", "all", 0);
setenv ("LIBUSB_DEBUG", "3", 0);
r = fp_init(); r = fp_init();
if (r < 0) { if (r < 0) {
fprintf(stderr, "Failed to initialize libfprint\n"); fprintf(stderr, "Failed to initialize libfprint\n");
exit(1); exit(1);
} }
fp_set_debug(3);
discovered_devs = fp_discover_devs(); discovered_devs = fp_discover_devs();
if (!discovered_devs) { if (!discovered_devs) {
+4 -1
View File
@@ -42,12 +42,14 @@ int main(void)
struct fp_dev *dev; struct fp_dev *dev;
struct fp_img *img = NULL; struct fp_img *img = NULL;
setenv ("G_MESSAGES_DEBUG", "all", 0);
setenv ("LIBUSB_DEBUG", "3", 0);
r = fp_init(); r = fp_init();
if (r < 0) { if (r < 0) {
fprintf(stderr, "Failed to initialize libfprint\n"); fprintf(stderr, "Failed to initialize libfprint\n");
exit(1); exit(1);
} }
fp_set_debug(3);
discovered_devs = fp_discover_devs(); discovered_devs = fp_discover_devs();
if (!discovered_devs) { if (!discovered_devs) {
@@ -57,6 +59,7 @@ int main(void)
ddev = discover_device(discovered_devs); ddev = discover_device(discovered_devs);
if (!ddev) { if (!ddev) {
fp_dscv_devs_free(discovered_devs);
fprintf(stderr, "No devices detected.\n"); fprintf(stderr, "No devices detected.\n");
goto out; goto out;
} }
+5 -3
View File
@@ -53,7 +53,7 @@ static int connection = -1;
static void grey2yuy2 (unsigned char *grey, char *YUV, int num) { static void grey2yuy2 (unsigned char *grey, char *YUV, int num) {
int i, j; int i, j;
int y0, y1, u0, u1, v0, v1; int y0, y1, u0, u1, v0, v1;
int gval; uint64_t gval;
for (i = 0, j = 0; i < num; i += 2, j += 4) for (i = 0, j = 0; i < num; i += 2, j += 4)
{ {
@@ -84,7 +84,7 @@ static void display_frame(struct fp_img *img)
0, 0, width, height, 0, 0, width, height); 0, 0, width, height, 0, 0, width, height);
} }
static void QueryXv() static void QueryXv(void)
{ {
unsigned int num_adaptors; unsigned int num_adaptors;
int num_formats; int num_formats;
@@ -141,12 +141,14 @@ int main(void)
int img_height; int img_height;
int standardize = 0; int standardize = 0;
setenv ("G_MESSAGES_DEBUG", "all", 0);
setenv ("LIBUSB_DEBUG", "3", 0);
r = fp_init(); r = fp_init();
if (r < 0) { if (r < 0) {
fprintf(stderr, "Failed to initialize libfprint\n"); fprintf(stderr, "Failed to initialize libfprint\n");
exit(1); exit(1);
} }
fp_set_debug(3);
discovered_devs = fp_discover_devs(); discovered_devs = fp_discover_devs();
if (!discovered_devs) { if (!discovered_devs) {
+29
View File
@@ -0,0 +1,29 @@
examples = [ 'verify_live', 'enroll', 'verify', 'img_capture' ]
foreach example: examples
executable(example,
example + '.c',
dependencies: libfprint_dep,
include_directories: [
root_inc,
],
c_args: common_cflags)
endforeach
executable('cpp-test',
'cpp-test.cpp',
dependencies: libfprint_dep,
include_directories: [
root_inc,
],
c_args: common_cflags)
if get_option('x11-examples')
executable('img_capture_continuous',
'img_capture_continuous.c',
dependencies: [ libfprint_dep, xv_dep, x11_dep ],
include_directories: [
root_inc,
],
c_args: common_cflags)
endif
+3 -1
View File
@@ -86,12 +86,14 @@ int main(void)
struct fp_dev *dev; struct fp_dev *dev;
struct fp_print_data *data; struct fp_print_data *data;
setenv ("G_MESSAGES_DEBUG", "all", 0);
setenv ("LIBUSB_DEBUG", "3", 0);
r = fp_init(); r = fp_init();
if (r < 0) { if (r < 0) {
fprintf(stderr, "Failed to initialize libfprint\n"); fprintf(stderr, "Failed to initialize libfprint\n");
exit(1); exit(1);
} }
fp_set_debug(3);
discovered_devs = fp_discover_devs(); discovered_devs = fp_discover_devs();
if (!discovered_devs) { if (!discovered_devs) {
+3 -1
View File
@@ -129,12 +129,14 @@ int main(void)
struct fp_dev *dev; struct fp_dev *dev;
struct fp_print_data *data; struct fp_print_data *data;
setenv ("G_MESSAGES_DEBUG", "all", 0);
setenv ("LIBUSB_DEBUG", "3", 0);
r = fp_init(); r = fp_init();
if (r < 0) { if (r < 0) {
fprintf(stderr, "Failed to initialize libfprint\n"); fprintf(stderr, "Failed to initialize libfprint\n");
exit(1); exit(1);
} }
fp_set_debug(3);
discovered_devs = fp_discover_devs(); discovered_devs = fp_discover_devs();
if (!discovered_devs) { if (!discovered_devs) {
-527
View File
@@ -1,527 +0,0 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2011-11-20.07; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:
-11
View File
@@ -1,11 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libfprint
Description: Generic C API for fingerprint reader access
Version: @VERSION@
Libs: -L${libdir} -lfprint
Cflags: -I${includedir}/libfprint
-162
View File
@@ -1,162 +0,0 @@
# AuthenTec AES3500
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="5731", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="5731", ENV{LIBFPRINT_DRIVER}="AuthenTec AES3500"
# AuthenTec AES4000
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="5501", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="5501", ENV{LIBFPRINT_DRIVER}="AuthenTec AES4000"
# AuthenTec AES2501
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2500", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2500", ENV{LIBFPRINT_DRIVER}="AuthenTec AES2501"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2580", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2580", ENV{LIBFPRINT_DRIVER}="AuthenTec AES2501"
# AuthenTec AES2550/AES2810
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2550", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2550", ENV{LIBFPRINT_DRIVER}="AuthenTec AES2550/AES2810"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2810", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2810", ENV{LIBFPRINT_DRIVER}="AuthenTec AES2550/AES2810"
# Digital Persona U.are.U 4000/4000B/4500
SUBSYSTEM=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="00bc", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="00bc", ENV{LIBFPRINT_DRIVER}="Digital Persona U.are.U 4000/4000B/4500"
SUBSYSTEM=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="00bd", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="00bd", ENV{LIBFPRINT_DRIVER}="Digital Persona U.are.U 4000/4000B/4500"
SUBSYSTEM=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="00ca", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="00ca", ENV{LIBFPRINT_DRIVER}="Digital Persona U.are.U 4000/4000B/4500"
SUBSYSTEM=="usb", ATTRS{idVendor}=="05ba", ATTRS{idProduct}=="0007", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="05ba", ATTRS{idProduct}=="0007", ENV{LIBFPRINT_DRIVER}="Digital Persona U.are.U 4000/4000B/4500"
SUBSYSTEM=="usb", ATTRS{idVendor}=="05ba", ATTRS{idProduct}=="0008", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="05ba", ATTRS{idProduct}=="0008", ENV{LIBFPRINT_DRIVER}="Digital Persona U.are.U 4000/4000B/4500"
SUBSYSTEM=="usb", ATTRS{idVendor}=="05ba", ATTRS{idProduct}=="000a", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="05ba", ATTRS{idProduct}=="000a", ENV{LIBFPRINT_DRIVER}="Digital Persona U.are.U 4000/4000B/4500"
# Veridicom 5thSense
SUBSYSTEM=="usb", ATTRS{idVendor}=="061a", ATTRS{idProduct}=="0110", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="061a", ATTRS{idProduct}=="0110", ENV{LIBFPRINT_DRIVER}="Veridicom 5thSense"
# UPEK TouchStrip Sensor-Only
SUBSYSTEM=="usb", ATTRS{idVendor}=="147e", ATTRS{idProduct}=="2016", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="147e", ATTRS{idProduct}=="2016", ENV{LIBFPRINT_DRIVER}="UPEK TouchStrip Sensor-Only"
SUBSYSTEM=="usb", ATTRS{idVendor}=="147e", ATTRS{idProduct}=="1000", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="147e", ATTRS{idProduct}=="1000", ENV{LIBFPRINT_DRIVER}="UPEK TouchStrip Sensor-Only"
SUBSYSTEM=="usb", ATTRS{idVendor}=="147e", ATTRS{idProduct}=="1001", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="147e", ATTRS{idProduct}=="1001", ENV{LIBFPRINT_DRIVER}="UPEK TouchStrip Sensor-Only"
# AuthenTec AES1610
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1600", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1600", ENV{LIBFPRINT_DRIVER}="AuthenTec AES1610"
# AuthenTec AES1660
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1660", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1660", ENV{LIBFPRINT_DRIVER}="AuthenTec AES1660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1680", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1680", ENV{LIBFPRINT_DRIVER}="AuthenTec AES1660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1681", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1681", ENV{LIBFPRINT_DRIVER}="AuthenTec AES1660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1682", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1682", ENV{LIBFPRINT_DRIVER}="AuthenTec AES1660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1683", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1683", ENV{LIBFPRINT_DRIVER}="AuthenTec AES1660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1684", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1684", ENV{LIBFPRINT_DRIVER}="AuthenTec AES1660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1685", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1685", ENV{LIBFPRINT_DRIVER}="AuthenTec AES1660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1686", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1686", ENV{LIBFPRINT_DRIVER}="AuthenTec AES1660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1687", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1687", ENV{LIBFPRINT_DRIVER}="AuthenTec AES1660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1688", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1688", ENV{LIBFPRINT_DRIVER}="AuthenTec AES1660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1689", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="1689", ENV{LIBFPRINT_DRIVER}="AuthenTec AES1660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="168a", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="168a", ENV{LIBFPRINT_DRIVER}="AuthenTec AES1660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="168b", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="168b", ENV{LIBFPRINT_DRIVER}="AuthenTec AES1660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="168c", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="168c", ENV{LIBFPRINT_DRIVER}="AuthenTec AES1660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="168d", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="168d", ENV{LIBFPRINT_DRIVER}="AuthenTec AES1660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="168e", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="168e", ENV{LIBFPRINT_DRIVER}="AuthenTec AES1660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="168f", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="168f", ENV{LIBFPRINT_DRIVER}="AuthenTec AES1660"
# AuthenTec AES2660
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2660", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2660", ENV{LIBFPRINT_DRIVER}="AuthenTec AES2660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2680", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2680", ENV{LIBFPRINT_DRIVER}="AuthenTec AES2660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2681", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2681", ENV{LIBFPRINT_DRIVER}="AuthenTec AES2660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2682", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2682", ENV{LIBFPRINT_DRIVER}="AuthenTec AES2660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2683", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2683", ENV{LIBFPRINT_DRIVER}="AuthenTec AES2660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2684", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2684", ENV{LIBFPRINT_DRIVER}="AuthenTec AES2660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2685", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2685", ENV{LIBFPRINT_DRIVER}="AuthenTec AES2660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2686", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2686", ENV{LIBFPRINT_DRIVER}="AuthenTec AES2660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2687", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2687", ENV{LIBFPRINT_DRIVER}="AuthenTec AES2660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2688", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2688", ENV{LIBFPRINT_DRIVER}="AuthenTec AES2660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2689", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2689", ENV{LIBFPRINT_DRIVER}="AuthenTec AES2660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="268a", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="268a", ENV{LIBFPRINT_DRIVER}="AuthenTec AES2660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="268b", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="268b", ENV{LIBFPRINT_DRIVER}="AuthenTec AES2660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="268c", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="268c", ENV{LIBFPRINT_DRIVER}="AuthenTec AES2660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="268d", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="268d", ENV{LIBFPRINT_DRIVER}="AuthenTec AES2660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="268e", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="268e", ENV{LIBFPRINT_DRIVER}="AuthenTec AES2660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="268f", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="268f", ENV{LIBFPRINT_DRIVER}="AuthenTec AES2660"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2691", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="08ff", ATTRS{idProduct}=="2691", ENV{LIBFPRINT_DRIVER}="AuthenTec AES2660"
# Validity VFS101
SUBSYSTEM=="usb", ATTRS{idVendor}=="138a", ATTRS{idProduct}=="0001", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="138a", ATTRS{idProduct}=="0001", ENV{LIBFPRINT_DRIVER}="Validity VFS101"
# Validity VFS301
SUBSYSTEM=="usb", ATTRS{idVendor}=="138a", ATTRS{idProduct}=="0005", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="138a", ATTRS{idProduct}=="0005", ENV{LIBFPRINT_DRIVER}="Validity VFS301"
SUBSYSTEM=="usb", ATTRS{idVendor}=="138a", ATTRS{idProduct}=="0008", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="138a", ATTRS{idProduct}=="0008", ENV{LIBFPRINT_DRIVER}="Validity VFS301"
# Validity VFS5011
SUBSYSTEM=="usb", ATTRS{idVendor}=="138a", ATTRS{idProduct}=="0010", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="138a", ATTRS{idProduct}=="0010", ENV{LIBFPRINT_DRIVER}="Validity VFS5011"
SUBSYSTEM=="usb", ATTRS{idVendor}=="138a", ATTRS{idProduct}=="0011", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="138a", ATTRS{idProduct}=="0011", ENV{LIBFPRINT_DRIVER}="Validity VFS5011"
SUBSYSTEM=="usb", ATTRS{idVendor}=="138a", ATTRS{idProduct}=="0017", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="138a", ATTRS{idProduct}=="0017", ENV{LIBFPRINT_DRIVER}="Validity VFS5011"
SUBSYSTEM=="usb", ATTRS{idVendor}=="138a", ATTRS{idProduct}=="0018", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="138a", ATTRS{idProduct}=="0018", ENV{LIBFPRINT_DRIVER}="Validity VFS5011"
# UPEK TouchChip/Eikon Touch 300
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="2015", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="2015", ENV{LIBFPRINT_DRIVER}="UPEK TouchChip/Eikon Touch 300"
SUBSYSTEM=="usb", ATTRS{idVendor}=="147e", ATTRS{idProduct}=="3001", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="147e", ATTRS{idProduct}=="3001", ENV{LIBFPRINT_DRIVER}="UPEK TouchChip/Eikon Touch 300"
# Upek TouchChip Fingerprint Coprocessor
SUBSYSTEM=="usb", ATTRS{idVendor}=="147e", ATTRS{idProduct}=="2020", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="147e", ATTRS{idProduct}=="2020", ENV{LIBFPRINT_DRIVER}="Upek TouchChip Fingerprint Coprocessor"
# EgisTec ES603
SUBSYSTEM=="usb", ATTRS{idVendor}=="1c7a", ATTRS{idProduct}=="0603", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1c7a", ATTRS{idProduct}=="0603", ENV{LIBFPRINT_DRIVER}="EgisTec ES603"
# Validity VFS0050
SUBSYSTEM=="usb", ATTRS{idVendor}=="138a", ATTRS{idProduct}=="0050", ATTRS{dev}=="*", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="usb", ATTRS{idVendor}=="138a", ATTRS{idProduct}=="0050", ENV{LIBFPRINT_DRIVER}="Validity VFS0050"
-227
View File
@@ -1,227 +0,0 @@
lib_LTLIBRARIES = libfprint.la
noinst_PROGRAMS = fprint-list-udev-rules
MOSTLYCLEANFILES = $(udev_rules_DATA)
UPEKE2_SRC = drivers/upeke2.c
UPEKTS_SRC = drivers/upekts.c
UPEKTC_SRC = drivers/upektc.c drivers/upektc.h
UPEKSONLY_SRC = drivers/upeksonly.c drivers/upeksonly.h
URU4000_SRC = drivers/uru4000.c
AES1610_SRC = drivers/aes1610.c
AES1660_SRC = drivers/aes1660.c drivers/aes1660.h
AES2501_SRC = drivers/aes2501.c drivers/aes2501.h
AES2550_SRC = drivers/aes2550.c drivers/aes2550.h
AES2660_SRC = drivers/aes2660.c drivers/aes2660.h
AES3500_SRC = drivers/aes3500.c
AES4000_SRC = drivers/aes4000.c
FDU2000_SRC = drivers/fdu2000.c
VCOM5S_SRC = drivers/vcom5s.c
VFS101_SRC = drivers/vfs101.c
VFS301_SRC = drivers/vfs301.c drivers/vfs301_proto.c drivers/vfs301_proto.h drivers/vfs301_proto_fragments.h
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) \
$(UPEKTS_SRC) \
$(UPEKTC_SRC) \
$(UPEKSONLY_SRC) \
$(URU4000_SRC) \
$(AES1610_SRC) \
$(AES1660_SRC) \
$(AES2501_SRC) \
$(AES2550_SRC) \
$(AES2660_SRC) \
$(AES3500_SRC) \
$(AES4000_SRC) \
$(FDU2000_SRC) \
$(VCOM5S_SRC) \
$(VFS101_SRC) \
$(VFS301_SRC) \
$(VFS5011_SRC) \
$(UPEKTC_IMG_SRC) \
$(ETES603_SRC) \
$(VFS0050_SRC) \
drivers/aesx660.c \
drivers/aesx660.h \
drivers/aes3k.c \
drivers/aes3k.h \
drivers/driver_ids.h \
aeslib.c aeslib.h \
assembling.c \
assembling.h \
pixman.c \
60-fprint-autosuspend.rules
DRIVER_SRC =
OTHER_SRC =
NBIS_SRC = \
nbis/include/bozorth.h \
nbis/include/bz_array.h \
nbis/include/defs.h \
nbis/include/lfs.h \
nbis/include/log.h \
nbis/include/morph.h \
nbis/include/sunrast.h \
nbis/bozorth3/bozorth3.c \
nbis/bozorth3/bz_alloc.c \
nbis/bozorth3/bz_drvrs.c \
nbis/bozorth3/bz_gbls.c \
nbis/bozorth3/bz_io.c \
nbis/bozorth3/bz_sort.c \
nbis/mindtct/binar.c \
nbis/mindtct/block.c \
nbis/mindtct/contour.c \
nbis/mindtct/detect.c \
nbis/mindtct/dft.c \
nbis/mindtct/free.c \
nbis/mindtct/globals.c \
nbis/mindtct/imgutil.c \
nbis/mindtct/init.c \
nbis/mindtct/line.c \
nbis/mindtct/log.c \
nbis/mindtct/loop.c \
nbis/mindtct/maps.c \
nbis/mindtct/matchpat.c \
nbis/mindtct/minutia.c \
nbis/mindtct/morph.c \
nbis/mindtct/quality.c \
nbis/mindtct/remove.c \
nbis/mindtct/ridges.c \
nbis/mindtct/shape.c \
nbis/mindtct/sort.c \
nbis/mindtct/util.c
libfprint_la_CFLAGS = -fvisibility=hidden -I$(srcdir)/nbis/include $(LIBUSB_CFLAGS) $(GLIB_CFLAGS) $(CRYPTO_CFLAGS) $(AM_CFLAGS)
libfprint_la_LDFLAGS = -version-info @lt_major@:@lt_revision@:@lt_age@
libfprint_la_LIBADD = -lm $(LIBUSB_LIBS) $(GLIB_LIBS) $(CRYPTO_LIBS)
fprint_list_udev_rules_SOURCES = fprint-list-udev-rules.c
fprint_list_udev_rules_CFLAGS = -fvisibility=hidden -I$(srcdir)/nbis/include $(LIBUSB_CFLAGS) $(GLIB_CFLAGS) $(CRYPTO_CFLAGS) $(AM_CFLAGS)
fprint_list_udev_rules_LDADD = $(builddir)/libfprint.la $(GLIB_LIBS)
udev_rules_DATA = 60-fprint-autosuspend.rules
if ENABLE_UDEV_RULES
$(udev_rules_DATA): fprint-list-udev-rules
$(builddir)/fprint-list-udev-rules > $@
endif
if ENABLE_UPEKE2
DRIVER_SRC += $(UPEKE2_SRC)
endif
if ENABLE_UPEKTS
DRIVER_SRC += $(UPEKTS_SRC)
endif
if ENABLE_UPEKSONLY
DRIVER_SRC += $(UPEKSONLY_SRC)
endif
if ENABLE_UPEKTC
DRIVER_SRC += $(UPEKTC_SRC)
endif
if ENABLE_URU4000
DRIVER_SRC += $(URU4000_SRC)
endif
if ENABLE_VCOM5S
DRIVER_SRC += $(VCOM5S_SRC)
endif
#if ENABLE_FDU2000
#DRIVER_SRC += $(FDU2000_SRC)
#endif
if ENABLE_AES1610
DRIVER_SRC += $(AES1610_SRC)
endif
if ENABLE_AES1660
DRIVER_SRC += $(AES1660_SRC)
endif
if ENABLE_AES2501
DRIVER_SRC += $(AES2501_SRC)
endif
if ENABLE_AES2550
DRIVER_SRC += $(AES2550_SRC)
endif
if ENABLE_AES2660
DRIVER_SRC += $(AES2660_SRC)
endif
if ENABLE_AES3500
DRIVER_SRC += $(AES3500_SRC)
endif
if ENABLE_AES4000
DRIVER_SRC += $(AES4000_SRC)
endif
if ENABLE_VFS101
DRIVER_SRC += $(VFS101_SRC)
endif
if ENABLE_VFS301
DRIVER_SRC += $(VFS301_SRC)
endif
if ENABLE_VFS5011
DRIVER_SRC += $(VFS5011_SRC)
endif
if ENABLE_UPEKTC_IMG
DRIVER_SRC += $(UPEKTC_IMG_SRC)
endif
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)
libfprint_la_LIBADD += $(IMAGING_LIBS)
endif
if REQUIRE_AESLIB
OTHER_SRC += aeslib.c aeslib.h
endif
if REQUIRE_AESX660
OTHER_SRC += drivers/aesx660.c drivers/aesx660.h
endif
if REQUIRE_AES3K
OTHER_SRC += drivers/aes3k.c drivers/aes3k.h
endif
libfprint_la_SOURCES = \
fp_internal.h \
async.c \
core.c \
data.c \
drv.c \
img.c \
imgdev.c \
poll.c \
sync.c \
assembling.c \
assembling.h \
$(DRIVER_SRC) \
$(OTHER_SRC) \
$(NBIS_SRC)
pkginclude_HEADERS = fprint.h
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -19,13 +19,14 @@
#define FP_COMPONENT "aeslib" #define FP_COMPONENT "aeslib"
#include "fp_internal.h"
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <libusb.h> #include <libusb.h>
#include <glib.h> #include <glib.h>
#include "fp_internal.h"
#include "assembling.h" #include "assembling.h"
#include "aeslib.h" #include "aeslib.h"
+1 -1
View File
@@ -20,7 +20,7 @@
#ifndef __AESLIB_H__ #ifndef __AESLIB_H__
#define __AESLIB_H__ #define __AESLIB_H__
#include <fp_internal.h> #include <fprint.h>
struct aes_regwrite { struct aes_regwrite {
unsigned char reg; unsigned char reg;
+16 -5
View File
@@ -21,13 +21,14 @@
#define FP_COMPONENT "assembling" #define FP_COMPONENT "assembling"
#include "fp_internal.h"
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <libusb.h> #include <libusb.h>
#include <glib.h> #include <glib.h>
#include "fp_internal.h"
#include "assembling.h" #include "assembling.h"
static unsigned int calc_error(struct fpi_frame_asmbl_ctx *ctx, static unsigned int calc_error(struct fpi_frame_asmbl_ctx *ctx,
@@ -131,8 +132,8 @@ static unsigned int do_movement_estimation(struct fpi_frame_asmbl_ctx *ctx,
if (reverse) { if (reverse) {
find_overlap(ctx, prev_stripe, cur_stripe, &min_error); find_overlap(ctx, prev_stripe, cur_stripe, &min_error);
prev_stripe->delta_y = -prev_stripe->delta_y; cur_stripe->delta_y = -cur_stripe->delta_y;
prev_stripe->delta_x = -prev_stripe->delta_x; cur_stripe->delta_x = -cur_stripe->delta_x;
} }
else else
find_overlap(ctx, cur_stripe, prev_stripe, &min_error); find_overlap(ctx, cur_stripe, prev_stripe, &min_error);
@@ -279,11 +280,18 @@ struct fp_img *fpi_assemble_frames(struct fpi_frame_asmbl_ctx *ctx,
do { do {
fpi_frame = stripe->data; fpi_frame = stripe->data;
if(reverse) {
y += fpi_frame->delta_y; y += fpi_frame->delta_y;
x += fpi_frame->delta_x; x += fpi_frame->delta_x;
}
aes_blit_stripe(ctx, img, fpi_frame, x, y); aes_blit_stripe(ctx, img, fpi_frame, x, y);
if(!reverse) {
y += fpi_frame->delta_y;
x += fpi_frame->delta_x;
}
stripe = g_slist_next(stripe); stripe = g_slist_next(stripe);
i++; i++;
} while (i < stripes_len); } while (i < stripes_len);
@@ -357,7 +365,10 @@ struct fp_img *fpi_assemble_lines(struct fpi_line_asmbl_ctx *ctx,
unsigned char *output = g_malloc0(ctx->line_width * ctx->max_height); unsigned char *output = g_malloc0(ctx->line_width * ctx->max_height);
struct fp_img *img; struct fp_img *img;
fp_dbg("%llu", g_get_real_time()); g_return_val_if_fail (lines != NULL, NULL);
g_return_val_if_fail (lines_len > 0, NULL);
fp_dbg("%"G_GINT64_FORMAT, g_get_real_time());
row1 = lines; row1 = lines;
for (i = 0; (i < lines_len - 1) && row1; i += 2) { for (i = 0; (i < lines_len - 1) && row1; i += 2) {
@@ -388,7 +399,7 @@ struct fp_img *fpi_assemble_lines(struct fpi_line_asmbl_ctx *ctx,
median_filter(offsets, (lines_len / 2) - 1, ctx->median_filter_size); median_filter(offsets, (lines_len / 2) - 1, ctx->median_filter_size);
fp_dbg("offsets_filtered: %llu", g_get_real_time()); fp_dbg("offsets_filtered: %"G_GINT64_FORMAT, g_get_real_time());
for (i = 0; i <= (lines_len / 2) - 1; i++) for (i = 0; i <= (lines_len / 2) - 1; i++)
fp_dbg("%d", offsets[i]); fp_dbg("%d", offsets[i]);
row1 = lines; row1 = lines;
+1 -1
View File
@@ -22,7 +22,7 @@
#ifndef __ASSEMBLING_H__ #ifndef __ASSEMBLING_H__
#define __ASSEMBLING_H__ #define __ASSEMBLING_H__
#include <fp_internal.h> #include <fprint.h>
struct fpi_frame { struct fpi_frame {
int delta_x; int delta_x;
+159 -42
View File
@@ -19,12 +19,12 @@
#define FP_COMPONENT "async" #define FP_COMPONENT "async"
#include "fp_internal.h"
#include <config.h> #include <config.h>
#include <errno.h> #include <errno.h>
#include <glib.h> #include <glib.h>
#include "fp_internal.h"
/* Drivers call this when device initialisation has completed */ /* Drivers call this when device initialisation has completed */
void fpi_drvcb_open_complete(struct fp_dev *dev, int status) void fpi_drvcb_open_complete(struct fp_dev *dev, int status)
{ {
@@ -36,15 +36,27 @@ void fpi_drvcb_open_complete(struct fp_dev *dev, int status)
dev->open_cb(dev, status, dev->open_cb_data); dev->open_cb(dev, status, dev->open_cb_data);
} }
API_EXPORTED int fp_async_dev_open(struct fp_dscv_dev *ddev, fp_dev_open_cb cb, /**
* fp_async_dev_open:
* @ddev:
* @callback:
* @user_data
*
* Returns:
*/
API_EXPORTED int fp_async_dev_open(struct fp_dscv_dev *ddev, fp_dev_open_cb callback,
void *user_data) void *user_data)
{ {
struct fp_driver *drv = ddev->drv; struct fp_driver *drv;
struct fp_dev *dev; struct fp_dev *dev;
libusb_device_handle *udevh; libusb_device_handle *udevh;
int r; int r;
fp_dbg(""); g_return_val_if_fail(ddev != NULL, -ENODEV);
drv = ddev->drv;
G_DEBUG_HERE();
r = libusb_open(ddev->udev, &udevh); r = libusb_open(ddev->udev, &udevh);
if (r < 0) { if (r < 0) {
fp_err("usb_open failed, error %d", r); fp_err("usb_open failed, error %d", r);
@@ -56,7 +68,7 @@ API_EXPORTED int fp_async_dev_open(struct fp_dscv_dev *ddev, fp_dev_open_cb cb,
dev->udev = udevh; dev->udev = udevh;
dev->__enroll_stage = -1; dev->__enroll_stage = -1;
dev->state = DEV_STATE_INITIALIZING; dev->state = DEV_STATE_INITIALIZING;
dev->open_cb = cb; dev->open_cb = callback;
dev->open_cb_data = user_data; dev->open_cb_data = user_data;
if (!drv->open) { if (!drv->open) {
@@ -78,7 +90,7 @@ API_EXPORTED int fp_async_dev_open(struct fp_dscv_dev *ddev, fp_dev_open_cb cb,
/* Drivers call this when device deinitialisation has completed */ /* Drivers call this when device deinitialisation has completed */
void fpi_drvcb_close_complete(struct fp_dev *dev) void fpi_drvcb_close_complete(struct fp_dev *dev)
{ {
fp_dbg(""); G_DEBUG_HERE();
BUG_ON(dev->state != DEV_STATE_DEINITIALIZING); BUG_ON(dev->state != DEV_STATE_DEINITIALIZING);
dev->state = DEV_STATE_DEINITIALIZED; dev->state = DEV_STATE_DEINITIALIZED;
libusb_close(dev->udev); libusb_close(dev->udev);
@@ -87,10 +99,22 @@ void fpi_drvcb_close_complete(struct fp_dev *dev)
g_free(dev); g_free(dev);
} }
/**
* fp_async_dev_close:
* @dev:
* @callback:
* @user_data
*/
API_EXPORTED void fp_async_dev_close(struct fp_dev *dev, API_EXPORTED void fp_async_dev_close(struct fp_dev *dev,
fp_dev_close_cb callback, void *user_data) fp_operation_stop_cb callback, void *user_data)
{ {
struct fp_driver *drv = dev->drv; struct fp_driver *drv;
g_return_if_fail (dev != NULL);
drv = dev->drv;
g_return_if_fail (drv->close != NULL);
if (g_slist_index(opened_devices, (gconstpointer) dev) == -1) if (g_slist_index(opened_devices, (gconstpointer) dev) == -1)
fp_err("device %p not in opened list!", dev); fp_err("device %p not in opened list!", dev);
@@ -98,12 +122,6 @@ API_EXPORTED void fp_async_dev_close(struct fp_dev *dev,
dev->close_cb = callback; dev->close_cb = callback;
dev->close_cb_data = user_data; dev->close_cb_data = user_data;
if (!drv->close) {
fpi_drvcb_close_complete(dev);
return;
}
dev->state = DEV_STATE_DEINITIALIZING; dev->state = DEV_STATE_DEINITIALIZING;
drv->close(dev); drv->close(dev);
} }
@@ -127,12 +145,24 @@ void fpi_drvcb_enroll_started(struct fp_dev *dev, int status)
} }
} }
/**
* fp_async_enroll_start:
* @dev:
* @callback:
* @user_data:
*
* Returns:
*/
API_EXPORTED int fp_async_enroll_start(struct fp_dev *dev, API_EXPORTED int fp_async_enroll_start(struct fp_dev *dev,
fp_enroll_stage_cb callback, void *user_data) fp_enroll_stage_cb callback, void *user_data)
{ {
struct fp_driver *drv = dev->drv; struct fp_driver *drv;
int r; int r;
g_return_val_if_fail(dev != NULL, -ENODEV);
drv = dev->drv;
if (!dev->nr_enroll_stages || !drv->enroll_start) { if (!dev->nr_enroll_stages || !drv->enroll_start) {
fp_err("driver %s has 0 enroll stages or no enroll func", fp_err("driver %s has 0 enroll stages or no enroll func",
drv->name); drv->name);
@@ -174,20 +204,32 @@ void fpi_drvcb_enroll_stage_completed(struct fp_dev *dev, int result,
/* Drivers call this when enrollment has stopped */ /* Drivers call this when enrollment has stopped */
void fpi_drvcb_enroll_stopped(struct fp_dev *dev) void fpi_drvcb_enroll_stopped(struct fp_dev *dev)
{ {
fp_dbg(""); G_DEBUG_HERE();
BUG_ON(dev->state != DEV_STATE_ENROLL_STOPPING); BUG_ON(dev->state != DEV_STATE_ENROLL_STOPPING);
dev->state = DEV_STATE_INITIALIZED; dev->state = DEV_STATE_INITIALIZED;
if (dev->enroll_stop_cb) if (dev->enroll_stop_cb)
dev->enroll_stop_cb(dev, dev->enroll_stop_cb_data); dev->enroll_stop_cb(dev, dev->enroll_stop_cb_data);
} }
/**
* fp_async_enroll_stop:
* @dev:
* @callback:
* @user_data:
*
* Returns:
*/
API_EXPORTED int fp_async_enroll_stop(struct fp_dev *dev, API_EXPORTED int fp_async_enroll_stop(struct fp_dev *dev,
fp_enroll_stop_cb callback, void *user_data) fp_operation_stop_cb callback, void *user_data)
{ {
struct fp_driver *drv = dev->drv; struct fp_driver *drv;
int r; int r;
fp_dbg(""); g_return_val_if_fail(dev != NULL, -ENODEV);
drv = dev->drv;
G_DEBUG_HERE();
if (!drv->enroll_start) if (!drv->enroll_start)
return -ENOTSUP; return -ENOTSUP;
@@ -210,13 +252,26 @@ API_EXPORTED int fp_async_enroll_stop(struct fp_dev *dev,
return r; return r;
} }
/**
* fp_async_verify_start:
* @dev:
* @data:
* @callback:
* @user_data:
*
* Returns:
*/
API_EXPORTED int fp_async_verify_start(struct fp_dev *dev, API_EXPORTED int fp_async_verify_start(struct fp_dev *dev,
struct fp_print_data *data, fp_verify_cb callback, void *user_data) struct fp_print_data *data, fp_img_operation_cb callback, void *user_data)
{ {
struct fp_driver *drv = dev->drv; struct fp_driver *drv;
int r; int r;
fp_dbg(""); g_return_val_if_fail(dev != NULL, -ENODEV);
drv = dev->drv;
G_DEBUG_HERE();
if (!drv->verify_start) if (!drv->verify_start)
return -ENOTSUP; return -ENOTSUP;
@@ -237,7 +292,7 @@ API_EXPORTED int fp_async_verify_start(struct fp_dev *dev,
/* Drivers call this when verification has started */ /* Drivers call this when verification has started */
void fpi_drvcb_verify_started(struct fp_dev *dev, int status) void fpi_drvcb_verify_started(struct fp_dev *dev, int status)
{ {
fp_dbg(""); G_DEBUG_HERE();
BUG_ON(dev->state != DEV_STATE_VERIFY_STARTING); BUG_ON(dev->state != DEV_STATE_VERIFY_STARTING);
if (status) { if (status) {
if (status > 0) { if (status > 0) {
@@ -271,21 +326,33 @@ void fpi_drvcb_report_verify_result(struct fp_dev *dev, int result,
/* Drivers call this when verification has stopped */ /* Drivers call this when verification has stopped */
void fpi_drvcb_verify_stopped(struct fp_dev *dev) void fpi_drvcb_verify_stopped(struct fp_dev *dev)
{ {
fp_dbg(""); G_DEBUG_HERE();
BUG_ON(dev->state != DEV_STATE_VERIFY_STOPPING); BUG_ON(dev->state != DEV_STATE_VERIFY_STOPPING);
dev->state = DEV_STATE_INITIALIZED; dev->state = DEV_STATE_INITIALIZED;
if (dev->verify_stop_cb) if (dev->verify_stop_cb)
dev->verify_stop_cb(dev, dev->verify_stop_cb_data); dev->verify_stop_cb(dev, dev->verify_stop_cb_data);
} }
/**
* fp_async_verify_stop:
* @dev:
* @callback:
* @user_data:
*
* Returns:
*/
API_EXPORTED int fp_async_verify_stop(struct fp_dev *dev, API_EXPORTED int fp_async_verify_stop(struct fp_dev *dev,
fp_verify_stop_cb callback, void *user_data) fp_operation_stop_cb callback, void *user_data)
{ {
struct fp_driver *drv = dev->drv; struct fp_driver *drv;
gboolean iterating = (dev->state == DEV_STATE_VERIFYING); gboolean iterating = (dev->state == DEV_STATE_VERIFYING);
int r; int r;
fp_dbg(""); g_return_val_if_fail(dev != NULL, -ENODEV);
drv = dev->drv;
G_DEBUG_HERE();
BUG_ON(dev->state != DEV_STATE_ERROR BUG_ON(dev->state != DEV_STATE_ERROR
&& dev->state != DEV_STATE_VERIFYING && dev->state != DEV_STATE_VERIFYING
&& dev->state != DEV_STATE_VERIFY_DONE); && dev->state != DEV_STATE_VERIFY_DONE);
@@ -311,13 +378,26 @@ API_EXPORTED int fp_async_verify_stop(struct fp_dev *dev,
return r; return r;
} }
/**
* fp_async_identify_start:
* @dev:
* @gallery:
* @callback:
* @user_data:
*
* Returns:
*/
API_EXPORTED int fp_async_identify_start(struct fp_dev *dev, API_EXPORTED int fp_async_identify_start(struct fp_dev *dev,
struct fp_print_data **gallery, fp_identify_cb callback, void *user_data) struct fp_print_data **gallery, fp_identify_cb callback, void *user_data)
{ {
struct fp_driver *drv = dev->drv; struct fp_driver *drv;
int r; int r;
fp_dbg(""); g_return_val_if_fail(dev != NULL, -ENODEV);
drv = dev->drv;
G_DEBUG_HERE();
if (!drv->identify_start) if (!drv->identify_start)
return -ENOTSUP; return -ENOTSUP;
dev->state = DEV_STATE_IDENTIFY_STARTING; dev->state = DEV_STATE_IDENTIFY_STARTING;
@@ -369,14 +449,26 @@ void fpi_drvcb_report_identify_result(struct fp_dev *dev, int result,
fp_dbg("ignoring verify result as no callback is subscribed"); fp_dbg("ignoring verify result as no callback is subscribed");
} }
/**
* fp_async_identify_stop:
* @dev:
* @callback:
* @user_data:
*
* Returns:
*/
API_EXPORTED int fp_async_identify_stop(struct fp_dev *dev, API_EXPORTED int fp_async_identify_stop(struct fp_dev *dev,
fp_identify_stop_cb callback, void *user_data) fp_operation_stop_cb callback, void *user_data)
{ {
struct fp_driver *drv = dev->drv; struct fp_driver *drv;
gboolean iterating = (dev->state == DEV_STATE_IDENTIFYING); gboolean iterating = (dev->state == DEV_STATE_IDENTIFYING);
int r; int r;
fp_dbg(""); g_return_val_if_fail(dev != NULL, -ENODEV);
drv = dev->drv;
G_DEBUG_HERE();
BUG_ON(dev->state != DEV_STATE_IDENTIFYING BUG_ON(dev->state != DEV_STATE_IDENTIFYING
&& dev->state != DEV_STATE_IDENTIFY_DONE); && dev->state != DEV_STATE_IDENTIFY_DONE);
@@ -405,20 +497,33 @@ API_EXPORTED int fp_async_identify_stop(struct fp_dev *dev,
/* Drivers call this when identification has stopped */ /* Drivers call this when identification has stopped */
void fpi_drvcb_identify_stopped(struct fp_dev *dev) void fpi_drvcb_identify_stopped(struct fp_dev *dev)
{ {
fp_dbg(""); G_DEBUG_HERE();
BUG_ON(dev->state != DEV_STATE_IDENTIFY_STOPPING); BUG_ON(dev->state != DEV_STATE_IDENTIFY_STOPPING);
dev->state = DEV_STATE_INITIALIZED; dev->state = DEV_STATE_INITIALIZED;
if (dev->identify_stop_cb) if (dev->identify_stop_cb)
dev->identify_stop_cb(dev, dev->identify_stop_cb_data); dev->identify_stop_cb(dev, dev->identify_stop_cb_data);
} }
/**
* fp_async_capture_start:
* @dev:
* @unconditional:
* @callback:
* @user_data:
*
* Returns:
*/
API_EXPORTED int fp_async_capture_start(struct fp_dev *dev, int unconditional, API_EXPORTED int fp_async_capture_start(struct fp_dev *dev, int unconditional,
fp_capture_cb callback, void *user_data) fp_img_operation_cb callback, void *user_data)
{ {
struct fp_driver *drv = dev->drv; struct fp_driver *drv;
int r; int r;
fp_dbg(""); g_return_val_if_fail(dev != NULL, -ENODEV);
drv = dev->drv;
G_DEBUG_HERE();
if (!drv->capture_start) if (!drv->capture_start)
return -ENOTSUP; return -ENOTSUP;
@@ -439,7 +544,7 @@ API_EXPORTED int fp_async_capture_start(struct fp_dev *dev, int unconditional,
/* Drivers call this when capture has started */ /* Drivers call this when capture has started */
void fpi_drvcb_capture_started(struct fp_dev *dev, int status) void fpi_drvcb_capture_started(struct fp_dev *dev, int status)
{ {
fp_dbg(""); G_DEBUG_HERE();
BUG_ON(dev->state != DEV_STATE_CAPTURE_STARTING); BUG_ON(dev->state != DEV_STATE_CAPTURE_STARTING);
if (status) { if (status) {
if (status > 0) { if (status > 0) {
@@ -472,20 +577,32 @@ void fpi_drvcb_report_capture_result(struct fp_dev *dev, int result,
/* Drivers call this when capture has stopped */ /* Drivers call this when capture has stopped */
void fpi_drvcb_capture_stopped(struct fp_dev *dev) void fpi_drvcb_capture_stopped(struct fp_dev *dev)
{ {
fp_dbg(""); G_DEBUG_HERE();
BUG_ON(dev->state != DEV_STATE_CAPTURE_STOPPING); BUG_ON(dev->state != DEV_STATE_CAPTURE_STOPPING);
dev->state = DEV_STATE_INITIALIZED; dev->state = DEV_STATE_INITIALIZED;
if (dev->capture_stop_cb) if (dev->capture_stop_cb)
dev->capture_stop_cb(dev, dev->capture_stop_cb_data); dev->capture_stop_cb(dev, dev->capture_stop_cb_data);
} }
/**
* fp_async_capture_stop:
* @dev:
* @callback:
* @user_data:
*
* Returns:
*/
API_EXPORTED int fp_async_capture_stop(struct fp_dev *dev, API_EXPORTED int fp_async_capture_stop(struct fp_dev *dev,
fp_capture_stop_cb callback, void *user_data) fp_operation_stop_cb callback, void *user_data)
{ {
struct fp_driver *drv = dev->drv; struct fp_driver *drv;
int r; int r;
fp_dbg(""); g_return_val_if_fail(dev != NULL, -ENODEV);
drv = dev->drv;
G_DEBUG_HERE();
BUG_ON(dev->state != DEV_STATE_ERROR BUG_ON(dev->state != DEV_STATE_ERROR
&& dev->state != DEV_STATE_CAPTURING && dev->state != DEV_STATE_CAPTURING
&& dev->state != DEV_STATE_CAPTURE_DONE); && dev->state != DEV_STATE_CAPTURE_DONE);
+302 -477
View File
File diff suppressed because it is too large Load Diff
+132 -69
View File
@@ -32,8 +32,11 @@
#define DIR_PERMS 0700 #define DIR_PERMS 0700
/** @defgroup print_data Stored prints /**
* Stored prints are represented by a structure named <tt>fp_print_data</tt>. * SECTION: print_data
* @title: Stored prints
*
* Stored prints are represented by a structure named #fp_print_data.
* Stored prints are originally obtained from an enrollment function such as * Stored prints are originally obtained from an enrollment function such as
* fp_enroll_finger(). * fp_enroll_finger().
* *
@@ -73,7 +76,6 @@ void fpi_data_exit(void)
((finger) >= LEFT_THUMB && (finger) <= RIGHT_LITTLE) ((finger) >= LEFT_THUMB && (finger) <= RIGHT_LITTLE)
/* for debug messages only */ /* for debug messages only */
#ifdef ENABLE_DEBUG_LOGGING
static const char *finger_num_to_str(enum fp_finger finger) static const char *finger_num_to_str(enum fp_finger finger)
{ {
const char *names[] = { const char *names[] = {
@@ -92,7 +94,6 @@ static const char *finger_num_to_str(enum fp_finger finger)
return "UNKNOWN"; return "UNKNOWN";
return names[finger]; return names[finger];
} }
#endif
static struct fp_print_data *print_data_new(uint16_t driver_id, static struct fp_print_data *print_data_new(uint16_t driver_id,
uint32_t devtype, enum fp_print_data_type type) uint32_t devtype, enum fp_print_data_type type)
@@ -112,7 +113,7 @@ void fpi_print_data_item_free(struct fp_print_data_item *item)
struct fp_print_data_item *fpi_print_data_item_new(size_t length) struct fp_print_data_item *fpi_print_data_item_new(size_t length)
{ {
struct fp_print_data_item *item = g_malloc(sizeof(*item) + length); struct fp_print_data_item *item = g_malloc0(sizeof(*item) + length);
item->length = length; item->length = length;
return item; return item;
@@ -124,14 +125,17 @@ struct fp_print_data *fpi_print_data_new(struct fp_dev *dev)
fpi_driver_get_data_type(dev->drv)); fpi_driver_get_data_type(dev->drv));
} }
/** \ingroup print_data /**
* fp_print_data_get_data:
* @data: the stored print
* @ret: output location for the data buffer. Must be freed with free()
* after use.
* Convert a stored print into a unified representation inside a data buffer. * Convert a stored print into a unified representation inside a data buffer.
* You can then store this data buffer in any way that suits you, and load * You can then store this data buffer in any way that suits you, and load
* it back at some later time using fp_print_data_from_data(). * it back at some later time using fp_print_data_from_data().
* \param data the stored print *
* \param ret output location for the data buffer. Must be freed with free() * Returns: the size of the freshly allocated buffer, or 0 on error.
* after use.
* \returns the size of the freshly allocated buffer, or 0 on error.
*/ */
API_EXPORTED size_t fp_print_data_get_data(struct fp_print_data *data, API_EXPORTED size_t fp_print_data_get_data(struct fp_print_data *data,
unsigned char **ret) unsigned char **ret)
@@ -143,7 +147,7 @@ API_EXPORTED size_t fp_print_data_get_data(struct fp_print_data *data,
GSList *list_item; GSList *list_item;
unsigned char *buf; unsigned char *buf;
fp_dbg(""); G_DEBUG_HERE();
list_item = data->prints; list_item = data->prints;
while (list_item) { while (list_item) {
@@ -220,7 +224,7 @@ static struct fp_print_data *fpi_print_data_from_fp2_data(unsigned char *buf,
raw_item = (struct fpi_print_data_item_fp2 *)raw_buf; raw_item = (struct fpi_print_data_item_fp2 *)raw_buf;
item_len = GUINT32_FROM_LE(raw_item->length); item_len = GUINT32_FROM_LE(raw_item->length);
fp_dbg("item len %d, total_data_len %d", item_len, total_data_len); fp_dbg("item len %d, total_data_len %d", (int) item_len, (int) total_data_len);
if (total_data_len < item_len) { if (total_data_len < item_len) {
fp_err("corrupted fingerprint data"); fp_err("corrupted fingerprint data");
break; break;
@@ -245,13 +249,16 @@ static struct fp_print_data *fpi_print_data_from_fp2_data(unsigned char *buf,
} }
/** \ingroup print_data /**
* fp_print_data_from_data:
* @buf: the data buffer
* @buflen: the length of the buffer
* Load a stored print from a data buffer. The contents of said buffer must * Load a stored print from a data buffer. The contents of said buffer must
* be the untouched contents of a buffer previously supplied to you by the * be the untouched contents of a buffer previously supplied to you by the
* fp_print_data_get_data() function. * fp_print_data_get_data() function.
* \param buf the data buffer *
* \param buflen the length of the buffer * Returns: the stored print represented by the data, or %NULL on error. Must
* \returns the stored print represented by the data, or NULL on error. Must
* be freed with fp_print_data_free() after use. * be freed with fp_print_data_free() after use.
*/ */
API_EXPORTED struct fp_print_data *fp_print_data_from_data(unsigned char *buf, API_EXPORTED struct fp_print_data *fp_print_data_from_data(unsigned char *buf,
@@ -305,7 +312,11 @@ static char *get_path_to_print(struct fp_dev *dev, enum fp_finger finger)
return __get_path_to_print(dev->drv->id, dev->devtype, finger); return __get_path_to_print(dev->drv->id, dev->devtype, finger);
} }
/** \ingroup print_data /**
* fp_print_data_save:
* @data: the stored print to save to disk
* @finger: the finger that this print corresponds to
*
* Saves a stored print to disk, assigned to a specific finger. Even though * Saves a stored print to disk, assigned to a specific finger. Even though
* you are limited to storing only the 10 human fingers, this is a * you are limited to storing only the 10 human fingers, this is a
* per-device-type limit. For example, you can store the users right index * per-device-type limit. For example, you can store the users right index
@@ -316,9 +327,8 @@ static char *get_path_to_print(struct fp_dev *dev, enum fp_finger finger)
* This function will unconditionally overwrite a fingerprint previously * This function will unconditionally overwrite a fingerprint previously
* saved for the same finger and device type. The print is saved in a hidden * saved for the same finger and device type. The print is saved in a hidden
* directory beneath the current user's home directory. * directory beneath the current user's home directory.
* \param data the stored print to save to disk *
* \param finger the finger that this print corresponds to * Returns: 0 on success, non-zero on error.
* \returns 0 on success, non-zero on error.
*/ */
API_EXPORTED int fp_print_data_save(struct fp_print_data *data, API_EXPORTED int fp_print_data_save(struct fp_print_data *data,
enum fp_finger finger) enum fp_finger finger)
@@ -415,7 +425,13 @@ static int load_from_file(char *path, struct fp_print_data **data)
return 0; return 0;
} }
/** \ingroup print_data /**
* fp_print_data_load:
* @dev: the device you are loading the print for
* @finger: the finger of the file you are loading
* @data: output location to put the corresponding stored print. Must be
* freed with fp_print_data_free() after use.
* Loads a previously stored print from disk. The print must have been saved * Loads a previously stored print from disk. The print must have been saved
* earlier using the fp_print_data_save() function. * earlier using the fp_print_data_save() function.
* *
@@ -423,11 +439,7 @@ static int load_from_file(char *path, struct fp_print_data **data)
* be found. Other error codes (both positive and negative) are possible for * be found. Other error codes (both positive and negative) are possible for
* obscure error conditions (e.g. corruption). * obscure error conditions (e.g. corruption).
* *
* \param dev the device you are loading the print for * Returns: 0 on success, non-zero on error
* \param finger the finger of the file you are loading
* \param data output location to put the corresponding stored print. Must be
* freed with fp_print_data_free() after use.
* \returns 0 on success, non-zero on error
*/ */
API_EXPORTED int fp_print_data_load(struct fp_dev *dev, API_EXPORTED int fp_print_data_load(struct fp_dev *dev,
enum fp_finger finger, struct fp_print_data **data) enum fp_finger finger, struct fp_print_data **data)
@@ -455,11 +467,14 @@ API_EXPORTED int fp_print_data_load(struct fp_dev *dev,
return 0; return 0;
} }
/** \ingroup print_data /**
* fp_print_data_delete:
* @dev: the device that the print belongs to
* @finger: the finger of the file you are deleting
* Removes a stored print from disk previously saved with fp_print_data_save(). * Removes a stored print from disk previously saved with fp_print_data_save().
* \param dev the device that the print belongs to *
* \param finger the finger of the file you are deleting * Returns: 0 on success, negative on error
* \returns 0 on success, negative on error
*/ */
API_EXPORTED int fp_print_data_delete(struct fp_dev *dev, API_EXPORTED int fp_print_data_delete(struct fp_dev *dev,
enum fp_finger finger) enum fp_finger finger)
@@ -477,18 +492,22 @@ API_EXPORTED int fp_print_data_delete(struct fp_dev *dev,
return r; return r;
} }
/** \ingroup print_data /**
* Attempts to load a stored print based on a \ref dscv_print * fp_print_data_from_dscv_print:
* "discovered print" record. * @print: the discovered print
* @data: output location to point to the corresponding stored print. Must
* be freed with fp_print_data_free() after use.
* Attempts to load a stored print based on a #fp_dscv_print
* discovered print record.
* *
* A return code of -ENOENT indicates that the file referred to by the * A return code of -ENOENT indicates that the file referred to by the
* discovered print could not be found. Other error codes (both positive and * discovered print could not be found. Other error codes (both positive and
* negative) are possible for obscure error conditions (e.g. corruption). * negative) are possible for obscure error conditions (e.g. corruption).
* *
* \param print the discovered print * Returns: 0 on success, non-zero on error.
* \param data output location to point to the corresponding stored print. Must *
* be freed with fp_print_data_free() after use. * Deprecated: Do not use.
* \returns 0 on success, non-zero on error.
*/ */
API_EXPORTED int fp_print_data_from_dscv_print(struct fp_dscv_print *print, API_EXPORTED int fp_print_data_from_dscv_print(struct fp_dscv_print *print,
struct fp_print_data **data) struct fp_print_data **data)
@@ -496,9 +515,11 @@ API_EXPORTED int fp_print_data_from_dscv_print(struct fp_dscv_print *print,
return load_from_file(print->path, data); return load_from_file(print->path, data);
} }
/** \ingroup print_data /**
* fp_print_data_free:
* @data: the stored print to destroy. If NULL, function simply returns.
*
* Frees a stored print. Must be called when you are finished using the print. * Frees a stored print. Must be called when you are finished using the print.
* \param data the stored print to destroy. If NULL, function simply returns.
*/ */
API_EXPORTED void fp_print_data_free(struct fp_print_data *data) API_EXPORTED void fp_print_data_free(struct fp_print_data *data)
{ {
@@ -507,31 +528,40 @@ API_EXPORTED void fp_print_data_free(struct fp_print_data *data)
g_free(data); g_free(data);
} }
/** \ingroup print_data /**
* Gets the \ref driver_id "driver ID" for a stored print. The driver ID * fp_print_data_get_driver_id:
* @data: the stored print
* Gets the [driver ID](advanced-topics.html#driver_id) for a stored print. The driver ID
* indicates which driver the print originally came from. The print is * indicates which driver the print originally came from. The print is
* only usable with a device controlled by that driver. * only usable with a device controlled by that driver.
* \param data the stored print *
* \returns the driver ID of the driver compatible with the print * Returns: the driver ID of the driver compatible with the print
*/ */
API_EXPORTED uint16_t fp_print_data_get_driver_id(struct fp_print_data *data) API_EXPORTED uint16_t fp_print_data_get_driver_id(struct fp_print_data *data)
{ {
return data->driver_id; return data->driver_id;
} }
/** \ingroup print_data /**
* Gets the \ref devtype "devtype" for a stored print. The devtype represents * fp_print_data_get_devtype:
* @data: the stored print
* Gets the [devtype](advanced-topics.html#device-types) for a stored print. The devtype represents
* which type of device under the parent driver is compatible with the print. * which type of device under the parent driver is compatible with the print.
* \param data the stored print *
* \returns the devtype of the device range compatible with the print * Returns: the devtype of the device range compatible with the print
*/ */
API_EXPORTED uint32_t fp_print_data_get_devtype(struct fp_print_data *data) API_EXPORTED uint32_t fp_print_data_get_devtype(struct fp_print_data *data)
{ {
return data->devtype; return data->devtype;
} }
/** @defgroup dscv_print Print discovery /**
* The \ref print_data "stored print" documentation detailed a simple API * SECTION:dscv_print
* @title: Print discovery (deprecated)
*
* The [stored print](libfprint-Stored-prints.html) documentation detailed a simple API
* for storing per-device prints for a single user, namely * for storing per-device prints for a single user, namely
* fp_print_data_save(). It also detailed a load function, * fp_print_data_save(). It also detailed a load function,
* fp_print_data_load(), but usage of this function is limited to scenarios * fp_print_data_load(), but usage of this function is limited to scenarios
@@ -542,7 +572,7 @@ API_EXPORTED uint32_t fp_print_data_get_devtype(struct fp_print_data *data)
* previously saved prints, potentially even before device discovery. These * previously saved prints, potentially even before device discovery. These
* functions are designed to offer this functionality to you. * functions are designed to offer this functionality to you.
* *
* Discovered prints are stored in a <tt>dscv_print</tt> structure, and you * Discovered prints are stored in a #fp_dscv_print structure, and you
* can use functions documented below to access some information about these * can use functions documented below to access some information about these
* prints. You can determine if a discovered print appears to be compatible * prints. You can determine if a discovered print appears to be compatible
* with a device using functions such as fp_dscv_dev_supports_dscv_print() and * with a device using functions such as fp_dscv_dev_supports_dscv_print() and
@@ -560,6 +590,10 @@ API_EXPORTED uint32_t fp_print_data_get_devtype(struct fp_print_data *data)
* circumstances it may turn out that the print is corrupt or not for the * circumstances it may turn out that the print is corrupt or not for the
* device that it appeared to be. Also, it is possible that the print may have * device that it appeared to be. Also, it is possible that the print may have
* been deleted by the time you come to load it. * been deleted by the time you come to load it.
*
* Note that this portion of the library is deprecated. All that it offers is
* already implementable using publicly available functions, and its usage is
* unnecessarily restrictive in terms of how it stores data.
*/ */
static GSList *scan_dev_store_dir(char *devpath, uint16_t driver_id, static GSList *scan_dev_store_dir(char *devpath, uint16_t driver_id,
@@ -643,11 +677,16 @@ static GSList *scan_driver_store_dir(char *drvpath, uint16_t driver_id,
return list; return list;
} }
/** \ingroup dscv_print /**
* fp_discover_prints:
*
* Scans the users home directory and returns a list of prints that were * Scans the users home directory and returns a list of prints that were
* previously saved using fp_print_data_save(). * previously saved using fp_print_data_save().
* \returns a NULL-terminated list of discovered prints, must be freed with *
* Returns: a %NULL-terminated list of discovered prints, must be freed with
* fp_dscv_prints_free() after use. * fp_dscv_prints_free() after use.
*
* Deprecated: Do not use.
*/ */
API_EXPORTED struct fp_dscv_print **fp_discover_prints(void) API_EXPORTED struct fp_dscv_print **fp_discover_prints(void)
{ {
@@ -704,12 +743,16 @@ API_EXPORTED struct fp_dscv_print **fp_discover_prints(void)
return list; return list;
} }
/** \ingroup dscv_print /**
* fp_dscv_prints_free:
* @prints: the list of discovered prints. If NULL, function simply
* returns.
*
* Frees a list of discovered prints. This function also frees the discovered * Frees a list of discovered prints. This function also frees the discovered
* prints themselves, so make sure you do not use any discovered prints * prints themselves, so make sure you do not use any discovered prints
* after calling this function. * after calling this function.
* \param prints the list of discovered prints. If NULL, function simply *
* returns. * Deprecated: Do not use.
*/ */
API_EXPORTED void fp_dscv_prints_free(struct fp_dscv_print **prints) API_EXPORTED void fp_dscv_prints_free(struct fp_dscv_print **prints)
{ {
@@ -727,47 +770,67 @@ API_EXPORTED void fp_dscv_prints_free(struct fp_dscv_print **prints)
g_free(prints); g_free(prints);
} }
/** \ingroup dscv_print /**
* Gets the \ref driver_id "driver ID" for a discovered print. The driver ID * fp_dscv_print_get_driver_id:
* @print: the discovered print
*
* Gets the [driver ID](advanced-topics.html#driver_id) for a discovered print. The driver ID
* indicates which driver the print originally came from. The print is only * indicates which driver the print originally came from. The print is only
* usable with a device controlled by that driver. * usable with a device controlled by that driver.
* \param print the discovered print *
* \returns the driver ID of the driver compatible with the print * Returns: the driver ID of the driver compatible with the print
*
* Deprecated: Do not use.
*/ */
API_EXPORTED uint16_t fp_dscv_print_get_driver_id(struct fp_dscv_print *print) API_EXPORTED uint16_t fp_dscv_print_get_driver_id(struct fp_dscv_print *print)
{ {
return print->driver_id; return print->driver_id;
} }
/** \ingroup dscv_print /**
* Gets the \ref devtype "devtype" for a discovered print. The devtype * fp_dscv_print_get_devtype:
* @print: the discovered print
*
* Gets the [devtype](advanced-topics.html#device-types) for a discovered print. The devtype
* represents which type of device under the parent driver is compatible * represents which type of device under the parent driver is compatible
* with the print. * with the print.
* \param print the discovered print *
* \returns the devtype of the device range compatible with the print * Returns: the devtype of the device range compatible with the print
*
* Deprecated: Do not use.
*/ */
API_EXPORTED uint32_t fp_dscv_print_get_devtype(struct fp_dscv_print *print) API_EXPORTED uint32_t fp_dscv_print_get_devtype(struct fp_dscv_print *print)
{ {
return print->devtype; return print->devtype;
} }
/** \ingroup dscv_print /**
* fp_dscv_print_get_finger:
* @print: discovered print
*
* Gets the finger code for a discovered print. * Gets the finger code for a discovered print.
* \param print discovered print *
* \returns a finger code from #fp_finger * Returns: a finger code from #fp_finger
*
* Deprecated: Do not use.
*/ */
API_EXPORTED enum fp_finger fp_dscv_print_get_finger(struct fp_dscv_print *print) API_EXPORTED enum fp_finger fp_dscv_print_get_finger(struct fp_dscv_print *print)
{ {
return print->finger; return print->finger;
} }
/** \ingroup dscv_print /**
* fp_dscv_print_delete:
* @print: the discovered print to remove from disk
*
* Removes a discovered print from disk. After successful return of this * Removes a discovered print from disk. After successful return of this
* function, functions such as fp_dscv_print_get_finger() will continue to * function, functions such as fp_dscv_print_get_finger() will continue to
* operate as before, however calling fp_print_data_from_dscv_print() will * operate as before, however calling fp_print_data_from_dscv_print() will
* fail for obvious reasons. * fail for obvious reasons.
* \param print the discovered print to remove from disk *
* \returns 0 on success, negative on error * Returns: 0 on success, negative on error
*
* Deprecated: Do not use.
*/ */
API_EXPORTED int fp_dscv_print_delete(struct fp_dscv_print *print) API_EXPORTED int fp_dscv_print_delete(struct fp_dscv_print *print)
{ {
+44 -45
View File
@@ -25,16 +25,8 @@
#define FP_COMPONENT "aes1610" #define FP_COMPONENT "aes1610"
#include <errno.h> #include "drivers_api.h"
#include <string.h> #include "aeslib.h"
#include <libusb.h>
#include <assembling.h>
#include <aeslib.h>
#include <fp_internal.h>
#include "driver_ids.h"
static void start_capture(struct fp_img_dev *dev); static void start_capture(struct fp_img_dev *dev);
static void complete_deactivation(struct fp_img_dev *dev); static void complete_deactivation(struct fp_img_dev *dev);
@@ -138,6 +130,7 @@ static void generic_read_ignore_data(struct fpi_ssm *ssm, size_t bytes)
{ {
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
unsigned char *data; unsigned char *data;
struct fp_dev *dev;
int r; int r;
if (!transfer) { if (!transfer) {
@@ -146,7 +139,8 @@ static void generic_read_ignore_data(struct fpi_ssm *ssm, size_t bytes)
} }
data = g_malloc(bytes); data = g_malloc(bytes);
libusb_fill_bulk_transfer(transfer, ssm->dev->udev, EP_IN, data, bytes, dev = fpi_ssm_get_dev(ssm);
libusb_fill_bulk_transfer(transfer, fpi_dev_get_usb_dev(dev), EP_IN, data, bytes,
generic_ignore_data_cb, ssm, BULK_TIMEOUT); generic_ignore_data_cb, ssm, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@@ -239,7 +233,7 @@ static void finger_det_reqs_cb(struct fp_img_dev *dev, int result, void *user_da
} }
data = g_malloc(19); data = g_malloc(19);
libusb_fill_bulk_transfer(transfer, dev->udev, EP_IN, data, 19, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_IN, data, 19,
finger_det_data_cb, dev, BULK_TIMEOUT); finger_det_data_cb, dev, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@@ -253,7 +247,7 @@ static void finger_det_reqs_cb(struct fp_img_dev *dev, int result, void *user_da
static void start_finger_detection(struct fp_img_dev *dev) static void start_finger_detection(struct fp_img_dev *dev)
{ {
struct aes1610_dev *aesdev = dev->priv; struct aes1610_dev *aesdev = fpi_imgdev_get_user_data(dev);
if (aesdev->deactivating) { if (aesdev->deactivating) {
complete_deactivation(dev); complete_deactivation(dev);
@@ -564,8 +558,8 @@ static void capture_read_strip_cb(struct libusb_transfer *transfer)
{ {
unsigned char *stripdata; unsigned char *stripdata;
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes1610_dev *aesdev = dev->priv; struct aes1610_dev *aesdev = fpi_imgdev_get_user_data(dev);
unsigned char *data = transfer->buffer; unsigned char *data = transfer->buffer;
int sum, i; int sum, i;
@@ -651,11 +645,11 @@ out:
static void capture_run_state(struct fpi_ssm *ssm) static void capture_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes1610_dev *aesdev = dev->priv; struct aes1610_dev *aesdev = fpi_imgdev_get_user_data(dev);
int r; int r;
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case CAPTURE_WRITE_REQS: case CAPTURE_WRITE_REQS:
fp_dbg("write reqs"); fp_dbg("write reqs");
aes_write_regv(dev, capture_reqs, G_N_ELEMENTS(capture_reqs), aes_write_regv(dev, capture_reqs, G_N_ELEMENTS(capture_reqs),
@@ -683,7 +677,7 @@ static void capture_run_state(struct fpi_ssm *ssm)
} }
data = g_malloc(665); data = g_malloc(665);
libusb_fill_bulk_transfer(transfer, dev->udev, EP_IN, data, 665, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_IN, data, 665,
capture_read_strip_cb, ssm, BULK_TIMEOUT); capture_read_strip_cb, ssm, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@@ -698,14 +692,14 @@ static void capture_run_state(struct fpi_ssm *ssm)
static void capture_sm_complete(struct fpi_ssm *ssm) static void capture_sm_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes1610_dev *aesdev = dev->priv; struct aes1610_dev *aesdev = fpi_imgdev_get_user_data(dev);
fp_dbg(""); G_DEBUG_HERE();
if (aesdev->deactivating) if (aesdev->deactivating)
complete_deactivation(dev); complete_deactivation(dev);
else if (ssm->error) else if (fpi_ssm_get_error(ssm))
fpi_imgdev_session_error(dev, ssm->error); fpi_imgdev_session_error(dev, fpi_ssm_get_error(ssm));
else else
start_finger_detection(dev); start_finger_detection(dev);
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
@@ -713,7 +707,7 @@ static void capture_sm_complete(struct fpi_ssm *ssm)
static void start_capture(struct fp_img_dev *dev) static void start_capture(struct fp_img_dev *dev)
{ {
struct aes1610_dev *aesdev = dev->priv; struct aes1610_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *ssm; struct fpi_ssm *ssm;
if (aesdev->deactivating) { if (aesdev->deactivating) {
@@ -721,9 +715,9 @@ static void start_capture(struct fp_img_dev *dev)
return; return;
} }
ssm = fpi_ssm_new(dev->dev, capture_run_state, CAPTURE_NUM_STATES); ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), capture_run_state, CAPTURE_NUM_STATES);
fp_dbg(""); G_DEBUG_HERE();
ssm->priv = dev; fpi_ssm_set_user_data(ssm, dev);
fpi_ssm_start(ssm, capture_sm_complete); fpi_ssm_start(ssm, capture_sm_complete);
} }
@@ -733,10 +727,11 @@ static const struct aes_regwrite init[] = {
{ 0x82, 0x00 } { 0x82, 0x00 }
}; };
/*
static const struct aes_regwrite stop_reader[] = { static const struct aes_regwrite stop_reader[] = {
{ 0xFF, 0x00 } { 0xFF, 0x00 }
}; };
*/
enum activate_states { enum activate_states {
WRITE_INIT, WRITE_INIT,
@@ -745,11 +740,11 @@ enum activate_states {
static void activate_run_state(struct fpi_ssm *ssm) static void activate_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
/* activation on aes1610 seems much more straightforward compared to aes2501 */ /* activation on aes1610 seems much more straightforward compared to aes2501 */
/* verify theres anything missing here */ /* verify theres anything missing here */
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case WRITE_INIT: case WRITE_INIT:
fp_dbg("write init"); fp_dbg("write init");
aes_write_regv(dev, init, G_N_ELEMENTS(init), generic_write_regv_cb, ssm); aes_write_regv(dev, init, G_N_ELEMENTS(init), generic_write_regv_cb, ssm);
@@ -760,21 +755,21 @@ static void activate_run_state(struct fpi_ssm *ssm)
/* jump to finger detection */ /* jump to finger detection */
static void activate_sm_complete(struct fpi_ssm *ssm) static void activate_sm_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
fp_dbg("status %d", ssm->error); fp_dbg("status %d", fpi_ssm_get_error(ssm));
fpi_imgdev_activate_complete(dev, ssm->error); fpi_imgdev_activate_complete(dev, fpi_ssm_get_error(ssm));
if (!ssm->error) if (!fpi_ssm_get_error(ssm))
start_finger_detection(dev); start_finger_detection(dev);
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
} }
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state) static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{ {
struct aes1610_dev *aesdev = dev->priv; struct aes1610_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *ssm = fpi_ssm_new(dev->dev, activate_run_state, struct fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_run_state,
ACTIVATE_NUM_STATES); ACTIVATE_NUM_STATES);
ssm->priv = dev; fpi_ssm_set_user_data(ssm, dev);
aesdev->read_regs_retry_count = 0; aesdev->read_regs_retry_count = 0;
fpi_ssm_start(ssm, activate_sm_complete); fpi_ssm_start(ssm, activate_sm_complete);
return 0; return 0;
@@ -782,7 +777,7 @@ static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
static void dev_deactivate(struct fp_img_dev *dev) static void dev_deactivate(struct fp_img_dev *dev)
{ {
struct aes1610_dev *aesdev = dev->priv; struct aes1610_dev *aesdev = fpi_imgdev_get_user_data(dev);
/* FIXME: audit cancellation points, probably need more, specifically /* FIXME: audit cancellation points, probably need more, specifically
* in error handling paths? */ * in error handling paths? */
aesdev->deactivating = TRUE; aesdev->deactivating = TRUE;
@@ -790,8 +785,8 @@ static void dev_deactivate(struct fp_img_dev *dev)
static void complete_deactivation(struct fp_img_dev *dev) static void complete_deactivation(struct fp_img_dev *dev)
{ {
struct aes1610_dev *aesdev = dev->priv; struct aes1610_dev *aesdev = fpi_imgdev_get_user_data(dev);
fp_dbg(""); G_DEBUG_HERE();
/* FIXME: if we're in the middle of a scan, we should cancel the scan. /* FIXME: if we're in the middle of a scan, we should cancel the scan.
* maybe we can do this with a master reset, unconditionally? */ * maybe we can do this with a master reset, unconditionally? */
@@ -808,22 +803,26 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
{ {
/* FIXME check endpoints */ /* FIXME check endpoints */
int r; int r;
struct aes1610_dev *aesdev;
r = libusb_claim_interface(dev->udev, 0); r = libusb_claim_interface(fpi_imgdev_get_usb_dev(dev), 0);
if (r < 0) { if (r < 0) {
fp_err("could not claim interface 0: %s", libusb_error_name(r)); fp_err("could not claim interface 0: %s", libusb_error_name(r));
return r; return r;
} }
dev->priv = g_malloc0(sizeof(struct aes1610_dev)); aesdev = g_malloc0(sizeof(struct aes1610_dev));
fpi_imgdev_set_user_data(dev, aesdev);
fpi_imgdev_open_complete(dev, 0); fpi_imgdev_open_complete(dev, 0);
return 0; return 0;
} }
static void dev_deinit(struct fp_img_dev *dev) static void dev_deinit(struct fp_img_dev *dev)
{ {
g_free(dev->priv); struct aes1610_dev *aesdev;
libusb_release_interface(dev->udev, 0); aesdev = fpi_imgdev_get_user_data(dev);
g_free(aesdev);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);
} }
+9 -19
View File
@@ -19,21 +19,10 @@
#define FP_COMPONENT "aes1660" #define FP_COMPONENT "aes1660"
#include <stdio.h> #include "drivers_api.h"
#include "aeslib.h"
#include <errno.h>
#include <string.h>
#include <libusb.h>
#include <fp_internal.h>
#include <assembling.h>
#include <aeslib.h>
#include "aesx660.h" #include "aesx660.h"
#include "aes1660.h" #include "aes1660.h"
#include "driver_ids.h"
#define FRAME_WIDTH 128 #define FRAME_WIDTH 128
#define IMAGE_WIDTH (FRAME_WIDTH + (FRAME_WIDTH / 2)) #define IMAGE_WIDTH (FRAME_WIDTH + (FRAME_WIDTH / 2))
@@ -51,18 +40,19 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
int r; int r;
struct aesX660_dev *aesdev; struct aesX660_dev *aesdev;
r = libusb_claim_interface(dev->udev, 0); r = libusb_claim_interface(fpi_imgdev_get_usb_dev(dev), 0);
if (r < 0) { if (r < 0) {
fp_err("could not claim interface 0: %s", libusb_error_name(r)); fp_err("could not claim interface 0: %s", libusb_error_name(r));
return r; return r;
} }
dev->priv = aesdev = g_malloc0(sizeof(struct aesX660_dev)); aesdev = g_malloc0(sizeof(struct aesX660_dev));
fpi_imgdev_set_user_data(dev, aesdev);
aesdev->buffer = g_malloc0(AES1660_FRAME_SIZE + AESX660_HEADER_SIZE); aesdev->buffer = g_malloc0(AES1660_FRAME_SIZE + AESX660_HEADER_SIZE);
aesdev->init_seqs[0] = aes1660_init_1; aesdev->init_seqs[0] = aes1660_init_1;
aesdev->init_seqs_len[0] = array_n_elements(aes1660_init_1); aesdev->init_seqs_len[0] = G_N_ELEMENTS(aes1660_init_1);
aesdev->init_seqs[1] = aes1660_init_2; aesdev->init_seqs[1] = aes1660_init_2;
aesdev->init_seqs_len[1] = array_n_elements(aes1660_init_2); aesdev->init_seqs_len[1] = G_N_ELEMENTS(aes1660_init_2);
aesdev->start_imaging_cmd = (unsigned char *)aes1660_start_imaging_cmd; aesdev->start_imaging_cmd = (unsigned char *)aes1660_start_imaging_cmd;
aesdev->start_imaging_cmd_len = sizeof(aes1660_start_imaging_cmd); aesdev->start_imaging_cmd_len = sizeof(aes1660_start_imaging_cmd);
aesdev->assembling_ctx = &assembling_ctx; aesdev->assembling_ctx = &assembling_ctx;
@@ -74,10 +64,10 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
static void dev_deinit(struct fp_img_dev *dev) static void dev_deinit(struct fp_img_dev *dev)
{ {
struct aesX660_dev *aesdev = dev->priv; struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
g_free(aesdev->buffer); g_free(aesdev->buffer);
g_free(aesdev); g_free(aesdev);
libusb_release_interface(dev->udev, 0); libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);
} }
+45 -49
View File
@@ -23,17 +23,9 @@
#define FP_COMPONENT "aes2501" #define FP_COMPONENT "aes2501"
#include <errno.h> #include "drivers_api.h"
#include <string.h> #include "aeslib.h"
#include <libusb.h>
#include <assembling.h>
#include <aeslib.h>
#include <fp_internal.h>
#include "aes2501.h" #include "aes2501.h"
#include "driver_ids.h"
static void start_capture(struct fp_img_dev *dev); static void start_capture(struct fp_img_dev *dev);
static void complete_deactivation(struct fp_img_dev *dev); static void complete_deactivation(struct fp_img_dev *dev);
@@ -130,7 +122,7 @@ static void read_regs_rq_cb(struct fp_img_dev *dev, int result, void *user_data)
} }
data = g_malloc(126); data = g_malloc(126);
libusb_fill_bulk_transfer(transfer, dev->udev, EP_IN, data, 126, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_IN, data, 126,
read_regs_data_cb, rdata, BULK_TIMEOUT); read_regs_data_cb, rdata, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@@ -155,7 +147,7 @@ static void read_regs(struct fp_img_dev *dev, aes2501_read_regs_cb callback,
struct aes_regwrite *regwrite = g_malloc(sizeof(*regwrite)); struct aes_regwrite *regwrite = g_malloc(sizeof(*regwrite));
struct aes2501_read_regs *rdata = g_malloc(sizeof(*rdata)); struct aes2501_read_regs *rdata = g_malloc(sizeof(*rdata));
fp_dbg(""); G_DEBUG_HERE();
regwrite->reg = AES2501_REG_CTRL2; regwrite->reg = AES2501_REG_CTRL2;
regwrite->value = AES2501_CTRL2_READ_REGS; regwrite->value = AES2501_CTRL2_READ_REGS;
rdata->dev = dev; rdata->dev = dev;
@@ -217,6 +209,7 @@ static void generic_read_ignore_data(struct fpi_ssm *ssm, size_t bytes)
{ {
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
unsigned char *data; unsigned char *data;
struct fp_dev *dev = fpi_ssm_get_dev(ssm);
int r; int r;
if (!transfer) { if (!transfer) {
@@ -225,7 +218,7 @@ static void generic_read_ignore_data(struct fpi_ssm *ssm, size_t bytes)
} }
data = g_malloc(bytes); data = g_malloc(bytes);
libusb_fill_bulk_transfer(transfer, ssm->dev->udev, EP_IN, data, bytes, libusb_fill_bulk_transfer(transfer, fpi_dev_get_usb_dev(dev), EP_IN, data, bytes,
generic_ignore_data_cb, ssm, BULK_TIMEOUT); generic_ignore_data_cb, ssm, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@@ -340,7 +333,7 @@ static void finger_det_reqs_cb(struct fp_img_dev *dev, int result,
} }
data = g_malloc(20); data = g_malloc(20);
libusb_fill_bulk_transfer(transfer, dev->udev, EP_IN, data, 20, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_IN, data, 20,
finger_det_data_cb, dev, BULK_TIMEOUT); finger_det_data_cb, dev, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@@ -353,8 +346,8 @@ static void finger_det_reqs_cb(struct fp_img_dev *dev, int result,
static void start_finger_detection(struct fp_img_dev *dev) static void start_finger_detection(struct fp_img_dev *dev)
{ {
struct aes2501_dev *aesdev = dev->priv; struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
fp_dbg(""); G_DEBUG_HERE();
if (aesdev->deactivating) { if (aesdev->deactivating) {
complete_deactivation(dev); complete_deactivation(dev);
@@ -444,8 +437,8 @@ static void capture_read_strip_cb(struct libusb_transfer *transfer)
{ {
unsigned char *stripdata; unsigned char *stripdata;
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2501_dev *aesdev = dev->priv; struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
unsigned char *data = transfer->buffer; unsigned char *data = transfer->buffer;
int sum; int sum;
int threshold; int threshold;
@@ -529,11 +522,11 @@ out:
static void capture_run_state(struct fpi_ssm *ssm) static void capture_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2501_dev *aesdev = dev->priv; struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
int r; int r;
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case CAPTURE_WRITE_REQS_1: case CAPTURE_WRITE_REQS_1:
aes_write_regv(dev, capture_reqs_1, G_N_ELEMENTS(capture_reqs_1), aes_write_regv(dev, capture_reqs_1, G_N_ELEMENTS(capture_reqs_1),
generic_write_regv_cb, ssm); generic_write_regv_cb, ssm);
@@ -565,7 +558,7 @@ static void capture_run_state(struct fpi_ssm *ssm)
} }
data = g_malloc(1705); data = g_malloc(1705);
libusb_fill_bulk_transfer(transfer, dev->udev, EP_IN, data, 1705, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_IN, data, 1705,
capture_read_strip_cb, ssm, BULK_TIMEOUT); capture_read_strip_cb, ssm, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@@ -580,14 +573,14 @@ static void capture_run_state(struct fpi_ssm *ssm)
static void capture_sm_complete(struct fpi_ssm *ssm) static void capture_sm_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2501_dev *aesdev = dev->priv; struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
fp_dbg(""); G_DEBUG_HERE();
if (aesdev->deactivating) if (aesdev->deactivating)
complete_deactivation(dev); complete_deactivation(dev);
else if (ssm->error) else if (fpi_ssm_get_error(ssm))
fpi_imgdev_session_error(dev, ssm->error); fpi_imgdev_session_error(dev, fpi_ssm_get_error(ssm));
else else
start_finger_detection(dev); start_finger_detection(dev);
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
@@ -595,7 +588,7 @@ static void capture_sm_complete(struct fpi_ssm *ssm)
static void start_capture(struct fp_img_dev *dev) static void start_capture(struct fp_img_dev *dev)
{ {
struct aes2501_dev *aesdev = dev->priv; struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *ssm; struct fpi_ssm *ssm;
if (aesdev->deactivating) { if (aesdev->deactivating) {
@@ -606,9 +599,9 @@ static void start_capture(struct fp_img_dev *dev)
aesdev->no_finger_cnt = 0; aesdev->no_finger_cnt = 0;
/* Reset gain */ /* Reset gain */
strip_scan_reqs[4].value = AES2501_ADREFHI_MAX_VALUE; strip_scan_reqs[4].value = AES2501_ADREFHI_MAX_VALUE;
ssm = fpi_ssm_new(dev->dev, capture_run_state, CAPTURE_NUM_STATES); ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), capture_run_state, CAPTURE_NUM_STATES);
fp_dbg(""); G_DEBUG_HERE();
ssm->priv = dev; fpi_ssm_set_user_data(ssm, dev);
fpi_ssm_start(ssm, capture_sm_complete); fpi_ssm_start(ssm, capture_sm_complete);
} }
@@ -721,7 +714,7 @@ void activate_read_regs_cb(struct fp_img_dev *dev, int status,
unsigned char *regs, void *user_data) unsigned char *regs, void *user_data)
{ {
struct fpi_ssm *ssm = user_data; struct fpi_ssm *ssm = user_data;
struct aes2501_dev *aesdev = dev->priv; struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
if (status != 0) { if (status != 0) {
fpi_ssm_mark_aborted(ssm, status); fpi_ssm_mark_aborted(ssm, status);
@@ -746,7 +739,7 @@ static void activate_init3_cb(struct fp_img_dev *dev, int result,
static void activate_run_state(struct fpi_ssm *ssm) static void activate_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
/* This state machine isn't as linear as it may appear. After doing init1 /* This state machine isn't as linear as it may appear. After doing init1
* and init2 register configuration writes, we have to poll a register * and init2 register configuration writes, we have to poll a register
@@ -767,7 +760,7 @@ static void activate_run_state(struct fpi_ssm *ssm)
aes_write_regv(init_4); aes_write_regv(init_4);
*/ */
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case WRITE_INIT_1: case WRITE_INIT_1:
aes_write_regv(dev, init_1, G_N_ELEMENTS(init_1), aes_write_regv(dev, init_1, G_N_ELEMENTS(init_1),
generic_write_regv_cb, ssm); generic_write_regv_cb, ssm);
@@ -784,7 +777,7 @@ static void activate_run_state(struct fpi_ssm *ssm)
read_regs(dev, activate_read_regs_cb, ssm); read_regs(dev, activate_read_regs_cb, ssm);
break; break;
case WRITE_INIT_3: case WRITE_INIT_3:
aes_write_regv(dev, init_4, G_N_ELEMENTS(init_4), aes_write_regv(dev, init_3, G_N_ELEMENTS(init_3),
activate_init3_cb, ssm); activate_init3_cb, ssm);
break; break;
case WRITE_INIT_4: case WRITE_INIT_4:
@@ -800,21 +793,21 @@ static void activate_run_state(struct fpi_ssm *ssm)
static void activate_sm_complete(struct fpi_ssm *ssm) static void activate_sm_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
fp_dbg("status %d", ssm->error); fp_dbg("status %d", fpi_ssm_get_error(ssm));
fpi_imgdev_activate_complete(dev, ssm->error); fpi_imgdev_activate_complete(dev, fpi_ssm_get_error(ssm));
if (!ssm->error) if (!fpi_ssm_get_error(ssm))
start_finger_detection(dev); start_finger_detection(dev);
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
} }
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state) static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{ {
struct aes2501_dev *aesdev = dev->priv; struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *ssm = fpi_ssm_new(dev->dev, activate_run_state, struct fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_run_state,
ACTIVATE_NUM_STATES); ACTIVATE_NUM_STATES);
ssm->priv = dev; fpi_ssm_set_user_data(ssm, dev);
aesdev->read_regs_retry_count = 0; aesdev->read_regs_retry_count = 0;
fpi_ssm_start(ssm, activate_sm_complete); fpi_ssm_start(ssm, activate_sm_complete);
return 0; return 0;
@@ -822,7 +815,7 @@ static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
static void dev_deactivate(struct fp_img_dev *dev) static void dev_deactivate(struct fp_img_dev *dev)
{ {
struct aes2501_dev *aesdev = dev->priv; struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
/* FIXME: audit cancellation points, probably need more, specifically /* FIXME: audit cancellation points, probably need more, specifically
* in error handling paths? */ * in error handling paths? */
aesdev->deactivating = TRUE; aesdev->deactivating = TRUE;
@@ -830,8 +823,8 @@ static void dev_deactivate(struct fp_img_dev *dev)
static void complete_deactivation(struct fp_img_dev *dev) static void complete_deactivation(struct fp_img_dev *dev)
{ {
struct aes2501_dev *aesdev = dev->priv; struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
fp_dbg(""); G_DEBUG_HERE();
/* FIXME: if we're in the middle of a scan, we should cancel the scan. /* FIXME: if we're in the middle of a scan, we should cancel the scan.
* maybe we can do this with a master reset, unconditionally? */ * maybe we can do this with a master reset, unconditionally? */
@@ -847,22 +840,25 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
{ {
/* FIXME check endpoints */ /* FIXME check endpoints */
int r; int r;
struct aes2501_dev *aesdev;
r = libusb_claim_interface(dev->udev, 0); r = libusb_claim_interface(fpi_imgdev_get_usb_dev(dev), 0);
if (r < 0) { if (r < 0) {
fp_err("could not claim interface 0: %s", libusb_error_name(r)); fp_err("could not claim interface 0: %s", libusb_error_name(r));
return r; return r;
} }
dev->priv = g_malloc0(sizeof(struct aes2501_dev)); aesdev = g_malloc0(sizeof(struct aes2501_dev));
fpi_imgdev_set_user_data(dev, aesdev);
fpi_imgdev_open_complete(dev, 0); fpi_imgdev_open_complete(dev, 0);
return 0; return 0;
} }
static void dev_deinit(struct fp_img_dev *dev) static void dev_deinit(struct fp_img_dev *dev)
{ {
g_free(dev->priv); struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
libusb_release_interface(dev->udev, 0); g_free(aesdev);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);
} }
+48 -52
View File
@@ -23,17 +23,9 @@
#define FP_COMPONENT "aes2550" #define FP_COMPONENT "aes2550"
#include <errno.h> #include "drivers_api.h"
#include <string.h>
#include <libusb.h>
#include <assembling.h>
#include <aeslib.h>
#include <fp_internal.h>
#include "aes2550.h" #include "aes2550.h"
#include "driver_ids.h" #include "aeslib.h"
static void start_capture(struct fp_img_dev *dev); static void start_capture(struct fp_img_dev *dev);
static void complete_deactivation(struct fp_img_dev *dev); static void complete_deactivation(struct fp_img_dev *dev);
@@ -141,7 +133,7 @@ static void finger_det_reqs_cb(struct libusb_transfer *t)
/* 2 bytes of result */ /* 2 bytes of result */
data = g_malloc(AES2550_EP_IN_BUF_SIZE); data = g_malloc(AES2550_EP_IN_BUF_SIZE);
libusb_fill_bulk_transfer(transfer, dev->udev, EP_IN, data, AES2550_EP_IN_BUF_SIZE, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_IN, data, AES2550_EP_IN_BUF_SIZE,
finger_det_data_cb, dev, BULK_TIMEOUT); finger_det_data_cb, dev, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@@ -157,9 +149,9 @@ exit_free_transfer:
static void start_finger_detection(struct fp_img_dev *dev) static void start_finger_detection(struct fp_img_dev *dev)
{ {
int r; int r;
struct aes2550_dev *aesdev = dev->priv; struct aes2550_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct libusb_transfer *transfer; struct libusb_transfer *transfer;
fp_dbg(""); G_DEBUG_HERE();
if (aesdev->deactivating) { if (aesdev->deactivating) {
complete_deactivation(dev); complete_deactivation(dev);
@@ -171,7 +163,7 @@ static void start_finger_detection(struct fp_img_dev *dev)
fpi_imgdev_session_error(dev, -ENOMEM); fpi_imgdev_session_error(dev, -ENOMEM);
return; return;
} }
libusb_fill_bulk_transfer(transfer, dev->udev, EP_OUT, finger_det_reqs, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_OUT, finger_det_reqs,
sizeof(finger_det_reqs), finger_det_reqs_cb, dev, BULK_TIMEOUT); sizeof(finger_det_reqs), finger_det_reqs_cb, dev, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
if (r < 0) { if (r < 0) {
@@ -211,8 +203,8 @@ enum capture_states {
static int process_strip_data(struct fpi_ssm *ssm, unsigned char *data) static int process_strip_data(struct fpi_ssm *ssm, unsigned char *data)
{ {
unsigned char *stripdata; unsigned char *stripdata;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2550_dev *aesdev = dev->priv; struct aes2550_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct fpi_frame *stripe; struct fpi_frame *stripe;
int len; int len;
@@ -253,8 +245,8 @@ static void capture_reqs_cb(struct libusb_transfer *transfer)
static void capture_set_idle_reqs_cb(struct libusb_transfer *transfer) static void capture_set_idle_reqs_cb(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2550_dev *aesdev = dev->priv; struct aes2550_dev *aesdev = fpi_imgdev_get_user_data(dev);
if ((transfer->status == LIBUSB_TRANSFER_COMPLETED) && if ((transfer->status == LIBUSB_TRANSFER_COMPLETED) &&
(transfer->length == transfer->actual_length) && (transfer->length == transfer->actual_length) &&
@@ -281,8 +273,8 @@ static void capture_set_idle_reqs_cb(struct libusb_transfer *transfer)
static void capture_read_data_cb(struct libusb_transfer *transfer) static void capture_read_data_cb(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2550_dev *aesdev = dev->priv; struct aes2550_dev *aesdev = fpi_imgdev_get_user_data(dev);
unsigned char *data = transfer->buffer; unsigned char *data = transfer->buffer;
int r; int r;
@@ -333,10 +325,10 @@ out:
static void capture_run_state(struct fpi_ssm *ssm) static void capture_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
int r; int r;
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case CAPTURE_WRITE_REQS: case CAPTURE_WRITE_REQS:
{ {
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
@@ -344,7 +336,7 @@ static void capture_run_state(struct fpi_ssm *ssm)
fpi_ssm_mark_aborted(ssm, -ENOMEM); fpi_ssm_mark_aborted(ssm, -ENOMEM);
return; return;
} }
libusb_fill_bulk_transfer(transfer, dev->udev, EP_OUT, capture_reqs, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_OUT, capture_reqs,
sizeof(capture_reqs), capture_reqs_cb, ssm, BULK_TIMEOUT); sizeof(capture_reqs), capture_reqs_cb, ssm, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
if (r < 0) { if (r < 0) {
@@ -364,7 +356,7 @@ static void capture_run_state(struct fpi_ssm *ssm)
} }
data = g_malloc(AES2550_EP_IN_BUF_SIZE); data = g_malloc(AES2550_EP_IN_BUF_SIZE);
libusb_fill_bulk_transfer(transfer, dev->udev, EP_IN, data, AES2550_EP_IN_BUF_SIZE, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_IN, data, AES2550_EP_IN_BUF_SIZE,
capture_read_data_cb, ssm, BULK_TIMEOUT); capture_read_data_cb, ssm, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@@ -382,7 +374,7 @@ static void capture_run_state(struct fpi_ssm *ssm)
fpi_ssm_mark_aborted(ssm, -ENOMEM); fpi_ssm_mark_aborted(ssm, -ENOMEM);
return; return;
} }
libusb_fill_bulk_transfer(transfer, dev->udev, EP_OUT, capture_set_idle_reqs, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_OUT, capture_set_idle_reqs,
sizeof(capture_set_idle_reqs), capture_set_idle_reqs_cb, ssm, BULK_TIMEOUT); sizeof(capture_set_idle_reqs), capture_set_idle_reqs_cb, ssm, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
if (r < 0) { if (r < 0) {
@@ -396,14 +388,14 @@ static void capture_run_state(struct fpi_ssm *ssm)
static void capture_sm_complete(struct fpi_ssm *ssm) static void capture_sm_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2550_dev *aesdev = dev->priv; struct aes2550_dev *aesdev = fpi_imgdev_get_user_data(dev);
fp_dbg("Capture completed"); fp_dbg("Capture completed");
if (aesdev->deactivating) if (aesdev->deactivating)
complete_deactivation(dev); complete_deactivation(dev);
else if (ssm->error) else if (fpi_ssm_get_error(ssm))
fpi_imgdev_session_error(dev, ssm->error); fpi_imgdev_session_error(dev, fpi_ssm_get_error(ssm));
else else
start_finger_detection(dev); start_finger_detection(dev);
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
@@ -411,7 +403,7 @@ static void capture_sm_complete(struct fpi_ssm *ssm)
static void start_capture(struct fp_img_dev *dev) static void start_capture(struct fp_img_dev *dev)
{ {
struct aes2550_dev *aesdev = dev->priv; struct aes2550_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *ssm; struct fpi_ssm *ssm;
if (aesdev->deactivating) { if (aesdev->deactivating) {
@@ -420,9 +412,9 @@ static void start_capture(struct fp_img_dev *dev)
} }
aesdev->heartbeat_cnt = 0; aesdev->heartbeat_cnt = 0;
ssm = fpi_ssm_new(dev->dev, capture_run_state, CAPTURE_NUM_STATES); ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), capture_run_state, CAPTURE_NUM_STATES);
fp_dbg(""); G_DEBUG_HERE();
ssm->priv = dev; fpi_ssm_set_user_data(ssm, dev);
fpi_ssm_start(ssm, capture_sm_complete); fpi_ssm_start(ssm, capture_sm_complete);
} }
@@ -493,10 +485,10 @@ static void calibrate_read_data_cb(struct libusb_transfer *transfer)
static void activate_run_state(struct fpi_ssm *ssm) static void activate_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
int r; int r;
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case WRITE_INIT: case WRITE_INIT:
{ {
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
@@ -504,7 +496,7 @@ static void activate_run_state(struct fpi_ssm *ssm)
fpi_ssm_mark_aborted(ssm, -ENOMEM); fpi_ssm_mark_aborted(ssm, -ENOMEM);
return; return;
} }
libusb_fill_bulk_transfer(transfer, dev->udev, EP_OUT, init_reqs, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_OUT, init_reqs,
sizeof(init_reqs), init_reqs_cb, ssm, BULK_TIMEOUT); sizeof(init_reqs), init_reqs_cb, ssm, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
if (r < 0) { if (r < 0) {
@@ -524,7 +516,7 @@ static void activate_run_state(struct fpi_ssm *ssm)
} }
data = g_malloc(AES2550_EP_IN_BUF_SIZE); data = g_malloc(AES2550_EP_IN_BUF_SIZE);
libusb_fill_bulk_transfer(transfer, dev->udev, EP_IN, data, AES2550_EP_IN_BUF_SIZE, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_IN, data, AES2550_EP_IN_BUF_SIZE,
init_read_data_cb, ssm, BULK_TIMEOUT); init_read_data_cb, ssm, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@@ -542,7 +534,7 @@ static void activate_run_state(struct fpi_ssm *ssm)
fpi_ssm_mark_aborted(ssm, -ENOMEM); fpi_ssm_mark_aborted(ssm, -ENOMEM);
return; return;
} }
libusb_fill_bulk_transfer(transfer, dev->udev, EP_OUT, calibrate_reqs, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_OUT, calibrate_reqs,
sizeof(calibrate_reqs), init_reqs_cb, ssm, BULK_TIMEOUT); sizeof(calibrate_reqs), init_reqs_cb, ssm, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
if (r < 0) { if (r < 0) {
@@ -562,7 +554,7 @@ static void activate_run_state(struct fpi_ssm *ssm)
} }
data = g_malloc(AES2550_EP_IN_BUF_SIZE); data = g_malloc(AES2550_EP_IN_BUF_SIZE);
libusb_fill_bulk_transfer(transfer, dev->udev, EP_IN, data, AES2550_EP_IN_BUF_SIZE, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_IN, data, AES2550_EP_IN_BUF_SIZE,
calibrate_read_data_cb, ssm, BULK_TIMEOUT); calibrate_read_data_cb, ssm, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@@ -578,35 +570,35 @@ static void activate_run_state(struct fpi_ssm *ssm)
static void activate_sm_complete(struct fpi_ssm *ssm) static void activate_sm_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
fp_dbg("status %d", ssm->error); fp_dbg("status %d", fpi_ssm_get_error(ssm));
fpi_imgdev_activate_complete(dev, ssm->error); fpi_imgdev_activate_complete(dev, fpi_ssm_get_error(ssm));
if (!ssm->error) if (!fpi_ssm_get_error(ssm))
start_finger_detection(dev); start_finger_detection(dev);
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
} }
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state) static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{ {
struct fpi_ssm *ssm = fpi_ssm_new(dev->dev, activate_run_state, struct fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_run_state,
ACTIVATE_NUM_STATES); ACTIVATE_NUM_STATES);
ssm->priv = dev; fpi_ssm_set_user_data(ssm, dev);
fpi_ssm_start(ssm, activate_sm_complete); fpi_ssm_start(ssm, activate_sm_complete);
return 0; return 0;
} }
static void dev_deactivate(struct fp_img_dev *dev) static void dev_deactivate(struct fp_img_dev *dev)
{ {
struct aes2550_dev *aesdev = dev->priv; struct aes2550_dev *aesdev = fpi_imgdev_get_user_data(dev);
aesdev->deactivating = TRUE; aesdev->deactivating = TRUE;
} }
static void complete_deactivation(struct fp_img_dev *dev) static void complete_deactivation(struct fp_img_dev *dev)
{ {
struct aes2550_dev *aesdev = dev->priv; struct aes2550_dev *aesdev = fpi_imgdev_get_user_data(dev);
fp_dbg(""); G_DEBUG_HERE();
aesdev->deactivating = FALSE; aesdev->deactivating = FALSE;
g_slist_free(aesdev->strips); g_slist_free(aesdev->strips);
@@ -619,22 +611,26 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
{ {
/* TODO check that device has endpoints we're using */ /* TODO check that device has endpoints we're using */
int r; int r;
struct aes2550_dev *aes2550_dev;
r = libusb_claim_interface(dev->udev, 0); r = libusb_claim_interface(fpi_imgdev_get_usb_dev(dev), 0);
if (r < 0) { if (r < 0) {
fp_err("could not claim interface 0: %s", libusb_error_name(r)); fp_err("could not claim interface 0: %s", libusb_error_name(r));
return r; return r;
} }
dev->priv = g_malloc0(sizeof(struct aes2550_dev)); aes2550_dev = g_malloc0(sizeof(struct aes2550_dev));
fpi_imgdev_set_user_data(dev, aes2550_dev);
fpi_imgdev_open_complete(dev, 0); fpi_imgdev_open_complete(dev, 0);
return 0; return 0;
} }
static void dev_deinit(struct fp_img_dev *dev) static void dev_deinit(struct fp_img_dev *dev)
{ {
g_free(dev->priv); struct aes2550_dev *aesdev;
libusb_release_interface(dev->udev, 0); aesdev = fpi_imgdev_get_user_data(dev);
g_free(aesdev);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);
} }
+10 -19
View File
@@ -19,21 +19,10 @@
#define FP_COMPONENT "aes2660" #define FP_COMPONENT "aes2660"
#include <stdio.h> #include "drivers_api.h"
#include "aeslib.h"
#include <errno.h>
#include <string.h>
#include <libusb.h>
#include <fp_internal.h>
#include <assembling.h>
#include <aeslib.h>
#include "aesx660.h" #include "aesx660.h"
#include "aes2660.h" #include "aes2660.h"
#include "driver_ids.h"
#define FRAME_WIDTH 192 #define FRAME_WIDTH 192
#define IMAGE_WIDTH (FRAME_WIDTH + (FRAME_WIDTH / 2)) #define IMAGE_WIDTH (FRAME_WIDTH + (FRAME_WIDTH / 2))
@@ -51,19 +40,20 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
int r; int r;
struct aesX660_dev *aesdev; struct aesX660_dev *aesdev;
r = libusb_claim_interface(dev->udev, 0); r = libusb_claim_interface(fpi_imgdev_get_usb_dev(dev), 0);
if (r < 0) { if (r < 0) {
fp_err("could not claim interface 0: %s", libusb_error_name(r)); fp_err("could not claim interface 0: %s", libusb_error_name(r));
return r; return r;
} }
dev->priv = aesdev = g_malloc0(sizeof(struct aesX660_dev)); aesdev = g_malloc0(sizeof(struct aesX660_dev));
fpi_imgdev_set_user_data(dev, aesdev);
aesdev->buffer = g_malloc0(AES2660_FRAME_SIZE + AESX660_HEADER_SIZE); aesdev->buffer = g_malloc0(AES2660_FRAME_SIZE + AESX660_HEADER_SIZE);
/* No scaling for AES2660 */ /* No scaling for AES2660 */
aesdev->init_seqs[0] = aes2660_init_1; aesdev->init_seqs[0] = aes2660_init_1;
aesdev->init_seqs_len[0] = array_n_elements(aes2660_init_1); aesdev->init_seqs_len[0] = G_N_ELEMENTS(aes2660_init_1);
aesdev->init_seqs[1] = aes2660_init_2; aesdev->init_seqs[1] = aes2660_init_2;
aesdev->init_seqs_len[1] = array_n_elements(aes2660_init_2); aesdev->init_seqs_len[1] = G_N_ELEMENTS(aes2660_init_2);
aesdev->start_imaging_cmd = (unsigned char *)aes2660_start_imaging_cmd; aesdev->start_imaging_cmd = (unsigned char *)aes2660_start_imaging_cmd;
aesdev->start_imaging_cmd_len = sizeof(aes2660_start_imaging_cmd); aesdev->start_imaging_cmd_len = sizeof(aes2660_start_imaging_cmd);
aesdev->assembling_ctx = &assembling_ctx; aesdev->assembling_ctx = &assembling_ctx;
@@ -75,10 +65,11 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
static void dev_deinit(struct fp_img_dev *dev) static void dev_deinit(struct fp_img_dev *dev)
{ {
struct aesX660_dev *aesdev = dev->priv; struct aesX660_dev *aesdev;
aesdev = fpi_imgdev_get_user_data(dev);
g_free(aesdev->buffer); g_free(aesdev->buffer);
g_free(aesdev); g_free(aesdev);
libusb_release_interface(dev->udev, 0); libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);
} }
+7 -13
View File
@@ -29,16 +29,9 @@
#define FP_COMPONENT "aes3500" #define FP_COMPONENT "aes3500"
#include <errno.h> #include "drivers_api.h"
#include "aeslib.h"
#include <glib.h>
#include <libusb.h>
#include <aeslib.h>
#include <fp_internal.h>
#include "aes3k.h" #include "aes3k.h"
#include "driver_ids.h"
#define DATA_BUFLEN 0x2089 #define DATA_BUFLEN 0x2089
@@ -129,13 +122,14 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
int r; int r;
struct aes3k_dev *aesdev; struct aes3k_dev *aesdev;
r = libusb_claim_interface(dev->udev, 0); r = libusb_claim_interface(fpi_imgdev_get_usb_dev(dev), 0);
if (r < 0) { if (r < 0) {
fp_err("could not claim interface 0: %s", libusb_error_name(r)); fp_err("could not claim interface 0: %s", libusb_error_name(r));
return r; return r;
} }
aesdev = dev->priv = g_malloc0(sizeof(struct aes3k_dev)); aesdev = g_malloc0(sizeof(struct aes3k_dev));
fpi_imgdev_set_user_data(dev, aesdev);
if (!aesdev) if (!aesdev)
return -ENOMEM; return -ENOMEM;
@@ -154,9 +148,9 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
static void dev_deinit(struct fp_img_dev *dev) static void dev_deinit(struct fp_img_dev *dev)
{ {
struct aes3k_dev *aesdev = dev->priv; struct aes3k_dev *aesdev = fpi_imgdev_get_user_data(dev);
g_free(aesdev); g_free(aesdev);
libusb_release_interface(dev->udev, 0); libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);
} }
+7 -13
View File
@@ -36,14 +36,8 @@
#define FP_COMPONENT "aes3k" #define FP_COMPONENT "aes3k"
#include <errno.h> #include "drivers_api.h"
#include "aeslib.h"
#include <glib.h>
#include <libusb.h>
#include <aeslib.h>
#include <fp_internal.h>
#include "aes3k.h" #include "aes3k.h"
#define CTRL_TIMEOUT 1000 #define CTRL_TIMEOUT 1000
@@ -69,7 +63,7 @@ static void aes3k_assemble_image(unsigned char *input, size_t width, size_t heig
static void img_cb(struct libusb_transfer *transfer) static void img_cb(struct libusb_transfer *transfer)
{ {
struct fp_img_dev *dev = transfer->user_data; struct fp_img_dev *dev = transfer->user_data;
struct aes3k_dev *aesdev = dev->priv; struct aes3k_dev *aesdev = fpi_imgdev_get_user_data(dev);
unsigned char *ptr = transfer->buffer; unsigned char *ptr = transfer->buffer;
struct fp_img *tmp; struct fp_img *tmp;
struct fp_img *img; struct fp_img *img;
@@ -118,7 +112,7 @@ err:
static void do_capture(struct fp_img_dev *dev) static void do_capture(struct fp_img_dev *dev)
{ {
struct aes3k_dev *aesdev = dev->priv; struct aes3k_dev *aesdev = fpi_imgdev_get_user_data(dev);
unsigned char *data; unsigned char *data;
int r; int r;
@@ -129,7 +123,7 @@ static void do_capture(struct fp_img_dev *dev)
} }
data = g_malloc(aesdev->data_buflen); data = g_malloc(aesdev->data_buflen);
libusb_fill_bulk_transfer(aesdev->img_trf, dev->udev, EP_IN, data, libusb_fill_bulk_transfer(aesdev->img_trf, fpi_imgdev_get_usb_dev(dev), EP_IN, data,
aesdev->data_buflen, img_cb, dev, 0); aesdev->data_buflen, img_cb, dev, 0);
r = libusb_submit_transfer(aesdev->img_trf); r = libusb_submit_transfer(aesdev->img_trf);
@@ -150,14 +144,14 @@ static void init_reqs_cb(struct fp_img_dev *dev, int result, void *user_data)
int aes3k_dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state) int aes3k_dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{ {
struct aes3k_dev *aesdev = dev->priv; struct aes3k_dev *aesdev = fpi_imgdev_get_user_data(dev);
aes_write_regv(dev, aesdev->init_reqs, aesdev->init_reqs_len, init_reqs_cb, NULL); aes_write_regv(dev, aesdev->init_reqs, aesdev->init_reqs_len, init_reqs_cb, NULL);
return 0; return 0;
} }
void aes3k_dev_deactivate(struct fp_img_dev *dev) void aes3k_dev_deactivate(struct fp_img_dev *dev)
{ {
struct aes3k_dev *aesdev = dev->priv; struct aes3k_dev *aesdev = fpi_imgdev_get_user_data(dev);
/* FIXME: should wait for cancellation to complete before returning /* FIXME: should wait for cancellation to complete before returning
* from deactivation, otherwise app may legally exit before we've * from deactivation, otherwise app may legally exit before we've
+7 -13
View File
@@ -26,16 +26,9 @@
#define FP_COMPONENT "aes4000" #define FP_COMPONENT "aes4000"
#include <errno.h> #include "drivers_api.h"
#include "aeslib.h"
#include <glib.h>
#include <libusb.h>
#include <aeslib.h>
#include <fp_internal.h>
#include "aes3k.h" #include "aes3k.h"
#include "driver_ids.h"
#define DATA_BUFLEN 0x1259 #define DATA_BUFLEN 0x1259
@@ -126,13 +119,14 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
int r; int r;
struct aes3k_dev *aesdev; struct aes3k_dev *aesdev;
r = libusb_claim_interface(dev->udev, 0); r = libusb_claim_interface(fpi_imgdev_get_usb_dev(dev), 0);
if (r < 0) { if (r < 0) {
fp_err("could not claim interface 0: %s", libusb_error_name(r)); fp_err("could not claim interface 0: %s", libusb_error_name(r));
return r; return r;
} }
aesdev = dev->priv = g_malloc0(sizeof(struct aes3k_dev)); aesdev = g_malloc0(sizeof(struct aes3k_dev));
fpi_imgdev_set_user_data(dev, aesdev);
if (!aesdev) if (!aesdev)
return -ENOMEM; return -ENOMEM;
@@ -151,9 +145,9 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
static void dev_deinit(struct fp_img_dev *dev) static void dev_deinit(struct fp_img_dev *dev)
{ {
struct aes3k_dev *aesdev = dev->priv; struct aes3k_dev *aesdev = fpi_imgdev_get_user_data(dev);
g_free(aesdev); g_free(aesdev);
libusb_release_interface(dev->udev, 0); libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);
} }
+49 -58
View File
@@ -23,17 +23,8 @@
#define FP_COMPONENT "aesX660" #define FP_COMPONENT "aesX660"
#include <stdio.h> #include "drivers_api.h"
#include "aeslib.h"
#include <errno.h>
#include <string.h>
#include <libusb.h>
#include <assembling.h>
#include <aeslib.h>
#include <fp_internal.h>
#include "aesx660.h" #include "aesx660.h"
static void start_capture(struct fp_img_dev *dev); static void start_capture(struct fp_img_dev *dev);
@@ -49,7 +40,7 @@ static void complete_deactivation(struct fp_img_dev *dev);
static void aesX660_send_cmd_timeout(struct fpi_ssm *ssm, const unsigned char *cmd, static void aesX660_send_cmd_timeout(struct fpi_ssm *ssm, const unsigned char *cmd,
size_t cmd_len, libusb_transfer_cb_fn callback, int timeout) size_t cmd_len, libusb_transfer_cb_fn callback, int timeout)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
int r; int r;
@@ -58,7 +49,7 @@ static void aesX660_send_cmd_timeout(struct fpi_ssm *ssm, const unsigned char *c
return; return;
} }
libusb_fill_bulk_transfer(transfer, dev->udev, EP_OUT, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_OUT,
(unsigned char *)cmd, cmd_len, (unsigned char *)cmd, cmd_len,
callback, ssm, timeout); callback, ssm, timeout);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@@ -78,7 +69,7 @@ static void aesX660_send_cmd(struct fpi_ssm *ssm, const unsigned char *cmd,
static void aesX660_read_response(struct fpi_ssm *ssm, size_t buf_len, static void aesX660_read_response(struct fpi_ssm *ssm, size_t buf_len,
libusb_transfer_cb_fn callback) libusb_transfer_cb_fn callback)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
unsigned char *data; unsigned char *data;
int r; int r;
@@ -89,7 +80,7 @@ static void aesX660_read_response(struct fpi_ssm *ssm, size_t buf_len,
} }
data = g_malloc(buf_len); data = g_malloc(buf_len);
libusb_fill_bulk_transfer(transfer, dev->udev, EP_IN, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_IN,
data, buf_len, data, buf_len,
callback, ssm, BULK_TIMEOUT); callback, ssm, BULK_TIMEOUT);
@@ -153,8 +144,8 @@ enum finger_det_states {
static void finger_det_read_fd_data_cb(struct libusb_transfer *transfer) static void finger_det_read_fd_data_cb(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = dev->priv; struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
unsigned char *data = transfer->buffer; unsigned char *data = transfer->buffer;
aesdev->fd_data_transfer = NULL; aesdev->fd_data_transfer = NULL;
@@ -206,9 +197,9 @@ static void finger_det_set_idle_cmd_cb(struct libusb_transfer *transfer)
static void finger_det_sm_complete(struct fpi_ssm *ssm) static void finger_det_sm_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = dev->priv; struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
int err = ssm->error; int err = fpi_ssm_get_error(ssm);
fp_dbg("Finger detection completed"); fp_dbg("Finger detection completed");
fpi_imgdev_report_finger_status(dev, TRUE); fpi_imgdev_report_finger_status(dev, TRUE);
@@ -226,7 +217,7 @@ static void finger_det_sm_complete(struct fpi_ssm *ssm)
static void finger_det_run_state(struct fpi_ssm *ssm) static void finger_det_run_state(struct fpi_ssm *ssm)
{ {
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case FINGER_DET_SEND_LED_CMD: case FINGER_DET_SEND_LED_CMD:
aesX660_send_cmd(ssm, led_blink_cmd, sizeof(led_blink_cmd), aesX660_send_cmd(ssm, led_blink_cmd, sizeof(led_blink_cmd),
aesX660_send_cmd_cb); aesX660_send_cmd_cb);
@@ -249,15 +240,15 @@ static void finger_det_run_state(struct fpi_ssm *ssm)
static void start_finger_detection(struct fp_img_dev *dev) static void start_finger_detection(struct fp_img_dev *dev)
{ {
struct fpi_ssm *ssm; struct fpi_ssm *ssm;
struct aesX660_dev *aesdev = dev->priv; struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
if (aesdev->deactivating) { if (aesdev->deactivating) {
complete_deactivation(dev); complete_deactivation(dev);
return; return;
} }
ssm = fpi_ssm_new(dev->dev, finger_det_run_state, FINGER_DET_NUM_STATES); ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), finger_det_run_state, FINGER_DET_NUM_STATES);
ssm->priv = dev; fpi_ssm_set_user_data(ssm, dev);
fpi_ssm_start(ssm, finger_det_sm_complete); fpi_ssm_start(ssm, finger_det_sm_complete);
} }
@@ -276,8 +267,8 @@ static int process_stripe_data(struct fpi_ssm *ssm, unsigned char *data)
{ {
struct fpi_frame *stripe; struct fpi_frame *stripe;
unsigned char *stripdata; unsigned char *stripdata;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = dev->priv; struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
stripe = g_malloc(aesdev->assembling_ctx->frame_width * FRAME_HEIGHT / 2 + sizeof(struct fpi_frame)); /* 4 bpp */ stripe = g_malloc(aesdev->assembling_ctx->frame_width * FRAME_HEIGHT / 2 + sizeof(struct fpi_frame)); /* 4 bpp */
stripdata = stripe->data; stripdata = stripe->data;
@@ -304,8 +295,8 @@ static int process_stripe_data(struct fpi_ssm *ssm, unsigned char *data)
static void capture_set_idle_cmd_cb(struct libusb_transfer *transfer) static void capture_set_idle_cmd_cb(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = dev->priv; struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
if ((transfer->status == LIBUSB_TRANSFER_COMPLETED) && if ((transfer->status == LIBUSB_TRANSFER_COMPLETED) &&
(transfer->length == transfer->actual_length)) { (transfer->length == transfer->actual_length)) {
@@ -330,8 +321,8 @@ static void capture_set_idle_cmd_cb(struct libusb_transfer *transfer)
static void capture_read_stripe_data_cb(struct libusb_transfer *transfer) static void capture_read_stripe_data_cb(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = dev->priv; struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
unsigned char *data = transfer->buffer; unsigned char *data = transfer->buffer;
int finger_missing = 0; int finger_missing = 0;
size_t copied, actual_len = transfer->actual_length; size_t copied, actual_len = transfer->actual_length;
@@ -341,7 +332,7 @@ static void capture_read_stripe_data_cb(struct libusb_transfer *transfer)
goto out; goto out;
} }
fp_dbg("Got %d bytes of data", actual_len); fp_dbg("Got %lu bytes of data", actual_len);
do { do {
copied = min(aesdev->buffer_max - aesdev->buffer_size, actual_len); copied = min(aesdev->buffer_max - aesdev->buffer_size, actual_len);
memcpy(aesdev->buffer + aesdev->buffer_size, memcpy(aesdev->buffer + aesdev->buffer_size,
@@ -350,13 +341,13 @@ static void capture_read_stripe_data_cb(struct libusb_transfer *transfer)
actual_len -= copied; actual_len -= copied;
data += copied; data += copied;
aesdev->buffer_size += copied; aesdev->buffer_size += copied;
fp_dbg("Copied %.4x bytes into internal buffer", fp_dbg("Copied %.4lx bytes into internal buffer",
copied); copied);
if (aesdev->buffer_size == aesdev->buffer_max) { if (aesdev->buffer_size == aesdev->buffer_max) {
if (aesdev->buffer_max == AESX660_HEADER_SIZE) { if (aesdev->buffer_max == AESX660_HEADER_SIZE) {
aesdev->buffer_max = aesdev->buffer[AESX660_RESPONSE_SIZE_LSB_OFFSET] + aesdev->buffer_max = aesdev->buffer[AESX660_RESPONSE_SIZE_LSB_OFFSET] +
(aesdev->buffer[AESX660_RESPONSE_SIZE_MSB_OFFSET] << 8) + AESX660_HEADER_SIZE; (aesdev->buffer[AESX660_RESPONSE_SIZE_MSB_OFFSET] << 8) + AESX660_HEADER_SIZE;
fp_dbg("Got frame, type %.2x size %.4x", fp_dbg("Got frame, type %.2x size %.4lx",
aesdev->buffer[AESX660_RESPONSE_TYPE_OFFSET], aesdev->buffer[AESX660_RESPONSE_TYPE_OFFSET],
aesdev->buffer_max); aesdev->buffer_max);
continue; continue;
@@ -382,10 +373,10 @@ out:
static void capture_run_state(struct fpi_ssm *ssm) static void capture_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = dev->priv; struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case CAPTURE_SEND_LED_CMD: case CAPTURE_SEND_LED_CMD:
aesX660_send_cmd(ssm, led_solid_cmd, sizeof(led_solid_cmd), aesX660_send_cmd(ssm, led_solid_cmd, sizeof(led_solid_cmd),
aesX660_send_cmd_cb); aesX660_send_cmd_cb);
@@ -402,7 +393,7 @@ static void capture_run_state(struct fpi_ssm *ssm)
capture_read_stripe_data_cb); capture_read_stripe_data_cb);
break; break;
case CAPTURE_SET_IDLE: case CAPTURE_SET_IDLE:
fp_dbg("Got %d frames\n", aesdev->strips_len); fp_dbg("Got %lu frames\n", aesdev->strips_len);
aesX660_send_cmd(ssm, set_idle_cmd, sizeof(set_idle_cmd), aesX660_send_cmd(ssm, set_idle_cmd, sizeof(set_idle_cmd),
capture_set_idle_cmd_cb); capture_set_idle_cmd_cb);
break; break;
@@ -411,9 +402,9 @@ static void capture_run_state(struct fpi_ssm *ssm)
static void capture_sm_complete(struct fpi_ssm *ssm) static void capture_sm_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = dev->priv; struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
int err = ssm->error; int err = fpi_ssm_get_error(ssm);
fp_dbg("Capture completed"); fp_dbg("Capture completed");
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
@@ -428,7 +419,7 @@ static void capture_sm_complete(struct fpi_ssm *ssm)
static void start_capture(struct fp_img_dev *dev) static void start_capture(struct fp_img_dev *dev)
{ {
struct aesX660_dev *aesdev = dev->priv; struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *ssm; struct fpi_ssm *ssm;
if (aesdev->deactivating) { if (aesdev->deactivating) {
@@ -436,9 +427,9 @@ static void start_capture(struct fp_img_dev *dev)
return; return;
} }
ssm = fpi_ssm_new(dev->dev, capture_run_state, CAPTURE_NUM_STATES); ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), capture_run_state, CAPTURE_NUM_STATES);
fp_dbg(""); G_DEBUG_HERE();
ssm->priv = dev; fpi_ssm_set_user_data(ssm, dev);
fpi_ssm_start(ssm, capture_sm_complete); fpi_ssm_start(ssm, capture_sm_complete);
} }
@@ -458,8 +449,8 @@ enum activate_states {
static void activate_read_id_cb(struct libusb_transfer *transfer) static void activate_read_id_cb(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = dev->priv; struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
unsigned char *data = transfer->buffer; unsigned char *data = transfer->buffer;
if ((transfer->status != LIBUSB_TRANSFER_COMPLETED) || if ((transfer->status != LIBUSB_TRANSFER_COMPLETED) ||
@@ -509,8 +500,8 @@ out:
static void activate_read_init_cb(struct libusb_transfer *transfer) static void activate_read_init_cb(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = dev->priv; struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
unsigned char *data = transfer->buffer; unsigned char *data = transfer->buffer;
fp_dbg("read_init_cb\n"); fp_dbg("read_init_cb\n");
@@ -545,10 +536,10 @@ out:
static void activate_run_state(struct fpi_ssm *ssm) static void activate_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aesX660_dev *aesdev = dev->priv; struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case ACTIVATE_SET_IDLE: case ACTIVATE_SET_IDLE:
aesdev->init_seq_idx = 0; aesdev->init_seq_idx = 0;
fp_dbg("Activate: set idle\n"); fp_dbg("Activate: set idle\n");
@@ -591,8 +582,8 @@ static void activate_run_state(struct fpi_ssm *ssm)
static void activate_sm_complete(struct fpi_ssm *ssm) static void activate_sm_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
int err = ssm->error; int err = fpi_ssm_get_error(ssm);
fp_dbg("status %d", err); fp_dbg("status %d", err);
fpi_imgdev_activate_complete(dev, err); fpi_imgdev_activate_complete(dev, err);
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
@@ -603,16 +594,16 @@ static void activate_sm_complete(struct fpi_ssm *ssm)
int aesX660_dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state) int aesX660_dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{ {
struct fpi_ssm *ssm = fpi_ssm_new(dev->dev, activate_run_state, struct fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_run_state,
ACTIVATE_NUM_STATES); ACTIVATE_NUM_STATES);
ssm->priv = dev; fpi_ssm_set_user_data(ssm, dev);
fpi_ssm_start(ssm, activate_sm_complete); fpi_ssm_start(ssm, activate_sm_complete);
return 0; return 0;
} }
void aesX660_dev_deactivate(struct fp_img_dev *dev) void aesX660_dev_deactivate(struct fp_img_dev *dev)
{ {
struct aesX660_dev *aesdev = dev->priv; struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
if (aesdev->fd_data_transfer) if (aesdev->fd_data_transfer)
libusb_cancel_transfer(aesdev->fd_data_transfer); libusb_cancel_transfer(aesdev->fd_data_transfer);
@@ -622,8 +613,8 @@ void aesX660_dev_deactivate(struct fp_img_dev *dev)
static void complete_deactivation(struct fp_img_dev *dev) static void complete_deactivation(struct fp_img_dev *dev)
{ {
struct aesX660_dev *aesdev = dev->priv; struct aesX660_dev *aesdev = fpi_imgdev_get_user_data(dev);
fp_dbg(""); G_DEBUG_HERE();
aesdev->deactivating = FALSE; aesdev->deactivating = FALSE;
g_slist_free(aesdev->strips); g_slist_free(aesdev->strips);
+2 -1
View File
@@ -33,7 +33,7 @@ enum {
VFS101_ID = 10, VFS101_ID = 10,
VFS301_ID = 11, VFS301_ID = 11,
AES2550_ID = 12, AES2550_ID = 12,
UPEKE2_ID = 13, /* UPEKE2_ID = 13 */
AES1660_ID = 14, AES1660_ID = 14,
AES2660_ID = 15, AES2660_ID = 15,
AES3500_ID = 16, AES3500_ID = 16,
@@ -41,6 +41,7 @@ enum {
ETES603_ID = 18, ETES603_ID = 18,
VFS5011_ID = 19, VFS5011_ID = 19,
VFS0050_ID = 20, VFS0050_ID = 20,
ELAN_ID = 21,
}; };
#endif #endif
+625
View File
@@ -0,0 +1,625 @@
/*
* Elan driver for libfprint
*
* Copyright (C) 2017 Igor Filatov <ia.filatov@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 "elan"
#include "drivers_api.h"
#include "elan.h"
unsigned char elan_get_pixel(struct fpi_frame_asmbl_ctx *ctx,
struct fpi_frame *frame, unsigned int x,
unsigned int y)
{
return frame->data[x + y * ctx->frame_width];
}
static struct fpi_frame_asmbl_ctx assembling_ctx = {
.frame_width = 0,
.frame_height = 0,
.image_width = 0,
.get_pixel = elan_get_pixel,
};
struct elan_dev {
gboolean deactivating;
const struct elan_cmd *cmds;
size_t cmds_len;
int cmd_idx;
int cmd_timeout;
struct libusb_transfer *cur_transfer;
unsigned char *last_read;
unsigned char frame_width;
unsigned char frame_height;
unsigned char raw_frame_width;
int num_frames;
GSList *frames;
};
static void elan_dev_reset(struct elan_dev *elandev)
{
G_DEBUG_HERE();
BUG_ON(elandev->cur_transfer);
elandev->deactivating = FALSE;
elandev->cmds = NULL;
elandev->cmd_idx = 0;
elandev->cmd_timeout = ELAN_CMD_TIMEOUT;
g_free(elandev->last_read);
elandev->last_read = NULL;
g_slist_free_full(elandev->frames, g_free);
elandev->frames = NULL;
elandev->num_frames = 0;
}
static void elan_save_frame(struct fp_img_dev *dev)
{
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
unsigned char raw_height = elandev->frame_width;
unsigned char raw_width = elandev->raw_frame_width;
unsigned short *frame =
g_malloc(elandev->frame_width * elandev->frame_height * 2);
G_DEBUG_HERE();
/* Raw images are vertical and perpendicular to swipe direction of a
* normalized image, which means we need to make them horizontal before
* assembling. We also discard stirpes of ELAN_FRAME_MARGIN along raw
* height. */
for (int y = 0; y < raw_height; y++)
for (int x = ELAN_FRAME_MARGIN;
x < raw_width - ELAN_FRAME_MARGIN; x++) {
int frame_idx =
y + (x - ELAN_FRAME_MARGIN) * raw_height;
int raw_idx = x + y * raw_width;
frame[frame_idx] =
((unsigned short *)elandev->last_read)[raw_idx];
}
elandev->frames = g_slist_prepend(elandev->frames, frame);
elandev->num_frames += 1;
}
/* Transform raw sesnsor data to normalized 8-bit grayscale image. */
static void elan_process_frame(unsigned short *raw_frame, GSList ** frames)
{
unsigned int frame_size =
assembling_ctx.frame_width * assembling_ctx.frame_height;
struct fpi_frame *frame =
g_malloc(frame_size + sizeof(struct fpi_frame));
G_DEBUG_HERE();
unsigned short min = 0xffff, max = 0;
for (int i = 0; i < frame_size; i++) {
if (raw_frame[i] < min)
min = raw_frame[i];
if (raw_frame[i] > max)
max = raw_frame[i];
}
unsigned short px;
for (int i = 0; i < frame_size; i++) {
px = raw_frame[i];
if (px <= min)
px = 0;
else if (px >= max)
px = 0xff;
else
px = (px - min) * 0xff / (max - min);
frame->data[i] = (unsigned char)px;
}
*frames = g_slist_prepend(*frames, frame);
}
static void elan_submit_image(struct fp_img_dev *dev)
{
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
GSList *frames = NULL;
struct fp_img *img;
G_DEBUG_HERE();
for (int i = 0; i < ELAN_SKIP_LAST_FRAMES; i++)
elandev->frames = g_slist_next(elandev->frames);
assembling_ctx.frame_width = elandev->frame_width;
assembling_ctx.frame_height = elandev->frame_height;
assembling_ctx.image_width = elandev->frame_width * 3 / 2;
g_slist_foreach(elandev->frames, (GFunc) elan_process_frame, &frames);
fpi_do_movement_estimation(&assembling_ctx, frames,
elandev->num_frames - ELAN_SKIP_LAST_FRAMES);
img = fpi_assemble_frames(&assembling_ctx, frames,
elandev->num_frames - ELAN_SKIP_LAST_FRAMES);
img->flags |= FP_IMG_PARTIAL;
fpi_imgdev_image_captured(dev, img);
}
static void elan_cmd_done(struct fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
G_DEBUG_HERE();
elandev->cmd_idx += 1;
if (elandev->cmd_idx < elandev->cmds_len)
elan_run_next_cmd(ssm);
else
fpi_ssm_next_state(ssm);
}
static void elan_cmd_cb(struct libusb_transfer *transfer)
{
struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
G_DEBUG_HERE();
elandev->cur_transfer = NULL;
switch (transfer->status) {
case LIBUSB_TRANSFER_COMPLETED:
if (transfer->length != transfer->actual_length) {
fp_dbg("unexpected transfer length");
elan_dev_reset(elandev);
fpi_ssm_mark_aborted(ssm, -EPROTO);
} else if (transfer->endpoint & LIBUSB_ENDPOINT_IN)
/* just finished receiving */
elan_cmd_done(ssm);
else {
/* just finished sending */
if (elandev->cmds[elandev->cmd_idx].response_len)
elan_cmd_read(ssm);
else
elan_cmd_done(ssm);
}
break;
case LIBUSB_TRANSFER_CANCELLED:
fp_dbg("transfer cancelled");
fpi_ssm_mark_aborted(ssm, -ECANCELED);
break;
case LIBUSB_TRANSFER_TIMED_OUT:
fp_dbg("transfer timed out");
// elan_dev_reset(elandev);
fpi_ssm_mark_aborted(ssm, -ETIMEDOUT);
break;
default:
fp_dbg("transfer failed: %d", transfer->status);
elan_dev_reset(elandev);
fpi_ssm_mark_aborted(ssm, -EIO);
}
}
static void elan_cmd_read(struct fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
int response_len = elandev->cmds[elandev->cmd_idx].response_len;
G_DEBUG_HERE();
if (elandev->cmds[elandev->cmd_idx].cmd == read_cmds[0].cmd)
/* raw data has 2-byte "pixels" and the frame is vertical */
response_len =
elandev->raw_frame_width * elandev->frame_width * 2;
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
if (!transfer) {
fpi_ssm_mark_aborted(ssm, -ENOMEM);
return;
}
elandev->cur_transfer = transfer;
g_free(elandev->last_read);
elandev->last_read = g_malloc(response_len);
libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev),
elandev->cmds[elandev->cmd_idx].response_in,
elandev->last_read, response_len, elan_cmd_cb,
ssm, elandev->cmd_timeout);
transfer->flags = LIBUSB_TRANSFER_FREE_TRANSFER;
int r = libusb_submit_transfer(transfer);
if (r < 0)
fpi_ssm_mark_aborted(ssm, r);
}
static void elan_run_next_cmd(struct fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
G_DEBUG_HERE();
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
if (!transfer) {
fpi_ssm_mark_aborted(ssm, -ENOMEM);
return;
}
elandev->cur_transfer = transfer;
libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), ELAN_EP_CMD_OUT,
(unsigned char *)elandev->cmds[elandev->
cmd_idx].cmd,
ELAN_CMD_LEN, elan_cmd_cb, ssm,
elandev->cmd_timeout);
transfer->flags = LIBUSB_TRANSFER_FREE_TRANSFER;
int r = libusb_submit_transfer(transfer);
if (r < 0)
fpi_ssm_mark_aborted(ssm, r);
}
static void elan_run_cmds(struct fpi_ssm *ssm, const struct elan_cmd *cmds,
size_t cmds_len, int cmd_timeout)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
G_DEBUG_HERE();
elandev->cmds = cmds;
elandev->cmds_len = cmds_len;
elandev->cmd_idx = 0;
if (cmd_timeout != -1)
elandev->cmd_timeout = cmd_timeout;
elan_run_next_cmd(ssm);
}
enum deactivate_states {
DEACTIVATE,
DEACTIVATE_NUM_STATES,
};
static void elan_deactivate_run_state(struct fpi_ssm *ssm)
{
switch (fpi_ssm_get_cur_state(ssm)) {
case DEACTIVATE:
elan_run_cmds(ssm, deactivate_cmds, deactivate_cmds_len,
ELAN_CMD_TIMEOUT);
break;
}
}
static void deactivate_complete(struct fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
fpi_imgdev_deactivate_complete(dev);
}
static void elan_deactivate(struct fp_img_dev *dev)
{
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
G_DEBUG_HERE();
elan_dev_reset(elandev);
struct fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), elan_deactivate_run_state,
DEACTIVATE_NUM_STATES);
fpi_ssm_set_user_data(ssm, dev);
fpi_ssm_start(ssm, deactivate_complete);
}
enum capture_states {
CAPTURE_START,
CAPTURE_WAIT_FINGER,
CAPTURE_READ_DATA,
CAPTURE_SAVE_FRAME,
CAPTURE_NUM_STATES,
};
static void elan_capture_run_state(struct fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
switch (fpi_ssm_get_cur_state(ssm)) {
case CAPTURE_START:
elan_run_cmds(ssm, capture_start_cmds, capture_start_cmds_len,
ELAN_CMD_TIMEOUT);
break;
case CAPTURE_WAIT_FINGER:
elan_run_cmds(ssm, capture_wait_finger_cmds,
capture_wait_finger_cmds_len, -1);
break;
case CAPTURE_READ_DATA:
/* 0x55 - finger present
* 0xff - device not calibrated */
if (elandev->last_read && elandev->last_read[0] == 0x55) {
fpi_imgdev_report_finger_status(dev, TRUE);
elan_run_cmds(ssm, read_cmds, read_cmds_len,
ELAN_CMD_TIMEOUT);
} else
fpi_ssm_mark_aborted(ssm, FP_VERIFY_RETRY);
break;
case CAPTURE_SAVE_FRAME:
elan_save_frame(dev);
if (elandev->num_frames < ELAN_MAX_FRAMES) {
/* quickly stop if finger is removed */
elandev->cmd_timeout = ELAN_FINGER_TIMEOUT;
fpi_ssm_jump_to_state(ssm, CAPTURE_WAIT_FINGER);
}
break;
}
}
static void elan_capture_async(void *data)
{
elan_capture((struct fp_img_dev *)data);
}
static void capture_complete(struct fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
G_DEBUG_HERE();
if (elandev->deactivating)
elan_deactivate(dev);
/* either max frames captured or timed out waiting for the next frame */
else if (!fpi_ssm_get_error(ssm)
|| (fpi_ssm_get_error(ssm) == -ETIMEDOUT
&& fpi_ssm_get_cur_state(ssm) == CAPTURE_WAIT_FINGER))
if (elandev->num_frames >= ELAN_MIN_FRAMES) {
elan_submit_image(dev);
fpi_imgdev_report_finger_status(dev, FALSE);
} else
fpi_imgdev_session_error(dev,
FP_VERIFY_RETRY_TOO_SHORT);
/* other error
* It says "...session_error" but repotring 1 during verification
* makes it successful! */
else
fpi_imgdev_session_error(dev, FP_VERIFY_NO_MATCH);
/* When enrolling the lib won't restart the capture after a stage has
* completed, so we need to keep feeding it images till it's had enough.
* But after that it can't finalize enrollemnt until this callback exits.
* That's why we schedule elan_capture instead of running it directly. */
if (fpi_dev_get_dev_state(fpi_imgdev_get_dev(dev)) == DEV_STATE_ENROLLING
&& !fpi_timeout_add(10, elan_capture_async, dev))
fpi_imgdev_session_error(dev, -ETIME);
fpi_ssm_free(ssm);
}
static void elan_capture(struct fp_img_dev *dev)
{
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
G_DEBUG_HERE();
elan_dev_reset(elandev);
struct fpi_ssm *ssm =
fpi_ssm_new(fpi_imgdev_get_dev(dev), elan_capture_run_state, CAPTURE_NUM_STATES);
fpi_ssm_set_user_data(ssm, dev);
fpi_ssm_start(ssm, capture_complete);
}
enum calibrate_states {
CALIBRATE_START_1,
CALIBRATE_READ_DATA_1,
CALIBRATE_END_1,
CALIBRATE_START_2,
CALIBRATE_READ_DATA_2,
CALIBRATE_END_2,
CALIBRATE_NUM_STATES,
};
static void elan_calibrate_run_state(struct fpi_ssm *ssm)
{
switch (fpi_ssm_get_cur_state(ssm)) {
case CALIBRATE_START_1:
case CALIBRATE_START_2:
elan_run_cmds(ssm, calibrate_start_cmds,
calibrate_start_cmds_len, ELAN_CMD_TIMEOUT);
break;
case CALIBRATE_READ_DATA_1:
case CALIBRATE_READ_DATA_2:
elan_run_cmds(ssm, read_cmds, read_cmds_len, ELAN_CMD_TIMEOUT);
break;
case CALIBRATE_END_1:
case CALIBRATE_END_2:
elan_run_cmds(ssm, calibrate_end_cmds, calibrate_end_cmds_len,
ELAN_CMD_TIMEOUT);
}
}
static void calibrate_complete(struct fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
G_DEBUG_HERE();
if (elandev->deactivating)
elan_deactivate(dev);
else if (fpi_ssm_get_error(ssm))
fpi_imgdev_session_error(dev, fpi_ssm_get_error(ssm));
else {
fpi_imgdev_activate_complete(dev, fpi_ssm_get_error(ssm));
elan_capture(dev);
}
fpi_ssm_free(ssm);
}
static void elan_calibrate(struct fp_img_dev *dev)
{
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
G_DEBUG_HERE();
elan_dev_reset(elandev);
struct fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), elan_calibrate_run_state,
CALIBRATE_NUM_STATES);
fpi_ssm_set_user_data(ssm, dev);
fpi_ssm_start(ssm, calibrate_complete);
}
enum activate_states {
ACTIVATE_GET_SENSOR_DIM,
ACTIVATE_SET_SENSOR_DIM,
ACTIVATE_START,
ACTIVATE_READ_DATA,
ACTIVATE_END,
ACTIVATE_NUM_STATES,
};
static void elan_activate_run_state(struct fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
switch (fpi_ssm_get_cur_state(ssm)) {
case ACTIVATE_GET_SENSOR_DIM:
elan_run_cmds(ssm, get_sensor_dim_cmds, get_sensor_dim_cmds_len,
ELAN_CMD_TIMEOUT);
break;
case ACTIVATE_SET_SENSOR_DIM:
elandev->frame_width = elandev->last_read[2];
elandev->raw_frame_width = elandev->last_read[0];
elandev->frame_height =
elandev->raw_frame_width - 2 * ELAN_FRAME_MARGIN;
fpi_ssm_next_state(ssm);
break;
case ACTIVATE_START:
elan_run_cmds(ssm, init_start_cmds, init_start_cmds_len,
ELAN_CMD_TIMEOUT);
break;
case ACTIVATE_READ_DATA:
elan_run_cmds(ssm, read_cmds, read_cmds_len, ELAN_CMD_TIMEOUT);
break;
case ACTIVATE_END:
elan_run_cmds(ssm, init_end_cmds, init_end_cmds_len,
ELAN_CMD_TIMEOUT);
}
}
static void activate_complete(struct fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
G_DEBUG_HERE();
if (elandev->deactivating)
elan_deactivate(dev);
else if (fpi_ssm_get_error(ssm))
fpi_imgdev_session_error(dev, fpi_ssm_get_error(ssm));
else
elan_calibrate(dev);
fpi_ssm_free(ssm);
}
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
G_DEBUG_HERE();
elan_dev_reset(elandev);
struct fpi_ssm *ssm =
fpi_ssm_new(fpi_imgdev_get_dev(dev), elan_activate_run_state, ACTIVATE_NUM_STATES);
fpi_ssm_set_user_data(ssm, dev);
fpi_ssm_start(ssm, activate_complete);
return 0;
}
static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
{
struct elan_dev *elandev;
int r;
G_DEBUG_HERE();
r = libusb_claim_interface(fpi_imgdev_get_usb_dev(dev), 0);
if (r < 0) {
fp_err("could not claim interface 0: %s", libusb_error_name(r));
return r;
}
elandev = g_malloc0(sizeof(struct elan_dev));
fpi_imgdev_set_user_data(dev, elandev);
fpi_imgdev_open_complete(dev, 0);
return 0;
}
static void dev_deinit(struct fp_img_dev *dev)
{
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
G_DEBUG_HERE();
elan_dev_reset(elandev);
g_free(elandev);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev);
}
static void dev_deactivate(struct fp_img_dev *dev)
{
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
G_DEBUG_HERE();
elandev->deactivating = TRUE;
if (elandev->cur_transfer)
libusb_cancel_transfer(elandev->cur_transfer);
else
elan_deactivate(dev);
}
static const struct usb_id id_table[] = {
{.vendor = 0x04f3,.product = 0x0907},
{0, 0, 0,},
};
struct fp_img_driver elan_driver = {
.driver = {
.id = ELAN_ID,
.name = FP_COMPONENT,
.full_name = "ElanTech Fingerprint Sensor",
.id_table = id_table,
.scan_type = FP_SCAN_TYPE_SWIPE,
},
.flags = 0,
.bz3_threshold = 22,
.open = dev_init,
.close = dev_deinit,
.activate = dev_activate,
.deactivate = dev_deactivate,
};
+176
View File
@@ -0,0 +1,176 @@
/*
* Elan driver for libfprint
*
* Copyright (C) 2017 Igor Filatov <ia.filatov@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
*/
#ifndef __ELAN_H
#define __ELAN_H
#include <string.h>
#include <libusb.h>
/* number of pixels to discard on left and right (along raw image height)
* because they have different intensity from the rest of the frame */
#define ELAN_FRAME_MARGIN 12
/* min and max frames in a capture */
#define ELAN_MIN_FRAMES 7
#define ELAN_MAX_FRAMES 30
/* number of frames to drop at the end of capture because frames captured
* while the finger is being lifted can be bad */
#define ELAN_SKIP_LAST_FRAMES 1
#define ELAN_CMD_LEN 0x2
#define ELAN_EP_CMD_OUT (0x1 | LIBUSB_ENDPOINT_OUT)
#define ELAN_EP_CMD_IN (0x3 | LIBUSB_ENDPOINT_IN)
#define ELAN_EP_IMG_IN (0x2 | LIBUSB_ENDPOINT_IN)
/* usual command timeout and timeout for when we need to check if the finger is
* still on the device */
#define ELAN_CMD_TIMEOUT 10000
#define ELAN_FINGER_TIMEOUT 200
struct elan_cmd {
unsigned char cmd[ELAN_CMD_LEN];
int response_len;
int response_in;
};
static const struct elan_cmd get_sensor_dim_cmds[] = {
{
.cmd = {0x00, 0x0c},
.response_len = 0x4,
.response_in = ELAN_EP_CMD_IN,
},
};
static const size_t get_sensor_dim_cmds_len =
G_N_ELEMENTS(get_sensor_dim_cmds);
static const struct elan_cmd init_start_cmds[] = {
{
.cmd = {0x40, 0x19},
.response_len = 0x2,
.response_in = ELAN_EP_CMD_IN,
},
{
.cmd = {0x40, 0x2a},
.response_len = 0x2,
.response_in = ELAN_EP_CMD_IN,
},
};
static const size_t init_start_cmds_len = G_N_ELEMENTS(init_start_cmds);
static const struct elan_cmd read_cmds[] = {
/* raw frame sizes are calculated from image dimesions reported by the
* device */
{
.cmd = {0x00, 0x09},
.response_len = -1,
.response_in = ELAN_EP_IMG_IN,
},
};
const size_t read_cmds_len = G_N_ELEMENTS(read_cmds);
/* issued after data reads during init and calibration */
static const struct elan_cmd init_end_cmds[] = {
{
.cmd = {0x40, 0x24},
.response_len = 0x2,
.response_in = ELAN_EP_CMD_IN,
},
};
static const size_t init_end_cmds_len = G_N_ELEMENTS(init_end_cmds);
/* same command 2 times
* original driver may observe return value to determine how many times it
* should be repeated */
static const struct elan_cmd calibrate_start_cmds[] = {
{
.cmd = {0x40, 0x23},
.response_len = 0x1,
.response_in = ELAN_EP_CMD_IN,
},
{
.cmd = {0x40, 0x23},
.response_len = 0x1,
.response_in = ELAN_EP_CMD_IN,
},
};
static const size_t calibrate_start_cmds_len =
G_N_ELEMENTS(calibrate_start_cmds);
/* issued after data reads during init and calibration */
static const struct elan_cmd calibrate_end_cmds[] = {
{
.cmd = {0x40, 0x24},
.response_len = 0x2,
.response_in = ELAN_EP_CMD_IN,
},
};
static const size_t calibrate_end_cmds_len =
G_N_ELEMENTS(calibrate_end_cmds);
static const struct elan_cmd capture_start_cmds[] = {
/* led on */
{
.cmd = {0x40, 0x31},
.response_len = 0x0,
.response_in = ELAN_EP_CMD_IN,
},
};
static size_t capture_start_cmds_len = G_N_ELEMENTS(capture_start_cmds);
static const struct elan_cmd capture_wait_finger_cmds[] = {
/* wait for finger
* subsequent read will not complete until finger is placed on the reader */
{
.cmd = {0x40, 0x3f},
.response_len = 0x1,
.response_in = ELAN_EP_CMD_IN,
},
};
static size_t capture_wait_finger_cmds_len =
G_N_ELEMENTS(capture_wait_finger_cmds);
static const struct elan_cmd deactivate_cmds[] = {
/* led off */
{
.cmd = {0x00, 0x0b},
.response_len = 0x0,
.response_in = ELAN_EP_CMD_IN,
},
};
static const size_t deactivate_cmds_len = G_N_ELEMENTS(deactivate_cmds);
static void elan_cmd_cb(struct libusb_transfer *transfer);
static void elan_cmd_read(struct fpi_ssm *ssm);
static void elan_run_next_cmd(struct fpi_ssm *ssm);
static void elan_capture(struct fp_img_dev *dev);
#endif
+77 -84
View File
@@ -33,16 +33,9 @@
* *
*/ */
#include <string.h>
#include <stdint.h>
#include <stdarg.h>
#include <errno.h>
#include <assert.h>
#include <libusb.h>
#include <glib.h>
#define FP_COMPONENT "etes603" #define FP_COMPONENT "etes603"
#include <fp_internal.h>
#include "drivers_api.h"
#include "driver_ids.h" #include "driver_ids.h"
/* libusb defines */ /* libusb defines */
@@ -299,7 +292,7 @@ static void msg_get_regs(struct etes603_dev *dev, int n_args, ... )
va_list ap; va_list ap;
int i; int i;
assert(n_args > 0 && n_args <= REG_MAX); g_assert(n_args > 0 && n_args <= REG_MAX);
msg_header_prepare(msg); msg_header_prepare(msg);
msg->cmd = CMD_READ_REG; msg->cmd = CMD_READ_REG;
@@ -348,7 +341,7 @@ static void msg_set_regs(struct etes603_dev *dev, int n_args, ...)
va_list ap; va_list ap;
int i; int i;
assert(n_args != 0 && n_args % 2 == 0 && n_args <= REG_MAX * 2); g_assert(n_args != 0 && n_args % 2 == 0 && n_args <= REG_MAX * 2);
msg_header_prepare(msg); msg_header_prepare(msg);
msg->cmd = CMD_WRITE_REG; msg->cmd = CMD_WRITE_REG;
@@ -646,7 +639,7 @@ enum {
static int async_tx(struct fp_img_dev *idev, unsigned int ep, void *cb, static int async_tx(struct fp_img_dev *idev, unsigned int ep, void *cb,
void *cb_arg) void *cb_arg)
{ {
struct etes603_dev *dev = idev->priv; struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
unsigned char *buffer; unsigned char *buffer;
int length; int length;
@@ -663,7 +656,7 @@ static int async_tx(struct fp_img_dev *idev, unsigned int ep, void *cb,
} else { } else {
return -EIO; return -EIO;
} }
libusb_fill_bulk_transfer(transfer, idev->udev, ep, buffer, length, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(idev), ep, buffer, length,
cb, cb_arg, BULK_TIMEOUT); cb, cb_arg, BULK_TIMEOUT);
if (libusb_submit_transfer(transfer)) { if (libusb_submit_transfer(transfer)) {
@@ -677,8 +670,8 @@ static int async_tx(struct fp_img_dev *idev, unsigned int ep, void *cb,
static void async_tx_cb(struct libusb_transfer *transfer) static void async_tx_cb(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = idev->priv; struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) { if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
fp_warn("transfer is not completed (status=%d)", fp_warn("transfer is not completed (status=%d)",
@@ -708,10 +701,10 @@ static void async_tx_cb(struct libusb_transfer *transfer)
static void m_exit_state(struct fpi_ssm *ssm) static void m_exit_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = idev->priv; struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case EXIT_SET_REGS_REQ: case EXIT_SET_REGS_REQ:
msg_set_regs(dev, 4, REG_VCO_CONTROL, REG_VCO_IDLE, msg_set_regs(dev, 4, REG_VCO_CONTROL, REG_VCO_IDLE,
REG_MODE_CONTROL, REG_MODE_SLEEP); REG_MODE_CONTROL, REG_MODE_SLEEP);
@@ -724,7 +717,7 @@ static void m_exit_state(struct fpi_ssm *ssm)
fpi_ssm_mark_completed(ssm); fpi_ssm_mark_completed(ssm);
break; break;
default: default:
fp_err("Unknown state %d", ssm->cur_state); fp_err("Unknown state %d", fpi_ssm_get_cur_state(ssm));
goto err; goto err;
break; break;
} }
@@ -736,9 +729,9 @@ err:
static void m_exit_complete(struct fpi_ssm *ssm) static void m_exit_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
if (ssm->error) { if (fpi_ssm_get_error(ssm)) {
fp_err("Error switching the device to idle state"); fp_err("Error switching the device to idle state");
} else { } else {
fp_dbg("The device is now in idle state"); fp_dbg("The device is now in idle state");
@@ -749,24 +742,24 @@ static void m_exit_complete(struct fpi_ssm *ssm)
static void m_exit_start(struct fp_img_dev *idev) static void m_exit_start(struct fp_img_dev *idev)
{ {
struct fpi_ssm *ssm = fpi_ssm_new(idev->dev, m_exit_state, struct fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(idev), m_exit_state,
EXIT_NUM_STATES); EXIT_NUM_STATES);
fp_dbg("Switching device to idle mode"); fp_dbg("Switching device to idle mode");
ssm->priv = idev; fpi_ssm_set_user_data(ssm, idev);
fpi_ssm_start(ssm, m_exit_complete); fpi_ssm_start(ssm, m_exit_complete);
} }
static void m_capture_state(struct fpi_ssm *ssm) static void m_capture_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = idev->priv; struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
if (dev->is_active == FALSE) { if (dev->is_active == FALSE) {
fpi_ssm_mark_completed(ssm); fpi_ssm_mark_completed(ssm);
return; return;
} }
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case CAP_FP_INIT_SET_REG10_REQ: case CAP_FP_INIT_SET_REG10_REQ:
/* Reset fingerprint */ /* Reset fingerprint */
fp_dbg("Capturing a fingerprint..."); fp_dbg("Capturing a fingerprint...");
@@ -827,7 +820,7 @@ static void m_capture_state(struct fpi_ssm *ssm)
} }
break; break;
default: default:
fp_err("Unknown state %d", ssm->cur_state); fp_err("Unknown state %d", fpi_ssm_get_cur_state(ssm));
goto err; goto err;
break; break;
} }
@@ -839,14 +832,14 @@ err:
static void m_capture_complete(struct fpi_ssm *ssm) static void m_capture_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = idev->priv; struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
if (ssm->error) { if (fpi_ssm_get_error(ssm)) {
if (idev->action_state != IMG_ACQUIRE_STATE_DEACTIVATING) { if (fpi_imgdev_get_action_state(idev) != IMG_ACQUIRE_STATE_DEACTIVATING) {
fp_err("Error while capturing fingerprint " fp_err("Error while capturing fingerprint "
"(ssm->error=%d)", ssm->error); "(fpi_ssm_get_error(ssm)=%d)", fpi_ssm_get_error(ssm));
fpi_imgdev_session_error(idev, ssm->error); fpi_imgdev_session_error(idev, fpi_ssm_get_error(ssm));
} }
} }
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
@@ -861,15 +854,15 @@ static void m_capture_complete(struct fpi_ssm *ssm)
static void m_finger_state(struct fpi_ssm *ssm) static void m_finger_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = idev->priv; struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
if (dev->is_active == FALSE) { if (dev->is_active == FALSE) {
fpi_ssm_mark_completed(ssm); fpi_ssm_mark_completed(ssm);
return; return;
} }
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case FGR_FPA_INIT_SET_MODE_SLEEP_REQ: case FGR_FPA_INIT_SET_MODE_SLEEP_REQ:
msg_set_mode_control(dev, REG_MODE_SLEEP); msg_set_mode_control(dev, REG_MODE_SLEEP);
if (async_tx(idev, EP_OUT, async_tx_cb, ssm)) if (async_tx(idev, EP_OUT, async_tx_cb, ssm))
@@ -945,7 +938,7 @@ static void m_finger_state(struct fpi_ssm *ssm)
} }
break; break;
default: default:
fp_err("Unknown state %d", ssm->cur_state); fp_err("Unknown state %d", fpi_ssm_get_cur_state(ssm));
goto err; goto err;
break; break;
} }
@@ -957,19 +950,19 @@ err:
static void m_finger_complete(struct fpi_ssm *ssm) static void m_finger_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = idev->priv; struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
if (!ssm->error) { if (!fpi_ssm_get_error(ssm)) {
struct fpi_ssm *ssm_cap; struct fpi_ssm *ssm_cap;
ssm_cap = fpi_ssm_new(idev->dev, m_capture_state, ssm_cap = fpi_ssm_new(fpi_imgdev_get_dev(idev), m_capture_state,
CAP_NUM_STATES); CAP_NUM_STATES);
ssm_cap->priv = idev; fpi_ssm_set_user_data(ssm_cap, idev);
fpi_ssm_start(ssm_cap, m_capture_complete); fpi_ssm_start(ssm_cap, m_capture_complete);
} else { } else {
if (idev->action_state != IMG_ACQUIRE_STATE_DEACTIVATING) { if (fpi_imgdev_get_action_state(idev) != IMG_ACQUIRE_STATE_DEACTIVATING) {
fp_err("Error while capturing fingerprint " fp_err("Error while capturing fingerprint "
"(ssm->error=%d)", ssm->error); "(fpi_ssm_get_error(ssm)=%d)", fpi_ssm_get_error(ssm));
fpi_imgdev_session_error(idev, -4); fpi_imgdev_session_error(idev, -4);
} }
dev->is_active = FALSE; dev->is_active = FALSE;
@@ -981,8 +974,8 @@ static void m_finger_complete(struct fpi_ssm *ssm)
static void m_start_fingerdetect(struct fp_img_dev *idev) static void m_start_fingerdetect(struct fp_img_dev *idev)
{ {
struct fpi_ssm *ssmf; struct fpi_ssm *ssmf;
ssmf = fpi_ssm_new(idev->dev, m_finger_state, FGR_NUM_STATES); ssmf = fpi_ssm_new(fpi_imgdev_get_dev(idev), m_finger_state, FGR_NUM_STATES);
ssmf->priv = idev; fpi_ssm_set_user_data(ssmf, idev);
fpi_ssm_start(ssmf, m_finger_complete); fpi_ssm_start(ssmf, m_finger_complete);
} }
@@ -991,8 +984,8 @@ static void m_start_fingerdetect(struct fp_img_dev *idev)
*/ */
static void m_tunevrb_state(struct fpi_ssm *ssm) static void m_tunevrb_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = idev->priv; struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
float hist[5]; float hist[5];
if (dev->is_active == FALSE) { if (dev->is_active == FALSE) {
@@ -1000,10 +993,10 @@ static void m_tunevrb_state(struct fpi_ssm *ssm)
return; return;
} }
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case TUNEVRB_INIT: case TUNEVRB_INIT:
fp_dbg("Tuning of VRT/VRB"); fp_dbg("Tuning of VRT/VRB");
assert(dev->dcoffset); g_assert(dev->dcoffset);
/* VRT(reg E1)=0x0A and VRB(reg E2)=0x10 are starting values */ /* VRT(reg E1)=0x0A and VRB(reg E2)=0x10 are starting values */
dev->vrt = 0x0A; dev->vrt = 0x0A;
dev->vrb = 0x10; dev->vrb = 0x10;
@@ -1131,7 +1124,7 @@ static void m_tunevrb_state(struct fpi_ssm *ssm)
fpi_ssm_mark_completed(ssm); fpi_ssm_mark_completed(ssm);
break; break;
default: default:
fp_err("Unknown state %d", ssm->cur_state); fp_err("Unknown state %d", fpi_ssm_get_cur_state(ssm));
goto err; goto err;
break; break;
} }
@@ -1143,14 +1136,14 @@ err:
static void m_tunevrb_complete(struct fpi_ssm *ssm) static void m_tunevrb_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
fpi_imgdev_activate_complete(idev, ssm->error != 0); fpi_imgdev_activate_complete(idev, fpi_ssm_get_error(ssm) != 0);
if (!ssm->error) { if (!fpi_ssm_get_error(ssm)) {
fp_dbg("Tuning is done. Starting finger detection."); fp_dbg("Tuning is done. Starting finger detection.");
m_start_fingerdetect(idev); m_start_fingerdetect(idev);
} else { } else {
struct etes603_dev *dev = idev->priv; struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
fp_err("Error while tuning VRT"); fp_err("Error while tuning VRT");
dev->is_active = FALSE; dev->is_active = FALSE;
reset_param(dev); reset_param(dev);
@@ -1165,8 +1158,8 @@ static void m_tunevrb_complete(struct fpi_ssm *ssm)
*/ */
static void m_tunedc_state(struct fpi_ssm *ssm) static void m_tunedc_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = idev->priv; struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
if (dev->is_active == FALSE) { if (dev->is_active == FALSE) {
fpi_ssm_mark_completed(ssm); fpi_ssm_mark_completed(ssm);
@@ -1177,7 +1170,7 @@ static void m_tunedc_state(struct fpi_ssm *ssm)
* captured traffic to make sure that the value is correct. */ * captured traffic to make sure that the value is correct. */
/* The default gain should work but it may reach a DCOffset limit so in /* The default gain should work but it may reach a DCOffset limit so in
* this case we decrease the gain. */ * this case we decrease the gain. */
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case TUNEDC_INIT: case TUNEDC_INIT:
/* reg_e0 = 0x23 is sensor normal/small gain */ /* reg_e0 = 0x23 is sensor normal/small gain */
dev->gain = GAIN_SMALL_INIT; dev->gain = GAIN_SMALL_INIT;
@@ -1255,7 +1248,7 @@ static void m_tunedc_state(struct fpi_ssm *ssm)
fpi_ssm_mark_completed(ssm); fpi_ssm_mark_completed(ssm);
break; break;
default: default:
fp_err("Unknown state %d", ssm->cur_state); fp_err("Unknown state %d", fpi_ssm_get_cur_state(ssm));
goto err; goto err;
break; break;
} }
@@ -1268,15 +1261,15 @@ err:
static void m_tunedc_complete(struct fpi_ssm *ssm) static void m_tunedc_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
if (!ssm->error) { if (!fpi_ssm_get_error(ssm)) {
struct fpi_ssm *ssm_tune; struct fpi_ssm *ssm_tune;
ssm_tune = fpi_ssm_new(idev->dev, m_tunevrb_state, ssm_tune = fpi_ssm_new(fpi_imgdev_get_dev(idev), m_tunevrb_state,
TUNEVRB_NUM_STATES); TUNEVRB_NUM_STATES);
ssm_tune->priv = idev; fpi_ssm_set_user_data(ssm_tune, idev);
fpi_ssm_start(ssm_tune, m_tunevrb_complete); fpi_ssm_start(ssm_tune, m_tunevrb_complete);
} else { } else {
struct etes603_dev *dev = idev->priv; struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
fp_err("Error while tuning DCOFFSET"); fp_err("Error while tuning DCOFFSET");
dev->is_active = FALSE; dev->is_active = FALSE;
reset_param(dev); reset_param(dev);
@@ -1287,15 +1280,15 @@ static void m_tunedc_complete(struct fpi_ssm *ssm)
static void m_init_state(struct fpi_ssm *ssm) static void m_init_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct etes603_dev *dev = idev->priv; struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
if (dev->is_active == FALSE) { if (dev->is_active == FALSE) {
fpi_ssm_mark_completed(ssm); fpi_ssm_mark_completed(ssm);
return; return;
} }
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case INIT_CHECK_INFO_REQ: case INIT_CHECK_INFO_REQ:
msg_get_regs(dev, 4, REG_INFO0, REG_INFO1, REG_INFO2, msg_get_regs(dev, 4, REG_INFO0, REG_INFO1, REG_INFO2,
REG_INFO3); REG_INFO3);
@@ -1375,7 +1368,7 @@ static void m_init_state(struct fpi_ssm *ssm)
fpi_ssm_mark_completed(ssm); fpi_ssm_mark_completed(ssm);
break; break;
default: default:
fp_err("Unknown state %d", ssm->cur_state); fp_err("Unknown state %d", fpi_ssm_get_cur_state(ssm));
goto err; goto err;
break; break;
} }
@@ -1388,15 +1381,15 @@ err:
static void m_init_complete(struct fpi_ssm *ssm) static void m_init_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
if (!ssm->error) { if (!fpi_ssm_get_error(ssm)) {
struct fpi_ssm *ssm_tune; struct fpi_ssm *ssm_tune;
ssm_tune = fpi_ssm_new(idev->dev, m_tunedc_state, ssm_tune = fpi_ssm_new(fpi_imgdev_get_dev(idev), m_tunedc_state,
TUNEDC_NUM_STATES); TUNEDC_NUM_STATES);
ssm_tune->priv = idev; fpi_ssm_set_user_data(ssm_tune, idev);
fpi_ssm_start(ssm_tune, m_tunedc_complete); fpi_ssm_start(ssm_tune, m_tunedc_complete);
} else { } else {
struct etes603_dev *dev = idev->priv; struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
fp_err("Error initializing the device"); fp_err("Error initializing the device");
dev->is_active = FALSE; dev->is_active = FALSE;
reset_param(dev); reset_param(dev);
@@ -1407,10 +1400,10 @@ static void m_init_complete(struct fpi_ssm *ssm)
static int dev_activate(struct fp_img_dev *idev, enum fp_imgdev_state state) static int dev_activate(struct fp_img_dev *idev, enum fp_imgdev_state state)
{ {
struct etes603_dev *dev = idev->priv; struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
struct fpi_ssm *ssm; struct fpi_ssm *ssm;
assert(dev); g_assert(dev);
if (state != IMGDEV_STATE_AWAIT_FINGER_ON) { if (state != IMGDEV_STATE_AWAIT_FINGER_ON) {
fp_err("The driver is in an unexpected state: %d.", state); fp_err("The driver is in an unexpected state: %d.", state);
@@ -1423,16 +1416,16 @@ static int dev_activate(struct fp_img_dev *idev, enum fp_imgdev_state state)
if (dev->dcoffset == 0) { if (dev->dcoffset == 0) {
fp_dbg("Tuning device..."); fp_dbg("Tuning device...");
ssm = fpi_ssm_new(idev->dev, m_init_state, INIT_NUM_STATES); ssm = fpi_ssm_new(fpi_imgdev_get_dev(idev), m_init_state, INIT_NUM_STATES);
ssm->priv = idev; fpi_ssm_set_user_data(ssm, idev);
fpi_ssm_start(ssm, m_init_complete); fpi_ssm_start(ssm, m_init_complete);
} else { } else {
fp_dbg("Using previous tuning (DCOFFSET=0x%02X,VRT=0x%02X," fp_dbg("Using previous tuning (DCOFFSET=0x%02X,VRT=0x%02X,"
"VRB=0x%02X,GAIN=0x%02X).", dev->dcoffset, dev->vrt, "VRB=0x%02X,GAIN=0x%02X).", dev->dcoffset, dev->vrt,
dev->vrb, dev->gain); dev->vrb, dev->gain);
fpi_imgdev_activate_complete(idev, 0); fpi_imgdev_activate_complete(idev, 0);
ssm = fpi_ssm_new(idev->dev, m_finger_state, FGR_NUM_STATES); ssm = fpi_ssm_new(fpi_imgdev_get_dev(idev), m_finger_state, FGR_NUM_STATES);
ssm->priv = idev; fpi_ssm_set_user_data(ssm, idev);
fpi_ssm_start(ssm, m_finger_complete); fpi_ssm_start(ssm, m_finger_complete);
} }
return 0; return 0;
@@ -1440,7 +1433,7 @@ static int dev_activate(struct fp_img_dev *idev, enum fp_imgdev_state state)
static void dev_deactivate(struct fp_img_dev *idev) static void dev_deactivate(struct fp_img_dev *idev)
{ {
struct etes603_dev *dev = idev->priv; struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
fp_dbg("deactivating"); fp_dbg("deactivating");
@@ -1457,13 +1450,13 @@ static int dev_open(struct fp_img_dev *idev, unsigned long driver_data)
struct etes603_dev *dev; struct etes603_dev *dev;
dev = g_malloc0(sizeof(struct etes603_dev)); dev = g_malloc0(sizeof(struct etes603_dev));
idev->priv = dev; fpi_imgdev_set_user_data(idev, dev);
dev->req = g_malloc(sizeof(struct egis_msg)); dev->req = g_malloc(sizeof(struct egis_msg));
dev->ans = g_malloc(FE_SIZE); dev->ans = g_malloc(FE_SIZE);
dev->fp = g_malloc(FE_SIZE * 4); dev->fp = g_malloc(FE_SIZE * 4);
ret = libusb_claim_interface(idev->udev, 0); ret = libusb_claim_interface(fpi_imgdev_get_usb_dev(idev), 0);
if (ret != LIBUSB_SUCCESS) { if (ret != LIBUSB_SUCCESS) {
fp_err("libusb_claim_interface failed on interface 0: %s", libusb_error_name(ret)); fp_err("libusb_claim_interface failed on interface 0: %s", libusb_error_name(ret));
return ret; return ret;
@@ -1475,14 +1468,14 @@ static int dev_open(struct fp_img_dev *idev, unsigned long driver_data)
static void dev_close(struct fp_img_dev *idev) static void dev_close(struct fp_img_dev *idev)
{ {
struct etes603_dev *dev = idev->priv; struct etes603_dev *dev = fpi_imgdev_get_user_data(idev);
g_free(dev->req); g_free(dev->req);
g_free(dev->ans); g_free(dev->ans);
g_free(dev->fp); g_free(dev->fp);
g_free(dev); g_free(dev);
libusb_release_interface(idev->udev, 0); libusb_release_interface(fpi_imgdev_get_usb_dev(idev), 0);
fpi_imgdev_close_complete(idev); fpi_imgdev_close_complete(idev);
} }
+15 -22
View File
@@ -17,16 +17,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <libusb.h>
#define FP_COMPONENT "fdu2000" #define FP_COMPONENT "fdu2000"
#include <fp_internal.h>
#include "driver_ids.h" #include "drivers_api.h"
#ifndef HAVE_MEMMEM #ifndef HAVE_MEMMEM
gpointer gpointer
@@ -176,25 +169,25 @@ capture(struct fp_img_dev *dev, gboolean unconditional,
image = g_malloc0(RAW_IMAGE_SIZE); image = g_malloc0(RAW_IMAGE_SIZE);
if ((r = bulk_write_safe(dev->udev, LED_ON))) { if ((r = bulk_write_safe(fpi_imgdev_get_usb_dev(dev), LED_ON))) {
fp_err("Command: LED_ON"); fp_err("Command: LED_ON");
goto out; goto out;
} }
if ((r = bulk_write_safe(dev->udev, CAPTURE_READY))) { if ((r = bulk_write_safe(fpi_imgdev_get_usb_dev(dev), CAPTURE_READY))) {
fp_err("Command: CAPTURE_READY"); fp_err("Command: CAPTURE_READY");
goto out; goto out;
} }
read: read:
if ((r = bulk_write_safe(dev->udev, CAPTURE_READ))) { if ((r = bulk_write_safe(fpi_imgdev_get_usb_dev(dev), CAPTURE_READ))) {
fp_err("Command: CAPTURE_READ"); fp_err("Command: CAPTURE_READ");
goto out; goto out;
} }
/* Now we are ready to read from dev */ /* Now we are ready to read from dev */
r = libusb_bulk_transfer(dev->udev, &msg, &bytes, BULK_TIMEOUT * 10); r = libusb_bulk_transfer(fpi_imgdev_get_usb_dev(dev), &msg, &bytes, BULK_TIMEOUT * 10);
if (r < 0 || bytes < 1) if (r < 0 || bytes < 1)
goto read; goto read;
@@ -235,12 +228,12 @@ read:
} }
} }
if ((r = bulk_write_safe(dev->udev, CAPTURE_END))) { if ((r = bulk_write_safe(fpi_imgdev_get_usb_dev(dev), CAPTURE_END))) {
fp_err("Command: CAPTURE_END"); fp_err("Command: CAPTURE_END");
goto out; goto out;
} }
if ((r = bulk_write_safe(dev->udev, LED_OFF))) { if ((r = bulk_write_safe(fpi_imgdev_get_usb_dev(dev), LED_OFF))) {
fp_err("Command: LED_OFF"); fp_err("Command: LED_OFF");
goto out; goto out;
} }
@@ -261,27 +254,27 @@ static
gint dev_init(struct fp_img_dev *dev, unsigned long driver_data) gint dev_init(struct fp_img_dev *dev, unsigned long driver_data)
{ {
gint r; gint r;
//if ( (r = usb_set_configuration(dev->udev, 1)) < 0 ) //if ( (r = usb_set_configuration(fpi_imgdev_get_usb_dev(dev), 1)) < 0 )
// goto out; // goto out;
if ( (r = libusb_claim_interface(dev->udev, 0)) < 0 ) { if ( (r = libusb_claim_interface(fpi_imgdev_get_usb_dev(dev), 0)) < 0 ) {
fp_err("could not claim interface 0: %s", libusb_error_name(r)); fp_err("could not claim interface 0: %s", libusb_error_name(r));
return r; return r;
} }
//if ( (r = usb_set_altinterface(dev->udev, 1)) < 0 ) //if ( (r = usb_set_altinterface(fpi_imgdev_get_usb_dev(dev), 1)) < 0 )
// goto out; // goto out;
//if ( (r = usb_clear_halt(dev->udev, EP_CMD)) < 0 ) //if ( (r = usb_clear_halt(fpi_imgdev_get_usb_dev(dev), EP_CMD)) < 0 )
// goto out; // goto out;
/* Make sure sensor mode is not capture_{ready|read} */ /* Make sure sensor mode is not capture_{ready|read} */
if ((r = bulk_write_safe(dev->udev, CAPTURE_END))) { if ((r = bulk_write_safe(fpi_imgdev_get_usb_dev(dev), CAPTURE_END))) {
fp_err("Command: CAPTURE_END"); fp_err("Command: CAPTURE_END");
goto out; goto out;
} }
if ((r = bulk_write_safe(dev->udev, LED_OFF))) { if ((r = bulk_write_safe(fpi_imgdev_get_usb_dev(dev), LED_OFF))) {
fp_err("Command: LED_OFF"); fp_err("Command: LED_OFF");
goto out; goto out;
} }
@@ -296,10 +289,10 @@ out:
static static
void dev_exit(struct fp_img_dev *dev) void dev_exit(struct fp_img_dev *dev)
{ {
if (bulk_write_safe(dev->udev, CAPTURE_END)) if (bulk_write_safe(fpi_imgdev_get_usb_dev(dev), CAPTURE_END))
fp_err("Command: CAPTURE_END"); fp_err("Command: CAPTURE_END");
libusb_release_interface(dev->udev, 0); libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
} }
static const struct usb_id id_table[] = { static const struct usb_id id_table[] = {
File diff suppressed because it is too large Load Diff
+131 -128
View File
@@ -25,18 +25,8 @@
#define FP_COMPONENT "upeksonly" #define FP_COMPONENT "upeksonly"
#include <errno.h> #include "drivers_api.h"
#include <string.h>
#include <glib.h>
#include <libusb.h>
#include <fp_internal.h>
#include <assembling.h>
#include "upeksonly.h" #include "upeksonly.h"
#include "driver_ids.h"
#define CTRL_TIMEOUT 1000 #define CTRL_TIMEOUT 1000
#define NUM_BULK_TRANSFERS 24 #define NUM_BULK_TRANSFERS 24
@@ -186,7 +176,7 @@ static void free_img_transfers(struct sonly_dev *sdev)
static void last_transfer_killed(struct fp_img_dev *dev) static void last_transfer_killed(struct fp_img_dev *dev)
{ {
struct sonly_dev *sdev = dev->priv; struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
switch (sdev->killing_transfers) { switch (sdev->killing_transfers) {
case ABORT_SSM: case ABORT_SSM:
fp_dbg("abort ssm error %d", sdev->kill_status_code); fp_dbg("abort ssm error %d", sdev->kill_status_code);
@@ -207,7 +197,7 @@ static void last_transfer_killed(struct fp_img_dev *dev)
static void cancel_img_transfers(struct fp_img_dev *dev) static void cancel_img_transfers(struct fp_img_dev *dev)
{ {
struct sonly_dev *sdev = dev->priv; struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
int i; int i;
if (sdev->num_flying == 0) { if (sdev->num_flying == 0) {
@@ -234,7 +224,7 @@ static gboolean is_capturing(struct sonly_dev *sdev)
static void handoff_img(struct fp_img_dev *dev) static void handoff_img(struct fp_img_dev *dev)
{ {
struct sonly_dev *sdev = dev->priv; struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
struct fp_img *img; struct fp_img *img;
GSList *elem = sdev->rows; GSList *elem = sdev->rows;
@@ -246,7 +236,7 @@ static void handoff_img(struct fp_img_dev *dev)
sdev->rows = g_slist_reverse(sdev->rows); sdev->rows = g_slist_reverse(sdev->rows);
fp_dbg("%d rows", sdev->num_rows); fp_dbg("%lu rows", sdev->num_rows);
img = fpi_assemble_lines(&assembling_ctx, sdev->rows, sdev->num_rows); img = fpi_assemble_lines(&assembling_ctx, sdev->rows, sdev->num_rows);
g_slist_free_full(sdev->rows, g_free); g_slist_free_full(sdev->rows, g_free);
@@ -262,7 +252,7 @@ static void handoff_img(struct fp_img_dev *dev)
static void row_complete(struct fp_img_dev *dev) static void row_complete(struct fp_img_dev *dev)
{ {
struct sonly_dev *sdev = dev->priv; struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
sdev->rowbuf_offset = -1; sdev->rowbuf_offset = -1;
if (sdev->num_rows > 0) { if (sdev->num_rows > 0) {
@@ -312,7 +302,7 @@ static void row_complete(struct fp_img_dev *dev)
*/ */
if (sdev->num_blank > FINGER_REMOVED_THRESHOLD) { if (sdev->num_blank > FINGER_REMOVED_THRESHOLD) {
sdev->finger_state = FINGER_REMOVED; sdev->finger_state = FINGER_REMOVED;
fp_dbg("detected finger removal. Blank rows: %d, Full rows: %d", sdev->num_blank, sdev->num_rows); fp_dbg("detected finger removal. Blank rows: %d, Full rows: %lu", sdev->num_blank, sdev->num_rows);
handoff_img(dev); handoff_img(dev);
return; return;
} }
@@ -350,7 +340,7 @@ static void row_complete(struct fp_img_dev *dev)
/* add data to row buffer */ /* add data to row buffer */
static void add_to_rowbuf(struct fp_img_dev *dev, unsigned char *data, int size) static void add_to_rowbuf(struct fp_img_dev *dev, unsigned char *data, int size)
{ {
struct sonly_dev *sdev = dev->priv; struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
memcpy(sdev->rowbuf + sdev->rowbuf_offset, data, size); memcpy(sdev->rowbuf + sdev->rowbuf_offset, data, size);
sdev->rowbuf_offset += size; sdev->rowbuf_offset += size;
@@ -384,7 +374,7 @@ static int rowbuf_remaining(struct sonly_dev *sdev)
static void handle_packet(struct fp_img_dev *dev, unsigned char *data) static void handle_packet(struct fp_img_dev *dev, unsigned char *data)
{ {
struct sonly_dev *sdev = dev->priv; struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
uint16_t seqnum = data[0] << 8 | data[1]; uint16_t seqnum = data[0] << 8 | data[1];
int abs_base_addr; int abs_base_addr;
int for_rowbuf; int for_rowbuf;
@@ -480,7 +470,7 @@ static void img_data_cb(struct libusb_transfer *transfer)
{ {
struct img_transfer_data *idata = transfer->user_data; struct img_transfer_data *idata = transfer->user_data;
struct fp_img_dev *dev = idata->dev; struct fp_img_dev *dev = idata->dev;
struct sonly_dev *sdev = dev->priv; struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
int i; int i;
idata->flying = FALSE; idata->flying = FALSE;
@@ -589,6 +579,7 @@ static void sm_write_regs(struct fpi_ssm *ssm,
{ {
struct write_regs_data *wrdata = g_malloc(sizeof(*wrdata)); struct write_regs_data *wrdata = g_malloc(sizeof(*wrdata));
unsigned char *data; unsigned char *data;
struct fp_dev *dev;
wrdata->transfer = libusb_alloc_transfer(0); wrdata->transfer = libusb_alloc_transfer(0);
if (!wrdata->transfer) { if (!wrdata->transfer) {
@@ -599,7 +590,9 @@ static void sm_write_regs(struct fpi_ssm *ssm,
data = g_malloc(LIBUSB_CONTROL_SETUP_SIZE + 1); data = g_malloc(LIBUSB_CONTROL_SETUP_SIZE + 1);
libusb_fill_control_setup(data, 0x40, 0x0c, 0, 0, 1); libusb_fill_control_setup(data, 0x40, 0x0c, 0, 0, 1);
libusb_fill_control_transfer(wrdata->transfer, ssm->dev->udev, data, dev = fpi_ssm_get_dev(ssm);
libusb_fill_control_transfer(wrdata->transfer,
fpi_dev_get_usb_dev(dev), data,
write_regs_cb, wrdata, CTRL_TIMEOUT); write_regs_cb, wrdata, CTRL_TIMEOUT);
wrdata->transfer->flags = LIBUSB_TRANSFER_SHORT_NOT_OK; wrdata->transfer->flags = LIBUSB_TRANSFER_SHORT_NOT_OK;
@@ -623,7 +616,7 @@ static void sm_write_reg_cb(struct libusb_transfer *transfer)
static void sm_write_reg(struct fpi_ssm *ssm, uint8_t reg, uint8_t value) static void sm_write_reg(struct fpi_ssm *ssm, uint8_t reg, uint8_t value)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
unsigned char *data; unsigned char *data;
int r; int r;
@@ -636,7 +629,8 @@ static void sm_write_reg(struct fpi_ssm *ssm, uint8_t reg, uint8_t value)
fp_dbg("set %02x=%02x", reg, value); fp_dbg("set %02x=%02x", reg, value);
data = g_malloc(LIBUSB_CONTROL_SETUP_SIZE + 1); data = g_malloc(LIBUSB_CONTROL_SETUP_SIZE + 1);
libusb_fill_control_setup(data, 0x40, 0x0c, 0, reg, 1); libusb_fill_control_setup(data, 0x40, 0x0c, 0, reg, 1);
libusb_fill_control_transfer(transfer, dev->udev, data, sm_write_reg_cb, libusb_fill_control_transfer(transfer, fpi_imgdev_get_usb_dev(dev),
data, sm_write_reg_cb,
ssm, CTRL_TIMEOUT); ssm, CTRL_TIMEOUT);
data[LIBUSB_CONTROL_SETUP_SIZE] = value; data[LIBUSB_CONTROL_SETUP_SIZE] = value;
@@ -654,8 +648,8 @@ static void sm_write_reg(struct fpi_ssm *ssm, uint8_t reg, uint8_t value)
static void sm_read_reg_cb(struct libusb_transfer *transfer) static void sm_read_reg_cb(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = dev->priv; struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) { if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
fpi_ssm_mark_aborted(ssm, -EIO); fpi_ssm_mark_aborted(ssm, -EIO);
@@ -670,7 +664,7 @@ static void sm_read_reg_cb(struct libusb_transfer *transfer)
static void sm_read_reg(struct fpi_ssm *ssm, uint8_t reg) static void sm_read_reg(struct fpi_ssm *ssm, uint8_t reg)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
unsigned char *data; unsigned char *data;
int r; int r;
@@ -683,7 +677,8 @@ static void sm_read_reg(struct fpi_ssm *ssm, uint8_t reg)
fp_dbg("read reg %02x", reg); fp_dbg("read reg %02x", reg);
data = g_malloc(LIBUSB_CONTROL_SETUP_SIZE + 8); data = g_malloc(LIBUSB_CONTROL_SETUP_SIZE + 8);
libusb_fill_control_setup(data, 0xc0, 0x0c, 0, reg, 8); libusb_fill_control_setup(data, 0xc0, 0x0c, 0, reg, 8);
libusb_fill_control_transfer(transfer, dev->udev, data, sm_read_reg_cb, libusb_fill_control_transfer(transfer, fpi_imgdev_get_usb_dev(dev),
data, sm_read_reg_cb,
ssm, CTRL_TIMEOUT); ssm, CTRL_TIMEOUT);
transfer->flags = LIBUSB_TRANSFER_SHORT_NOT_OK | transfer->flags = LIBUSB_TRANSFER_SHORT_NOT_OK |
LIBUSB_TRANSFER_FREE_TRANSFER; LIBUSB_TRANSFER_FREE_TRANSFER;
@@ -699,8 +694,8 @@ static void sm_read_reg(struct fpi_ssm *ssm, uint8_t reg)
static void sm_await_intr_cb(struct libusb_transfer *transfer) static void sm_await_intr_cb(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = dev->priv; struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) { if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
g_free(transfer->buffer); g_free(transfer->buffer);
@@ -720,7 +715,7 @@ static void sm_await_intr_cb(struct libusb_transfer *transfer)
static void sm_await_intr(struct fpi_ssm *ssm) static void sm_await_intr(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
unsigned char *data; unsigned char *data;
int r; int r;
@@ -730,9 +725,10 @@ static void sm_await_intr(struct fpi_ssm *ssm)
return; return;
} }
fp_dbg(""); G_DEBUG_HERE();
data = g_malloc(4); data = g_malloc(4);
libusb_fill_interrupt_transfer(transfer, dev->udev, 0x83, data, 4, libusb_fill_interrupt_transfer(transfer, fpi_imgdev_get_usb_dev(dev),
0x83, data, 4,
sm_await_intr_cb, ssm, 0); sm_await_intr_cb, ssm, 0);
transfer->flags = LIBUSB_TRANSFER_SHORT_NOT_OK | transfer->flags = LIBUSB_TRANSFER_SHORT_NOT_OK |
LIBUSB_TRANSFER_FREE_TRANSFER; LIBUSB_TRANSFER_FREE_TRANSFER;
@@ -769,10 +765,10 @@ enum awfsm_1000_states {
static void awfsm_2016_run_state(struct fpi_ssm *ssm) static void awfsm_2016_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = dev->priv; struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case AWFSM_2016_WRITEV_1: case AWFSM_2016_WRITEV_1:
sm_write_regs(ssm, awfsm_2016_writev_1, G_N_ELEMENTS(awfsm_2016_writev_1)); sm_write_regs(ssm, awfsm_2016_writev_1, G_N_ELEMENTS(awfsm_2016_writev_1));
break; break;
@@ -816,7 +812,7 @@ static void awfsm_2016_run_state(struct fpi_ssm *ssm)
static void awfsm_1000_run_state(struct fpi_ssm *ssm) static void awfsm_1000_run_state(struct fpi_ssm *ssm)
{ {
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case AWFSM_1000_WRITEV_1: case AWFSM_1000_WRITEV_1:
sm_write_regs(ssm, awfsm_1000_writev_1, G_N_ELEMENTS(awfsm_1000_writev_1)); sm_write_regs(ssm, awfsm_1000_writev_1, G_N_ELEMENTS(awfsm_1000_writev_1));
break; break;
@@ -857,8 +853,8 @@ enum capsm_1001_states {
static void capsm_fire_bulk(struct fpi_ssm *ssm) static void capsm_fire_bulk(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = dev->priv; struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
int i; int i;
for (i = 0; i < NUM_BULK_TRANSFERS; i++) { for (i = 0; i < NUM_BULK_TRANSFERS; i++) {
int r = libusb_submit_transfer(sdev->img_transfer[i]); int r = libusb_submit_transfer(sdev->img_transfer[i]);
@@ -887,10 +883,10 @@ static void capsm_fire_bulk(struct fpi_ssm *ssm)
static void capsm_2016_run_state(struct fpi_ssm *ssm) static void capsm_2016_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = dev->priv; struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case CAPSM_2016_INIT: case CAPSM_2016_INIT:
sdev->rowbuf_offset = -1; sdev->rowbuf_offset = -1;
sdev->num_rows = 0; sdev->num_rows = 0;
@@ -919,10 +915,10 @@ static void capsm_2016_run_state(struct fpi_ssm *ssm)
static void capsm_1000_run_state(struct fpi_ssm *ssm) static void capsm_1000_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = dev->priv; struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case CAPSM_1000_INIT: case CAPSM_1000_INIT:
sdev->rowbuf_offset = -1; sdev->rowbuf_offset = -1;
sdev->num_rows = 0; sdev->num_rows = 0;
@@ -945,10 +941,10 @@ static void capsm_1000_run_state(struct fpi_ssm *ssm)
static void capsm_1001_run_state(struct fpi_ssm *ssm) static void capsm_1001_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = dev->priv; struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case CAPSM_1001_INIT: case CAPSM_1001_INIT:
sdev->rowbuf_offset = -1; sdev->rowbuf_offset = -1;
sdev->num_rows = 0; sdev->num_rows = 0;
@@ -1000,7 +996,7 @@ enum deinitsm_1001_states {
static void deinitsm_2016_run_state(struct fpi_ssm *ssm) static void deinitsm_2016_run_state(struct fpi_ssm *ssm)
{ {
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case DEINITSM_2016_WRITEV: case DEINITSM_2016_WRITEV:
sm_write_regs(ssm, deinitsm_2016_writev, G_N_ELEMENTS(deinitsm_2016_writev)); sm_write_regs(ssm, deinitsm_2016_writev, G_N_ELEMENTS(deinitsm_2016_writev));
break; break;
@@ -1009,7 +1005,7 @@ static void deinitsm_2016_run_state(struct fpi_ssm *ssm)
static void deinitsm_1000_run_state(struct fpi_ssm *ssm) static void deinitsm_1000_run_state(struct fpi_ssm *ssm)
{ {
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case DEINITSM_1000_WRITEV: case DEINITSM_1000_WRITEV:
sm_write_regs(ssm, deinitsm_1000_writev, G_N_ELEMENTS(deinitsm_1000_writev)); sm_write_regs(ssm, deinitsm_1000_writev, G_N_ELEMENTS(deinitsm_1000_writev));
break; break;
@@ -1018,7 +1014,7 @@ static void deinitsm_1000_run_state(struct fpi_ssm *ssm)
static void deinitsm_1001_run_state(struct fpi_ssm *ssm) static void deinitsm_1001_run_state(struct fpi_ssm *ssm)
{ {
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case DEINITSM_1001_WRITEV: case DEINITSM_1001_WRITEV:
sm_write_regs(ssm, deinitsm_1001_writev, G_N_ELEMENTS(deinitsm_1001_writev)); sm_write_regs(ssm, deinitsm_1001_writev, G_N_ELEMENTS(deinitsm_1001_writev));
break; break;
@@ -1054,10 +1050,10 @@ enum initsm_1001_states {
static void initsm_2016_run_state(struct fpi_ssm *ssm) static void initsm_2016_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = dev->priv; struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case INITSM_2016_WRITEV_1: case INITSM_2016_WRITEV_1:
sm_write_regs(ssm, initsm_2016_writev_1, G_N_ELEMENTS(initsm_2016_writev_1)); sm_write_regs(ssm, initsm_2016_writev_1, G_N_ELEMENTS(initsm_2016_writev_1));
break; break;
@@ -1084,7 +1080,7 @@ static void initsm_2016_run_state(struct fpi_ssm *ssm)
static void initsm_1000_run_state(struct fpi_ssm *ssm) static void initsm_1000_run_state(struct fpi_ssm *ssm)
{ {
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case INITSM_1000_WRITEV_1: case INITSM_1000_WRITEV_1:
sm_write_regs(ssm, initsm_1000_writev_1, G_N_ELEMENTS(initsm_1000_writev_1)); sm_write_regs(ssm, initsm_1000_writev_1, G_N_ELEMENTS(initsm_1000_writev_1));
break; break;
@@ -1093,7 +1089,7 @@ static void initsm_1000_run_state(struct fpi_ssm *ssm)
static void initsm_1001_run_state(struct fpi_ssm *ssm) static void initsm_1001_run_state(struct fpi_ssm *ssm)
{ {
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case INITSM_1001_WRITEV_1: case INITSM_1001_WRITEV_1:
sm_write_regs(ssm, initsm_1001_writev_1, G_N_ELEMENTS(initsm_1001_writev_1)); sm_write_regs(ssm, initsm_1001_writev_1, G_N_ELEMENTS(initsm_1001_writev_1));
break; break;
@@ -1126,10 +1122,10 @@ enum loopsm_states {
static void loopsm_run_state(struct fpi_ssm *ssm) static void loopsm_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = dev->priv; struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case LOOPSM_RUN_AWFSM: ; case LOOPSM_RUN_AWFSM: ;
switch (sdev->dev_model) { switch (sdev->dev_model) {
case UPEKSONLY_1001: case UPEKSONLY_1001:
@@ -1146,15 +1142,15 @@ static void loopsm_run_state(struct fpi_ssm *ssm)
struct fpi_ssm *awfsm = NULL; struct fpi_ssm *awfsm = NULL;
switch (sdev->dev_model) { switch (sdev->dev_model) {
case UPEKSONLY_2016: case UPEKSONLY_2016:
awfsm = fpi_ssm_new(dev->dev, awfsm_2016_run_state, awfsm = fpi_ssm_new(fpi_imgdev_get_dev(dev), awfsm_2016_run_state,
AWFSM_2016_NUM_STATES); AWFSM_2016_NUM_STATES);
break; break;
case UPEKSONLY_1000: case UPEKSONLY_1000:
awfsm = fpi_ssm_new(dev->dev, awfsm_1000_run_state, awfsm = fpi_ssm_new(fpi_imgdev_get_dev(dev), awfsm_1000_run_state,
AWFSM_1000_NUM_STATES); AWFSM_1000_NUM_STATES);
break; break;
} }
awfsm->priv = dev; fpi_ssm_set_user_data(awfsm, dev);
fpi_ssm_start_subsm(ssm, awfsm); fpi_ssm_start_subsm(ssm, awfsm);
} }
break; break;
@@ -1174,19 +1170,19 @@ static void loopsm_run_state(struct fpi_ssm *ssm)
struct fpi_ssm *capsm = NULL; struct fpi_ssm *capsm = NULL;
switch (sdev->dev_model) { switch (sdev->dev_model) {
case UPEKSONLY_2016: case UPEKSONLY_2016:
capsm = fpi_ssm_new(dev->dev, capsm_2016_run_state, capsm = fpi_ssm_new(fpi_imgdev_get_dev(dev), capsm_2016_run_state,
CAPSM_2016_NUM_STATES); CAPSM_2016_NUM_STATES);
break; break;
case UPEKSONLY_1000: case UPEKSONLY_1000:
capsm = fpi_ssm_new(dev->dev, capsm_1000_run_state, capsm = fpi_ssm_new(fpi_imgdev_get_dev(dev), capsm_1000_run_state,
CAPSM_1000_NUM_STATES); CAPSM_1000_NUM_STATES);
break; break;
case UPEKSONLY_1001: case UPEKSONLY_1001:
capsm = fpi_ssm_new(dev->dev, capsm_1001_run_state, capsm = fpi_ssm_new(fpi_imgdev_get_dev(dev), capsm_1001_run_state,
CAPSM_1001_NUM_STATES); CAPSM_1001_NUM_STATES);
break; break;
} }
capsm->priv = dev; fpi_ssm_set_user_data(capsm, dev);
fpi_ssm_start_subsm(ssm, capsm); fpi_ssm_start_subsm(ssm, capsm);
break; break;
case LOOPSM_CAPTURE: case LOOPSM_CAPTURE:
@@ -1195,20 +1191,20 @@ static void loopsm_run_state(struct fpi_ssm *ssm)
struct fpi_ssm *deinitsm = NULL; struct fpi_ssm *deinitsm = NULL;
switch (sdev->dev_model) { switch (sdev->dev_model) {
case UPEKSONLY_2016: case UPEKSONLY_2016:
deinitsm = fpi_ssm_new(dev->dev, deinitsm_2016_run_state, deinitsm = fpi_ssm_new(fpi_imgdev_get_dev(dev), deinitsm_2016_run_state,
DEINITSM_2016_NUM_STATES); DEINITSM_2016_NUM_STATES);
break; break;
case UPEKSONLY_1000: case UPEKSONLY_1000:
deinitsm = fpi_ssm_new(dev->dev, deinitsm_1000_run_state, deinitsm = fpi_ssm_new(fpi_imgdev_get_dev(dev), deinitsm_1000_run_state,
DEINITSM_1000_NUM_STATES); DEINITSM_1000_NUM_STATES);
break; break;
case UPEKSONLY_1001: case UPEKSONLY_1001:
deinitsm = fpi_ssm_new(dev->dev, deinitsm_1001_run_state, deinitsm = fpi_ssm_new(fpi_imgdev_get_dev(dev), deinitsm_1001_run_state,
DEINITSM_1001_NUM_STATES); DEINITSM_1001_NUM_STATES);
break; break;
} }
sdev->capturing = FALSE; sdev->capturing = FALSE;
deinitsm->priv = dev; fpi_ssm_set_user_data(deinitsm, dev);
fpi_ssm_start_subsm(ssm, deinitsm); fpi_ssm_start_subsm(ssm, deinitsm);
break; break;
case LOOPSM_FINAL: case LOOPSM_FINAL:
@@ -1222,9 +1218,9 @@ static void loopsm_run_state(struct fpi_ssm *ssm)
static void deactivate_done(struct fp_img_dev *dev) static void deactivate_done(struct fp_img_dev *dev)
{ {
struct sonly_dev *sdev = dev->priv; struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
fp_dbg(""); G_DEBUG_HERE();
free_img_transfers(sdev); free_img_transfers(sdev);
g_free(sdev->rowbuf); g_free(sdev->rowbuf);
sdev->rowbuf = NULL; sdev->rowbuf = NULL;
@@ -1239,7 +1235,7 @@ static void deactivate_done(struct fp_img_dev *dev)
static void dev_deactivate(struct fp_img_dev *dev) static void dev_deactivate(struct fp_img_dev *dev)
{ {
struct sonly_dev *sdev = dev->priv; struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
if (!sdev->capturing) { if (!sdev->capturing) {
deactivate_done(dev); deactivate_done(dev);
@@ -1254,9 +1250,9 @@ static void dev_deactivate(struct fp_img_dev *dev)
static void loopsm_complete(struct fpi_ssm *ssm) static void loopsm_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = dev->priv; struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
int r = ssm->error; int r = fpi_ssm_get_error(ssm);
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
@@ -1273,23 +1269,23 @@ static void loopsm_complete(struct fpi_ssm *ssm)
static void initsm_complete(struct fpi_ssm *ssm) static void initsm_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct sonly_dev *sdev = dev->priv; struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
int r = ssm->error; int r = fpi_ssm_get_error(ssm);
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
fpi_imgdev_activate_complete(dev, r); fpi_imgdev_activate_complete(dev, r);
if (r != 0) if (r != 0)
return; return;
sdev->loopsm = fpi_ssm_new(dev->dev, loopsm_run_state, LOOPSM_NUM_STATES); sdev->loopsm = fpi_ssm_new(fpi_imgdev_get_dev(dev), loopsm_run_state, LOOPSM_NUM_STATES);
sdev->loopsm->priv = dev; fpi_ssm_set_user_data(sdev->loopsm, dev);
fpi_ssm_start(sdev->loopsm, loopsm_complete); fpi_ssm_start(sdev->loopsm, loopsm_complete);
} }
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state) static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{ {
struct sonly_dev *sdev = dev->priv; struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *ssm = NULL; struct fpi_ssm *ssm = NULL;
int i; int i;
@@ -1311,71 +1307,35 @@ static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
sdev->img_transfer_data[i].idx = i; sdev->img_transfer_data[i].idx = i;
sdev->img_transfer_data[i].dev = dev; sdev->img_transfer_data[i].dev = dev;
data = g_malloc(4096); data = g_malloc(4096);
libusb_fill_bulk_transfer(sdev->img_transfer[i], dev->udev, 0x81, data, libusb_fill_bulk_transfer(sdev->img_transfer[i], fpi_imgdev_get_usb_dev(dev),
0x81, data,
4096, img_data_cb, &sdev->img_transfer_data[i], 0); 4096, img_data_cb, &sdev->img_transfer_data[i], 0);
} }
switch (sdev->dev_model) { switch (sdev->dev_model) {
case UPEKSONLY_2016: case UPEKSONLY_2016:
ssm = fpi_ssm_new(dev->dev, initsm_2016_run_state, INITSM_2016_NUM_STATES); ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), initsm_2016_run_state, INITSM_2016_NUM_STATES);
break; break;
case UPEKSONLY_1000: case UPEKSONLY_1000:
ssm = fpi_ssm_new(dev->dev, initsm_1000_run_state, INITSM_1000_NUM_STATES); ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), initsm_1000_run_state, INITSM_1000_NUM_STATES);
break; break;
case UPEKSONLY_1001: case UPEKSONLY_1001:
ssm = fpi_ssm_new(dev->dev, initsm_1001_run_state, INITSM_1001_NUM_STATES); ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), initsm_1001_run_state, INITSM_1001_NUM_STATES);
break; break;
} }
ssm->priv = dev; fpi_ssm_set_user_data(ssm, dev);
fpi_ssm_start(ssm, initsm_complete); fpi_ssm_start(ssm, initsm_complete);
return 0; return 0;
} }
static int dev_init(struct fp_img_dev *dev, unsigned long driver_data) static int dev_init(struct fp_img_dev *dev, unsigned long driver_data);
{
int r;
struct sonly_dev *sdev;
r = libusb_set_configuration(dev->udev, 1);
if (r < 0) {
fp_err("could not set configuration 1");
return r;
}
r = libusb_claim_interface(dev->udev, 0);
if (r < 0) {
fp_err("could not claim interface 0: %s", libusb_error_name(r));
return r;
}
sdev = dev->priv = g_malloc0(sizeof(struct sonly_dev));
sdev->dev_model = (int)driver_data;
switch (driver_data) {
case UPEKSONLY_1000:
sdev->img_width = IMG_WIDTH_1000;
upeksonly_driver.img_width = IMG_WIDTH_1000;
assembling_ctx.line_width = IMG_WIDTH_1000;
break;
case UPEKSONLY_1001:
sdev->img_width = IMG_WIDTH_1001;
upeksonly_driver.img_width = IMG_WIDTH_1001;
upeksonly_driver.bz3_threshold = 25;
assembling_ctx.line_width = IMG_WIDTH_1001;
break;
case UPEKSONLY_2016:
sdev->img_width = IMG_WIDTH_2016;
upeksonly_driver.img_width = IMG_WIDTH_2016;
assembling_ctx.line_width = IMG_WIDTH_2016;
break;
}
fpi_imgdev_open_complete(dev, 0);
return 0;
}
static void dev_deinit(struct fp_img_dev *dev) static void dev_deinit(struct fp_img_dev *dev)
{ {
g_free(dev->priv); void *user_data;
libusb_release_interface(dev->udev, 0); user_data = fpi_imgdev_get_user_data(dev);
g_free(user_data);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);
} }
@@ -1422,3 +1382,46 @@ struct fp_img_driver upeksonly_driver = {
.deactivate = dev_deactivate, .deactivate = dev_deactivate,
}; };
static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
{
int r;
struct sonly_dev *sdev;
r = libusb_set_configuration(fpi_imgdev_get_usb_dev(dev), 1);
if (r < 0) {
fp_err("could not set configuration 1");
return r;
}
r = libusb_claim_interface(fpi_imgdev_get_usb_dev(dev), 0);
if (r < 0) {
fp_err("could not claim interface 0: %s", libusb_error_name(r));
return r;
}
sdev = g_malloc0(sizeof(struct sonly_dev));
fpi_imgdev_set_user_data(dev, sdev);
sdev->dev_model = (int)driver_data;
switch (driver_data) {
case UPEKSONLY_1000:
sdev->img_width = IMG_WIDTH_1000;
upeksonly_driver.img_width = IMG_WIDTH_1000;
assembling_ctx.line_width = IMG_WIDTH_1000;
break;
case UPEKSONLY_1001:
sdev->img_width = IMG_WIDTH_1001;
upeksonly_driver.img_width = IMG_WIDTH_1001;
upeksonly_driver.bz3_threshold = 25;
assembling_ctx.line_width = IMG_WIDTH_1001;
break;
case UPEKSONLY_2016:
sdev->img_width = IMG_WIDTH_2016;
upeksonly_driver.img_width = IMG_WIDTH_2016;
assembling_ctx.line_width = IMG_WIDTH_2016;
break;
}
fpi_imgdev_open_complete(dev, 0);
return 0;
}
+51 -53
View File
@@ -20,13 +20,8 @@
#define FP_COMPONENT "upektc" #define FP_COMPONENT "upektc"
#include <errno.h> #include "drivers_api.h"
#include <string.h>
#include <libusb.h>
#include <fp_internal.h>
#include "upektc.h" #include "upektc.h"
#include "driver_ids.h"
#define UPEKTC_EP_IN (2 | LIBUSB_ENDPOINT_IN) #define UPEKTC_EP_IN (2 | LIBUSB_ENDPOINT_IN)
#define UPEKTC_EP_OUT (3 | LIBUSB_ENDPOINT_OUT) #define UPEKTC_EP_OUT (3 | LIBUSB_ENDPOINT_OUT)
@@ -63,8 +58,8 @@ enum activate_states {
static void upektc_next_init_cmd(struct fpi_ssm *ssm) static void upektc_next_init_cmd(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_dev *upekdev = dev->priv; struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev);
upekdev->init_idx += 1; upekdev->init_idx += 1;
if (upekdev->init_idx == upekdev->setup_commands_len) if (upekdev->init_idx == upekdev->setup_commands_len)
@@ -76,8 +71,8 @@ static void upektc_next_init_cmd(struct fpi_ssm *ssm)
static void write_init_cb(struct libusb_transfer *transfer) static void write_init_cb(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_dev *upekdev = dev->priv; struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev);
if ((transfer->status == LIBUSB_TRANSFER_COMPLETED) && if ((transfer->status == LIBUSB_TRANSFER_COMPLETED) &&
(transfer->length == transfer->actual_length)) { (transfer->length == transfer->actual_length)) {
@@ -105,11 +100,11 @@ static void read_init_data_cb(struct libusb_transfer *transfer)
static void activate_run_state(struct fpi_ssm *ssm) static void activate_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_dev *upekdev = dev->priv; struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev);
int r; int r;
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case WRITE_INIT: case WRITE_INIT:
{ {
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
@@ -117,7 +112,7 @@ static void activate_run_state(struct fpi_ssm *ssm)
fpi_ssm_mark_aborted(ssm, -ENOMEM); fpi_ssm_mark_aborted(ssm, -ENOMEM);
return; return;
} }
libusb_fill_bulk_transfer(transfer, dev->udev, upekdev->ep_out, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), upekdev->ep_out,
(unsigned char*)upekdev->setup_commands[upekdev->init_idx].cmd, (unsigned char*)upekdev->setup_commands[upekdev->init_idx].cmd,
UPEKTC_CMD_LEN, write_init_cb, ssm, BULK_TIMEOUT); UPEKTC_CMD_LEN, write_init_cb, ssm, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@@ -138,7 +133,7 @@ static void activate_run_state(struct fpi_ssm *ssm)
} }
data = g_malloc(upekdev->setup_commands[upekdev->init_idx].response_len); data = g_malloc(upekdev->setup_commands[upekdev->init_idx].response_len);
libusb_fill_bulk_transfer(transfer, dev->udev, upekdev->ep_in, data, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), upekdev->ep_in, data,
upekdev->setup_commands[upekdev->init_idx].response_len, upekdev->setup_commands[upekdev->init_idx].response_len,
read_init_data_cb, ssm, BULK_TIMEOUT); read_init_data_cb, ssm, BULK_TIMEOUT);
@@ -155,11 +150,11 @@ static void activate_run_state(struct fpi_ssm *ssm)
static void activate_sm_complete(struct fpi_ssm *ssm) static void activate_sm_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
fp_dbg("status %d", ssm->error); fp_dbg("status %d", fpi_ssm_get_error(ssm));
fpi_imgdev_activate_complete(dev, ssm->error); fpi_imgdev_activate_complete(dev, fpi_ssm_get_error(ssm));
if (!ssm->error) if (!fpi_ssm_get_error(ssm))
start_finger_detection(dev); start_finger_detection(dev);
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
} }
@@ -186,7 +181,7 @@ static int finger_present(unsigned char *img, size_t len, int sum_threshold)
static void finger_det_data_cb(struct libusb_transfer *transfer) static void finger_det_data_cb(struct libusb_transfer *transfer)
{ {
struct fp_img_dev *dev = transfer->user_data; struct fp_img_dev *dev = transfer->user_data;
struct upektc_dev *upekdev = dev->priv; struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev);
unsigned char *data = transfer->buffer; unsigned char *data = transfer->buffer;
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) { if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
@@ -219,7 +214,7 @@ static void finger_det_cmd_cb(struct libusb_transfer *t)
unsigned char *data; unsigned char *data;
int r; int r;
struct fp_img_dev *dev = t->user_data; struct fp_img_dev *dev = t->user_data;
struct upektc_dev *upekdev = dev->priv; struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev);
if (t->status != LIBUSB_TRANSFER_COMPLETED) { if (t->status != LIBUSB_TRANSFER_COMPLETED) {
fp_dbg("req transfer status %d\n", t->status); fp_dbg("req transfer status %d\n", t->status);
@@ -238,7 +233,7 @@ static void finger_det_cmd_cb(struct libusb_transfer *t)
} }
data = g_malloc(IMAGE_SIZE); data = g_malloc(IMAGE_SIZE);
libusb_fill_bulk_transfer(transfer, dev->udev, upekdev->ep_in, data, IMAGE_SIZE, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), upekdev->ep_in, data, IMAGE_SIZE,
finger_det_data_cb, dev, BULK_TIMEOUT); finger_det_data_cb, dev, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@@ -254,9 +249,9 @@ exit_free_transfer:
static void start_finger_detection(struct fp_img_dev *dev) static void start_finger_detection(struct fp_img_dev *dev)
{ {
int r; int r;
struct upektc_dev *upekdev = dev->priv; struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev);
struct libusb_transfer *transfer; struct libusb_transfer *transfer;
fp_dbg(""); G_DEBUG_HERE();
if (upekdev->deactivating) { if (upekdev->deactivating) {
complete_deactivation(dev); complete_deactivation(dev);
@@ -268,7 +263,7 @@ static void start_finger_detection(struct fp_img_dev *dev)
fpi_imgdev_session_error(dev, -ENOMEM); fpi_imgdev_session_error(dev, -ENOMEM);
return; return;
} }
libusb_fill_bulk_transfer(transfer, dev->udev, upekdev->ep_out, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), upekdev->ep_out,
(unsigned char *)scan_cmd, UPEKTC_CMD_LEN, (unsigned char *)scan_cmd, UPEKTC_CMD_LEN,
finger_det_cmd_cb, dev, BULK_TIMEOUT); finger_det_cmd_cb, dev, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@@ -302,7 +297,7 @@ static void capture_cmd_cb(struct libusb_transfer *transfer)
static void capture_read_data_cb(struct libusb_transfer *transfer) static void capture_read_data_cb(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
unsigned char *data = transfer->buffer; unsigned char *data = transfer->buffer;
struct fp_img *img; struct fp_img *img;
@@ -328,11 +323,11 @@ out:
static void capture_run_state(struct fpi_ssm *ssm) static void capture_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_dev *upekdev = dev->priv; struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev);
int r; int r;
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case CAPTURE_WRITE_CMD: case CAPTURE_WRITE_CMD:
{ {
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
@@ -340,7 +335,7 @@ static void capture_run_state(struct fpi_ssm *ssm)
fpi_ssm_mark_aborted(ssm, -ENOMEM); fpi_ssm_mark_aborted(ssm, -ENOMEM);
return; return;
} }
libusb_fill_bulk_transfer(transfer, dev->udev, upekdev->ep_out, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), upekdev->ep_out,
(unsigned char *)scan_cmd, UPEKTC_CMD_LEN, (unsigned char *)scan_cmd, UPEKTC_CMD_LEN,
capture_cmd_cb, ssm, BULK_TIMEOUT); capture_cmd_cb, ssm, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@@ -361,7 +356,7 @@ static void capture_run_state(struct fpi_ssm *ssm)
} }
data = g_malloc(IMAGE_SIZE); data = g_malloc(IMAGE_SIZE);
libusb_fill_bulk_transfer(transfer, dev->udev, upekdev->ep_in, data, IMAGE_SIZE, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), upekdev->ep_in, data, IMAGE_SIZE,
capture_read_data_cb, ssm, BULK_TIMEOUT); capture_read_data_cb, ssm, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@@ -377,14 +372,14 @@ static void capture_run_state(struct fpi_ssm *ssm)
static void capture_sm_complete(struct fpi_ssm *ssm) static void capture_sm_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_dev *upekdev = dev->priv; struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev);
fp_dbg("Capture completed"); fp_dbg("Capture completed");
if (upekdev->deactivating) if (upekdev->deactivating)
complete_deactivation(dev); complete_deactivation(dev);
else if (ssm->error) else if (fpi_ssm_get_error(ssm))
fpi_imgdev_session_error(dev, ssm->error); fpi_imgdev_session_error(dev, fpi_ssm_get_error(ssm));
else else
start_finger_detection(dev); start_finger_detection(dev);
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
@@ -392,7 +387,7 @@ static void capture_sm_complete(struct fpi_ssm *ssm)
static void start_capture(struct fp_img_dev *dev) static void start_capture(struct fp_img_dev *dev)
{ {
struct upektc_dev *upekdev = dev->priv; struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *ssm; struct fpi_ssm *ssm;
if (upekdev->deactivating) { if (upekdev->deactivating) {
@@ -400,18 +395,18 @@ static void start_capture(struct fp_img_dev *dev)
return; return;
} }
ssm = fpi_ssm_new(dev->dev, capture_run_state, CAPTURE_NUM_STATES); ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), capture_run_state, CAPTURE_NUM_STATES);
fp_dbg(""); G_DEBUG_HERE();
ssm->priv = dev; fpi_ssm_set_user_data(ssm, dev);
fpi_ssm_start(ssm, capture_sm_complete); fpi_ssm_start(ssm, capture_sm_complete);
} }
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state) static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{ {
struct upektc_dev *upekdev = dev->priv; struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *ssm = fpi_ssm_new(dev->dev, activate_run_state, struct fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_run_state,
ACTIVATE_NUM_STATES); ACTIVATE_NUM_STATES);
ssm->priv = dev; fpi_ssm_set_user_data(ssm, dev);
upekdev->init_idx = 0; upekdev->init_idx = 0;
fpi_ssm_start(ssm, activate_sm_complete); fpi_ssm_start(ssm, activate_sm_complete);
return 0; return 0;
@@ -419,15 +414,15 @@ static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
static void dev_deactivate(struct fp_img_dev *dev) static void dev_deactivate(struct fp_img_dev *dev)
{ {
struct upektc_dev *upekdev = dev->priv; struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev);
upekdev->deactivating = TRUE; upekdev->deactivating = TRUE;
} }
static void complete_deactivation(struct fp_img_dev *dev) static void complete_deactivation(struct fp_img_dev *dev)
{ {
struct upektc_dev *upekdev = dev->priv; struct upektc_dev *upekdev = fpi_imgdev_get_user_data(dev);
fp_dbg(""); G_DEBUG_HERE();
upekdev->deactivating = FALSE; upekdev->deactivating = FALSE;
fpi_imgdev_deactivate_complete(dev); fpi_imgdev_deactivate_complete(dev);
@@ -439,32 +434,33 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
int r; int r;
struct upektc_dev *upekdev; struct upektc_dev *upekdev;
r = libusb_claim_interface(dev->udev, 0); r = libusb_claim_interface(fpi_imgdev_get_usb_dev(dev), 0);
if (r < 0) { if (r < 0) {
fp_err("could not claim interface 0: %s", libusb_error_name(r)); fp_err("could not claim interface 0: %s", libusb_error_name(r));
return r; return r;
} }
dev->priv = upekdev = g_malloc0(sizeof(struct upektc_dev)); upekdev = g_malloc0(sizeof(struct upektc_dev));
fpi_imgdev_set_user_data(dev, upekdev);
switch (driver_data) { switch (driver_data) {
case UPEKTC_2015: case UPEKTC_2015:
upekdev->ep_in = UPEKTC_EP_IN; upekdev->ep_in = UPEKTC_EP_IN;
upekdev->ep_out = UPEKTC_EP_OUT; upekdev->ep_out = UPEKTC_EP_OUT;
upekdev->setup_commands = upektc_setup_commands; upekdev->setup_commands = upektc_setup_commands;
upekdev->setup_commands_len = array_n_elements(upektc_setup_commands); upekdev->setup_commands_len = G_N_ELEMENTS(upektc_setup_commands);
upekdev->sum_threshold = UPEKTC_SUM_THRESHOLD; upekdev->sum_threshold = UPEKTC_SUM_THRESHOLD;
break; break;
case UPEKTC_3001: case UPEKTC_3001:
upekdev->ep_in = UPEKET_EP_IN; upekdev->ep_in = UPEKET_EP_IN;
upekdev->ep_out = UPEKET_EP_OUT; upekdev->ep_out = UPEKET_EP_OUT;
upekdev->setup_commands = upeket_setup_commands; upekdev->setup_commands = upeket_setup_commands;
upekdev->setup_commands_len = array_n_elements(upeket_setup_commands); upekdev->setup_commands_len = G_N_ELEMENTS(upeket_setup_commands);
upekdev->sum_threshold = UPEKET_SUM_THRESHOLD; upekdev->sum_threshold = UPEKET_SUM_THRESHOLD;
break; break;
default: default:
fp_err("Device variant %d is not known\n", driver_data); fp_err("Device variant %lu is not known\n", driver_data);
g_free(upekdev); g_free(upekdev);
dev->priv = NULL; fpi_imgdev_set_user_data(dev, NULL);
return -ENODEV; return -ENODEV;
break; break;
} }
@@ -474,8 +470,10 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
static void dev_deinit(struct fp_img_dev *dev) static void dev_deinit(struct fp_img_dev *dev)
{ {
g_free(dev->priv); void *user_data;
libusb_release_interface(dev->udev, 0); user_data = fpi_imgdev_get_user_data(dev);
g_free(user_data);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);
} }
+51 -58
View File
@@ -19,16 +19,9 @@
#define FP_COMPONENT "upektc_img" #define FP_COMPONENT "upektc_img"
#include <errno.h> #include "drivers_api.h"
#include <string.h> #include "aeslib.h"
#include <libusb.h>
#include <aeslib.h>
#include <fp_internal.h>
#include "upektc_img.h" #include "upektc_img.h"
#include "driver_ids.h"
static void start_capture(struct fp_img_dev *dev); static void start_capture(struct fp_img_dev *dev);
static void start_deactivation(struct fp_img_dev *dev); static void start_deactivation(struct fp_img_dev *dev);
@@ -125,8 +118,8 @@ static void upektc_img_submit_req(struct fpi_ssm *ssm,
const unsigned char *buf, size_t buf_size, unsigned char seq, const unsigned char *buf, size_t buf_size, unsigned char seq,
libusb_transfer_cb_fn cb) libusb_transfer_cb_fn cb)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_img_dev *upekdev = dev->priv; struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev);
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
int r; int r;
@@ -143,7 +136,7 @@ static void upektc_img_submit_req(struct fpi_ssm *ssm,
upektc_img_cmd_fix_seq(upekdev->cmd, seq); upektc_img_cmd_fix_seq(upekdev->cmd, seq);
upektc_img_cmd_update_crc(upekdev->cmd, buf_size); upektc_img_cmd_update_crc(upekdev->cmd, buf_size);
libusb_fill_bulk_transfer(transfer, dev->udev, EP_OUT, upekdev->cmd, buf_size, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_OUT, upekdev->cmd, buf_size,
cb, ssm, BULK_TIMEOUT); cb, ssm, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@@ -156,8 +149,8 @@ static void upektc_img_submit_req(struct fpi_ssm *ssm,
static void upektc_img_read_data(struct fpi_ssm *ssm, size_t buf_size, size_t buf_offset, libusb_transfer_cb_fn cb) static void upektc_img_read_data(struct fpi_ssm *ssm, size_t buf_size, size_t buf_offset, libusb_transfer_cb_fn cb)
{ {
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_img_dev *upekdev = dev->priv; struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev);
int r; int r;
if (!transfer) { if (!transfer) {
@@ -169,7 +162,7 @@ static void upektc_img_read_data(struct fpi_ssm *ssm, size_t buf_size, size_t bu
transfer->flags |= LIBUSB_TRANSFER_FREE_TRANSFER; transfer->flags |= LIBUSB_TRANSFER_FREE_TRANSFER;
libusb_fill_bulk_transfer(transfer, dev->udev, EP_IN, upekdev->response + buf_offset, buf_size, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_IN, upekdev->response + buf_offset, buf_size,
cb, ssm, BULK_TIMEOUT); cb, ssm, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@@ -201,7 +194,7 @@ static void capture_reqs_cb(struct libusb_transfer *transfer)
fpi_ssm_mark_aborted(ssm, -EIO); fpi_ssm_mark_aborted(ssm, -EIO);
return; return;
} }
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case CAPTURE_ACK_00_28_TERM: case CAPTURE_ACK_00_28_TERM:
fpi_ssm_jump_to_state(ssm, CAPTURE_READ_DATA_TERM); fpi_ssm_jump_to_state(ssm, CAPTURE_READ_DATA_TERM);
break; break;
@@ -232,8 +225,8 @@ static int upektc_img_process_image_frame(unsigned char *image_buf, unsigned cha
static void capture_read_data_cb(struct libusb_transfer *transfer) static void capture_read_data_cb(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_img_dev *upekdev = dev->priv; struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev);
unsigned char *data = upekdev->response; unsigned char *data = upekdev->response;
struct fp_img *img; struct fp_img *img;
size_t response_size; size_t response_size;
@@ -252,11 +245,11 @@ static void capture_read_data_cb(struct libusb_transfer *transfer)
fp_dbg("request completed, len: %.4x", transfer->actual_length); fp_dbg("request completed, len: %.4x", transfer->actual_length);
if (transfer->actual_length == 0) { if (transfer->actual_length == 0) {
fpi_ssm_jump_to_state(ssm, ssm->cur_state); fpi_ssm_jump_to_state(ssm, fpi_ssm_get_cur_state(ssm));
return; return;
} }
if (ssm->cur_state == CAPTURE_READ_DATA_TERM) { if (fpi_ssm_get_cur_state(ssm) == CAPTURE_READ_DATA_TERM) {
fp_dbg("Terminating SSM\n"); fp_dbg("Terminating SSM\n");
fpi_ssm_mark_completed(ssm); fpi_ssm_mark_completed(ssm);
return; return;
@@ -266,7 +259,7 @@ static void capture_read_data_cb(struct libusb_transfer *transfer)
response_size = ((data[5] & 0x0f) << 8) + data[6]; response_size = ((data[5] & 0x0f) << 8) + data[6];
response_size += 9; /* 7 bytes for header, 2 for CRC */ response_size += 9; /* 7 bytes for header, 2 for CRC */
if (response_size > transfer->actual_length) { if (response_size > transfer->actual_length) {
fp_dbg("response_size is %d, actual_length is %d\n", fp_dbg("response_size is %lu, actual_length is %d\n",
response_size, transfer->actual_length); response_size, transfer->actual_length);
fp_dbg("Waiting for rest of transfer"); fp_dbg("Waiting for rest of transfer");
BUG_ON(upekdev->response_rest); BUG_ON(upekdev->response_rest);
@@ -331,7 +324,7 @@ static void capture_read_data_cb(struct libusb_transfer *transfer)
upektc_img_process_image_frame(upekdev->image_bits + upekdev->image_size, upektc_img_process_image_frame(upekdev->image_bits + upekdev->image_size,
data); data);
BUG_ON(upekdev->image_size != IMAGE_SIZE); BUG_ON(upekdev->image_size != IMAGE_SIZE);
fp_dbg("Image size is %d\n", upekdev->image_size); fp_dbg("Image size is %lu\n", upekdev->image_size);
img = fpi_img_new(IMAGE_SIZE); img = fpi_img_new(IMAGE_SIZE);
img->flags = FP_IMG_PARTIAL; img->flags = FP_IMG_PARTIAL;
memcpy(img->data, upekdev->image_bits, IMAGE_SIZE); memcpy(img->data, upekdev->image_bits, IMAGE_SIZE);
@@ -356,10 +349,10 @@ static void capture_read_data_cb(struct libusb_transfer *transfer)
static void capture_run_state(struct fpi_ssm *ssm) static void capture_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_img_dev *upekdev = dev->priv; struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev);
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case CAPTURE_INIT_CAPTURE: case CAPTURE_INIT_CAPTURE:
upektc_img_submit_req(ssm, upek2020_init_capture, sizeof(upek2020_init_capture), upektc_img_submit_req(ssm, upek2020_init_capture, sizeof(upek2020_init_capture),
upekdev->seq, capture_reqs_cb); upekdev->seq, capture_reqs_cb);
@@ -393,9 +386,9 @@ static void capture_run_state(struct fpi_ssm *ssm)
static void capture_sm_complete(struct fpi_ssm *ssm) static void capture_sm_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_img_dev *upekdev = dev->priv; struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev);
int err = ssm->error; int err = fpi_ssm_get_error(ssm);
fp_dbg("Capture completed, %d", err); fp_dbg("Capture completed, %d", err);
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
@@ -410,13 +403,13 @@ static void capture_sm_complete(struct fpi_ssm *ssm)
static void start_capture(struct fp_img_dev *dev) static void start_capture(struct fp_img_dev *dev)
{ {
struct upektc_img_dev *upekdev = dev->priv; struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *ssm; struct fpi_ssm *ssm;
upekdev->image_size = 0; upekdev->image_size = 0;
ssm = fpi_ssm_new(dev->dev, capture_run_state, CAPTURE_NUM_STATES); ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), capture_run_state, CAPTURE_NUM_STATES);
ssm->priv = dev; fpi_ssm_set_user_data(ssm, dev);
fpi_ssm_start(ssm, capture_sm_complete); fpi_ssm_start(ssm, capture_sm_complete);
} }
@@ -454,10 +447,10 @@ static void deactivate_read_data_cb(struct libusb_transfer *transfer)
static void deactivate_run_state(struct fpi_ssm *ssm) static void deactivate_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_img_dev *upekdev = dev->priv; struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev);
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case DEACTIVATE_DEINIT: case DEACTIVATE_DEINIT:
upektc_img_submit_req(ssm, upek2020_deinit, sizeof(upek2020_deinit), upektc_img_submit_req(ssm, upek2020_deinit, sizeof(upek2020_deinit),
upekdev->seq, deactivate_reqs_cb); upekdev->seq, deactivate_reqs_cb);
@@ -471,9 +464,9 @@ static void deactivate_run_state(struct fpi_ssm *ssm)
static void deactivate_sm_complete(struct fpi_ssm *ssm) static void deactivate_sm_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct upektc_img_dev *upekdev = dev->priv; struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev);
int err = ssm->error; int err = fpi_ssm_get_error(ssm);
fp_dbg("Deactivate completed"); fp_dbg("Deactivate completed");
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
@@ -489,13 +482,13 @@ static void deactivate_sm_complete(struct fpi_ssm *ssm)
static void start_deactivation(struct fp_img_dev *dev) static void start_deactivation(struct fp_img_dev *dev)
{ {
struct upektc_img_dev *upekdev = dev->priv; struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *ssm; struct fpi_ssm *ssm;
upekdev->image_size = 0; upekdev->image_size = 0;
ssm = fpi_ssm_new(dev->dev, deactivate_run_state, DEACTIVATE_NUM_STATES); ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), deactivate_run_state, DEACTIVATE_NUM_STATES);
ssm->priv = dev; fpi_ssm_set_user_data(ssm, dev);
fpi_ssm_start(ssm, deactivate_sm_complete); fpi_ssm_start(ssm, deactivate_sm_complete);
} }
@@ -553,11 +546,12 @@ static void init_read_data_cb(struct libusb_transfer *transfer)
static void activate_run_state(struct fpi_ssm *ssm) static void activate_run_state(struct fpi_ssm *ssm)
{ {
struct libusb_transfer *transfer; struct libusb_transfer *transfer;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct upektc_img_dev *upekdev = dev->priv; struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(idev);
struct fp_dev *dev = fpi_ssm_get_dev(ssm);
int r; int r;
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case ACTIVATE_CONTROL_REQ_1: case ACTIVATE_CONTROL_REQ_1:
case ACTIVATE_CONTROL_REQ_2: case ACTIVATE_CONTROL_REQ_2:
{ {
@@ -574,7 +568,7 @@ static void activate_run_state(struct fpi_ssm *ssm)
data = g_malloc0(LIBUSB_CONTROL_SETUP_SIZE + 1); data = g_malloc0(LIBUSB_CONTROL_SETUP_SIZE + 1);
libusb_fill_control_setup(data, libusb_fill_control_setup(data,
LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE, 0x0c, 0x100, 0x0400, 1); LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE, 0x0c, 0x100, 0x0400, 1);
libusb_fill_control_transfer(transfer, ssm->dev->udev, data, libusb_fill_control_transfer(transfer, fpi_dev_get_usb_dev(dev), data,
init_reqs_ctrl_cb, ssm, CTRL_TIMEOUT); init_reqs_ctrl_cb, ssm, CTRL_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
if (r < 0) { if (r < 0) {
@@ -615,8 +609,8 @@ static void activate_run_state(struct fpi_ssm *ssm)
static void activate_sm_complete(struct fpi_ssm *ssm) static void activate_sm_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
int err = ssm->error; int err = fpi_ssm_get_error(ssm);
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
fp_dbg("%s status %d", __func__, err); fp_dbg("%s status %d", __func__, err);
@@ -628,10 +622,10 @@ static void activate_sm_complete(struct fpi_ssm *ssm)
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state) static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{ {
struct upektc_img_dev *upekdev = dev->priv; struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *ssm = fpi_ssm_new(dev->dev, activate_run_state, struct fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_run_state,
ACTIVATE_NUM_STATES); ACTIVATE_NUM_STATES);
ssm->priv = dev; fpi_ssm_set_user_data(ssm, dev);
upekdev->seq = 0; upekdev->seq = 0;
fpi_ssm_start(ssm, activate_sm_complete); fpi_ssm_start(ssm, activate_sm_complete);
return 0; return 0;
@@ -639,7 +633,7 @@ static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
static void dev_deactivate(struct fp_img_dev *dev) static void dev_deactivate(struct fp_img_dev *dev)
{ {
struct upektc_img_dev *upekdev = dev->priv; struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev);
upekdev->deactivating = TRUE; upekdev->deactivating = TRUE;
} }
@@ -648,22 +642,25 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
{ {
/* TODO check that device has endpoints we're using */ /* TODO check that device has endpoints we're using */
int r; int r;
struct upektc_img_dev *upekdev;
r = libusb_claim_interface(dev->udev, 0); r = libusb_claim_interface(fpi_imgdev_get_usb_dev(dev), 0);
if (r < 0) { if (r < 0) {
fp_err("could not claim interface 0: %s", libusb_error_name(r)); fp_err("could not claim interface 0: %s", libusb_error_name(r));
return r; return r;
} }
dev->priv = g_malloc0(sizeof(struct upektc_img_dev)); upekdev = g_malloc0(sizeof(struct upektc_img_dev));
fpi_imgdev_set_user_data(dev, upekdev);
fpi_imgdev_open_complete(dev, 0); fpi_imgdev_open_complete(dev, 0);
return 0; return 0;
} }
static void dev_deinit(struct fp_img_dev *dev) static void dev_deinit(struct fp_img_dev *dev)
{ {
g_free(dev->priv); struct upektc_img_dev *upekdev = fpi_imgdev_get_user_data(dev);
libusb_release_interface(dev->udev, 0); g_free(upekdev);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);
} }
@@ -671,18 +668,14 @@ static int discover(struct libusb_device_descriptor *dsc, uint32_t *devtype)
{ {
if (dsc->idProduct == 0x2020 && dsc->bcdDevice == 1) if (dsc->idProduct == 0x2020 && dsc->bcdDevice == 1)
return 1; return 1;
#ifndef ENABLE_UPEKE2
if (dsc->idProduct == 0x2016 && dsc->bcdDevice == 2) if (dsc->idProduct == 0x2016 && dsc->bcdDevice == 2)
return 1; return 1;
#endif
return 0; return 0;
} }
static const struct usb_id id_table[] = { static const struct usb_id id_table[] = {
#ifndef ENABLE_UPEKE2
{ .vendor = 0x147e, .product = 0x2016 }, { .vendor = 0x147e, .product = 0x2016 },
#endif
{ .vendor = 0x147e, .product = 0x2020 }, { .vendor = 0x147e, .product = 0x2020 },
{ 0, 0, 0, }, { 0, 0, 0, },
}; };
+71 -73
View File
@@ -27,15 +27,7 @@
#define FP_COMPONENT "upekts" #define FP_COMPONENT "upekts"
#include <errno.h> #include "drivers_api.h"
#include <string.h>
#include <glib.h>
#include <libusb.h>
#include <fp_internal.h>
#include "driver_ids.h"
#define EP_IN (1 | LIBUSB_ENDPOINT_IN) #define EP_IN (1 | LIBUSB_ENDPOINT_IN)
#define EP_OUT (2 | LIBUSB_ENDPOINT_OUT) #define EP_OUT (2 | LIBUSB_ENDPOINT_OUT)
@@ -141,6 +133,7 @@ static struct libusb_transfer *alloc_send_cmd_transfer(struct fp_dev *dev,
{ {
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
uint16_t crc; uint16_t crc;
const char *ciao = "Ciao";
/* 9 bytes extra for: 4 byte 'Ciao', 1 byte A, 1 byte B | lenHI, /* 9 bytes extra for: 4 byte 'Ciao', 1 byte A, 1 byte B | lenHI,
* 1 byte lenLO, 2 byte CRC */ * 1 byte lenLO, 2 byte CRC */
@@ -158,7 +151,7 @@ static struct libusb_transfer *alloc_send_cmd_transfer(struct fp_dev *dev,
buf = g_malloc(urblen); buf = g_malloc(urblen);
/* Write header */ /* Write header */
strncpy(buf, "Ciao", 4); memcpy(buf, ciao, strlen(ciao));
len = GUINT16_TO_LE(len); len = GUINT16_TO_LE(len);
buf[4] = seq_a; buf[4] = seq_a;
buf[5] = seq_b | ((len & 0xf00) >> 8); buf[5] = seq_b | ((len & 0xf00) >> 8);
@@ -173,7 +166,7 @@ static struct libusb_transfer *alloc_send_cmd_transfer(struct fp_dev *dev,
buf[urblen - 2] = crc >> 8; buf[urblen - 2] = crc >> 8;
buf[urblen - 1] = crc & 0xff; buf[urblen - 1] = crc & 0xff;
libusb_fill_bulk_transfer(transfer, dev->udev, EP_OUT, buf, urblen, libusb_fill_bulk_transfer(transfer, fpi_dev_get_usb_dev(dev), EP_OUT, buf, urblen,
callback, user_data, TIMEOUT); callback, user_data, TIMEOUT);
return transfer; return transfer;
} }
@@ -185,7 +178,7 @@ static struct libusb_transfer *alloc_send_cmd28_transfer(struct fp_dev *dev,
uint16_t _innerlen = innerlen; uint16_t _innerlen = innerlen;
size_t len = innerlen + 6; size_t len = innerlen + 6;
unsigned char *buf = g_malloc0(len); unsigned char *buf = g_malloc0(len);
struct upekts_dev *upekdev = dev->priv; struct upekts_dev *upekdev = fpi_dev_get_user_data(dev);
uint8_t seq = upekdev->seq + CMD_SEQ_INCREMENT; uint8_t seq = upekdev->seq + CMD_SEQ_INCREMENT;
struct libusb_transfer *ret; struct libusb_transfer *ret;
@@ -424,7 +417,7 @@ static void read_msg_cb(struct libusb_transfer *transfer)
fp_dbg("didn't fit in buffer, need to extend by %d bytes", needed); fp_dbg("didn't fit in buffer, need to extend by %d bytes", needed);
data = g_realloc((gpointer) data, MSG_READ_BUF_SIZE + needed); data = g_realloc((gpointer) data, MSG_READ_BUF_SIZE + needed);
libusb_fill_bulk_transfer(etransfer, udata->dev->udev, EP_IN, libusb_fill_bulk_transfer(etransfer, fpi_dev_get_usb_dev(udata->dev), EP_IN,
data + MSG_READ_BUF_SIZE, needed, read_msg_extend_cb, udata, data + MSG_READ_BUF_SIZE, needed, read_msg_extend_cb, udata,
TIMEOUT); TIMEOUT);
@@ -463,7 +456,7 @@ static int __read_msg_async(struct read_msg_data *udata)
return -ENOMEM; return -ENOMEM;
} }
libusb_fill_bulk_transfer(transfer, udata->dev->udev, EP_IN, buf, libusb_fill_bulk_transfer(transfer, fpi_dev_get_usb_dev(udata->dev), EP_IN, buf,
MSG_READ_BUF_SIZE, read_msg_cb, udata, TIMEOUT); MSG_READ_BUF_SIZE, read_msg_cb, udata, TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
if (r < 0) { if (r < 0) {
@@ -536,23 +529,23 @@ static void initsm_read_msg_response_cb(struct fpi_ssm *ssm,
enum read_msg_status status, uint8_t seq, enum read_msg_status status, uint8_t seq,
unsigned char expect_subcmd, unsigned char subcmd) unsigned char expect_subcmd, unsigned char subcmd)
{ {
struct fp_dev *dev = ssm->dev; struct fp_dev *dev = fpi_ssm_get_dev(ssm);
struct upekts_dev *upekdev = dev->priv; struct upekts_dev *upekdev = fpi_dev_get_user_data(dev);
if (status != READ_MSG_RESPONSE) { if (status != READ_MSG_RESPONSE) {
fp_err("expected response, got %d seq=%x in state %d", status, seq, fp_err("expected response, got %d seq=%x in state %d", status, seq,
ssm->cur_state); fpi_ssm_get_cur_state(ssm));
fpi_ssm_mark_aborted(ssm, -1); fpi_ssm_mark_aborted(ssm, -1);
} else if (subcmd != expect_subcmd) { } else if (subcmd != expect_subcmd) {
fp_warn("expected response to subcmd 0x%02x, got response to %02x in " fp_warn("expected response to subcmd 0x%02x, got response to %02x in "
"state %d", expect_subcmd, subcmd, ssm->cur_state); "state %d", expect_subcmd, subcmd, fpi_ssm_get_cur_state(ssm));
fpi_ssm_mark_aborted(ssm, -1); fpi_ssm_mark_aborted(ssm, -1);
} else if (seq != upekdev->seq) { } else if (seq != upekdev->seq) {
fp_err("expected response to cmd seq=%02x, got response to %02x " fp_err("expected response to cmd seq=%02x, got response to %02x "
"in state %d", upekdev->seq, seq, ssm->cur_state); "in state %d", upekdev->seq, seq, fpi_ssm_get_cur_state(ssm));
fpi_ssm_mark_aborted(ssm, -1); fpi_ssm_mark_aborted(ssm, -1);
} else { } else {
fp_dbg("state %d completed", ssm->cur_state); fp_dbg("state %d completed", fpi_ssm_get_cur_state(ssm));
fpi_ssm_next_state(ssm); fpi_ssm_next_state(ssm);
} }
} }
@@ -600,22 +593,22 @@ static void read28_06_cb(struct fp_dev *dev, enum read_msg_status status,
static void initsm_read_msg_cmd_cb(struct fpi_ssm *ssm, static void initsm_read_msg_cmd_cb(struct fpi_ssm *ssm,
enum read_msg_status status, uint8_t expect_seq, uint8_t seq) enum read_msg_status status, uint8_t expect_seq, uint8_t seq)
{ {
struct fp_dev *dev = ssm->dev; struct fp_dev *dev = fpi_ssm_get_dev(ssm);
struct upekts_dev *upekdev = dev->priv; struct upekts_dev *upekdev = fpi_dev_get_user_data(dev);
if (status == READ_MSG_ERROR) { if (status == READ_MSG_ERROR) {
fpi_ssm_mark_aborted(ssm, -1); fpi_ssm_mark_aborted(ssm, -1);
return; return;
} else if (status != READ_MSG_CMD) { } else if (status != READ_MSG_CMD) {
fp_err("expected command, got %d seq=%x in state %d", status, seq, fp_err("expected command, got %d seq=%x in state %d", status, seq,
ssm->cur_state); fpi_ssm_get_cur_state(ssm));
fpi_ssm_mark_aborted(ssm, -1); fpi_ssm_mark_aborted(ssm, -1);
return; return;
} }
upekdev->seq = seq; upekdev->seq = seq;
if (seq != expect_seq) { if (seq != expect_seq) {
fp_err("expected seq=%x, got %x in state %d", expect_seq, seq, fp_err("expected seq=%x, got %x in state %d", expect_seq, seq,
ssm->cur_state); fpi_ssm_get_cur_state(ssm));
fpi_ssm_mark_aborted(ssm, -1); fpi_ssm_mark_aborted(ssm, -1);
return; return;
} }
@@ -652,9 +645,9 @@ static void ctrl400_cb(struct libusb_transfer *transfer)
static void initsm_read_msg_handler(struct fpi_ssm *ssm, static void initsm_read_msg_handler(struct fpi_ssm *ssm,
read_msg_cb_fn callback) read_msg_cb_fn callback)
{ {
int r = read_msg_async(ssm->dev, callback, ssm); int r = read_msg_async(fpi_ssm_get_dev(ssm), callback, ssm);
if (r < 0) { if (r < 0) {
fp_err("async read msg failed in state %d", ssm->cur_state); fp_err("async read msg failed in state %d", fpi_ssm_get_cur_state(ssm));
fpi_ssm_mark_aborted(ssm, r); fpi_ssm_mark_aborted(ssm, r);
} }
} }
@@ -664,10 +657,10 @@ static void initsm_send_msg_cb(struct libusb_transfer *transfer)
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
if (transfer->status == LIBUSB_TRANSFER_COMPLETED if (transfer->status == LIBUSB_TRANSFER_COMPLETED
&& transfer->length == transfer->actual_length) { && transfer->length == transfer->actual_length) {
fp_dbg("state %d completed", ssm->cur_state); fp_dbg("state %d completed", fpi_ssm_get_cur_state(ssm));
fpi_ssm_next_state(ssm); fpi_ssm_next_state(ssm);
} else { } else {
fp_err("failed, state=%d rqlength=%d actual_length=%d", ssm->cur_state, fp_err("failed, state=%d rqlength=%d actual_length=%d", fpi_ssm_get_cur_state(ssm),
transfer->length, transfer->actual_length); transfer->length, transfer->actual_length);
fpi_ssm_mark_aborted(ssm, -1); fpi_ssm_mark_aborted(ssm, -1);
} }
@@ -677,7 +670,7 @@ static void initsm_send_msg_cb(struct libusb_transfer *transfer)
static void initsm_send_msg28_handler(struct fpi_ssm *ssm, static void initsm_send_msg28_handler(struct fpi_ssm *ssm,
unsigned char subcmd, const unsigned char *data, uint16_t innerlen) unsigned char subcmd, const unsigned char *data, uint16_t innerlen)
{ {
struct fp_dev *dev = ssm->dev; struct fp_dev *dev = fpi_ssm_get_dev(ssm);
struct libusb_transfer *transfer; struct libusb_transfer *transfer;
int r; int r;
@@ -690,7 +683,7 @@ static void initsm_send_msg28_handler(struct fpi_ssm *ssm,
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
if (r < 0) { if (r < 0) {
fp_err("urb submission failed error %d in state %d", r, ssm->cur_state); fp_err("urb submission failed error %d in state %d", r, fpi_ssm_get_cur_state(ssm));
g_free(transfer->buffer); g_free(transfer->buffer);
libusb_free_transfer(transfer); libusb_free_transfer(transfer);
fpi_ssm_mark_aborted(ssm, -EIO); fpi_ssm_mark_aborted(ssm, -EIO);
@@ -699,12 +692,12 @@ static void initsm_send_msg28_handler(struct fpi_ssm *ssm,
static void initsm_run_state(struct fpi_ssm *ssm) static void initsm_run_state(struct fpi_ssm *ssm)
{ {
struct fp_dev *dev = ssm->dev; struct fp_dev *dev = fpi_ssm_get_dev(ssm);
struct upekts_dev *upekdev = dev->priv; struct upekts_dev *upekdev = fpi_dev_get_user_data(dev);
struct libusb_transfer *transfer; struct libusb_transfer *transfer;
int r; int r;
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case WRITE_CTRL400: ; case WRITE_CTRL400: ;
unsigned char *data; unsigned char *data;
@@ -717,7 +710,7 @@ static void initsm_run_state(struct fpi_ssm *ssm)
data = g_malloc(LIBUSB_CONTROL_SETUP_SIZE + 1); data = g_malloc(LIBUSB_CONTROL_SETUP_SIZE + 1);
libusb_fill_control_setup(data, libusb_fill_control_setup(data,
LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE, 0x0c, 0x100, 0x0400, 1); LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE, 0x0c, 0x100, 0x0400, 1);
libusb_fill_control_transfer(transfer, ssm->dev->udev, data, libusb_fill_control_transfer(transfer, fpi_dev_get_usb_dev(dev), data,
ctrl400_cb, ssm, TIMEOUT); ctrl400_cb, ssm, TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@@ -812,7 +805,7 @@ static void read_msg01_cb(struct fp_dev *dev, enum read_msg_status status,
void *user_data) void *user_data)
{ {
struct fpi_ssm *ssm = user_data; struct fpi_ssm *ssm = user_data;
struct upekts_dev *upekdev = dev->priv; struct upekts_dev *upekdev = fpi_dev_get_user_data(dev);
if (status == READ_MSG_ERROR) { if (status == READ_MSG_ERROR) {
fpi_ssm_mark_aborted(ssm, -1); fpi_ssm_mark_aborted(ssm, -1);
@@ -834,10 +827,10 @@ static void read_msg01_cb(struct fp_dev *dev, enum read_msg_status status,
static void deinitsm_state_handler(struct fpi_ssm *ssm) static void deinitsm_state_handler(struct fpi_ssm *ssm)
{ {
struct fp_dev *dev = ssm->dev; struct fp_dev *dev = fpi_ssm_get_dev(ssm);
int r; int r;
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case SEND_RESP07: ; case SEND_RESP07: ;
struct libusb_transfer *transfer; struct libusb_transfer *transfer;
unsigned char dummy = 0; unsigned char dummy = 0;
@@ -874,7 +867,7 @@ static int dev_init(struct fp_dev *dev, unsigned long driver_data)
struct upekts_dev *upekdev = NULL; struct upekts_dev *upekdev = NULL;
int r; int r;
r = libusb_claim_interface(dev->udev, 0); r = libusb_claim_interface(fpi_dev_get_usb_dev(dev), 0);
if (r < 0) { if (r < 0) {
fp_err("could not claim interface 0: %s", libusb_error_name(r)); fp_err("could not claim interface 0: %s", libusb_error_name(r));
return r; return r;
@@ -882,8 +875,8 @@ static int dev_init(struct fp_dev *dev, unsigned long driver_data)
upekdev = g_malloc(sizeof(*upekdev)); upekdev = g_malloc(sizeof(*upekdev));
upekdev->seq = 0xf0; /* incremented to 0x00 before first cmd */ upekdev->seq = 0xf0; /* incremented to 0x00 before first cmd */
dev->priv = upekdev; fpi_dev_set_user_data(dev, upekdev);
dev->nr_enroll_stages = 3; fpi_dev_set_nr_enroll_stages(dev, 3);
fpi_drvcb_open_complete(dev, 0); fpi_drvcb_open_complete(dev, 0);
return 0; return 0;
@@ -891,8 +884,10 @@ static int dev_init(struct fp_dev *dev, unsigned long driver_data)
static void dev_exit(struct fp_dev *dev) static void dev_exit(struct fp_dev *dev)
{ {
libusb_release_interface(dev->udev, 0); void *user_data;
g_free(dev->priv); libusb_release_interface(fpi_dev_get_usb_dev(dev), 0);
user_data = fpi_dev_get_user_data(dev);
g_free(user_data);
fpi_drvcb_close_complete(dev); fpi_drvcb_close_complete(dev);
} }
@@ -916,8 +911,8 @@ enum enroll_start_sm_states {
/* Called when the device initialization state machine completes */ /* Called when the device initialization state machine completes */
static void enroll_start_sm_cb_initsm(struct fpi_ssm *initsm) static void enroll_start_sm_cb_initsm(struct fpi_ssm *initsm)
{ {
struct fpi_ssm *enroll_start_ssm = initsm->priv; struct fpi_ssm *enroll_start_ssm = fpi_ssm_get_user_data(initsm);
int error = initsm->error; int error = fpi_ssm_get_error(initsm);
fpi_ssm_free(initsm); fpi_ssm_free(initsm);
if (error) if (error)
@@ -943,7 +938,7 @@ static void enroll_start_sm_cb_msg28(struct fp_dev *dev,
enum read_msg_status status, uint8_t seq, unsigned char subcmd, enum read_msg_status status, uint8_t seq, unsigned char subcmd,
unsigned char *data, size_t data_len, void *user_data) unsigned char *data, size_t data_len, void *user_data)
{ {
struct upekts_dev *upekdev = dev->priv; struct upekts_dev *upekdev = fpi_dev_get_user_data(dev);
struct fpi_ssm *ssm = user_data; struct fpi_ssm *ssm = user_data;
if (status != READ_MSG_RESPONSE) { if (status != READ_MSG_RESPONSE) {
@@ -964,13 +959,13 @@ static void enroll_start_sm_cb_msg28(struct fp_dev *dev,
static void enroll_start_sm_run_state(struct fpi_ssm *ssm) static void enroll_start_sm_run_state(struct fpi_ssm *ssm)
{ {
struct fp_dev *dev = ssm->dev; struct fp_dev *dev = fpi_ssm_get_dev(ssm);
int r; int r;
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case RUN_INITSM: ; case RUN_INITSM: ;
struct fpi_ssm *initsm = initsm_new(dev); struct fpi_ssm *initsm = initsm_new(dev);
initsm->priv = ssm; fpi_ssm_set_user_data(initsm, ssm);
fpi_ssm_start(initsm, enroll_start_sm_cb_initsm); fpi_ssm_start(initsm, enroll_start_sm_cb_initsm);
break; break;
case ENROLL_INIT: ; case ENROLL_INIT: ;
@@ -1006,12 +1001,12 @@ static void enroll_iterate(struct fp_dev *dev);
static void e_handle_resp00(struct fp_dev *dev, unsigned char *data, static void e_handle_resp00(struct fp_dev *dev, unsigned char *data,
size_t data_len) size_t data_len)
{ {
struct upekts_dev *upekdev = dev->priv; struct upekts_dev *upekdev = fpi_dev_get_user_data(dev);
unsigned char status; unsigned char status;
int result = 0; int result = 0;
if (data_len != 14) { if (data_len != 14) {
fp_err("received 3001 poll response of %d bytes?", data_len); fp_err("received 3001 poll response of %lu bytes?", data_len);
fpi_drvcb_enroll_stage_completed(dev, -EPROTO, NULL, NULL); fpi_drvcb_enroll_stage_completed(dev, -EPROTO, NULL, NULL);
return; return;
} }
@@ -1083,7 +1078,7 @@ static void e_handle_resp02(struct fp_dev *dev, unsigned char *data,
int result = -EPROTO; int result = -EPROTO;
if (data_len < sizeof(scan_comp)) { if (data_len < sizeof(scan_comp)) {
fp_err("fingerprint data too short (%d bytes)", data_len); fp_err("fingerprint data too short (%lu bytes)", data_len);
} else if (memcmp(data, scan_comp, sizeof(scan_comp)) != 0) { } else if (memcmp(data, scan_comp, sizeof(scan_comp)) != 0) {
fp_err("unrecognised data prefix %x %x %x %x %x", fp_err("unrecognised data prefix %x %x %x %x %x",
data[0], data[1], data[2], data[3], data[4]); data[0], data[1], data[2], data[3], data[4]);
@@ -1157,10 +1152,10 @@ static void enroll_iterate(struct fp_dev *dev)
static void enroll_started(struct fpi_ssm *ssm) static void enroll_started(struct fpi_ssm *ssm)
{ {
struct fp_dev *dev = ssm->dev; struct fp_dev *dev = fpi_ssm_get_dev(ssm);
fpi_drvcb_enroll_started(dev, ssm->error); fpi_drvcb_enroll_started(dev, fpi_ssm_get_error(ssm));
if (!ssm->error) if (!fpi_ssm_get_error(ssm))
enroll_iterate(dev); enroll_iterate(dev);
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
@@ -1168,7 +1163,7 @@ static void enroll_started(struct fpi_ssm *ssm)
static int enroll_start(struct fp_dev *dev) static int enroll_start(struct fp_dev *dev)
{ {
struct upekts_dev *upekdev = dev->priv; struct upekts_dev *upekdev = fpi_dev_get_user_data(dev);
/* do_init state machine first */ /* do_init state machine first */
struct fpi_ssm *ssm = fpi_ssm_new(dev, enroll_start_sm_run_state, struct fpi_ssm *ssm = fpi_ssm_new(dev, enroll_start_sm_run_state,
@@ -1182,7 +1177,7 @@ static int enroll_start(struct fp_dev *dev)
static void enroll_stop_deinit_cb(struct fpi_ssm *ssm) static void enroll_stop_deinit_cb(struct fpi_ssm *ssm)
{ {
/* don't really care about errors */ /* don't really care about errors */
fpi_drvcb_enroll_stopped(ssm->dev); fpi_drvcb_enroll_stopped(fpi_ssm_get_dev(ssm));
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
} }
@@ -1196,7 +1191,7 @@ static int enroll_stop(struct fp_dev *dev)
static void verify_stop_deinit_cb(struct fpi_ssm *ssm) static void verify_stop_deinit_cb(struct fpi_ssm *ssm)
{ {
/* don't really care about errors */ /* don't really care about errors */
fpi_drvcb_verify_stopped(ssm->dev); fpi_drvcb_verify_stopped(fpi_ssm_get_dev(ssm));
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
} }
@@ -1221,9 +1216,12 @@ enum {
/* Called when the device initialization state machine completes */ /* Called when the device initialization state machine completes */
static void verify_start_sm_cb_initsm(struct fpi_ssm *initsm) static void verify_start_sm_cb_initsm(struct fpi_ssm *initsm)
{ {
struct fpi_ssm *verify_start_ssm = initsm->priv; struct fpi_ssm *verify_start_ssm = fpi_ssm_get_user_data(initsm);
if (initsm->error) int err;
fpi_ssm_mark_aborted(verify_start_ssm, initsm->error);
err = fpi_ssm_get_error(initsm);
if (err)
fpi_ssm_mark_aborted(verify_start_ssm, err);
else else
fpi_ssm_next_state(verify_start_ssm); fpi_ssm_next_state(verify_start_ssm);
fpi_ssm_free(initsm); fpi_ssm_free(initsm);
@@ -1243,17 +1241,17 @@ static void verify_init_2803_cb(struct libusb_transfer *transfer)
static void verify_start_sm_run_state(struct fpi_ssm *ssm) static void verify_start_sm_run_state(struct fpi_ssm *ssm)
{ {
struct fp_dev *dev = ssm->dev; struct fp_dev *dev = fpi_ssm_get_dev(ssm);
int r; int r;
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case VERIFY_RUN_INITSM: ; case VERIFY_RUN_INITSM: ;
struct fpi_ssm *initsm = initsm_new(dev); struct fpi_ssm *initsm = initsm_new(dev);
initsm->priv = ssm; fpi_ssm_set_user_data(initsm, ssm);
fpi_ssm_start(initsm, verify_start_sm_cb_initsm); fpi_ssm_start(initsm, verify_start_sm_cb_initsm);
break; break;
case VERIFY_INIT: ; case VERIFY_INIT: ;
struct fp_print_data *print = dev->verify_data; struct fp_print_data *print = fpi_dev_get_verify_data(dev);
struct fp_print_data_item *item = print->prints->data; struct fp_print_data_item *item = print->prints->data;
size_t data_len = sizeof(verify_hdr) + item->length; size_t data_len = sizeof(verify_hdr) + item->length;
unsigned char *data = g_malloc(data_len); unsigned char *data = g_malloc(data_len);
@@ -1288,7 +1286,7 @@ static void v_handle_resp00(struct fp_dev *dev, unsigned char *data,
int r = 0; int r = 0;
if (data_len != 14) { if (data_len != 14) {
fp_err("received 3001 poll response of %d bytes?", data_len); fp_err("received 3001 poll response of %lu bytes?", data_len);
r = -EPROTO; r = -EPROTO;
goto out; goto out;
} }
@@ -1359,7 +1357,7 @@ static void verify_rd2800_cb(struct fp_dev *dev, enum read_msg_status msgstat,
uint8_t seq, unsigned char subcmd, unsigned char *data, size_t data_len, uint8_t seq, unsigned char subcmd, unsigned char *data, size_t data_len,
void *user_data) void *user_data)
{ {
struct upekts_dev *upekdev = dev->priv; struct upekts_dev *upekdev = fpi_dev_get_user_data(dev);
if (msgstat != READ_MSG_RESPONSE) { if (msgstat != READ_MSG_RESPONSE) {
fp_err("expected response, got %d seq=%x", msgstat, seq); fp_err("expected response, got %d seq=%x", msgstat, seq);
@@ -1398,7 +1396,7 @@ static void verify_wr2800_cb(struct libusb_transfer *transfer)
static void verify_iterate(struct fp_dev *dev) static void verify_iterate(struct fp_dev *dev)
{ {
struct upekts_dev *upekdev = dev->priv; struct upekts_dev *upekdev = fpi_dev_get_user_data(dev);
if (upekdev->stop_verify) { if (upekdev->stop_verify) {
do_verify_stop(dev); do_verify_stop(dev);
@@ -1433,11 +1431,11 @@ static void verify_iterate(struct fp_dev *dev)
static void verify_started(struct fpi_ssm *ssm) static void verify_started(struct fpi_ssm *ssm)
{ {
struct fp_dev *dev = ssm->dev; struct fp_dev *dev = fpi_ssm_get_dev(ssm);
struct upekts_dev *upekdev = dev->priv; struct upekts_dev *upekdev = fpi_dev_get_user_data(dev);
fpi_drvcb_verify_started(dev, ssm->error); fpi_drvcb_verify_started(dev, fpi_ssm_get_error(ssm));
if (!ssm->error) { if (!fpi_ssm_get_error(ssm)) {
upekdev->first_verify_iteration = TRUE; upekdev->first_verify_iteration = TRUE;
verify_iterate(dev); verify_iterate(dev);
} }
@@ -1447,7 +1445,7 @@ static void verify_started(struct fpi_ssm *ssm)
static int verify_start(struct fp_dev *dev) static int verify_start(struct fp_dev *dev)
{ {
struct upekts_dev *upekdev = dev->priv; struct upekts_dev *upekdev = fpi_dev_get_user_data(dev);
struct fpi_ssm *ssm = fpi_ssm_new(dev, verify_start_sm_run_state, struct fpi_ssm *ssm = fpi_ssm_new(dev, verify_start_sm_run_state,
VERIFY_NUM_STATES); VERIFY_NUM_STATES);
upekdev->stop_verify = FALSE; upekdev->stop_verify = FALSE;
@@ -1457,7 +1455,7 @@ static int verify_start(struct fp_dev *dev)
static int verify_stop(struct fp_dev *dev, gboolean iterating) static int verify_stop(struct fp_dev *dev, gboolean iterating)
{ {
struct upekts_dev *upekdev = dev->priv; struct upekts_dev *upekdev = fpi_dev_get_user_data(dev);
if (!iterating) if (!iterating)
do_verify_stop(dev); do_verify_stop(dev);
+60 -67
View File
@@ -20,17 +20,10 @@
#define FP_COMPONENT "uru4000" #define FP_COMPONENT "uru4000"
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <nss.h> #include <nss.h>
#include <pk11pub.h> #include <pk11pub.h>
#include <libusb.h>
#include <fp_internal.h> #include "drivers_api.h"
#include "driver_ids.h"
#define EP_INTR (1 | LIBUSB_ENDPOINT_IN) #define EP_INTR (1 | LIBUSB_ENDPOINT_IN)
#define EP_DATA (2 | LIBUSB_ENDPOINT_IN) #define EP_DATA (2 | LIBUSB_ENDPOINT_IN)
@@ -45,7 +38,7 @@
#define IMAGE_HEIGHT 290 #define IMAGE_HEIGHT 290
#define IMAGE_WIDTH 384 #define IMAGE_WIDTH 384
#define ENC_THRESHOLD 1000 #define ENC_THRESHOLD 5000
enum { enum {
IRQDATA_SCANPWR_ON = 0x56aa, IRQDATA_SCANPWR_ON = 0x56aa,
@@ -208,7 +201,7 @@ static int write_regs(struct fp_img_dev *dev, uint16_t first_reg,
data = g_malloc(LIBUSB_CONTROL_SETUP_SIZE + num_regs); data = g_malloc(LIBUSB_CONTROL_SETUP_SIZE + num_regs);
memcpy(data + LIBUSB_CONTROL_SETUP_SIZE, values, num_regs); memcpy(data + LIBUSB_CONTROL_SETUP_SIZE, values, num_regs);
libusb_fill_control_setup(data, CTRL_OUT, USB_RQ, first_reg, 0, num_regs); libusb_fill_control_setup(data, CTRL_OUT, USB_RQ, first_reg, 0, num_regs);
libusb_fill_control_transfer(transfer, dev->udev, data, write_regs_cb, libusb_fill_control_transfer(transfer, fpi_imgdev_get_usb_dev(dev), data, write_regs_cb,
wrdata, CTRL_TIMEOUT); wrdata, CTRL_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@@ -274,7 +267,7 @@ static int read_regs(struct fp_img_dev *dev, uint16_t first_reg,
data = g_malloc(LIBUSB_CONTROL_SETUP_SIZE + num_regs); data = g_malloc(LIBUSB_CONTROL_SETUP_SIZE + num_regs);
libusb_fill_control_setup(data, CTRL_IN, USB_RQ, first_reg, 0, num_regs); libusb_fill_control_setup(data, CTRL_IN, USB_RQ, first_reg, 0, num_regs);
libusb_fill_control_transfer(transfer, dev->udev, data, read_regs_cb, libusb_fill_control_transfer(transfer, fpi_imgdev_get_usb_dev(dev), data, read_regs_cb,
rrdata, CTRL_TIMEOUT); rrdata, CTRL_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@@ -324,7 +317,7 @@ static void challenge_cb(struct fp_img_dev *dev, int status,
uint16_t num_regs, unsigned char *data, void *user_data) uint16_t num_regs, unsigned char *data, void *user_data)
{ {
struct fpi_ssm *ssm = user_data; struct fpi_ssm *ssm = user_data;
struct uru4k_dev *urudev = dev->priv; struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
unsigned char *respdata; unsigned char *respdata;
PK11Context *ctx; PK11Context *ctx;
int r, outlen; int r, outlen;
@@ -363,10 +356,10 @@ static void challenge_cb(struct fp_img_dev *dev, int status,
*/ */
static void sm_do_challenge_response(struct fpi_ssm *ssm) static void sm_do_challenge_response(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
int r; int r;
fp_dbg(""); G_DEBUG_HERE();
r = read_regs(dev, REG_CHALLENGE, CR_LENGTH, challenge_cb, ssm); r = read_regs(dev, REG_CHALLENGE, CR_LENGTH, challenge_cb, ssm);
if (r < 0) if (r < 0)
fpi_ssm_mark_aborted(ssm, r); fpi_ssm_mark_aborted(ssm, r);
@@ -381,7 +374,7 @@ static int start_irq_handler(struct fp_img_dev *dev);
static void irq_handler(struct libusb_transfer *transfer) static void irq_handler(struct libusb_transfer *transfer)
{ {
struct fp_img_dev *dev = transfer->user_data; struct fp_img_dev *dev = transfer->user_data;
struct uru4k_dev *urudev = dev->priv; struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
unsigned char *data = transfer->buffer; unsigned char *data = transfer->buffer;
uint16_t type; uint16_t type;
int r = 0; int r = 0;
@@ -433,7 +426,7 @@ out:
static int start_irq_handler(struct fp_img_dev *dev) static int start_irq_handler(struct fp_img_dev *dev)
{ {
struct uru4k_dev *urudev = dev->priv; struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
unsigned char *data; unsigned char *data;
int r; int r;
@@ -442,7 +435,7 @@ static int start_irq_handler(struct fp_img_dev *dev)
return -ENOMEM; return -ENOMEM;
data = g_malloc(IRQ_LENGTH); data = g_malloc(IRQ_LENGTH);
libusb_fill_bulk_transfer(transfer, dev->udev, EP_INTR, data, IRQ_LENGTH, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_INTR, data, IRQ_LENGTH,
irq_handler, dev, 0); irq_handler, dev, 0);
urudev->irq_transfer = transfer; urudev->irq_transfer = transfer;
@@ -457,7 +450,7 @@ static int start_irq_handler(struct fp_img_dev *dev)
static void stop_irq_handler(struct fp_img_dev *dev, irqs_stopped_cb_fn cb) static void stop_irq_handler(struct fp_img_dev *dev, irqs_stopped_cb_fn cb)
{ {
struct uru4k_dev *urudev = dev->priv; struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
struct libusb_transfer *transfer = urudev->irq_transfer; struct libusb_transfer *transfer = urudev->irq_transfer;
if (transfer) { if (transfer) {
libusb_cancel_transfer(transfer); libusb_cancel_transfer(transfer);
@@ -491,7 +484,7 @@ static void change_state_write_reg_cb(struct fp_img_dev *dev, int status,
static int dev_change_state(struct fp_img_dev *dev, enum fp_imgdev_state state) static int dev_change_state(struct fp_img_dev *dev, enum fp_imgdev_state state)
{ {
struct uru4k_dev *urudev = dev->priv; struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
switch (state) { switch (state) {
case IMGDEV_STATE_INACTIVE: case IMGDEV_STATE_INACTIVE:
@@ -526,7 +519,7 @@ static void sm_write_reg_cb(struct fp_img_dev *dev, int result, void *user_data)
static void sm_write_regs(struct fpi_ssm *ssm, uint16_t first_reg, uint16_t num_regs, static void sm_write_regs(struct fpi_ssm *ssm, uint16_t first_reg, uint16_t num_regs,
void *data) void *data)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
int r = write_regs(dev, first_reg, num_regs, data, sm_write_reg_cb, ssm); int r = write_regs(dev, first_reg, num_regs, data, sm_write_reg_cb, ssm);
if (r < 0) if (r < 0)
fpi_ssm_mark_aborted(ssm, r); fpi_ssm_mark_aborted(ssm, r);
@@ -542,7 +535,7 @@ static void sm_read_reg_cb(struct fp_img_dev *dev, int result,
uint16_t num_regs, unsigned char *data, void *user_data) uint16_t num_regs, unsigned char *data, void *user_data)
{ {
struct fpi_ssm *ssm = user_data; struct fpi_ssm *ssm = user_data;
struct uru4k_dev *urudev = dev->priv; struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
if (result) { if (result) {
fpi_ssm_mark_aborted(ssm, result); fpi_ssm_mark_aborted(ssm, result);
@@ -555,8 +548,8 @@ static void sm_read_reg_cb(struct fp_img_dev *dev, int result,
static void sm_read_regs(struct fpi_ssm *ssm, uint16_t reg, uint16_t num_regs) static void sm_read_regs(struct fpi_ssm *ssm, uint16_t reg, uint16_t num_regs)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = dev->priv; struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
int r; int r;
if (num_regs > sizeof(urudev->last_reg_rd)) { if (num_regs > sizeof(urudev->last_reg_rd)) {
@@ -671,7 +664,7 @@ static int calc_dev2(struct uru4k_image *img)
uint8_t *b[2] = { NULL, NULL }; uint8_t *b[2] = { NULL, NULL };
int res = 0, mean = 0, i, r, j, idx; int res = 0, mean = 0, i, r, j, idx;
for (i = r = idx = 0; i < array_n_elements(img->block_info) && idx < 2; i++) { for (i = r = idx = 0; i < G_N_ELEMENTS(img->block_info) && idx < 2; i++) {
if (img->block_info[i].flags & BLOCKF_NOT_PRESENT) if (img->block_info[i].flags & BLOCKF_NOT_PRESENT)
continue; continue;
for (j = 0; j < img->block_info[i].num_lines && idx < 2; j++) for (j = 0; j < img->block_info[i].num_lines && idx < 2; j++)
@@ -696,8 +689,8 @@ static int calc_dev2(struct uru4k_image *img)
static void imaging_run_state(struct fpi_ssm *ssm) static void imaging_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = dev->priv; struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
struct uru4k_image *img = urudev->img_data; struct uru4k_image *img = urudev->img_data;
struct fp_img *fpimg; struct fp_img *fpimg;
uint32_t key; uint32_t key;
@@ -705,11 +698,11 @@ static void imaging_run_state(struct fpi_ssm *ssm)
int i, r, to, dev2; int i, r, to, dev2;
char buf[5]; char buf[5];
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case IMAGING_CAPTURE: case IMAGING_CAPTURE:
urudev->img_lines_done = 0; urudev->img_lines_done = 0;
urudev->img_block = 0; urudev->img_block = 0;
libusb_fill_bulk_transfer(urudev->img_transfer, dev->udev, EP_DATA, libusb_fill_bulk_transfer(urudev->img_transfer, fpi_imgdev_get_usb_dev(dev), EP_DATA,
urudev->img_data, sizeof(struct uru4k_image), image_transfer_cb, ssm, 0); urudev->img_data, sizeof(struct uru4k_image), image_transfer_cb, ssm, 0);
r = libusb_submit_transfer(urudev->img_transfer); r = libusb_submit_transfer(urudev->img_transfer);
if (r < 0) if (r < 0)
@@ -754,7 +747,7 @@ static void imaging_run_state(struct fpi_ssm *ssm)
key ^= urudev->img_enc_seed; key ^= urudev->img_enc_seed;
fp_dbg("encryption id %02x -> key %08x", img->key_number, key); fp_dbg("encryption id %02x -> key %08x", img->key_number, key);
while (urudev->img_block < array_n_elements(img->block_info) && while (urudev->img_block < G_N_ELEMENTS(img->block_info) &&
urudev->img_lines_done < img->num_lines) { urudev->img_lines_done < img->num_lines) {
flags = img->block_info[urudev->img_block].flags; flags = img->block_info[urudev->img_block].flags;
num_lines = img->block_info[urudev->img_block].num_lines; num_lines = img->block_info[urudev->img_block].num_lines;
@@ -792,7 +785,7 @@ static void imaging_run_state(struct fpi_ssm *ssm)
fpimg = fpi_img_new_for_imgdev(dev); fpimg = fpi_img_new_for_imgdev(dev);
to = r = 0; to = r = 0;
for (i = 0; i < array_n_elements(img->block_info) && r < img->num_lines; i++) { for (i = 0; i < G_N_ELEMENTS(img->block_info) && r < img->num_lines; i++) {
flags = img->block_info[i].flags; flags = img->block_info[i].flags;
num_lines = img->block_info[i].num_lines; num_lines = img->block_info[i].num_lines;
if (num_lines == 0) if (num_lines == 0)
@@ -819,9 +812,9 @@ static void imaging_run_state(struct fpi_ssm *ssm)
static void imaging_complete(struct fpi_ssm *ssm) static void imaging_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = dev->priv; struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
int r = ssm->error; int r = fpi_ssm_get_error(ssm);
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
/* Report error before exiting imaging loop - the error handler /* Report error before exiting imaging loop - the error handler
@@ -870,8 +863,8 @@ enum rebootpwr_states {
static void rebootpwr_pause_cb(void *data) static void rebootpwr_pause_cb(void *data)
{ {
struct fpi_ssm *ssm = data; struct fpi_ssm *ssm = data;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = dev->priv; struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
if (!--urudev->rebootpwr_ctr) { if (!--urudev->rebootpwr_ctr) {
fp_err("could not reboot device power"); fp_err("could not reboot device power");
@@ -883,10 +876,10 @@ static void rebootpwr_pause_cb(void *data)
static void rebootpwr_run_state(struct fpi_ssm *ssm) static void rebootpwr_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = dev->priv; struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case REBOOTPWR_SET_HWSTAT: case REBOOTPWR_SET_HWSTAT:
urudev->rebootpwr_ctr = 100; urudev->rebootpwr_ctr = 100;
sm_set_hwstat(ssm, urudev->last_hwstat & 0xf); sm_set_hwstat(ssm, urudev->last_hwstat & 0xf);
@@ -947,8 +940,8 @@ enum powerup_states {
static void powerup_pause_cb(void *data) static void powerup_pause_cb(void *data)
{ {
struct fpi_ssm *ssm = data; struct fpi_ssm *ssm = data;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = dev->priv; struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
if (!--urudev->powerup_ctr) { if (!--urudev->powerup_ctr) {
fp_err("could not power device up"); fp_err("could not power device up");
@@ -962,10 +955,10 @@ static void powerup_pause_cb(void *data)
static void powerup_run_state(struct fpi_ssm *ssm) static void powerup_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = dev->priv; struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case POWERUP_INIT: case POWERUP_INIT:
urudev->powerup_ctr = 100; urudev->powerup_ctr = 100;
urudev->powerup_hwstat = urudev->last_hwstat & 0xf; urudev->powerup_hwstat = urudev->last_hwstat & 0xf;
@@ -1032,13 +1025,13 @@ static void init_scanpwr_irq_cb(struct fp_img_dev *dev, int status,
uint16_t type, void *user_data) uint16_t type, void *user_data)
{ {
struct fpi_ssm *ssm = user_data; struct fpi_ssm *ssm = user_data;
struct uru4k_dev *urudev = dev->priv; struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
if (status) if (status)
fpi_ssm_mark_aborted(ssm, status); fpi_ssm_mark_aborted(ssm, status);
else if (type != IRQDATA_SCANPWR_ON) else if (type != IRQDATA_SCANPWR_ON)
fp_dbg("ignoring interrupt"); fp_dbg("ignoring interrupt");
else if (ssm->cur_state != INIT_AWAIT_SCAN_POWER) { else if (fpi_ssm_get_cur_state(ssm) != INIT_AWAIT_SCAN_POWER) {
fp_dbg("early scanpwr interrupt"); fp_dbg("early scanpwr interrupt");
urudev->scanpwr_irq_timeouts = -1; urudev->scanpwr_irq_timeouts = -1;
} else { } else {
@@ -1050,8 +1043,8 @@ static void init_scanpwr_irq_cb(struct fp_img_dev *dev, int status,
static void init_scanpwr_timeout(void *user_data) static void init_scanpwr_timeout(void *user_data)
{ {
struct fpi_ssm *ssm = user_data; struct fpi_ssm *ssm = user_data;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = dev->priv; struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
fp_warn("powerup timed out"); fp_warn("powerup timed out");
urudev->irq_cb = NULL; urudev->irq_cb = NULL;
@@ -1067,10 +1060,10 @@ static void init_scanpwr_timeout(void *user_data)
static void init_run_state(struct fpi_ssm *ssm) static void init_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct uru4k_dev *urudev = dev->priv; struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case INIT_GET_HWSTAT: case INIT_GET_HWSTAT:
sm_read_reg(ssm, REG_HWSTAT); sm_read_reg(ssm, REG_HWSTAT);
break; break;
@@ -1082,9 +1075,9 @@ static void init_run_state(struct fpi_ssm *ssm)
fpi_ssm_jump_to_state(ssm, INIT_CHECK_HWSTAT_POWERDOWN); fpi_ssm_jump_to_state(ssm, INIT_CHECK_HWSTAT_POWERDOWN);
break; break;
case INIT_REBOOT_POWER: ; case INIT_REBOOT_POWER: ;
struct fpi_ssm *rebootsm = fpi_ssm_new(dev->dev, rebootpwr_run_state, struct fpi_ssm *rebootsm = fpi_ssm_new(fpi_imgdev_get_dev(dev), rebootpwr_run_state,
REBOOTPWR_NUM_STATES); REBOOTPWR_NUM_STATES);
rebootsm->priv = dev; fpi_ssm_set_user_data(rebootsm, dev);
fpi_ssm_start_subsm(ssm, rebootsm); fpi_ssm_start_subsm(ssm, rebootsm);
break; break;
case INIT_CHECK_HWSTAT_POWERDOWN: case INIT_CHECK_HWSTAT_POWERDOWN:
@@ -1101,9 +1094,9 @@ static void init_run_state(struct fpi_ssm *ssm)
urudev->irq_cb_data = ssm; urudev->irq_cb_data = ssm;
urudev->irq_cb = init_scanpwr_irq_cb; urudev->irq_cb = init_scanpwr_irq_cb;
struct fpi_ssm *powerupsm = fpi_ssm_new(dev->dev, powerup_run_state, struct fpi_ssm *powerupsm = fpi_ssm_new(fpi_imgdev_get_dev(dev), powerup_run_state,
POWERUP_NUM_STATES); POWERUP_NUM_STATES);
powerupsm->priv = dev; fpi_ssm_set_user_data(powerupsm, dev);
fpi_ssm_start_subsm(ssm, powerupsm); fpi_ssm_start_subsm(ssm, powerupsm);
break; break;
case INIT_AWAIT_SCAN_POWER: case INIT_AWAIT_SCAN_POWER:
@@ -1147,8 +1140,8 @@ static void init_run_state(struct fpi_ssm *ssm)
static void activate_initsm_complete(struct fpi_ssm *ssm) static void activate_initsm_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
int r = ssm->error; int r = fpi_ssm_get_error(ssm);
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
if (r) { if (r) {
@@ -1166,7 +1159,7 @@ static void activate_initsm_complete(struct fpi_ssm *ssm)
* call. */ * call. */
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state) static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{ {
struct uru4k_dev *urudev = dev->priv; struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *ssm; struct fpi_ssm *ssm;
int r; int r;
@@ -1176,8 +1169,8 @@ static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
urudev->scanpwr_irq_timeouts = 0; urudev->scanpwr_irq_timeouts = 0;
urudev->activate_state = state; urudev->activate_state = state;
ssm = fpi_ssm_new(dev->dev, init_run_state, INIT_NUM_STATES); ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), init_run_state, INIT_NUM_STATES);
ssm->priv = dev; fpi_ssm_set_user_data(ssm, dev);
fpi_ssm_start(ssm, activate_initsm_complete); fpi_ssm_start(ssm, activate_initsm_complete);
return 0; return 0;
} }
@@ -1202,7 +1195,7 @@ static void dev_deactivate(struct fp_img_dev *dev)
static int execute_state_change(struct fp_img_dev *dev) static int execute_state_change(struct fp_img_dev *dev)
{ {
struct uru4k_dev *urudev = dev->priv; struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *ssm; struct fpi_ssm *ssm;
switch (urudev->activate_state) { switch (urudev->activate_state) {
@@ -1230,8 +1223,8 @@ static int execute_state_change(struct fp_img_dev *dev)
urudev->img_data = g_malloc(sizeof(struct uru4k_image)); urudev->img_data = g_malloc(sizeof(struct uru4k_image));
urudev->img_enc_seed = rand(); urudev->img_enc_seed = rand();
ssm = fpi_ssm_new(dev->dev, imaging_run_state, IMAGING_NUM_STATES); ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), imaging_run_state, IMAGING_NUM_STATES);
ssm->priv = dev; fpi_ssm_set_user_data(ssm, dev);
fpi_ssm_start(ssm, imaging_complete); fpi_ssm_start(ssm, imaging_complete);
return write_reg(dev, REG_MODE, MODE_CAPTURE, return write_reg(dev, REG_MODE, MODE_CAPTURE,
@@ -1264,7 +1257,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
int r; int r;
/* Find fingerprint interface */ /* Find fingerprint interface */
r = libusb_get_config_descriptor(libusb_get_device(dev->udev), 0, &config); r = libusb_get_config_descriptor(libusb_get_device(fpi_imgdev_get_usb_dev(dev)), 0, &config);
if (r < 0) { if (r < 0) {
fp_err("Failed to get config descriptor"); fp_err("Failed to get config descriptor");
return r; return r;
@@ -1318,7 +1311,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
/* Device looks like a supported reader */ /* Device looks like a supported reader */
r = libusb_claim_interface(dev->udev, iface_desc->bInterfaceNumber); r = libusb_claim_interface(fpi_imgdev_get_usb_dev(dev), iface_desc->bInterfaceNumber);
if (r < 0) { if (r < 0) {
fp_err("interface claim failed: %s", libusb_error_name(r)); fp_err("interface claim failed: %s", libusb_error_name(r));
goto out; goto out;
@@ -1358,7 +1351,7 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
} }
urudev->param = PK11_ParamFromIV(urudev->cipher, NULL); urudev->param = PK11_ParamFromIV(urudev->cipher, NULL);
dev->priv = urudev; fpi_imgdev_set_user_data(dev, urudev);
fpi_imgdev_open_complete(dev, 0); fpi_imgdev_open_complete(dev, 0);
out: out:
@@ -1368,14 +1361,14 @@ out:
static void dev_deinit(struct fp_img_dev *dev) static void dev_deinit(struct fp_img_dev *dev)
{ {
struct uru4k_dev *urudev = dev->priv; struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
if (urudev->symkey) if (urudev->symkey)
PK11_FreeSymKey (urudev->symkey); PK11_FreeSymKey (urudev->symkey);
if (urudev->param) if (urudev->param)
SECITEM_FreeItem(urudev->param, PR_TRUE); SECITEM_FreeItem(urudev->param, PR_TRUE);
if (urudev->slot) if (urudev->slot)
PK11_FreeSlot(urudev->slot); PK11_FreeSlot(urudev->slot);
libusb_release_interface(dev->udev, urudev->interface); libusb_release_interface(fpi_imgdev_get_usb_dev(dev), urudev->interface);
g_free(urudev); g_free(urudev);
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);
} }
+33 -36
View File
@@ -19,6 +19,8 @@
#define FP_COMPONENT "vcom5s" #define FP_COMPONENT "vcom5s"
#include "drivers_api.h"
/* TODO: /* TODO:
* calibration? * calibration?
* image size: windows gets 300x300 through vpas enrollment util? * image size: windows gets 300x300 through vpas enrollment util?
@@ -26,16 +28,6 @@
* powerdown? does windows do anything special on exit? * powerdown? does windows do anything special on exit?
*/ */
#include <errno.h>
#include <string.h>
#include <glib.h>
#include <libusb.h>
#include <fp_internal.h>
#include "driver_ids.h"
#define CTRL_IN 0xc0 #define CTRL_IN 0xc0
#define CTRL_OUT 0x40 #define CTRL_OUT 0x40
#define CTRL_TIMEOUT 1000 #define CTRL_TIMEOUT 1000
@@ -96,7 +88,7 @@ static void sm_write_reg_cb(struct libusb_transfer *transfer)
static void sm_write_reg(struct fpi_ssm *ssm, unsigned char reg, static void sm_write_reg(struct fpi_ssm *ssm, unsigned char reg,
unsigned char value) unsigned char value)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
unsigned char *data; unsigned char *data;
int r; int r;
@@ -109,7 +101,7 @@ static void sm_write_reg(struct fpi_ssm *ssm, unsigned char reg,
fp_dbg("set %02x=%02x", reg, value); fp_dbg("set %02x=%02x", reg, value);
data = g_malloc(LIBUSB_CONTROL_SETUP_SIZE); data = g_malloc(LIBUSB_CONTROL_SETUP_SIZE);
libusb_fill_control_setup(data, CTRL_OUT, reg, value, 0, 0); libusb_fill_control_setup(data, CTRL_OUT, reg, value, 0, 0);
libusb_fill_control_transfer(transfer, dev->udev, data, sm_write_reg_cb, libusb_fill_control_transfer(transfer, fpi_imgdev_get_usb_dev(dev), data, sm_write_reg_cb,
ssm, CTRL_TIMEOUT); ssm, CTRL_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
if (r < 0) { if (r < 0) {
@@ -135,7 +127,7 @@ static void sm_exec_cmd_cb(struct libusb_transfer *transfer)
static void sm_exec_cmd(struct fpi_ssm *ssm, unsigned char cmd, static void sm_exec_cmd(struct fpi_ssm *ssm, unsigned char cmd,
unsigned char param) unsigned char param)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
unsigned char *data; unsigned char *data;
int r; int r;
@@ -148,7 +140,7 @@ static void sm_exec_cmd(struct fpi_ssm *ssm, unsigned char cmd,
fp_dbg("cmd %02x param %02x", cmd, param); fp_dbg("cmd %02x param %02x", cmd, param);
data = g_malloc(LIBUSB_CONTROL_SETUP_SIZE); data = g_malloc(LIBUSB_CONTROL_SETUP_SIZE);
libusb_fill_control_setup(data, CTRL_IN, cmd, param, 0, 0); libusb_fill_control_setup(data, CTRL_IN, cmd, param, 0, 0);
libusb_fill_control_transfer(transfer, dev->udev, data, sm_exec_cmd_cb, libusb_fill_control_transfer(transfer, fpi_imgdev_get_usb_dev(dev), data, sm_exec_cmd_cb,
ssm, CTRL_TIMEOUT); ssm, CTRL_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
if (r < 0) { if (r < 0) {
@@ -200,8 +192,8 @@ static void capture_iterate(struct fpi_ssm *ssm);
static void capture_cb(struct libusb_transfer *transfer) static void capture_cb(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct v5s_dev *vdev = dev->priv; struct v5s_dev *vdev = fpi_imgdev_get_user_data(dev);
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) { if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
fpi_ssm_mark_aborted(ssm, -EIO); fpi_ssm_mark_aborted(ssm, -EIO);
@@ -228,8 +220,8 @@ out:
static void capture_iterate(struct fpi_ssm *ssm) static void capture_iterate(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct v5s_dev *vdev = dev->priv; struct v5s_dev *vdev = fpi_imgdev_get_user_data(dev);
int iteration = vdev->capture_iteration; int iteration = vdev->capture_iteration;
struct libusb_transfer *transfer = libusb_alloc_transfer(0); struct libusb_transfer *transfer = libusb_alloc_transfer(0);
int r; int r;
@@ -239,7 +231,7 @@ static void capture_iterate(struct fpi_ssm *ssm)
return; return;
} }
libusb_fill_bulk_transfer(transfer, dev->udev, EP_IN, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_IN,
vdev->capture_img->data + (RQ_SIZE * iteration), RQ_SIZE, vdev->capture_img->data + (RQ_SIZE * iteration), RQ_SIZE,
capture_cb, ssm, CTRL_TIMEOUT); capture_cb, ssm, CTRL_TIMEOUT);
transfer->flags = LIBUSB_TRANSFER_SHORT_NOT_OK; transfer->flags = LIBUSB_TRANSFER_SHORT_NOT_OK;
@@ -253,10 +245,10 @@ static void capture_iterate(struct fpi_ssm *ssm)
static void sm_do_capture(struct fpi_ssm *ssm) static void sm_do_capture(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct v5s_dev *vdev = dev->priv; struct v5s_dev *vdev = fpi_imgdev_get_user_data(dev);
fp_dbg(""); G_DEBUG_HERE();
vdev->capture_img = fpi_img_new_for_imgdev(dev); vdev->capture_img = fpi_img_new_for_imgdev(dev);
vdev->capture_iteration = 0; vdev->capture_iteration = 0;
capture_iterate(ssm); capture_iterate(ssm);
@@ -275,10 +267,10 @@ enum loop_states {
static void loop_run_state(struct fpi_ssm *ssm) static void loop_run_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct v5s_dev *vdev = dev->priv; struct v5s_dev *vdev = fpi_imgdev_get_user_data(dev);
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case LOOP_SET_CONTRAST: case LOOP_SET_CONTRAST:
sm_write_reg(ssm, REG_CONTRAST, 0x01); sm_write_reg(ssm, REG_CONTRAST, 0x01);
break; break;
@@ -303,9 +295,9 @@ static void loop_run_state(struct fpi_ssm *ssm)
static void loopsm_complete(struct fpi_ssm *ssm) static void loopsm_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct v5s_dev *vdev = dev->priv; struct v5s_dev *vdev = fpi_imgdev_get_user_data(dev);
int r = ssm->error; int r = fpi_ssm_get_error(ssm);
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
fp_img_free(vdev->capture_img); fp_img_free(vdev->capture_img);
@@ -321,10 +313,10 @@ static void loopsm_complete(struct fpi_ssm *ssm)
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state) static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{ {
struct v5s_dev *vdev = dev->priv; struct v5s_dev *vdev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *ssm = fpi_ssm_new(dev->dev, loop_run_state, struct fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), loop_run_state,
LOOP_NUM_STATES); LOOP_NUM_STATES);
ssm->priv = dev; fpi_ssm_set_user_data(ssm, dev);
vdev->deactivating = FALSE; vdev->deactivating = FALSE;
fpi_ssm_start(ssm, loopsm_complete); fpi_ssm_start(ssm, loopsm_complete);
vdev->loop_running = TRUE; vdev->loop_running = TRUE;
@@ -334,7 +326,7 @@ static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
static void dev_deactivate(struct fp_img_dev *dev) static void dev_deactivate(struct fp_img_dev *dev)
{ {
struct v5s_dev *vdev = dev->priv; struct v5s_dev *vdev = fpi_imgdev_get_user_data(dev);
if (vdev->loop_running) if (vdev->loop_running)
vdev->deactivating = TRUE; vdev->deactivating = TRUE;
else else
@@ -344,9 +336,12 @@ static void dev_deactivate(struct fp_img_dev *dev)
static int dev_init(struct fp_img_dev *dev, unsigned long driver_data) static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
{ {
int r; int r;
dev->priv = g_malloc0(sizeof(struct v5s_dev)); struct v5s_dev *v5s_dev;
r = libusb_claim_interface(dev->udev, 0); v5s_dev = g_malloc0(sizeof(struct v5s_dev));
fpi_imgdev_set_user_data(dev, v5s_dev);
r = libusb_claim_interface(fpi_imgdev_get_usb_dev(dev), 0);
if (r < 0) if (r < 0)
fp_err("could not claim interface 0: %s", libusb_error_name(r)); fp_err("could not claim interface 0: %s", libusb_error_name(r));
@@ -358,8 +353,10 @@ static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
static void dev_deinit(struct fp_img_dev *dev) static void dev_deinit(struct fp_img_dev *dev)
{ {
g_free(dev->priv); struct v5s_dev *v5s_dev;
libusb_release_interface(dev->udev, 0); v5s_dev = fpi_imgdev_get_user_data(dev);
g_free(v5s_dev);
libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);
} }
+64 -64
View File
@@ -19,12 +19,7 @@
#define FP_COMPONENT "vfs0050" #define FP_COMPONENT "vfs0050"
#include <errno.h> #include "drivers_api.h"
#include <string.h>
#include <fp_internal.h>
#include <assembling.h>
#include "driver_ids.h"
#include "vfs0050.h" #include "vfs0050.h"
/* USB functions */ /* USB functions */
@@ -33,7 +28,7 @@
static void async_write_callback(struct libusb_transfer *transfer) static void async_write_callback(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
int transferred = transfer->actual_length, error = int transferred = transfer->actual_length, error =
transfer->status, len = transfer->length; transfer->status, len = transfer->length;
@@ -58,13 +53,13 @@ static void async_write_callback(struct libusb_transfer *transfer)
/* Send data to EP1, the only out endpoint */ /* Send data to EP1, the only out endpoint */
static void async_write(struct fpi_ssm *ssm, void *data, int len) static void async_write(struct fpi_ssm *ssm, void *data, int len)
{ {
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct libusb_device_handle *udev = idev->udev; struct libusb_device_handle *usb_dev = fpi_imgdev_get_usb_dev(idev);
struct vfs_dev_t *vdev = idev->priv; struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev);
vdev->transfer = libusb_alloc_transfer(0); vdev->transfer = libusb_alloc_transfer(0);
vdev->transfer->flags |= LIBUSB_TRANSFER_FREE_TRANSFER; vdev->transfer->flags |= LIBUSB_TRANSFER_FREE_TRANSFER;
libusb_fill_bulk_transfer(vdev->transfer, udev, 0x01, data, len, libusb_fill_bulk_transfer(vdev->transfer, usb_dev, 0x01, data, len,
async_write_callback, ssm, VFS_USB_TIMEOUT); async_write_callback, ssm, VFS_USB_TIMEOUT);
libusb_submit_transfer(vdev->transfer); libusb_submit_transfer(vdev->transfer);
} }
@@ -73,7 +68,7 @@ static void async_write(struct fpi_ssm *ssm, void *data, int len)
static void async_read_callback(struct libusb_transfer *transfer) static void async_read_callback(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
int transferred = transfer->actual_length, error = int transferred = transfer->actual_length, error =
transfer->status, len = transfer->length; transfer->status, len = transfer->length;
@@ -100,9 +95,9 @@ static void async_read_callback(struct libusb_transfer *transfer)
/* Receive data from the given ep and compare with expected */ /* Receive data from the given ep and compare with expected */
static void async_read(struct fpi_ssm *ssm, int ep, void *data, int len) static void async_read(struct fpi_ssm *ssm, int ep, void *data, int len)
{ {
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct libusb_device_handle *udev = idev->udev; struct libusb_device_handle *usb_dev = fpi_imgdev_get_usb_dev(idev);
struct vfs_dev_t *vdev = idev->priv; struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev);
ep |= LIBUSB_ENDPOINT_IN; ep |= LIBUSB_ENDPOINT_IN;
@@ -111,11 +106,11 @@ static void async_read(struct fpi_ssm *ssm, int ep, void *data, int len)
/* 0x83 is the only interrupt endpoint */ /* 0x83 is the only interrupt endpoint */
if (ep == EP3_IN) if (ep == EP3_IN)
libusb_fill_interrupt_transfer(vdev->transfer, udev, ep, data, libusb_fill_interrupt_transfer(vdev->transfer, usb_dev, ep, data,
len, async_read_callback, ssm, len, async_read_callback, ssm,
VFS_USB_TIMEOUT); VFS_USB_TIMEOUT);
else else
libusb_fill_bulk_transfer(vdev->transfer, udev, ep, data, len, libusb_fill_bulk_transfer(vdev->transfer, usb_dev, ep, data, len,
async_read_callback, ssm, async_read_callback, ssm,
VFS_USB_TIMEOUT); VFS_USB_TIMEOUT);
libusb_submit_transfer(vdev->transfer); libusb_submit_transfer(vdev->transfer);
@@ -125,7 +120,7 @@ static void async_read(struct fpi_ssm *ssm, int ep, void *data, int len)
static void async_abort_callback(struct libusb_transfer *transfer) static void async_abort_callback(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
int transferred = transfer->actual_length, error = transfer->status; int transferred = transfer->actual_length, error = transfer->status;
int ep = transfer->endpoint; int ep = transfer->endpoint;
@@ -148,15 +143,15 @@ static void async_abort_callback(struct libusb_transfer *transfer)
fp_warn("Endpoint %d had extra %d bytes", ep - 0x80, fp_warn("Endpoint %d had extra %d bytes", ep - 0x80,
transferred); transferred);
fpi_ssm_jump_to_state(ssm, ssm->cur_state); fpi_ssm_jump_to_state(ssm, fpi_ssm_get_cur_state(ssm));
} }
/* Receive data from the given ep and compare with expected */ /* Receive data from the given ep and compare with expected */
static void async_abort(struct fpi_ssm *ssm, int ep) static void async_abort(struct fpi_ssm *ssm, int ep)
{ {
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct libusb_device_handle *udev = idev->udev; struct libusb_device_handle *usb_dev = fpi_imgdev_get_usb_dev(idev);
struct vfs_dev_t *vdev = idev->priv; struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev);
int len = VFS_USB_BUFFER_SIZE; int len = VFS_USB_BUFFER_SIZE;
unsigned char *data = g_malloc(VFS_USB_BUFFER_SIZE); unsigned char *data = g_malloc(VFS_USB_BUFFER_SIZE);
@@ -169,11 +164,11 @@ static void async_abort(struct fpi_ssm *ssm, int ep)
/* 0x83 is the only interrupt endpoint */ /* 0x83 is the only interrupt endpoint */
if (ep == EP3_IN) if (ep == EP3_IN)
libusb_fill_interrupt_transfer(vdev->transfer, udev, ep, data, libusb_fill_interrupt_transfer(vdev->transfer, usb_dev, ep, data,
len, async_abort_callback, ssm, len, async_abort_callback, ssm,
VFS_USB_ABORT_TIMEOUT); VFS_USB_ABORT_TIMEOUT);
else else
libusb_fill_bulk_transfer(vdev->transfer, udev, ep, data, len, libusb_fill_bulk_transfer(vdev->transfer, usb_dev, ep, data, len,
async_abort_callback, ssm, async_abort_callback, ssm,
VFS_USB_ABORT_TIMEOUT); VFS_USB_ABORT_TIMEOUT);
libusb_submit_transfer(vdev->transfer); libusb_submit_transfer(vdev->transfer);
@@ -264,7 +259,7 @@ static struct fp_img *prepare_image(struct vfs_dev_t *vdev)
/* Processes and submits image after fingerprint received */ /* Processes and submits image after fingerprint received */
static void submit_image(struct fp_img_dev *idev) static void submit_image(struct fp_img_dev *idev)
{ {
struct vfs_dev_t *vdev = idev->priv; struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev);
/* We were not asked to submit image actually */ /* We were not asked to submit image actually */
if (!vdev->active) if (!vdev->active)
@@ -286,12 +281,12 @@ static void submit_image(struct fp_img_dev *idev)
/* SSM loop for clear_ep2 */ /* SSM loop for clear_ep2 */
static void clear_ep2_ssm(struct fpi_ssm *ssm) static void clear_ep2_ssm(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
short result; short result;
char command04 = 0x04; char command04 = 0x04;
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case SUBSM1_COMMAND_04: case SUBSM1_COMMAND_04:
async_write(ssm, &command04, sizeof(command04)); async_write(ssm, &command04, sizeof(command04));
break; break;
@@ -314,23 +309,23 @@ static void clear_ep2_ssm(struct fpi_ssm *ssm)
/* Send command to clear EP2 */ /* Send command to clear EP2 */
static void clear_ep2(struct fpi_ssm *ssm) static void clear_ep2(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct fpi_ssm *subsm = struct fpi_ssm *subsm =
fpi_ssm_new(idev->dev, clear_ep2_ssm, SUBSM1_STATES); fpi_ssm_new(fpi_imgdev_get_dev(idev), clear_ep2_ssm, SUBSM1_STATES);
subsm->priv = idev; fpi_ssm_set_user_data(subsm, idev);
fpi_ssm_start_subsm(ssm, subsm); fpi_ssm_start_subsm(ssm, subsm);
} }
static void send_control_packet_ssm(struct fpi_ssm *ssm) static void send_control_packet_ssm(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct vfs_dev_t *vdev = idev->priv; struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev);
short result; short result;
unsigned char *commit_result = NULL; unsigned char *commit_result = NULL;
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case SUBSM2_SEND_CONTROL: case SUBSM2_SEND_CONTROL:
async_write(ssm, vdev->control_packet, VFS_CONTROL_PACKET_SIZE); async_write(ssm, vdev->control_packet, VFS_CONTROL_PACKET_SIZE);
break; break;
@@ -392,11 +387,11 @@ static void send_control_packet_ssm(struct fpi_ssm *ssm)
/* Send device state control packet */ /* Send device state control packet */
static void send_control_packet(struct fpi_ssm *ssm) static void send_control_packet(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct fpi_ssm *subsm = struct fpi_ssm *subsm =
fpi_ssm_new(idev->dev, send_control_packet_ssm, SUBSM2_STATES); fpi_ssm_new(fpi_imgdev_get_dev(idev), send_control_packet_ssm, SUBSM2_STATES);
subsm->priv = idev; fpi_ssm_set_user_data(subsm, idev);
fpi_ssm_start_subsm(ssm, subsm); fpi_ssm_start_subsm(ssm, subsm);
} }
@@ -412,8 +407,8 @@ static void clear_data(struct vfs_dev_t *vdev)
static void interrupt_callback(struct libusb_transfer *transfer) static void interrupt_callback(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct vfs_dev_t *vdev = idev->priv; struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev);
char *interrupt = vdev->interrupt; char *interrupt = vdev->interrupt;
int error = transfer->status, transferred = transfer->actual_length; int error = transfer->status, transferred = transfer->actual_length;
@@ -472,8 +467,8 @@ static void interrupt_callback(struct libusb_transfer *transfer)
static void receive_callback(struct libusb_transfer *transfer) static void receive_callback(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct vfs_dev_t *vdev = idev->priv; struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev);
int transferred = transfer->actual_length, error = transfer->status; int transferred = transfer->actual_length, error = transfer->status;
@@ -492,7 +487,7 @@ static void receive_callback(struct libusb_transfer *transfer)
vdev->bytes += transferred; vdev->bytes += transferred;
/* We need more data */ /* We need more data */
fpi_ssm_jump_to_state(ssm, ssm->cur_state); fpi_ssm_jump_to_state(ssm, fpi_ssm_get_cur_state(ssm));
} }
} }
@@ -500,12 +495,12 @@ static void receive_callback(struct libusb_transfer *transfer)
static void wait_interrupt(void *data) static void wait_interrupt(void *data)
{ {
struct fpi_ssm *ssm = data; struct fpi_ssm *ssm = data;
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct vfs_dev_t *vdev = idev->priv; struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev);
/* Keep sleeping while this flag is on */ /* Keep sleeping while this flag is on */
if (vdev->wait_interrupt) if (vdev->wait_interrupt)
fpi_ssm_jump_to_state(ssm, ssm->cur_state); fpi_ssm_jump_to_state(ssm, fpi_ssm_get_cur_state(ssm));
} }
/* SSM stub to prepare device to another scan after orange light was on */ /* SSM stub to prepare device to another scan after orange light was on */
@@ -525,11 +520,11 @@ static void scan_completed(void *data)
/* Main SSM loop */ /* Main SSM loop */
static void activate_ssm(struct fpi_ssm *ssm) static void activate_ssm(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct libusb_device_handle *udev = idev->udev; struct libusb_device_handle *usb_dev = fpi_imgdev_get_usb_dev(idev);
struct vfs_dev_t *vdev = idev->priv; struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev);
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case SSM_INITIAL_ABORT_1: case SSM_INITIAL_ABORT_1:
async_abort(ssm, 1); async_abort(ssm, 1);
break; break;
@@ -582,7 +577,7 @@ static void activate_ssm(struct fpi_ssm *ssm)
/* Asyncronously enquire an interrupt */ /* Asyncronously enquire an interrupt */
vdev->transfer = libusb_alloc_transfer(0); vdev->transfer = libusb_alloc_transfer(0);
vdev->transfer->flags |= LIBUSB_TRANSFER_FREE_TRANSFER; vdev->transfer->flags |= LIBUSB_TRANSFER_FREE_TRANSFER;
libusb_fill_interrupt_transfer(vdev->transfer, udev, 0x83, libusb_fill_interrupt_transfer(vdev->transfer, usb_dev, 0x83,
vdev->interrupt, vdev->interrupt,
VFS_INTERRUPT_SIZE, VFS_INTERRUPT_SIZE,
interrupt_callback, ssm, 0); interrupt_callback, ssm, 0);
@@ -632,7 +627,7 @@ static void activate_ssm(struct fpi_ssm *ssm)
/* Receive chunk of data */ /* Receive chunk of data */
vdev->transfer = libusb_alloc_transfer(0); vdev->transfer = libusb_alloc_transfer(0);
vdev->transfer->flags |= LIBUSB_TRANSFER_FREE_TRANSFER; vdev->transfer->flags |= LIBUSB_TRANSFER_FREE_TRANSFER;
libusb_fill_bulk_transfer(vdev->transfer, udev, 0x82, libusb_fill_bulk_transfer(vdev->transfer, usb_dev, 0x82,
(void *)vdev->lines_buffer + (void *)vdev->lines_buffer +
vdev->bytes, VFS_USB_BUFFER_SIZE, vdev->bytes, VFS_USB_BUFFER_SIZE,
receive_callback, ssm, receive_callback, ssm,
@@ -678,8 +673,8 @@ static void activate_ssm(struct fpi_ssm *ssm)
/* Callback for dev_activate ssm */ /* Callback for dev_activate ssm */
static void dev_activate_callback(struct fpi_ssm *ssm) static void dev_activate_callback(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *idev = ssm->priv; struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
struct vfs_dev_t *vdev = idev->priv; struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev);
vdev->ssm_active = 0; vdev->ssm_active = 0;
@@ -689,15 +684,15 @@ static void dev_activate_callback(struct fpi_ssm *ssm)
/* Activate device */ /* Activate device */
static int dev_activate(struct fp_img_dev *idev, enum fp_imgdev_state state) static int dev_activate(struct fp_img_dev *idev, enum fp_imgdev_state state)
{ {
struct vfs_dev_t *vdev = idev->priv; struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev);
/* Initialize flags */ /* Initialize flags */
vdev->active = 1; vdev->active = 1;
vdev->need_report = 1; vdev->need_report = 1;
vdev->ssm_active = 1; vdev->ssm_active = 1;
struct fpi_ssm *ssm = fpi_ssm_new(idev->dev, activate_ssm, SSM_STATES); struct fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(idev), activate_ssm, SSM_STATES);
ssm->priv = idev; fpi_ssm_set_user_data(ssm, idev);
fpi_ssm_start(ssm, dev_activate_callback); fpi_ssm_start(ssm, dev_activate_callback);
return 0; return 0;
} }
@@ -705,7 +700,7 @@ static int dev_activate(struct fp_img_dev *idev, enum fp_imgdev_state state)
/* Deactivate device */ /* Deactivate device */
static void dev_deactivate(struct fp_img_dev *idev) static void dev_deactivate(struct fp_img_dev *idev)
{ {
struct vfs_dev_t *vdev = idev->priv; struct vfs_dev_t *vdev = fpi_imgdev_get_user_data(idev);
if (!vdev->ssm_active) { if (!vdev->ssm_active) {
fpi_imgdev_deactivate_complete(idev); fpi_imgdev_deactivate_complete(idev);
@@ -721,15 +716,17 @@ static void dev_deactivate(struct fp_img_dev *idev)
static void dev_open_callback(struct fpi_ssm *ssm) static void dev_open_callback(struct fpi_ssm *ssm)
{ {
/* Notify open complete */ /* Notify open complete */
fpi_imgdev_open_complete((struct fp_img_dev *)ssm->priv, 0); fpi_imgdev_open_complete(fpi_ssm_get_user_data(ssm), 0);
fpi_ssm_free(ssm); fpi_ssm_free(ssm);
} }
/* Open device */ /* Open device */
static int dev_open(struct fp_img_dev *idev, unsigned long driver_data) static int dev_open(struct fp_img_dev *idev, unsigned long driver_data)
{ {
struct vfs_dev_t *vdev;
/* Claim usb interface */ /* Claim usb interface */
int error = libusb_claim_interface(idev->udev, 0); int error = libusb_claim_interface(fpi_imgdev_get_usb_dev(idev), 0);
if (error < 0) { if (error < 0) {
/* Interface not claimed, return error */ /* Interface not claimed, return error */
fp_err("could not claim interface 0"); fp_err("could not claim interface 0");
@@ -737,12 +734,12 @@ static int dev_open(struct fp_img_dev *idev, unsigned long driver_data)
} }
/* Initialize private structure */ /* Initialize private structure */
struct vfs_dev_t *vdev = g_malloc0(sizeof(struct vfs_dev_t)); vdev = g_malloc0(sizeof(struct vfs_dev_t));
idev->priv = vdev; fpi_imgdev_set_user_data(idev, vdev);
/* Clearing previous device state */ /* Clearing previous device state */
struct fpi_ssm *ssm = fpi_ssm_new(idev->dev, activate_ssm, SSM_STATES); struct fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(idev), activate_ssm, SSM_STATES);
ssm->priv = idev; fpi_ssm_set_user_data(ssm, idev);
fpi_ssm_start(ssm, dev_open_callback); fpi_ssm_start(ssm, dev_open_callback);
return 0; return 0;
} }
@@ -750,11 +747,14 @@ static int dev_open(struct fp_img_dev *idev, unsigned long driver_data)
/* Close device */ /* Close device */
static void dev_close(struct fp_img_dev *idev) static void dev_close(struct fp_img_dev *idev)
{ {
struct vfs_dev_t *vdev;
/* Release private structure */ /* Release private structure */
g_free(idev->priv); vdev = fpi_imgdev_get_user_data(idev);
g_free(vdev);
/* Release usb interface */ /* Release usb interface */
libusb_release_interface(idev->udev, 0); libusb_release_interface(fpi_imgdev_get_usb_dev(idev), 0);
/* Notify close complete */ /* Notify close complete */
fpi_imgdev_close_complete(idev); fpi_imgdev_close_complete(idev);
+65 -68
View File
@@ -17,15 +17,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#define FP_COMPONENT "vfs101" #define FP_COMPONENT "vfs101"
#include <fp_internal.h> #include "drivers_api.h"
#include "driver_ids.h"
/* Input-Output usb endpoint */ /* Input-Output usb endpoint */
#define EP_IN(n) (n | LIBUSB_ENDPOINT_IN) #define EP_IN(n) (n | LIBUSB_ENDPOINT_IN)
@@ -190,7 +184,7 @@ static int result_code(struct fp_img_dev *dev, int result)
return result; return result;
/* Return result code */ /* Return result code */
if (dev->action == IMG_ACTION_ENROLL) if (fpi_imgdev_get_action(dev) == IMG_ACTION_ENROLL)
return result_codes[0][result]; return result_codes[0][result];
else else
return result_codes[1][result]; return result_codes[1][result];
@@ -206,8 +200,8 @@ static int result_code(struct fp_img_dev *dev, int result)
static void async_send_cb(struct libusb_transfer *transfer) static void async_send_cb(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = dev->priv; struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev);
/* Cleanup transfer */ /* Cleanup transfer */
vdev->transfer = NULL; vdev->transfer = NULL;
@@ -250,8 +244,8 @@ out:
/* Submit asynchronous send */ /* Submit asynchronous send */
static void async_send(struct fpi_ssm *ssm) static void async_send(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = dev->priv; struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev);
int r; int r;
/* Allocation of transfer */ /* Allocation of transfer */
@@ -271,7 +265,7 @@ static void async_send(struct fpi_ssm *ssm)
vdev->buffer[1] = byte(1, vdev->seqnum); vdev->buffer[1] = byte(1, vdev->seqnum);
/* Prepare bulk transfer */ /* Prepare bulk transfer */
libusb_fill_bulk_transfer(vdev->transfer, dev->udev, EP_OUT(1), vdev->buffer, vdev->length, async_send_cb, ssm, BULK_TIMEOUT); libusb_fill_bulk_transfer(vdev->transfer, fpi_imgdev_get_usb_dev(dev), EP_OUT(1), vdev->buffer, vdev->length, async_send_cb, ssm, BULK_TIMEOUT);
/* Submit transfer */ /* Submit transfer */
r = libusb_submit_transfer(vdev->transfer); r = libusb_submit_transfer(vdev->transfer);
@@ -290,8 +284,8 @@ static void async_send(struct fpi_ssm *ssm)
static void async_recv_cb(struct libusb_transfer *transfer) static void async_recv_cb(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = dev->priv; struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev);
/* Cleanup transfer */ /* Cleanup transfer */
vdev->transfer = NULL; vdev->transfer = NULL;
@@ -337,8 +331,8 @@ out:
/* Submit asynchronous recv */ /* Submit asynchronous recv */
static void async_recv(struct fpi_ssm *ssm) static void async_recv(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = dev->priv; struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev);
int r; int r;
/* Allocation of transfer */ /* Allocation of transfer */
@@ -353,7 +347,7 @@ static void async_recv(struct fpi_ssm *ssm)
} }
/* Prepare bulk transfer */ /* Prepare bulk transfer */
libusb_fill_bulk_transfer(vdev->transfer, dev->udev, EP_IN(1), vdev->buffer, 0x0f, async_recv_cb, ssm, BULK_TIMEOUT); libusb_fill_bulk_transfer(vdev->transfer, fpi_imgdev_get_usb_dev(dev), EP_IN(1), vdev->buffer, 0x0f, async_recv_cb, ssm, BULK_TIMEOUT);
/* Submit transfer */ /* Submit transfer */
r = libusb_submit_transfer(vdev->transfer); r = libusb_submit_transfer(vdev->transfer);
@@ -374,8 +368,8 @@ static void async_load(struct fpi_ssm *ssm);
static void async_load_cb(struct libusb_transfer *transfer) static void async_load_cb(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = dev->priv; struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev);
/* Cleanup transfer */ /* Cleanup transfer */
vdev->transfer = NULL; vdev->transfer = NULL;
@@ -438,8 +432,8 @@ out:
/* Submit asynchronous load */ /* Submit asynchronous load */
static void async_load(struct fpi_ssm *ssm) static void async_load(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = dev->priv; struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev);
unsigned char *buffer; unsigned char *buffer;
int r; int r;
@@ -458,7 +452,7 @@ static void async_load(struct fpi_ssm *ssm)
buffer = vdev->buffer + vdev->length; buffer = vdev->buffer + vdev->length;
/* Prepare bulk transfer */ /* Prepare bulk transfer */
libusb_fill_bulk_transfer(vdev->transfer, dev->udev, EP_IN(2), buffer, VFS_BLOCK_SIZE, async_load_cb, ssm, BULK_TIMEOUT); libusb_fill_bulk_transfer(vdev->transfer, fpi_imgdev_get_usb_dev(dev), EP_IN(2), buffer, VFS_BLOCK_SIZE, async_load_cb, ssm, BULK_TIMEOUT);
/* Submit transfer */ /* Submit transfer */
r = libusb_submit_transfer(vdev->transfer); r = libusb_submit_transfer(vdev->transfer);
@@ -477,8 +471,8 @@ static void async_load(struct fpi_ssm *ssm)
static void async_sleep_cb(void *data) static void async_sleep_cb(void *data)
{ {
struct fpi_ssm *ssm = data; struct fpi_ssm *ssm = data;
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = dev->priv; struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev);
/* Cleanup timeout */ /* Cleanup timeout */
vdev->timeout = NULL; vdev->timeout = NULL;
@@ -489,8 +483,8 @@ static void async_sleep_cb(void *data)
/* Submit asynchronous sleep */ /* Submit asynchronous sleep */
static void async_sleep(unsigned int msec, struct fpi_ssm *ssm) static void async_sleep(unsigned int msec, struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = dev->priv; struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev);
/* Add timeout */ /* Add timeout */
vdev->timeout = fpi_timeout_add(msec, async_sleep_cb, ssm); vdev->timeout = fpi_timeout_add(msec, async_sleep_cb, ssm);
@@ -515,7 +509,7 @@ enum
/* Exec swap sequential state machine */ /* Exec swap sequential state machine */
static void m_swap_state(struct fpi_ssm *ssm) static void m_swap_state(struct fpi_ssm *ssm)
{ {
switch (ssm->cur_state) switch (fpi_ssm_get_cur_state(ssm))
{ {
case M_SWAP_SEND: case M_SWAP_SEND:
/* Send data */ /* Send data */
@@ -532,8 +526,8 @@ static void m_swap_state(struct fpi_ssm *ssm)
/* Start swap sequential state machine */ /* Start swap sequential state machine */
static void m_swap(struct fpi_ssm *ssm, unsigned char *data, size_t length) static void m_swap(struct fpi_ssm *ssm, unsigned char *data, size_t length)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = dev->priv; struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *subsm; struct fpi_ssm *subsm;
/* Prepare data for sending */ /* Prepare data for sending */
@@ -542,8 +536,8 @@ static void m_swap(struct fpi_ssm *ssm, unsigned char *data, size_t length)
vdev->length = length; vdev->length = length;
/* Start swap ssm */ /* Start swap ssm */
subsm = fpi_ssm_new(dev->dev, m_swap_state, M_SWAP_NUM_STATES); subsm = fpi_ssm_new(fpi_imgdev_get_dev(dev), m_swap_state, M_SWAP_NUM_STATES);
subsm->priv = dev; fpi_ssm_set_user_data(subsm, dev);
fpi_ssm_start_subsm(ssm, subsm); fpi_ssm_start_subsm(ssm, subsm);
} }
@@ -589,7 +583,7 @@ static void vfs_abort_print(struct fpi_ssm *ssm)
{ {
unsigned char data[0x06] = { 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00 }; unsigned char data[0x06] = { 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00 };
fp_dbg(""); G_DEBUG_HERE();
/* Run swap sequential state machine */ /* Run swap sequential state machine */
m_swap (ssm, data, 0x06); m_swap (ssm, data, 0x06);
@@ -622,7 +616,7 @@ static void vfs_get_finger_state(struct fpi_ssm *ssm)
{ {
unsigned char data[0x06] = { 0x00, 0x00, 0x00, 0x00, 0x16, 0x00 }; unsigned char data[0x06] = { 0x00, 0x00, 0x00, 0x00, 0x16, 0x00 };
fp_dbg(""); G_DEBUG_HERE();
/* Run swap sequential state machine */ /* Run swap sequential state machine */
m_swap (ssm, data, 0x06); m_swap (ssm, data, 0x06);
@@ -631,10 +625,10 @@ static void vfs_get_finger_state(struct fpi_ssm *ssm)
/* Load raw image from reader */ /* Load raw image from reader */
static void vfs_img_load(struct fpi_ssm *ssm) static void vfs_img_load(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = dev->priv; struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev);
fp_dbg(""); G_DEBUG_HERE();
/* Reset buffer length */ /* Reset buffer length */
vdev->length = 0; vdev->length = 0;
@@ -650,10 +644,10 @@ static void vfs_img_load(struct fpi_ssm *ssm)
/* Check if action is completed */ /* Check if action is completed */
static int action_completed(struct fp_img_dev *dev) static int action_completed(struct fp_img_dev *dev)
{ {
struct vfs101_dev *vdev = dev->priv; struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev);
if ((dev->action == IMG_ACTION_ENROLL) && if ((fpi_imgdev_get_action(dev) == IMG_ACTION_ENROLL) &&
(vdev->enroll_stage < dev->dev->nr_enroll_stages)) (vdev->enroll_stage < fpi_dev_get_nr_enroll_stages(fpi_imgdev_get_dev(dev))))
/* Enroll not completed, return false */ /* Enroll not completed, return false */
return FALSE; return FALSE;
@@ -762,8 +756,8 @@ static void img_copy(struct vfs101_dev *vdev, struct fp_img *img)
/* Extract fingerpint image from raw data */ /* Extract fingerpint image from raw data */
static void img_extract(struct fpi_ssm *ssm) static void img_extract(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = dev->priv; struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev);
struct fp_img *img; struct fp_img *img;
/* Screen image to remove noise and find top and bottom line */ /* Screen image to remove noise and find top and bottom line */
@@ -793,28 +787,28 @@ static void img_extract(struct fpi_ssm *ssm)
fpi_imgdev_image_captured(dev, img); fpi_imgdev_image_captured(dev, img);
/* Check captured result */ /* Check captured result */
if (dev->action_result >= 0 && if (fpi_imgdev_get_action_result(dev) >= 0 &&
dev->action_result != FP_ENROLL_RETRY && fpi_imgdev_get_action_result(dev) != FP_ENROLL_RETRY &&
dev->action_result != FP_VERIFY_RETRY) fpi_imgdev_get_action_result(dev) != FP_VERIFY_RETRY)
{ {
/* Image captured, increase enroll stage */ /* Image captured, increase enroll stage */
vdev->enroll_stage++; vdev->enroll_stage++;
/* Check if action is completed */ /* Check if action is completed */
if (!action_completed(dev)) if (!action_completed(dev))
dev->action_result = FP_ENROLL_PASS; fpi_imgdev_set_action_result(dev, FP_ENROLL_PASS);
} }
else else
{ {
/* Image capture failed */ /* Image capture failed */
if (dev->action == IMG_ACTION_ENROLL) if (fpi_imgdev_get_action(dev) == IMG_ACTION_ENROLL)
/* Return retry */ /* Return retry */
dev->action_result = result_code(dev, RESULT_RETRY); fpi_imgdev_set_action_result(dev, result_code(dev, RESULT_RETRY));
else else
{ {
/* Return no match */ /* Return no match */
vdev->enroll_stage++; vdev->enroll_stage++;
dev->action_result = FP_VERIFY_NO_MATCH; fpi_imgdev_set_action_result(dev, FP_VERIFY_NO_MATCH);
} }
} }
@@ -920,8 +914,8 @@ enum
/* Exec loop sequential state machine */ /* Exec loop sequential state machine */
static void m_loop_state(struct fpi_ssm *ssm) static void m_loop_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = dev->priv; struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev);
/* Check action state */ /* Check action state */
if (!vdev->active) if (!vdev->active)
@@ -931,7 +925,7 @@ static void m_loop_state(struct fpi_ssm *ssm)
return; return;
} }
switch (ssm->cur_state) switch (fpi_ssm_get_cur_state(ssm))
{ {
case M_LOOP_0_GET_PRINT: case M_LOOP_0_GET_PRINT:
/* Send get print command to the reader */ /* Send get print command to the reader */
@@ -1184,8 +1178,8 @@ enum
/* Exec init sequential state machine */ /* Exec init sequential state machine */
static void m_init_state(struct fpi_ssm *ssm) static void m_init_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = dev->priv; struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev);
/* Check action state */ /* Check action state */
if (!vdev->active) if (!vdev->active)
@@ -1195,7 +1189,7 @@ static void m_init_state(struct fpi_ssm *ssm)
return; return;
} }
switch (ssm->cur_state) switch (fpi_ssm_get_cur_state(ssm))
{ {
case M_INIT_0_RECV_DIRTY: case M_INIT_0_RECV_DIRTY:
/* Recv eventualy dirty data */ /* Recv eventualy dirty data */
@@ -1425,18 +1419,18 @@ static void m_init_state(struct fpi_ssm *ssm)
/* Complete init sequential state machine */ /* Complete init sequential state machine */
static void m_init_complete(struct fpi_ssm *ssm) static void m_init_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs101_dev *vdev = dev->priv; struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *ssm_loop; struct fpi_ssm *ssm_loop;
if (!ssm->error && vdev->active) if (!fpi_ssm_get_error(ssm) && vdev->active)
{ {
/* Notify activate complete */ /* Notify activate complete */
fpi_imgdev_activate_complete(dev, 0); fpi_imgdev_activate_complete(dev, 0);
/* Start loop ssm */ /* Start loop ssm */
ssm_loop = fpi_ssm_new(dev->dev, m_loop_state, M_LOOP_NUM_STATES); ssm_loop = fpi_ssm_new(fpi_imgdev_get_dev(dev), m_loop_state, M_LOOP_NUM_STATES);
ssm_loop->priv = dev; fpi_ssm_set_user_data(ssm_loop, dev);
fpi_ssm_start(ssm_loop, m_loop_complete); fpi_ssm_start(ssm_loop, m_loop_complete);
} }
@@ -1447,7 +1441,7 @@ static void m_init_complete(struct fpi_ssm *ssm)
/* Activate device */ /* Activate device */
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state) static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{ {
struct vfs101_dev *vdev = dev->priv; struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *ssm; struct fpi_ssm *ssm;
/* Check if already active */ /* Check if already active */
@@ -1470,8 +1464,8 @@ static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
vdev->enroll_stage = 0; vdev->enroll_stage = 0;
/* Start init ssm */ /* Start init ssm */
ssm = fpi_ssm_new(dev->dev, m_init_state, M_INIT_NUM_STATES); ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), m_init_state, M_INIT_NUM_STATES);
ssm->priv = dev; fpi_ssm_set_user_data(ssm, dev);
fpi_ssm_start(ssm, m_init_complete); fpi_ssm_start(ssm, m_init_complete);
return 0; return 0;
@@ -1480,7 +1474,7 @@ static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
/* Deactivate device */ /* Deactivate device */
static void dev_deactivate(struct fp_img_dev *dev) static void dev_deactivate(struct fp_img_dev *dev)
{ {
struct vfs101_dev *vdev = dev->priv; struct vfs101_dev *vdev = fpi_imgdev_get_user_data(dev);
/* Reset active state */ /* Reset active state */
vdev->active = FALSE; vdev->active = FALSE;
@@ -1500,7 +1494,7 @@ static int dev_open(struct fp_img_dev *dev, unsigned long driver_data)
int r; int r;
/* Claim usb interface */ /* Claim usb interface */
r = libusb_claim_interface(dev->udev, 0); r = libusb_claim_interface(fpi_imgdev_get_usb_dev(dev), 0);
if (r < 0) if (r < 0)
{ {
/* Interface not claimed, return error */ /* Interface not claimed, return error */
@@ -1511,7 +1505,7 @@ static int dev_open(struct fp_img_dev *dev, unsigned long driver_data)
/* Initialize private structure */ /* Initialize private structure */
vdev = g_malloc0(sizeof(struct vfs101_dev)); vdev = g_malloc0(sizeof(struct vfs101_dev));
vdev->seqnum = -1; vdev->seqnum = -1;
dev->priv = vdev; fpi_imgdev_set_user_data(dev, vdev);
/* Notify open complete */ /* Notify open complete */
fpi_imgdev_open_complete(dev, 0); fpi_imgdev_open_complete(dev, 0);
@@ -1522,11 +1516,14 @@ static int dev_open(struct fp_img_dev *dev, unsigned long driver_data)
/* Close device */ /* Close device */
static void dev_close(struct fp_img_dev *dev) static void dev_close(struct fp_img_dev *dev)
{ {
struct vfs101_dev *vdev;
/* Release private structure */ /* Release private structure */
g_free(dev->priv); vdev = fpi_imgdev_get_user_data(dev);
g_free(vdev);
/* Release usb interface */ /* Release usb interface */
libusb_release_interface(dev->udev, 0); libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
/* Notify close complete */ /* Notify close complete */
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);
+30 -39
View File
@@ -21,20 +21,8 @@
#define FP_COMPONENT "vfs301" #define FP_COMPONENT "vfs301"
#include <errno.h> #include "drivers_api.h"
#include <signal.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <libusb-1.0/libusb.h>
#include "vfs301_proto.h" #include "vfs301_proto.h"
#include <unistd.h>
#include <fp_internal.h>
#include "driver_ids.h"
/************************** GENERIC STUFF *************************************/ /************************** GENERIC STUFF *************************************/
@@ -49,7 +37,7 @@ static void async_sleep_cb(void *data)
/* Submit asynchronous sleep */ /* Submit asynchronous sleep */
static void async_sleep(unsigned int msec, struct fpi_ssm *ssm) static void async_sleep(unsigned int msec, struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct fpi_timeout *timeout; struct fpi_timeout *timeout;
/* Add timeout */ /* Add timeout */
@@ -65,8 +53,8 @@ static void async_sleep(unsigned int msec, struct fpi_ssm *ssm)
static int submit_image(struct fpi_ssm *ssm) static int submit_image(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
vfs301_dev_t *vdev = dev->priv; vfs301_dev_t *vdev = fpi_imgdev_get_user_data(dev);
int height; int height;
struct fp_img *img; struct fp_img *img;
@@ -117,12 +105,12 @@ enum
/* Exec loop sequential state machine */ /* Exec loop sequential state machine */
static void m_loop_state(struct fpi_ssm *ssm) static void m_loop_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
vfs301_dev_t *vdev = dev->priv; vfs301_dev_t *vdev = fpi_imgdev_get_user_data(dev);
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case M_REQUEST_PRINT: case M_REQUEST_PRINT:
vfs301_proto_request_fingerprint(dev->udev, vdev); vfs301_proto_request_fingerprint(fpi_imgdev_get_usb_dev(dev), vdev);
fpi_ssm_next_state(ssm); fpi_ssm_next_state(ssm);
break; break;
@@ -132,7 +120,7 @@ static void m_loop_state(struct fpi_ssm *ssm)
break; break;
case M_CHECK_PRINT: case M_CHECK_PRINT:
if (!vfs301_proto_peek_event(dev->udev, vdev)) if (!vfs301_proto_peek_event(fpi_imgdev_get_usb_dev(dev), vdev))
fpi_ssm_jump_to_state(ssm, M_WAIT_PRINT); fpi_ssm_jump_to_state(ssm, M_WAIT_PRINT);
else else
fpi_ssm_next_state(ssm); fpi_ssm_next_state(ssm);
@@ -140,7 +128,7 @@ static void m_loop_state(struct fpi_ssm *ssm)
case M_READ_PRINT_START: case M_READ_PRINT_START:
fpi_imgdev_report_finger_status(dev, TRUE); fpi_imgdev_report_finger_status(dev, TRUE);
vfs301_proto_process_event_start(dev->udev, vdev); vfs301_proto_process_event_start(fpi_imgdev_get_usb_dev(dev), vdev);
fpi_ssm_next_state(ssm); fpi_ssm_next_state(ssm);
break; break;
@@ -151,8 +139,8 @@ static void m_loop_state(struct fpi_ssm *ssm)
case M_READ_PRINT_POLL: case M_READ_PRINT_POLL:
{ {
int rv = vfs301_proto_process_event_poll(dev->udev, vdev); int rv = vfs301_proto_process_event_poll(fpi_imgdev_get_usb_dev(dev), vdev);
assert(rv != VFS301_FAILURE); g_assert(rv != VFS301_FAILURE);
if (rv == VFS301_ONGOING) if (rv == VFS301_ONGOING)
fpi_ssm_jump_to_state(ssm, M_READ_PRINT_WAIT); fpi_ssm_jump_to_state(ssm, M_READ_PRINT_WAIT);
else else
@@ -182,12 +170,12 @@ static void m_loop_complete(struct fpi_ssm *ssm)
/* Exec init sequential state machine */ /* Exec init sequential state machine */
static void m_init_state(struct fpi_ssm *ssm) static void m_init_state(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
vfs301_dev_t *vdev = dev->priv; vfs301_dev_t *vdev = fpi_imgdev_get_user_data(dev);
assert(ssm->cur_state == 0); g_assert(fpi_ssm_get_cur_state(ssm) == 0);
vfs301_proto_init(dev->udev, vdev); vfs301_proto_init(fpi_imgdev_get_usb_dev(dev), vdev);
fpi_ssm_mark_completed(ssm); fpi_ssm_mark_completed(ssm);
} }
@@ -195,16 +183,16 @@ static void m_init_state(struct fpi_ssm *ssm)
/* Complete init sequential state machine */ /* Complete init sequential state machine */
static void m_init_complete(struct fpi_ssm *ssm) static void m_init_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct fpi_ssm *ssm_loop; struct fpi_ssm *ssm_loop;
if (!ssm->error) { if (!fpi_ssm_get_error(ssm)) {
/* Notify activate complete */ /* Notify activate complete */
fpi_imgdev_activate_complete(dev, 0); fpi_imgdev_activate_complete(dev, 0);
/* Start loop ssm */ /* Start loop ssm */
ssm_loop = fpi_ssm_new(dev->dev, m_loop_state, M_LOOP_NUM_STATES); ssm_loop = fpi_ssm_new(fpi_imgdev_get_dev(dev), m_loop_state, M_LOOP_NUM_STATES);
ssm_loop->priv = dev; fpi_ssm_set_user_data(ssm_loop, dev);
fpi_ssm_start(ssm_loop, m_loop_complete); fpi_ssm_start(ssm_loop, m_loop_complete);
} }
@@ -218,8 +206,8 @@ static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
struct fpi_ssm *ssm; struct fpi_ssm *ssm;
/* Start init ssm */ /* Start init ssm */
ssm = fpi_ssm_new(dev->dev, m_init_state, 1); ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), m_init_state, 1);
ssm->priv = dev; fpi_ssm_set_user_data(ssm, dev);
fpi_ssm_start(ssm, m_init_complete); fpi_ssm_start(ssm, m_init_complete);
return 0; return 0;
@@ -237,7 +225,7 @@ static int dev_open(struct fp_img_dev *dev, unsigned long driver_data)
int r; int r;
/* Claim usb interface */ /* Claim usb interface */
r = libusb_claim_interface(dev->udev, 0); r = libusb_claim_interface(fpi_imgdev_get_usb_dev(dev), 0);
if (r < 0) { if (r < 0) {
/* Interface not claimed, return error */ /* Interface not claimed, return error */
fp_err("could not claim interface 0: %s", libusb_error_name(r)); fp_err("could not claim interface 0: %s", libusb_error_name(r));
@@ -246,7 +234,7 @@ static int dev_open(struct fp_img_dev *dev, unsigned long driver_data)
/* Initialize private structure */ /* Initialize private structure */
vdev = g_malloc0(sizeof(vfs301_dev_t)); vdev = g_malloc0(sizeof(vfs301_dev_t));
dev->priv = vdev; fpi_imgdev_set_user_data(dev, vdev);
vdev->scanline_buf = malloc(0); vdev->scanline_buf = malloc(0);
vdev->scanline_count = 0; vdev->scanline_count = 0;
@@ -259,12 +247,15 @@ static int dev_open(struct fp_img_dev *dev, unsigned long driver_data)
static void dev_close(struct fp_img_dev *dev) static void dev_close(struct fp_img_dev *dev)
{ {
vfs301_dev_t *vdev;
/* Release private structure */ /* Release private structure */
free(((vfs301_dev_t*)dev->priv)->scanline_buf); vdev = fpi_imgdev_get_user_data(dev);
g_free(dev->priv); free(vdev->scanline_buf);
g_free(vdev);
/* Release usb interface */ /* Release usb interface */
libusb_release_interface(dev->udev, 0); libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
/* Notify close complete */ /* Notify close complete */
fpi_imgdev_close_complete(dev); fpi_imgdev_close_complete(dev);
+21 -24
View File
@@ -28,18 +28,15 @@
* - describe some interesting structures better * - describe some interesting structures better
*/ */
#include <errno.h> #include <errno.h>
#include <signal.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <assert.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <glib.h>
#include <libusb-1.0/libusb.h> #include <libusb-1.0/libusb.h>
#include "vfs301_proto.h" #include "vfs301_proto.h"
#include "vfs301_proto_fragments.h" #include "vfs301_proto_fragments.h"
#include <unistd.h>
#define min(a, b) (((a) < (b)) ? (a) : (b))
/************************** USB STUFF *****************************************/ /************************** USB STUFF *****************************************/
@@ -51,7 +48,7 @@ static void usb_print_packet(int dir, int rv, const unsigned char *data, int len
#ifdef PRINT_VERBOSE #ifdef PRINT_VERBOSE
int i; int i;
for (i = 0; i < min(length, 128); i++) { for (i = 0; i < MIN(length, 128); i++) {
fprintf(stderr, "%.2X ", data[i]); fprintf(stderr, "%.2X ", data[i]);
if (i % 8 == 7) if (i % 8 == 7)
fprintf(stderr, " "); fprintf(stderr, " ");
@@ -68,7 +65,7 @@ static int usb_recv(
vfs301_dev_t *dev, vfs301_dev_t *dev,
struct libusb_device_handle *devh, unsigned char endpoint, int max_bytes) struct libusb_device_handle *devh, unsigned char endpoint, int max_bytes)
{ {
assert(max_bytes <= sizeof(dev->recv_buf)); g_assert(max_bytes <= sizeof(dev->recv_buf));
int r = libusb_bulk_transfer( int r = libusb_bulk_transfer(
devh, endpoint, devh, endpoint,
@@ -99,7 +96,7 @@ static int usb_send(
usb_print_packet(1, r, data, length); usb_print_packet(1, r, data, length);
#endif #endif
assert(r == 0); g_assert(r == 0);
if (r < 0) if (r < 0)
return r; return r;
@@ -131,7 +128,7 @@ static void vfs301_proto_generate_0B(int subtype, unsigned char *data, int *len)
len++; len++;
break; break;
default: default:
assert(!"unsupported"); g_assert_not_reached();
break; break;
} }
} }
@@ -147,8 +144,8 @@ static void translate_str(const char **srcL, unsigned char *data, int *len)
while (*srcL != NULL) { while (*srcL != NULL) {
src = *srcL; src = *srcL;
while (*src != '\0') { while (*src != '\0') {
assert(*src != '\0'); g_assert(*src != '\0');
assert(*(src +1) != '\0'); g_assert(*(src +1) != '\0');
*data = (unsigned char)((HEX_TO_INT(*src) << 4) | (HEX_TO_INT(*(src + 1)))); *data = (unsigned char)((HEX_TO_INT(*src) << 4) | (HEX_TO_INT(*(src + 1))));
data++; data++;
@@ -193,7 +190,7 @@ static void vfs301_proto_generate(int type, int subtype, unsigned char *data, in
vfs301_02D0_06, vfs301_02D0_06,
vfs301_02D0_07, vfs301_02D0_07,
}; };
assert((int)subtype <= (int)(sizeof(dataLs) / sizeof(dataLs[0]))); g_assert((int)subtype <= (int)(sizeof(dataLs) / sizeof(dataLs[0])));
translate_str(dataLs[subtype - 1], data, len); translate_str(dataLs[subtype - 1], data, len);
} }
break; break;
@@ -214,10 +211,10 @@ static void vfs301_proto_generate(int type, int subtype, unsigned char *data, in
translate_str(vfs301_next_scan_template, data, len); translate_str(vfs301_next_scan_template, data, len);
unsigned char *field = data + *len - (sizeof(S4_TAIL) - 1) / 2 - 4; unsigned char *field = data + *len - (sizeof(S4_TAIL) - 1) / 2 - 4;
assert(*field == 0xDE); g_assert(*field == 0xDE);
assert(*(field + 1) == 0xAD); g_assert(*(field + 1) == 0xAD);
assert(*(field + 2) == 0xDE); g_assert(*(field + 2) == 0xDE);
assert(*(field + 3) == 0xAD); g_assert(*(field + 3) == 0xAD);
*field = (unsigned char)((subtype >> 8) & 0xFF); *field = (unsigned char)((subtype >> 8) & 0xFF);
*(field + 1) = (unsigned char)(subtype & 0xFF); *(field + 1) = (unsigned char)(subtype & 0xFF);
@@ -225,15 +222,15 @@ static void vfs301_proto_generate(int type, int subtype, unsigned char *data, in
*(field + 3) = *(field + 1); *(field + 3) = *(field + 1);
break; break;
default: default:
assert(0); g_assert(0);
break; break;
} }
break; break;
case 0x06: case 0x06:
assert(!"Not generated"); g_assert_not_reached();
break; break;
default: default:
assert(!"Unknown message type"); g_assert_not_reached();
break; break;
} }
} }
@@ -296,7 +293,7 @@ void vfs301_extract_image(
int last_line; int last_line;
int i; int i;
assert(vfs->scanline_count >= 1); g_assert(vfs->scanline_count >= 1);
*output_height = 1; *output_height = 1;
memcpy(output, scanlines, VFS301_FP_OUTPUT_WIDTH); memcpy(output, scanlines, VFS301_FP_OUTPUT_WIDTH);
@@ -344,7 +341,7 @@ static int img_process_data(
} }
dev->scanline_buf = realloc(dev->scanline_buf, dev->scanline_count * VFS301_FP_OUTPUT_WIDTH); dev->scanline_buf = realloc(dev->scanline_buf, dev->scanline_count * VFS301_FP_OUTPUT_WIDTH);
assert(dev->scanline_buf != NULL); g_assert(dev->scanline_buf != NULL);
for (cur_line = dev->scanline_buf + last_img_height * VFS301_FP_OUTPUT_WIDTH, i = 0; for (cur_line = dev->scanline_buf + last_img_height * VFS301_FP_OUTPUT_WIDTH, i = 0;
i < no_lines; i < no_lines;
@@ -391,7 +388,7 @@ static int vfs301_proto_process_data(int first_block, vfs301_dev_t *dev)
int len = dev->recv_len; int len = dev->recv_len;
if (first_block) { if (first_block) {
assert(len >= VFS301_FP_FRAME_SIZE); g_assert(len >= VFS301_FP_FRAME_SIZE);
/* Skip bytes until start_sequence is found */ /* Skip bytes until start_sequence is found */
for (i = 0; i < VFS301_FP_FRAME_SIZE; i++, buf++, len--) { for (i = 0; i < VFS301_FP_FRAME_SIZE; i++, buf++, len--) {
@@ -417,14 +414,14 @@ int vfs301_proto_peek_event(
const char got_event[] = {0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00}; const char got_event[] = {0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00};
USB_SEND(0x17, -1); USB_SEND(0x17, -1);
assert(USB_RECV(VFS301_RECEIVE_ENDPOINT_CTRL, 7) == 0); g_assert(USB_RECV(VFS301_RECEIVE_ENDPOINT_CTRL, 7) == 0);
if (memcmp(dev->recv_buf, no_event, sizeof(no_event)) == 0) { if (memcmp(dev->recv_buf, no_event, sizeof(no_event)) == 0) {
return 0; return 0;
} else if (memcmp(dev->recv_buf, got_event, sizeof(no_event)) == 0) { } else if (memcmp(dev->recv_buf, got_event, sizeof(no_event)) == 0) {
return 1; return 1;
} else { } else {
assert(!"unexpected reply to wait"); g_assert_not_reached();
} }
} }
+69 -55
View File
@@ -18,14 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <stdio.h> #include "drivers_api.h"
#include <errno.h>
#include <string.h>
#include <libusb.h>
#include <fp_internal.h>
#include <assembling.h>
#include "driver_ids.h"
#include "vfs5011_proto.h" #include "vfs5011_proto.h"
/* =================== sync/async USB transfer sequence ==================== */ /* =================== sync/async USB transfer sequence ==================== */
@@ -83,17 +76,17 @@ static void start_scan(struct fp_img_dev *dev);
static void async_send_cb(struct libusb_transfer *transfer) static void async_send_cb(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct usbexchange_data *data = (struct usbexchange_data *)ssm->priv; struct usbexchange_data *data = fpi_ssm_get_user_data(ssm);
struct usb_action *action; struct usb_action *action;
if (ssm->cur_state >= data->stepcount) { if (fpi_ssm_get_cur_state(ssm) >= data->stepcount) {
fp_err("Radiation detected!"); fp_err("Radiation detected!");
fpi_imgdev_session_error(data->device, -EINVAL); fpi_imgdev_session_error(data->device, -EINVAL);
fpi_ssm_mark_aborted(ssm, -EINVAL); fpi_ssm_mark_aborted(ssm, -EINVAL);
goto out; goto out;
} }
action = &data->actions[ssm->cur_state]; action = &data->actions[fpi_ssm_get_cur_state(ssm)];
if (action->type != ACTION_SEND) { if (action->type != ACTION_SEND) {
fp_err("Radiation detected!"); fp_err("Radiation detected!");
fpi_imgdev_session_error(data->device, -EINVAL); fpi_imgdev_session_error(data->device, -EINVAL);
@@ -127,7 +120,7 @@ out:
static void async_recv_cb(struct libusb_transfer *transfer) static void async_recv_cb(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = transfer->user_data; struct fpi_ssm *ssm = transfer->user_data;
struct usbexchange_data *data = (struct usbexchange_data *)ssm->priv; struct usbexchange_data *data = fpi_ssm_get_user_data(ssm);
struct usb_action *action; struct usb_action *action;
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) { if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
@@ -138,14 +131,14 @@ static void async_recv_cb(struct libusb_transfer *transfer)
goto out; goto out;
} }
if (ssm->cur_state >= data->stepcount) { if (fpi_ssm_get_cur_state(ssm) >= data->stepcount) {
fp_err("Radiation detected!"); fp_err("Radiation detected!");
fpi_imgdev_session_error(data->device, -EINVAL); fpi_imgdev_session_error(data->device, -EINVAL);
fpi_ssm_mark_aborted(ssm, -EINVAL); fpi_ssm_mark_aborted(ssm, -EINVAL);
goto out; goto out;
} }
action = &data->actions[ssm->cur_state]; action = &data->actions[fpi_ssm_get_cur_state(ssm)];
if (action->type != ACTION_RECEIVE) { if (action->type != ACTION_RECEIVE) {
fp_err("Radiation detected!"); fp_err("Radiation detected!");
fpi_imgdev_session_error(data->device, -EINVAL); fpi_imgdev_session_error(data->device, -EINVAL);
@@ -180,16 +173,16 @@ out:
static void usbexchange_loop(struct fpi_ssm *ssm) static void usbexchange_loop(struct fpi_ssm *ssm)
{ {
struct usbexchange_data *data = (struct usbexchange_data *)ssm->priv; struct usbexchange_data *data = fpi_ssm_get_user_data(ssm);
if (ssm->cur_state >= data->stepcount) { if (fpi_ssm_get_cur_state(ssm) >= data->stepcount) {
fp_err("Bug detected: state %d out of range, only %d steps", fp_err("Bug detected: state %d out of range, only %d steps",
ssm->cur_state, data->stepcount); fpi_ssm_get_cur_state(ssm), data->stepcount);
fpi_imgdev_session_error(data->device, -EINVAL); fpi_imgdev_session_error(data->device, -EINVAL);
fpi_ssm_mark_aborted(ssm, -EINVAL); fpi_ssm_mark_aborted(ssm, -EINVAL);
return; return;
} }
struct usb_action *action = &data->actions[ssm->cur_state]; struct usb_action *action = &data->actions[fpi_ssm_get_cur_state(ssm)];
struct libusb_transfer *transfer; struct libusb_transfer *transfer;
int ret = -EINVAL; int ret = -EINVAL;
@@ -203,7 +196,7 @@ static void usbexchange_loop(struct fpi_ssm *ssm)
fpi_ssm_mark_aborted(ssm, -ENOMEM); fpi_ssm_mark_aborted(ssm, -ENOMEM);
return; return;
} }
libusb_fill_bulk_transfer(transfer, data->device->udev, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(data->device),
action->endpoint, action->data, action->endpoint, action->data,
action->size, async_send_cb, ssm, action->size, async_send_cb, ssm,
data->timeout); data->timeout);
@@ -219,7 +212,7 @@ static void usbexchange_loop(struct fpi_ssm *ssm)
fpi_ssm_mark_aborted(ssm, -ENOMEM); fpi_ssm_mark_aborted(ssm, -ENOMEM);
return; return;
} }
libusb_fill_bulk_transfer(transfer, data->device->udev, libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(data->device),
action->endpoint, data->receive_buf, action->endpoint, data->receive_buf,
action->size, async_recv_cb, ssm, action->size, async_recv_cb, ssm,
data->timeout); data->timeout);
@@ -243,10 +236,10 @@ static void usbexchange_loop(struct fpi_ssm *ssm)
static void usb_exchange_async(struct fpi_ssm *ssm, static void usb_exchange_async(struct fpi_ssm *ssm,
struct usbexchange_data *data) struct usbexchange_data *data)
{ {
struct fpi_ssm *subsm = fpi_ssm_new(data->device->dev, struct fpi_ssm *subsm = fpi_ssm_new(fpi_imgdev_get_dev(data->device),
usbexchange_loop, usbexchange_loop,
data->stepcount); data->stepcount);
subsm->priv = data; fpi_ssm_set_user_data(subsm, data);
fpi_ssm_start_subsm(ssm, subsm); fpi_ssm_start_subsm(ssm, subsm);
} }
@@ -404,9 +397,17 @@ static int process_chunk(struct vfs5011_data *data, int transferred)
void submit_image(struct fpi_ssm *ssm, struct vfs5011_data *data) void submit_image(struct fpi_ssm *ssm, struct vfs5011_data *data)
{ {
struct fp_img_dev *dev = (struct fp_img_dev *)ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct fp_img *img; struct fp_img *img;
if (data->lines_recorded == 0) {
/* == FP_ENROLL_RETRY_TOO_SHORT */
fpi_imgdev_session_error(dev, FP_VERIFY_RETRY_TOO_SHORT);
return;
}
g_assert (data->rows != NULL);
data->rows = g_slist_reverse(data->rows); data->rows = g_slist_reverse(data->rows);
img = fpi_assemble_lines(&assembling_ctx, data->rows, data->lines_recorded); img = fpi_assemble_lines(&assembling_ctx, data->rows, data->lines_recorded);
@@ -422,8 +423,10 @@ void submit_image(struct fpi_ssm *ssm, struct vfs5011_data *data)
static void chunk_capture_callback(struct libusb_transfer *transfer) static void chunk_capture_callback(struct libusb_transfer *transfer)
{ {
struct fpi_ssm *ssm = (struct fpi_ssm *)transfer->user_data; struct fpi_ssm *ssm = (struct fpi_ssm *)transfer->user_data;
struct fp_img_dev *dev = (struct fp_img_dev *)ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs5011_data *data = (struct vfs5011_data *)dev->priv; struct vfs5011_data *data;
data = fpi_imgdev_get_user_data(dev);
if ((transfer->status == LIBUSB_TRANSFER_COMPLETED) || if ((transfer->status == LIBUSB_TRANSFER_COMPLETED) ||
(transfer->status == LIBUSB_TRANSFER_TIMED_OUT)) { (transfer->status == LIBUSB_TRANSFER_TIMED_OUT)) {
@@ -666,12 +669,14 @@ static void activate_loop(struct fpi_ssm *ssm)
{ {
enum {READ_TIMEOUT = 0}; enum {READ_TIMEOUT = 0};
struct fp_img_dev *dev = (struct fp_img_dev *)ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs5011_data *data = (struct vfs5011_data *)dev->priv; struct vfs5011_data *data;
int r; int r;
struct fpi_timeout *timeout; struct fpi_timeout *timeout;
fp_dbg("main_loop: state %d", ssm->cur_state); data = fpi_imgdev_get_user_data(dev);
fp_dbg("main_loop: state %d", fpi_ssm_get_cur_state(ssm));
if (data->deactivating) { if (data->deactivating) {
fp_dbg("deactivating, marking completed"); fp_dbg("deactivating, marking completed");
@@ -679,10 +684,10 @@ static void activate_loop(struct fpi_ssm *ssm)
return; return;
} }
switch (ssm->cur_state) { switch (fpi_ssm_get_cur_state(ssm)) {
case DEV_ACTIVATE_REQUEST_FPRINT: case DEV_ACTIVATE_REQUEST_FPRINT:
data->init_sequence.stepcount = data->init_sequence.stepcount =
array_n_elements(vfs5011_initiate_capture); G_N_ELEMENTS(vfs5011_initiate_capture);
data->init_sequence.actions = vfs5011_initiate_capture; data->init_sequence.actions = vfs5011_initiate_capture;
data->init_sequence.device = dev; data->init_sequence.device = dev;
if (data->init_sequence.receive_buf == NULL) if (data->init_sequence.receive_buf == NULL)
@@ -702,7 +707,7 @@ static void activate_loop(struct fpi_ssm *ssm)
break; break;
case DEV_ACTIVATE_READ_DATA: case DEV_ACTIVATE_READ_DATA:
r = capture_chunk_async(data, dev->udev, CAPTURE_LINES, r = capture_chunk_async(data, fpi_imgdev_get_usb_dev(dev), CAPTURE_LINES,
READ_TIMEOUT, ssm); READ_TIMEOUT, ssm);
if (r != 0) { if (r != 0) {
fp_err("Failed to capture data"); fp_err("Failed to capture data");
@@ -724,7 +729,7 @@ static void activate_loop(struct fpi_ssm *ssm)
case DEV_ACTIVATE_PREPARE_NEXT_CAPTURE: case DEV_ACTIVATE_PREPARE_NEXT_CAPTURE:
data->init_sequence.stepcount = data->init_sequence.stepcount =
array_n_elements(vfs5011_initiate_capture); G_N_ELEMENTS(vfs5011_initiate_capture);
data->init_sequence.actions = vfs5011_initiate_capture; data->init_sequence.actions = vfs5011_initiate_capture;
data->init_sequence.device = dev; data->init_sequence.device = dev;
if (data->init_sequence.receive_buf == NULL) if (data->init_sequence.receive_buf == NULL)
@@ -739,16 +744,17 @@ static void activate_loop(struct fpi_ssm *ssm)
static void activate_loop_complete(struct fpi_ssm *ssm) static void activate_loop_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = (struct fp_img_dev *)ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs5011_data *data = (struct vfs5011_data *)dev->priv; struct vfs5011_data *data;
int r = ssm->error; int r = fpi_ssm_get_error(ssm);
data = fpi_imgdev_get_user_data(dev);
fp_dbg("finishing"); fp_dbg("finishing");
if (data->init_sequence.receive_buf != NULL) if (data->init_sequence.receive_buf != NULL)
g_free(data->init_sequence.receive_buf); g_free(data->init_sequence.receive_buf);
data->init_sequence.receive_buf = NULL; data->init_sequence.receive_buf = NULL;
/* We don't want to submit image if we're in deactivating process */ if (!data->deactivating && !r) {
if (!data->deactivating) {
submit_image(ssm, data); submit_image(ssm, data);
fpi_imgdev_report_finger_status(dev, FALSE); fpi_imgdev_report_finger_status(dev, FALSE);
} }
@@ -768,13 +774,15 @@ static void activate_loop_complete(struct fpi_ssm *ssm)
static void open_loop(struct fpi_ssm *ssm) static void open_loop(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = (struct fp_img_dev *)ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs5011_data *data = (struct vfs5011_data *)dev->priv; struct vfs5011_data *data;
switch (ssm->cur_state) { data = fpi_imgdev_get_user_data(dev);
switch (fpi_ssm_get_cur_state(ssm)) {
case DEV_OPEN_START: case DEV_OPEN_START:
data->init_sequence.stepcount = data->init_sequence.stepcount =
array_n_elements(vfs5011_initialization); G_N_ELEMENTS(vfs5011_initialization);
data->init_sequence.actions = vfs5011_initialization; data->init_sequence.actions = vfs5011_initialization;
data->init_sequence.device = dev; data->init_sequence.device = dev;
data->init_sequence.receive_buf = data->init_sequence.receive_buf =
@@ -787,9 +795,10 @@ static void open_loop(struct fpi_ssm *ssm)
static void open_loop_complete(struct fpi_ssm *ssm) static void open_loop_complete(struct fpi_ssm *ssm)
{ {
struct fp_img_dev *dev = (struct fp_img_dev *)ssm->priv; struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct vfs5011_data *data = (struct vfs5011_data *)dev->priv; struct vfs5011_data *data;
data = fpi_imgdev_get_user_data(dev);
g_free(data->init_sequence.receive_buf); g_free(data->init_sequence.receive_buf);
data->init_sequence.receive_buf = NULL; data->init_sequence.receive_buf = NULL;
@@ -806,23 +815,23 @@ static int dev_open(struct fp_img_dev *dev, unsigned long driver_data)
data = (struct vfs5011_data *)g_malloc0(sizeof(*data)); data = (struct vfs5011_data *)g_malloc0(sizeof(*data));
data->capture_buffer = data->capture_buffer =
(unsigned char *)g_malloc0(CAPTURE_LINES * VFS5011_LINE_SIZE); (unsigned char *)g_malloc0(CAPTURE_LINES * VFS5011_LINE_SIZE);
dev->priv = data; fpi_imgdev_set_user_data(dev, data);
r = libusb_reset_device(dev->udev); r = libusb_reset_device(fpi_imgdev_get_usb_dev(dev));
if (r != 0) { if (r != 0) {
fp_err("Failed to reset the device"); fp_err("Failed to reset the device");
return r; return r;
} }
r = libusb_claim_interface(dev->udev, 0); r = libusb_claim_interface(fpi_imgdev_get_usb_dev(dev), 0);
if (r != 0) { if (r != 0) {
fp_err("Failed to claim interface: %s", libusb_error_name(r)); fp_err("Failed to claim interface: %s", libusb_error_name(r));
return r; return r;
} }
struct fpi_ssm *ssm; struct fpi_ssm *ssm;
ssm = fpi_ssm_new(dev->dev, open_loop, DEV_OPEN_NUM_STATES); ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), open_loop, DEV_OPEN_NUM_STATES);
ssm->priv = dev; fpi_ssm_set_user_data(ssm, dev);
fpi_ssm_start(ssm, open_loop_complete); fpi_ssm_start(ssm, open_loop_complete);
return 0; return 0;
@@ -830,8 +839,9 @@ static int dev_open(struct fp_img_dev *dev, unsigned long driver_data)
static void dev_close(struct fp_img_dev *dev) static void dev_close(struct fp_img_dev *dev)
{ {
libusb_release_interface(dev->udev, 0); libusb_release_interface(fpi_imgdev_get_usb_dev(dev), 0);
struct vfs5011_data *data = (struct vfs5011_data *)dev->priv; struct vfs5011_data *data;
data = fpi_imgdev_get_user_data(dev);
if (data != NULL) { if (data != NULL) {
g_free(data->capture_buffer); g_free(data->capture_buffer);
g_slist_free_full(data->rows, g_free); g_slist_free_full(data->rows, g_free);
@@ -842,13 +852,14 @@ static void dev_close(struct fp_img_dev *dev)
static void start_scan(struct fp_img_dev *dev) static void start_scan(struct fp_img_dev *dev)
{ {
struct vfs5011_data *data = (struct vfs5011_data *)dev->priv; struct vfs5011_data *data;
struct fpi_ssm *ssm; struct fpi_ssm *ssm;
data = fpi_imgdev_get_user_data(dev);
data->loop_running = TRUE; data->loop_running = TRUE;
fp_dbg("creating ssm"); fp_dbg("creating ssm");
ssm = fpi_ssm_new(dev->dev, activate_loop, DEV_ACTIVATE_NUM_STATES); ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_loop, DEV_ACTIVATE_NUM_STATES);
ssm->priv = dev; fpi_ssm_set_user_data(ssm, dev);
fp_dbg("starting ssm"); fp_dbg("starting ssm");
fpi_ssm_start(ssm, activate_loop_complete); fpi_ssm_start(ssm, activate_loop_complete);
fp_dbg("ssm done, getting out"); fp_dbg("ssm done, getting out");
@@ -856,8 +867,9 @@ static void start_scan(struct fp_img_dev *dev)
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state) static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{ {
struct vfs5011_data *data = (struct vfs5011_data *)dev->priv; struct vfs5011_data *data;
data = fpi_imgdev_get_user_data(dev);
fp_dbg("device initialized"); fp_dbg("device initialized");
data->deactivating = FALSE; data->deactivating = FALSE;
@@ -869,7 +881,9 @@ static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
static void dev_deactivate(struct fp_img_dev *dev) static void dev_deactivate(struct fp_img_dev *dev)
{ {
int r; int r;
struct vfs5011_data *data = dev->priv; struct vfs5011_data *data;
data = fpi_imgdev_get_user_data(dev);
if (data->loop_running) { if (data->loop_running) {
data->deactivating = TRUE; data->deactivating = TRUE;
if (data->flying_transfer) { if (data->flying_transfer) {
+304
View File
@@ -0,0 +1,304 @@
/*
* Driver API definitions
* Copyright (C) 2007-2008 Daniel Drake <dsd@gentoo.org>
* Copyright (C) 2018 Bastien Nocera <hadess@hadess.net>
*
* 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
*/
#ifndef __DRIVERS_API_H__
#define __DRIVERS_API_H__
#include <config.h>
#ifdef FP_COMPONENT
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "libfprint-"FP_COMPONENT
#endif
#include <stdint.h>
#include <errno.h>
#include <glib.h>
#include <libusb.h>
#include "fprint.h"
#include "assembling.h"
#include "drivers/driver_ids.h"
#define fp_dbg g_debug
#define fp_info g_debug
#define fp_warn g_warning
#define fp_err g_error
#define BUG_ON(condition) g_assert(!(condition))
#define BUG() g_assert_not_reached()
enum fp_dev_state {
DEV_STATE_INITIAL = 0,
DEV_STATE_ERROR,
DEV_STATE_INITIALIZING,
DEV_STATE_INITIALIZED,
DEV_STATE_DEINITIALIZING,
DEV_STATE_DEINITIALIZED,
DEV_STATE_ENROLL_STARTING,
DEV_STATE_ENROLLING,
DEV_STATE_ENROLL_STOPPING,
DEV_STATE_VERIFY_STARTING,
DEV_STATE_VERIFYING,
DEV_STATE_VERIFY_DONE,
DEV_STATE_VERIFY_STOPPING,
DEV_STATE_IDENTIFY_STARTING,
DEV_STATE_IDENTIFYING,
DEV_STATE_IDENTIFY_DONE,
DEV_STATE_IDENTIFY_STOPPING,
DEV_STATE_CAPTURE_STARTING,
DEV_STATE_CAPTURING,
DEV_STATE_CAPTURE_DONE,
DEV_STATE_CAPTURE_STOPPING,
};
struct fp_dev;
libusb_device_handle *fpi_dev_get_usb_dev(struct fp_dev *dev);
void *fpi_dev_get_user_data (struct fp_dev *dev);
void fpi_dev_set_user_data (struct fp_dev *dev, void *user_data);
int fpi_dev_get_nr_enroll_stages(struct fp_dev *dev);
void fpi_dev_set_nr_enroll_stages(struct fp_dev *dev, int nr_enroll_stages);
struct fp_print_data *fpi_dev_get_verify_data(struct fp_dev *dev);
enum fp_dev_state fpi_dev_get_dev_state(struct fp_dev *dev);
enum fp_imgdev_state {
IMGDEV_STATE_INACTIVE,
IMGDEV_STATE_AWAIT_FINGER_ON,
IMGDEV_STATE_CAPTURE,
IMGDEV_STATE_AWAIT_FINGER_OFF,
};
enum fp_imgdev_action {
IMG_ACTION_NONE = 0,
IMG_ACTION_ENROLL,
IMG_ACTION_VERIFY,
IMG_ACTION_IDENTIFY,
IMG_ACTION_CAPTURE,
};
enum fp_imgdev_enroll_state {
IMG_ACQUIRE_STATE_NONE = 0,
IMG_ACQUIRE_STATE_ACTIVATING,
IMG_ACQUIRE_STATE_AWAIT_FINGER_ON,
IMG_ACQUIRE_STATE_AWAIT_IMAGE,
IMG_ACQUIRE_STATE_AWAIT_FINGER_OFF,
IMG_ACQUIRE_STATE_DONE,
IMG_ACQUIRE_STATE_DEACTIVATING,
};
enum fp_imgdev_verify_state {
IMG_VERIFY_STATE_NONE = 0,
IMG_VERIFY_STATE_ACTIVATING
};
struct fp_img_dev;
libusb_device_handle *fpi_imgdev_get_usb_dev(struct fp_img_dev *dev);
void fpi_imgdev_set_user_data(struct fp_img_dev *imgdev,
void *user_data);
void *fpi_imgdev_get_user_data(struct fp_img_dev *imgdev);
struct fp_dev *fpi_imgdev_get_dev(struct fp_img_dev *imgdev);
enum fp_imgdev_enroll_state fpi_imgdev_get_action_state(struct fp_img_dev *imgdev);
enum fp_imgdev_action fpi_imgdev_get_action(struct fp_img_dev *imgdev);
int fpi_imgdev_get_action_result(struct fp_img_dev *imgdev);
void fpi_imgdev_set_action_result(struct fp_img_dev *imgdev, int action_result);
int fpi_imgdev_get_img_width(struct fp_img_dev *imgdev);
int fpi_imgdev_get_img_height(struct fp_img_dev *imgdev);
struct usb_id {
uint16_t vendor;
uint16_t product;
unsigned long driver_data;
};
enum fp_driver_type {
DRIVER_PRIMITIVE = 0,
DRIVER_IMAGING = 1,
};
struct fp_driver {
const uint16_t id;
const char *name;
const char *full_name;
const struct usb_id * const id_table;
enum fp_driver_type type;
enum fp_scan_type scan_type;
void *priv;
/* Device operations */
int (*discover)(struct libusb_device_descriptor *dsc, uint32_t *devtype);
int (*open)(struct fp_dev *dev, unsigned long driver_data);
void (*close)(struct fp_dev *dev);
int (*enroll_start)(struct fp_dev *dev);
int (*enroll_stop)(struct fp_dev *dev);
int (*verify_start)(struct fp_dev *dev);
int (*verify_stop)(struct fp_dev *dev, gboolean iterating);
int (*identify_start)(struct fp_dev *dev);
int (*identify_stop)(struct fp_dev *dev, gboolean iterating);
int (*capture_start)(struct fp_dev *dev);
int (*capture_stop)(struct fp_dev *dev);
};
/* flags for fp_img_driver.flags */
#define FP_IMGDRV_SUPPORTS_UNCONDITIONAL_CAPTURE (1 << 0)
struct fp_img_driver {
struct fp_driver driver;
uint16_t flags;
int img_width;
int img_height;
int bz3_threshold;
/* Device operations */
int (*open)(struct fp_img_dev *dev, unsigned long driver_data);
void (*close)(struct fp_img_dev *dev);
int (*activate)(struct fp_img_dev *dev, enum fp_imgdev_state state);
int (*change_state)(struct fp_img_dev *dev, enum fp_imgdev_state state);
void (*deactivate)(struct fp_img_dev *dev);
};
enum fp_print_data_type {
PRINT_DATA_RAW = 0, /* memset-imposed default */
PRINT_DATA_NBIS_MINUTIAE,
};
struct fp_print_data_item {
size_t length;
unsigned char data[0];
};
struct fp_print_data {
uint16_t driver_id;
uint32_t devtype;
enum fp_print_data_type type;
GSList *prints;
};
struct fp_print_data *fpi_print_data_new(struct fp_dev *dev);
struct fp_print_data_item *fpi_print_data_item_new(size_t length);
gboolean fpi_print_data_compatible(uint16_t driver_id1, uint32_t devtype1,
enum fp_print_data_type type1, uint16_t driver_id2, uint32_t devtype2,
enum fp_print_data_type type2);
struct fp_minutiae;
/* bit values for fp_img.flags */
#define FP_IMG_V_FLIPPED (1<<0)
#define FP_IMG_H_FLIPPED (1<<1)
#define FP_IMG_COLORS_INVERTED (1<<2)
#define FP_IMG_BINARIZED_FORM (1<<3)
#define FP_IMG_PARTIAL (1<<4)
#define FP_IMG_STANDARDIZATION_FLAGS (FP_IMG_V_FLIPPED | FP_IMG_H_FLIPPED \
| FP_IMG_COLORS_INVERTED)
struct fp_img {
int width;
int height;
size_t length;
uint16_t flags;
struct fp_minutiae *minutiae;
unsigned char *binarized;
unsigned char data[0];
};
struct fp_img *fpi_img_new(size_t length);
struct fp_img *fpi_img_new_for_imgdev(struct fp_img_dev *dev);
struct fp_img *fpi_img_resize(struct fp_img *img, size_t newsize);
struct fp_img *fpi_im_resize(struct fp_img *img, unsigned int w_factor, unsigned int h_factor);
/* polling and timeouts */
typedef void (*fpi_timeout_fn)(void *data);
struct fpi_timeout;
struct fpi_timeout *fpi_timeout_add(unsigned int msec, fpi_timeout_fn callback,
void *data);
void fpi_timeout_cancel(struct fpi_timeout *timeout);
/* async drv <--> lib comms */
struct fpi_ssm;
typedef void (*ssm_completed_fn)(struct fpi_ssm *ssm);
typedef void (*ssm_handler_fn)(struct fpi_ssm *ssm);
/* sequential state machine: state machine that iterates sequentially over
* a predefined series of states. can be aborted by either completion or
* abortion error conditions. */
/* for library and drivers */
struct fpi_ssm *fpi_ssm_new(struct fp_dev *dev, ssm_handler_fn handler,
int nr_states);
void fpi_ssm_free(struct fpi_ssm *machine);
void fpi_ssm_start(struct fpi_ssm *machine, ssm_completed_fn callback);
void fpi_ssm_start_subsm(struct fpi_ssm *parent, struct fpi_ssm *child);
/* for drivers */
void fpi_ssm_next_state(struct fpi_ssm *machine);
void fpi_ssm_jump_to_state(struct fpi_ssm *machine, int state);
void fpi_ssm_mark_completed(struct fpi_ssm *machine);
void fpi_ssm_mark_aborted(struct fpi_ssm *machine, int error);
struct fp_dev *fpi_ssm_get_dev(struct fpi_ssm *machine);
void fpi_ssm_set_user_data(struct fpi_ssm *machine,
void *user_data);
void *fpi_ssm_get_user_data(struct fpi_ssm *machine);
int fpi_ssm_get_error(struct fpi_ssm *machine);
int fpi_ssm_get_cur_state(struct fpi_ssm *machine);
void fpi_drvcb_open_complete(struct fp_dev *dev, int status);
void fpi_drvcb_close_complete(struct fp_dev *dev);
void fpi_drvcb_enroll_started(struct fp_dev *dev, int status);
void fpi_drvcb_enroll_stage_completed(struct fp_dev *dev, int result,
struct fp_print_data *data, struct fp_img *img);
void fpi_drvcb_enroll_stopped(struct fp_dev *dev);
void fpi_drvcb_verify_started(struct fp_dev *dev, int status);
void fpi_drvcb_report_verify_result(struct fp_dev *dev, int result,
struct fp_img *img);
void fpi_drvcb_verify_stopped(struct fp_dev *dev);
void fpi_drvcb_identify_started(struct fp_dev *dev, int status);
void fpi_drvcb_report_identify_result(struct fp_dev *dev, int result,
size_t match_offset, struct fp_img *img);
void fpi_drvcb_identify_stopped(struct fp_dev *dev);
void fpi_drvcb_capture_started(struct fp_dev *dev, int status);
void fpi_drvcb_report_capture_result(struct fp_dev *dev, int result,
struct fp_img *img);
void fpi_drvcb_capture_stopped(struct fp_dev *dev);
/* for image drivers */
void fpi_imgdev_open_complete(struct fp_img_dev *imgdev, int status);
void fpi_imgdev_close_complete(struct fp_img_dev *imgdev);
void fpi_imgdev_activate_complete(struct fp_img_dev *imgdev, int status);
void fpi_imgdev_deactivate_complete(struct fp_img_dev *imgdev);
void fpi_imgdev_report_finger_status(struct fp_img_dev *imgdev,
gboolean present);
void fpi_imgdev_image_captured(struct fp_img_dev *imgdev, struct fp_img *img);
void fpi_imgdev_abort_scan(struct fp_img_dev *imgdev, int result);
void fpi_imgdev_session_error(struct fp_img_dev *imgdev, int error);
/* utils */
int fpi_std_sq_dev(const unsigned char *buf, int size);
int fpi_mean_sq_diff_norm(unsigned char *buf1, unsigned char *buf2, int size);
#endif
+30 -2
View File
@@ -19,11 +19,11 @@
#define FP_COMPONENT "drv" #define FP_COMPONENT "drv"
#include "fp_internal.h"
#include <config.h> #include <config.h>
#include <errno.h> #include <errno.h>
#include "fp_internal.h"
/* SSM: sequential state machine /* SSM: sequential state machine
* Asynchronous driver design encourages some kind of state machine behind it. * Asynchronous driver design encourages some kind of state machine behind it.
* In most cases, the state machine is entirely linear - you only go to the * In most cases, the state machine is entirely linear - you only go to the
@@ -83,6 +83,25 @@ struct fpi_ssm *fpi_ssm_new(struct fp_dev *dev, ssm_handler_fn handler,
return machine; return machine;
} }
struct fp_dev *
fpi_ssm_get_dev(struct fpi_ssm *machine)
{
return machine->dev;
}
void
fpi_ssm_set_user_data(struct fpi_ssm *machine,
void *user_data)
{
machine->priv = user_data;
}
void *
fpi_ssm_get_user_data(struct fpi_ssm *machine)
{
return machine->priv;
}
/* Free a ssm */ /* Free a ssm */
void fpi_ssm_free(struct fpi_ssm *machine) void fpi_ssm_free(struct fpi_ssm *machine)
{ {
@@ -169,3 +188,12 @@ void fpi_ssm_jump_to_state(struct fpi_ssm *machine, int state)
__ssm_call_handler(machine); __ssm_call_handler(machine);
} }
int fpi_ssm_get_cur_state(struct fpi_ssm *machine)
{
return machine->cur_state;
}
int fpi_ssm_get_error(struct fpi_ssm *machine)
{
return machine->error;
}
+1
View File
@@ -0,0 +1 @@
+38 -132
View File
@@ -21,57 +21,31 @@
#define __FPRINT_INTERNAL_H__ #define __FPRINT_INTERNAL_H__
#include <config.h> #include <config.h>
#include <stdint.h>
#ifdef FP_COMPONENT
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "libfprint-"FP_COMPONENT
#endif
#include <stdint.h>
#include <errno.h>
#include <glib.h> #include <glib.h>
#include <libusb.h> #include <libusb.h>
#include <fprint.h> #include "fprint.h"
#include "drivers/driver_ids.h"
#define array_n_elements(array) (sizeof(array) / sizeof(array[0]))
#define container_of(ptr, type, member) ({ \ #define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );}) (type *)( (char *)__mptr - offsetof(type,member) );})
enum fpi_log_level { #define fp_dbg g_debug
FPRINT_LOG_LEVEL_DEBUG, #define fp_info g_debug
FPRINT_LOG_LEVEL_INFO, #define fp_warn g_warning
FPRINT_LOG_LEVEL_WARNING, #define fp_err g_error
FPRINT_LOG_LEVEL_ERROR,
};
void fpi_log(enum fpi_log_level, const char *component, const char *function, #define BUG_ON(condition) g_assert(!(condition))
const char *format, ...); #define BUG() g_assert_not_reached()
#ifndef FP_COMPONENT
#define FP_COMPONENT NULL
#endif
#ifdef ENABLE_LOGGING
#define _fpi_log(level, fmt...) fpi_log(level, FP_COMPONENT, __FUNCTION__, fmt)
#else
#define _fpi_log(level, fmt...)
#endif
#ifdef ENABLE_DEBUG_LOGGING
#define fp_dbg(fmt...) _fpi_log(FPRINT_LOG_LEVEL_DEBUG, fmt)
#else
#define fp_dbg(fmt...)
#endif
#define fp_info(fmt...) _fpi_log(FPRINT_LOG_LEVEL_INFO, fmt)
#define fp_warn(fmt...) _fpi_log(FPRINT_LOG_LEVEL_WARNING, fmt)
#define fp_err(fmt...) _fpi_log(FPRINT_LOG_LEVEL_ERROR, fmt)
#ifndef NDEBUG
#define BUG_ON(condition) \
if ((condition)) fp_err("BUG at %s:%d", __FILE__, __LINE__)
#else
#define BUG_ON(condition)
#endif
#define BUG() BUG_ON(1)
enum fp_dev_state { enum fp_dev_state {
DEV_STATE_INITIAL = 0, DEV_STATE_INITIAL = 0,
@@ -119,23 +93,23 @@ struct fp_dev {
/* FIXME: convert this to generic state operational data mechanism? */ /* FIXME: convert this to generic state operational data mechanism? */
fp_dev_open_cb open_cb; fp_dev_open_cb open_cb;
void *open_cb_data; void *open_cb_data;
fp_dev_close_cb close_cb; fp_operation_stop_cb close_cb;
void *close_cb_data; void *close_cb_data;
fp_enroll_stage_cb enroll_stage_cb; fp_enroll_stage_cb enroll_stage_cb;
void *enroll_stage_cb_data; void *enroll_stage_cb_data;
fp_enroll_stop_cb enroll_stop_cb; fp_operation_stop_cb enroll_stop_cb;
void *enroll_stop_cb_data; void *enroll_stop_cb_data;
fp_verify_cb verify_cb; fp_img_operation_cb verify_cb;
void *verify_cb_data; void *verify_cb_data;
fp_verify_stop_cb verify_stop_cb; fp_operation_stop_cb verify_stop_cb;
void *verify_stop_cb_data; void *verify_stop_cb_data;
fp_identify_cb identify_cb; fp_identify_cb identify_cb;
void *identify_cb_data; void *identify_cb_data;
fp_identify_stop_cb identify_stop_cb; fp_operation_stop_cb identify_stop_cb;
void *identify_stop_cb_data; void *identify_stop_cb_data;
fp_capture_cb capture_cb; fp_img_operation_cb capture_cb;
void *capture_cb_data; void *capture_cb_data;
fp_capture_stop_cb capture_stop_cb; fp_operation_stop_cb capture_stop_cb;
void *capture_stop_cb_data; void *capture_stop_cb_data;
/* FIXME: better place to put this? */ /* FIXME: better place to put this? */
@@ -248,66 +222,7 @@ struct fp_img_driver {
void (*deactivate)(struct fp_img_dev *dev); void (*deactivate)(struct fp_img_dev *dev);
}; };
#ifdef ENABLE_UPEKTS #include "drivers_definitions.h"
extern struct fp_driver upekts_driver;
#endif
#ifdef ENABLE_UPEKE2
extern struct fp_driver upeke2_driver;
#endif
#ifdef ENABLE_UPEKTC
extern struct fp_img_driver upektc_driver;
#endif
#ifdef ENABLE_UPEKSONLY
extern struct fp_img_driver upeksonly_driver;
#endif
#ifdef ENABLE_URU4000
extern struct fp_img_driver uru4000_driver;
#endif
#ifdef ENABLE_AES1610
extern struct fp_img_driver aes1610_driver;
#endif
#ifdef ENABLE_AES1660
extern struct fp_img_driver aes1660_driver;
#endif
#ifdef ENABLE_AES2501
extern struct fp_img_driver aes2501_driver;
#endif
#ifdef ENABLE_AES2550
extern struct fp_img_driver aes2550_driver;
#endif
#ifdef ENABLE_AES2660
extern struct fp_img_driver aes2660_driver;
#endif
#ifdef ENABLE_AES3500
extern struct fp_img_driver aes3500_driver;
#endif
#ifdef ENABLE_AES4000
extern struct fp_img_driver aes4000_driver;
#endif
#ifdef ENABLE_FDU2000
extern struct fp_img_driver fdu2000_driver;
#endif
#ifdef ENABLE_VCOM5S
extern struct fp_img_driver vcom5s_driver;
#endif
#ifdef ENABLE_VFS101
extern struct fp_img_driver vfs101_driver;
#endif
#ifdef ENABLE_VFS301
extern struct fp_img_driver vfs301_driver;
#endif
#ifdef ENABLE_VFS5011
extern struct fp_img_driver vfs5011_driver;
#endif
#ifdef ENABLE_UPEKTC_IMG
extern struct fp_img_driver upektc_img_driver;
#endif
#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 libusb_context *fpi_usb_ctx;
extern GSList *opened_devices; extern GSList *opened_devices;
@@ -368,6 +283,21 @@ gboolean fpi_print_data_compatible(uint16_t driver_id1, uint32_t devtype1,
enum fp_print_data_type type1, uint16_t driver_id2, uint32_t devtype2, enum fp_print_data_type type1, uint16_t driver_id2, uint32_t devtype2,
enum fp_print_data_type type2); enum fp_print_data_type type2);
struct fp_minutia {
int x;
int y;
int ex;
int ey;
int direction;
double reliability;
int type;
int appearing;
int feature_id;
int *nbrs;
int *ridge_counts;
int num_nbrs;
};
struct fp_minutiae { struct fp_minutiae {
int alloc; int alloc;
int num; int num;
@@ -395,10 +325,8 @@ struct fp_img {
}; };
struct fp_img *fpi_img_new(size_t length); struct fp_img *fpi_img_new(size_t length);
struct fp_img *fpi_img_new_for_imgdev(struct fp_img_dev *dev);
struct fp_img *fpi_img_resize(struct fp_img *img, size_t newsize); struct fp_img *fpi_img_resize(struct fp_img *img, size_t newsize);
gboolean fpi_img_is_sane(struct fp_img *img); gboolean fpi_img_is_sane(struct fp_img *img);
int fpi_img_detect_minutiae(struct fp_img *img);
int fpi_img_to_print_data(struct fp_img_dev *imgdev, struct fp_img *img, int fpi_img_to_print_data(struct fp_img_dev *imgdev, struct fp_img *img,
struct fp_print_data **ret); struct fp_print_data **ret);
int fpi_img_compare_print_data(struct fp_print_data *enrolled_print, int fpi_img_compare_print_data(struct fp_print_data *enrolled_print,
@@ -414,11 +342,6 @@ void fpi_poll_exit(void);
typedef void (*fpi_timeout_fn)(void *data); typedef void (*fpi_timeout_fn)(void *data);
struct fpi_timeout;
struct fpi_timeout *fpi_timeout_add(unsigned int msec, fpi_timeout_fn callback,
void *data);
void fpi_timeout_cancel(struct fpi_timeout *timeout);
/* async drv <--> lib comms */ /* async drv <--> lib comms */
struct fpi_ssm; struct fpi_ssm;
@@ -446,8 +369,6 @@ struct fpi_ssm *fpi_ssm_new(struct fp_dev *dev, ssm_handler_fn handler,
int nr_states); int nr_states);
void fpi_ssm_free(struct fpi_ssm *machine); void fpi_ssm_free(struct fpi_ssm *machine);
void fpi_ssm_start(struct fpi_ssm *machine, ssm_completed_fn callback); void fpi_ssm_start(struct fpi_ssm *machine, ssm_completed_fn callback);
void fpi_ssm_start_subsm(struct fpi_ssm *parent, struct fpi_ssm *child);
int fpi_ssm_has_completed(struct fpi_ssm *machine);
/* for drivers */ /* for drivers */
void fpi_ssm_next_state(struct fpi_ssm *machine); void fpi_ssm_next_state(struct fpi_ssm *machine);
@@ -478,20 +399,5 @@ void fpi_drvcb_report_capture_result(struct fp_dev *dev, int result,
struct fp_img *img); struct fp_img *img);
void fpi_drvcb_capture_stopped(struct fp_dev *dev); void fpi_drvcb_capture_stopped(struct fp_dev *dev);
/* for image drivers */
void fpi_imgdev_open_complete(struct fp_img_dev *imgdev, int status);
void fpi_imgdev_close_complete(struct fp_img_dev *imgdev);
void fpi_imgdev_activate_complete(struct fp_img_dev *imgdev, int status);
void fpi_imgdev_deactivate_complete(struct fp_img_dev *imgdev);
void fpi_imgdev_report_finger_status(struct fp_img_dev *imgdev,
gboolean present);
void fpi_imgdev_image_captured(struct fp_img_dev *imgdev, struct fp_img *img);
void fpi_imgdev_abort_scan(struct fp_img_dev *imgdev, int result);
void fpi_imgdev_session_error(struct fp_img_dev *imgdev, int error);
/* utils */
int fpi_std_sq_dev(const unsigned char *buf, int size);
int fpi_mean_sq_diff_norm(unsigned char *buf1, unsigned char *buf2, int size);
#endif #endif
+90
View File
@@ -0,0 +1,90 @@
/*
* Copyright (C) 2009 Red Hat <mjg@redhat.com>
* Copyright (C) 2008 Bastien Nocera <hadess@hadess.net>
* Copyright (C) 2008 Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
*
* 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
*/
#include <config.h>
#include <stdio.h>
#include <locale.h>
#include "fp_internal.h"
GHashTable *printed = NULL;
static GList *insert_driver (GList *list,
struct fp_driver *driver)
{
int i;
for (i = 0; driver->id_table[i].vendor != 0; i++) {
char *key;
key = g_strdup_printf ("%04x:%04x", driver->id_table[i].vendor, driver->id_table[i].product);
if (g_hash_table_lookup (printed, key) != NULL) {
g_free (key);
continue;
}
g_hash_table_insert (printed, key, GINT_TO_POINTER (1));
list = g_list_prepend (list, g_strdup_printf ("%s | %s\n", key, driver->full_name));
}
return list;
}
int main (int argc, char **argv)
{
struct fp_driver **driver_list;
guint i;
GList *list, *l;
setlocale (LC_ALL, "");
driver_list = fprint_get_drivers ();
printed = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
g_print ("%% lifprint — Supported Devices\n");
g_print ("%% Bastien Nocera, Daniel Drake\n");
g_print ("%% 2018\n");
g_print ("\n");
g_print ("# Supported Devices\n");
g_print ("\n");
g_print ("This is a list of supported devices in libfprint's development version. Those drivers might not all be available in the stable, released version. If in doubt, contact your distribution or systems integrator for details.\n");
g_print ("\n");
g_print ("## USB devices\n");
g_print ("\n");
g_print ("USB ID | Driver\n");
g_print ("------------ | ------------\n");
list = NULL;
for (i = 0; driver_list[i] != NULL; i++)
list = insert_driver (list, driver_list[i]);
list = g_list_sort (list, (GCompareFunc) g_strcmp0);
for (l = list; l != NULL; l = l->next)
g_print ("%s", (char *) l->data);
g_list_free_full (list, g_free);
g_hash_table_destroy (printed);
return 0;
}
+9 -3
View File
@@ -24,9 +24,15 @@
#include "fp_internal.h" #include "fp_internal.h"
static const struct usb_id whitelist_id_table[] = { static const struct usb_id whitelist_id_table[] = {
{ .vendor = 0x08ff, .product = 0x2810 }, /* Unsupported (for now) Elantech finger print readers */
/* https://bugzilla.redhat.com/show_bug.cgi?id=1173367 */ { .vendor = 0x04f3, .product = 0x0c03 },
{ .vendor = 0x138a, .product = 0x0017 }, { .vendor = 0x04f3, .product = 0x0c16 },
{ .vendor = 0x04f3, .product = 0x0c26 },
/* Unsupported (for now) Validity Sensors finger print readers */
{ .vendor = 0x138a, .product = 0x0090 }, /* Found on e.g. Lenovo T460s */
{ .vendor = 0x138a, .product = 0x0091 },
{ .vendor = 0x138a, .product = 0x0094 },
{ .vendor = 0x138a, .product = 0x0097 }, /* Found on e.g. Lenovo T470s */
{ 0, 0, 0, }, { 0, 0, 0, },
}; };
+233 -153
View File
@@ -27,42 +27,100 @@ extern "C" {
#include <stdint.h> #include <stdint.h>
#include <sys/time.h> #include <sys/time.h>
/* structs that applications are not allowed to peek into */ #define LIBFPRINT_DEPRECATED __attribute__((__deprecated__))
/**
* fp_dscv_dev:
*
* #fp_dscv_dev is an opaque structure type. You must access it using the
* functions below.
*/
struct fp_dscv_dev; struct fp_dscv_dev;
/**
* fp_dscv_print:
*
* #fp_dscv_print is an opaque structure type. You must access it using the
* functions below.
*/
struct fp_dscv_print; struct fp_dscv_print;
/**
* fp_dev:
*
* #fp_dev is an opaque structure type. You must access it using the
* functions below.
*/
struct fp_dev; struct fp_dev;
/**
* fp_driver:
*
* #fp_driver is an opaque structure type. You must access it using the
* functions below.
*/
struct fp_driver; struct fp_driver;
/**
* fp_print_data:
*
* #fp_print_data is an opaque structure type. You must access it using the
* functions below.
*/
struct fp_print_data; struct fp_print_data;
/**
* fp_img:
*
* #fp_img is an opaque structure type. You must access it using the
* functions below.
*/
struct fp_img; struct fp_img;
/* misc/general stuff */ /* misc/general stuff */
/** \ingroup print_data /**
* fp_finger:
* @LEFT_THUMB: Left thumb
* @LEFT_INDEX: Left index finger
* @LEFT_MIDDLE: Left middle finger
* @LEFT_RING: Left ring finger
* @LEFT_LITTLE: Left little finger
* @RIGHT_THUMB: Right thumb
* @RIGHT_INDEX: Right index finger
* @RIGHT_MIDDLE: Right middle finger
* @RIGHT_RING: Right ring finger
* @RIGHT_LITTLE: Right little finger
*
* Numeric codes used to refer to fingers (and thumbs) of a human. These are * Numeric codes used to refer to fingers (and thumbs) of a human. These are
* purposely not available as strings, to avoid getting the library tangled up * purposely not available as strings, to avoid getting the library tangled up
* in localization efforts. * in localization efforts.
*/ */
enum fp_finger { enum fp_finger {
LEFT_THUMB = 1, /** thumb (left hand) */ LEFT_THUMB = 1,
LEFT_INDEX, /** index finger (left hand) */ LEFT_INDEX,
LEFT_MIDDLE, /** middle finger (left hand) */ LEFT_MIDDLE,
LEFT_RING, /** ring finger (left hand) */ LEFT_RING,
LEFT_LITTLE, /** little finger (left hand) */ LEFT_LITTLE,
RIGHT_THUMB, /** thumb (right hand) */ RIGHT_THUMB,
RIGHT_INDEX, /** index finger (right hand) */ RIGHT_INDEX,
RIGHT_MIDDLE, /** middle finger (right hand) */ RIGHT_MIDDLE,
RIGHT_RING, /** ring finger (right hand) */ RIGHT_RING,
RIGHT_LITTLE, /** little finger (right hand) */ RIGHT_LITTLE,
}; };
/** \ingroup dev /**
* fp_scan_type:
* @FP_SCAN_TYPE_PRESS: the reader has a surface area that covers the whole finger
* @FP_SCAN_TYPE_SWIPE: the reader requires swiping the finger on a smaller area
*
* Numeric codes used to refer to the scan type of the device. Devices require * Numeric codes used to refer to the scan type of the device. Devices require
* either swiping or pressing the finger on the device. This is useful for * either swiping or pressing the finger on the device. This is useful for
* front-ends. * front-ends.
*/ */
enum fp_scan_type { enum fp_scan_type {
FP_SCAN_TYPE_PRESS = 0, /** press */ FP_SCAN_TYPE_PRESS = 0,
FP_SCAN_TYPE_SWIPE, /** swipe */ FP_SCAN_TYPE_SWIPE,
}; };
/* Drivers */ /* Drivers */
@@ -75,28 +133,24 @@ enum fp_scan_type fp_driver_get_scan_type(struct fp_driver *drv);
struct fp_dscv_dev **fp_discover_devs(void); struct fp_dscv_dev **fp_discover_devs(void);
void fp_dscv_devs_free(struct fp_dscv_dev **devs); void fp_dscv_devs_free(struct fp_dscv_dev **devs);
struct fp_driver *fp_dscv_dev_get_driver(struct fp_dscv_dev *dev); struct fp_driver *fp_dscv_dev_get_driver(struct fp_dscv_dev *dev);
uint16_t fp_dscv_dev_get_driver_id(struct fp_dscv_dev *dev);
uint32_t fp_dscv_dev_get_devtype(struct fp_dscv_dev *dev); uint32_t fp_dscv_dev_get_devtype(struct fp_dscv_dev *dev);
int fp_dscv_dev_supports_print_data(struct fp_dscv_dev *dev, int fp_dscv_dev_supports_print_data(struct fp_dscv_dev *dev,
struct fp_print_data *print); struct fp_print_data *print);
int fp_dscv_dev_supports_dscv_print(struct fp_dscv_dev *dev, int fp_dscv_dev_supports_dscv_print(struct fp_dscv_dev *dev,
struct fp_dscv_print *print); struct fp_dscv_print *print) LIBFPRINT_DEPRECATED;
struct fp_dscv_dev *fp_dscv_dev_for_print_data(struct fp_dscv_dev **devs, struct fp_dscv_dev *fp_dscv_dev_for_print_data(struct fp_dscv_dev **devs,
struct fp_print_data *print); struct fp_print_data *print) LIBFPRINT_DEPRECATED;
struct fp_dscv_dev *fp_dscv_dev_for_dscv_print(struct fp_dscv_dev **devs, struct fp_dscv_dev *fp_dscv_dev_for_dscv_print(struct fp_dscv_dev **devs,
struct fp_dscv_print *print); struct fp_dscv_print *print) LIBFPRINT_DEPRECATED;
static inline uint16_t fp_dscv_dev_get_driver_id(struct fp_dscv_dev *dev)
{
return fp_driver_get_driver_id(fp_dscv_dev_get_driver(dev));
}
/* Print discovery */ /* Print discovery */
struct fp_dscv_print **fp_discover_prints(void); struct fp_dscv_print **fp_discover_prints(void) LIBFPRINT_DEPRECATED;
void fp_dscv_prints_free(struct fp_dscv_print **prints); void fp_dscv_prints_free(struct fp_dscv_print **prints) LIBFPRINT_DEPRECATED;
uint16_t fp_dscv_print_get_driver_id(struct fp_dscv_print *print); uint16_t fp_dscv_print_get_driver_id(struct fp_dscv_print *print) LIBFPRINT_DEPRECATED;
uint32_t fp_dscv_print_get_devtype(struct fp_dscv_print *print); uint32_t fp_dscv_print_get_devtype(struct fp_dscv_print *print) LIBFPRINT_DEPRECATED;
enum fp_finger fp_dscv_print_get_finger(struct fp_dscv_print *print); enum fp_finger fp_dscv_print_get_finger(struct fp_dscv_print *print) LIBFPRINT_DEPRECATED;
int fp_dscv_print_delete(struct fp_dscv_print *print); int fp_dscv_print_delete(struct fp_dscv_print *print) LIBFPRINT_DEPRECATED;
/* Device handling */ /* Device handling */
struct fp_dev *fp_dev_open(struct fp_dscv_dev *ddev); struct fp_dev *fp_dev_open(struct fp_dscv_dev *ddev);
@@ -105,78 +159,84 @@ struct fp_driver *fp_dev_get_driver(struct fp_dev *dev);
int fp_dev_get_nr_enroll_stages(struct fp_dev *dev); int fp_dev_get_nr_enroll_stages(struct fp_dev *dev);
uint32_t fp_dev_get_devtype(struct fp_dev *dev); uint32_t fp_dev_get_devtype(struct fp_dev *dev);
int fp_dev_supports_print_data(struct fp_dev *dev, struct fp_print_data *data); int fp_dev_supports_print_data(struct fp_dev *dev, struct fp_print_data *data);
int fp_dev_supports_dscv_print(struct fp_dev *dev, struct fp_dscv_print *print); int fp_dev_supports_dscv_print(struct fp_dev *dev, struct fp_dscv_print *print) LIBFPRINT_DEPRECATED;
/** \ingroup dev /**
* Image capture result codes returned from fp_dev_img_capture(). * fp_capture_result:
* Whether a capture failed or completed.
*
* @FP_CAPTURE_COMPLETE: Capture completed successfully, the capture data has been returned to the caller.
* @FP_CAPTURE_FAIL: Capture failed
*
*/ */
enum fp_capture_result { enum fp_capture_result {
/** Capture completed successfully, the capture data has been
* returned to the caller. */
FP_CAPTURE_COMPLETE = 0, FP_CAPTURE_COMPLETE = 0,
/** Capture failed for some reason */
FP_CAPTURE_FAIL, FP_CAPTURE_FAIL,
}; };
int fp_dev_supports_imaging(struct fp_dev *dev); int fp_dev_supports_imaging(struct fp_dev *dev);
int fp_dev_img_capture(struct fp_dev *dev, int unconditional, int fp_dev_img_capture(struct fp_dev *dev, int unconditional,
struct fp_img **image); struct fp_img **img);
int fp_dev_get_img_width(struct fp_dev *dev); int fp_dev_get_img_width(struct fp_dev *dev);
int fp_dev_get_img_height(struct fp_dev *dev); int fp_dev_get_img_height(struct fp_dev *dev);
/** \ingroup dev /**
* fp_enroll_result:
* @FP_ENROLL_COMPLETE: Enrollment completed successfully, the enrollment data has been
* returned to the caller.
* @FP_ENROLL_FAIL: Enrollment failed due to incomprehensible data; this may occur when
* the user scans a different finger on each enroll stage.
* @FP_ENROLL_PASS: Enroll stage passed; more stages are need to complete the process.
* @FP_ENROLL_RETRY: The enrollment scan did not succeed due to poor scan quality or
* other general user scanning problem.
* @FP_ENROLL_RETRY_TOO_SHORT: The enrollment scan did not succeed because the finger swipe was
* too short.
* @FP_ENROLL_RETRY_CENTER_FINGER: The enrollment scan did not succeed because the finger was not
* centered on the scanner.
* @FP_ENROLL_RETRY_REMOVE_FINGER: The verification scan did not succeed due to quality or pressure
* problems; the user should remove their finger from the scanner before
* retrying.
*
*
* Enrollment result codes returned from fp_enroll_finger(). * Enrollment result codes returned from fp_enroll_finger().
* Result codes with RETRY in the name suggest that the scan failed due to * Result codes with RETRY in the name suggest that the scan failed due to
* user error. Applications will generally want to inform the user of the * user error. Applications will generally want to inform the user of the
* problem and then retry the enrollment stage. For more info on the semantics * problem and then retry the enrollment stage. For more info on the semantics
* of interpreting these result codes and tracking enrollment process, see * of interpreting these result codes and tracking enrollment process, see
* \ref enrolling. * [Enrolling](libfprint-Devices-operations.html#enrolling)
*/ */
enum fp_enroll_result { enum fp_enroll_result {
/** Enrollment completed successfully, the enrollment data has been
* returned to the caller. */
FP_ENROLL_COMPLETE = 1, FP_ENROLL_COMPLETE = 1,
/** Enrollment failed due to incomprehensible data; this may occur when
* the user scans a different finger on each enroll stage. */
FP_ENROLL_FAIL, FP_ENROLL_FAIL,
/** Enroll stage passed; more stages are need to complete the process. */
FP_ENROLL_PASS, FP_ENROLL_PASS,
/** The enrollment scan did not succeed due to poor scan quality or
* other general user scanning problem. */
FP_ENROLL_RETRY = 100, FP_ENROLL_RETRY = 100,
/** The enrollment scan did not succeed because the finger swipe was
* too short. */
FP_ENROLL_RETRY_TOO_SHORT, FP_ENROLL_RETRY_TOO_SHORT,
/** The enrollment scan did not succeed because the finger was not
* centered on the scanner. */
FP_ENROLL_RETRY_CENTER_FINGER, FP_ENROLL_RETRY_CENTER_FINGER,
/** The verification scan did not succeed due to quality or pressure
* problems; the user should remove their finger from the scanner before
* retrying. */
FP_ENROLL_RETRY_REMOVE_FINGER, FP_ENROLL_RETRY_REMOVE_FINGER,
}; };
int fp_enroll_finger_img(struct fp_dev *dev, struct fp_print_data **print_data, int fp_enroll_finger_img(struct fp_dev *dev, struct fp_print_data **print_data,
struct fp_img **img); struct fp_img **img);
int fp_enroll_finger(struct fp_dev *dev,
struct fp_print_data **print_data);
/** \ingroup dev /**
* Performs an enroll stage. See \ref enrolling for an explanation of enroll * fp_verify_result:
* stages. This function is just a shortcut to calling fp_enroll_finger_img() * @FP_VERIFY_NO_MATCH: The scan completed successfully, but the newly scanned fingerprint
* with a NULL image parameter. Be sure to read the description of * does not match the fingerprint being verified against.
* fp_enroll_finger_img() in order to understand its behaviour. * In the case of identification, this return code indicates that the
* scanned finger could not be found in the print gallery.
* @FP_VERIFY_MATCH: The scan completed successfully and the newly scanned fingerprint does
* match the fingerprint being verified, or in the case of identification,
* the scanned fingerprint was found in the print gallery.
* @FP_VERIFY_RETRY: The scan did not succeed due to poor scan quality or other general
* user scanning problem.
* @FP_VERIFY_RETRY_TOO_SHORT: The scan did not succeed because the finger swipe was too short.
* @FP_VERIFY_RETRY_CENTER_FINGER: The scan did not succeed because the finger was not centered on the
* scanner.
* @FP_VERIFY_RETRY_REMOVE_FINGER: The scan did not succeed due to quality or pressure problems; the user
* should remove their finger from the scanner before retrying.
* *
* \param dev the device
* \param print_data a location to return the resultant enrollment data from
* the final stage. Must be freed with fp_print_data_free() after use.
* \return negative code on error, otherwise a code from #fp_enroll_result
*/
static inline int fp_enroll_finger(struct fp_dev *dev,
struct fp_print_data **print_data)
{
return fp_enroll_finger_img(dev, print_data, NULL);
}
/** \ingroup dev
* Verification result codes returned from fp_verify_finger(). Return codes * Verification result codes returned from fp_verify_finger(). Return codes
* are also shared with fp_identify_finger(). * are also shared with fp_identify_finger().
* Result codes with RETRY in the name suggest that the scan failed due to * Result codes with RETRY in the name suggest that the scan failed due to
@@ -184,78 +244,31 @@ static inline int fp_enroll_finger(struct fp_dev *dev,
* problem and then retry the verify operation. * problem and then retry the verify operation.
*/ */
enum fp_verify_result { enum fp_verify_result {
/** The scan completed successfully, but the newly scanned fingerprint
* does not match the fingerprint being verified against.
* In the case of identification, this return code indicates that the
* scanned finger could not be found in the print gallery. */
FP_VERIFY_NO_MATCH = 0, FP_VERIFY_NO_MATCH = 0,
/** The scan completed successfully and the newly scanned fingerprint does
* match the fingerprint being verified, or in the case of identification,
* the scanned fingerprint was found in the print gallery. */
FP_VERIFY_MATCH = 1, FP_VERIFY_MATCH = 1,
/** The scan did not succeed due to poor scan quality or other general
* user scanning problem. */
FP_VERIFY_RETRY = FP_ENROLL_RETRY, FP_VERIFY_RETRY = FP_ENROLL_RETRY,
/** The scan did not succeed because the finger swipe was too short. */
FP_VERIFY_RETRY_TOO_SHORT = FP_ENROLL_RETRY_TOO_SHORT, FP_VERIFY_RETRY_TOO_SHORT = FP_ENROLL_RETRY_TOO_SHORT,
/** The scan did not succeed because the finger was not centered on the
* scanner. */
FP_VERIFY_RETRY_CENTER_FINGER = FP_ENROLL_RETRY_CENTER_FINGER, FP_VERIFY_RETRY_CENTER_FINGER = FP_ENROLL_RETRY_CENTER_FINGER,
/** The scan did not succeed due to quality or pressure problems; the user
* should remove their finger from the scanner before retrying. */
FP_VERIFY_RETRY_REMOVE_FINGER = FP_ENROLL_RETRY_REMOVE_FINGER, FP_VERIFY_RETRY_REMOVE_FINGER = FP_ENROLL_RETRY_REMOVE_FINGER,
}; };
int fp_verify_finger_img(struct fp_dev *dev, int fp_verify_finger_img(struct fp_dev *dev,
struct fp_print_data *enrolled_print, struct fp_img **img); struct fp_print_data *enrolled_print, struct fp_img **img);
int fp_verify_finger(struct fp_dev *dev,
/** \ingroup dev struct fp_print_data *enrolled_print);
* Performs a new scan and verify it against a previously enrolled print. This
* function is just a shortcut to calling fp_verify_finger_img() with a NULL
* image output parameter.
* \param dev the device to perform the scan.
* \param enrolled_print the print to verify against. Must have been previously
* enrolled with a device compatible to the device selected to perform the scan.
* \return negative code on error, otherwise a code from #fp_verify_result
* \sa fp_verify_finger_img()
*/
static inline int fp_verify_finger(struct fp_dev *dev,
struct fp_print_data *enrolled_print)
{
return fp_verify_finger_img(dev, enrolled_print, NULL);
}
int fp_dev_supports_identification(struct fp_dev *dev); int fp_dev_supports_identification(struct fp_dev *dev);
int fp_identify_finger_img(struct fp_dev *dev, int fp_identify_finger_img(struct fp_dev *dev,
struct fp_print_data **print_gallery, size_t *match_offset, struct fp_print_data **print_gallery, size_t *match_offset,
struct fp_img **img); struct fp_img **img);
int fp_identify_finger(struct fp_dev *dev,
/** \ingroup dev struct fp_print_data **print_gallery, size_t *match_offset);
* Performs a new scan and attempts to identify the scanned finger against a
* collection of previously enrolled fingerprints. This function is just a
* shortcut to calling fp_identify_finger_img() with a NULL image output
* parameter.
* \param dev the device to perform the scan.
* \param print_gallery NULL-terminated array of pointers to the prints to
* identify against. Each one must have been previously enrolled with a device
* compatible to the device selected to perform the scan.
* \param match_offset output location to store the array index of the matched
* gallery print (if any was found). Only valid if FP_VERIFY_MATCH was
* returned.
* \return negative code on error, otherwise a code from #fp_verify_result
* \sa fp_identify_finger_img()
*/
static inline int fp_identify_finger(struct fp_dev *dev,
struct fp_print_data **print_gallery, size_t *match_offset)
{
return fp_identify_finger_img(dev, print_gallery, match_offset, NULL);
}
/* Data handling */ /* Data handling */
int fp_print_data_load(struct fp_dev *dev, enum fp_finger finger, int fp_print_data_load(struct fp_dev *dev, enum fp_finger finger,
struct fp_print_data **data); struct fp_print_data **data);
int fp_print_data_from_dscv_print(struct fp_dscv_print *print, int fp_print_data_from_dscv_print(struct fp_dscv_print *print,
struct fp_print_data **data); struct fp_print_data **data) LIBFPRINT_DEPRECATED;
int fp_print_data_save(struct fp_print_data *data, enum fp_finger finger); int fp_print_data_save(struct fp_print_data *data, enum fp_finger finger);
int fp_print_data_delete(struct fp_dev *dev, enum fp_finger finger); int fp_print_data_delete(struct fp_dev *dev, enum fp_finger finger);
void fp_print_data_free(struct fp_print_data *data); void fp_print_data_free(struct fp_print_data *data);
@@ -267,21 +280,13 @@ uint32_t fp_print_data_get_devtype(struct fp_print_data *data);
/* Image handling */ /* Image handling */
/** \ingroup img */ /**
struct fp_minutia { * fp_minutia:
int x; *
int y; * #fp_minutia is an opaque structure type. You must access it using the
int ex; * functions below.
int ey; */
int direction; struct fp_minutia;
double reliability;
int type;
int appearing;
int feature_id;
int *nbrs;
int *ridge_counts;
int num_nbrs;
};
int fp_img_get_height(struct fp_img *img); int fp_img_get_height(struct fp_img *img);
int fp_img_get_width(struct fp_img *img); int fp_img_get_width(struct fp_img *img);
@@ -294,6 +299,14 @@ void fp_img_free(struct fp_img *img);
/* Polling and timing */ /* Polling and timing */
/**
* fp_pollfd:
* @fd: a file descriptor
* @events: Event flags to poll for from `<poll.h>`
*
* A structure representing a file descriptor and the events to poll
* for, as returned by fp_get_pollfds().
*/
struct fp_pollfd { struct fp_pollfd {
int fd; int fd;
short events; short events;
@@ -304,7 +317,24 @@ int fp_handle_events(void);
size_t fp_get_pollfds(struct fp_pollfd **pollfds); size_t fp_get_pollfds(struct fp_pollfd **pollfds);
int fp_get_next_timeout(struct timeval *tv); int fp_get_next_timeout(struct timeval *tv);
/**
* fp_pollfd_added_cb:
* @fd: the new file descriptor
* @events: events to monitor for, see `<poll.h>` for the possible values
*
* Type definition for a function that will be called when a new
* event source is added. The @events argument is a flag as defined in
* `<poll.h>` such as `POLLIN`, or `POLLOUT`. See fp_set_pollfd_notifiers().
*/
typedef void (*fp_pollfd_added_cb)(int fd, short events); typedef void (*fp_pollfd_added_cb)(int fd, short events);
/**
* fp_pollfd_removed_cb:
* @fd: the file descriptor to stop monitoring
*
* Type definition for a function that will be called when an
* event source is removed. See fp_set_pollfd_notifiers().
*/
typedef void (*fp_pollfd_removed_cb)(int fd); typedef void (*fp_pollfd_removed_cb)(int fd);
void fp_set_pollfd_notifiers(fp_pollfd_added_cb added_cb, void fp_set_pollfd_notifiers(fp_pollfd_added_cb added_cb,
fp_pollfd_removed_cb removed_cb); fp_pollfd_removed_cb removed_cb);
@@ -312,51 +342,101 @@ void fp_set_pollfd_notifiers(fp_pollfd_added_cb added_cb,
/* Library */ /* Library */
int fp_init(void); int fp_init(void);
void fp_exit(void); void fp_exit(void);
void fp_set_debug(int level); void fp_set_debug(int level) LIBFPRINT_DEPRECATED;
/* Asynchronous I/O */ /* Asynchronous I/O */
/**
* fp_operation_stop_cb:
* @dev: the #fp_dev device
* @user_data: user data passed to the callback
*
* Type definition for a function that will be called when fp_async_dev_close(),
* fp_async_verify_stop(), fp_async_identify_stop() or fp_async_capture_stop()
* finishes.
*/
typedef void (*fp_operation_stop_cb)(struct fp_dev *dev, void *user_data);
/**
* fp_img_operation_cb:
* @dev: the #fp_dev device
* @result: an #fp_verify_result for fp_async_verify_start(), or an #fp_capture_result
* for fp_async_capture_start(), or a negative value on error
* @img: the captured #fp_img if capture or verification was successful
* @user_data: user data passed to the callback
*
* Type definition for a function that will be called when fp_async_verify_start()
* or fp_async_capture_start() finished.
*/
typedef void (*fp_img_operation_cb)(struct fp_dev *dev, int result,
struct fp_img *img, void *user_data);
/**
* fp_dev_open_cb:
* @dev: the #fp_dev device
* @status: 0 on success, or a negative value on error
* @user_data: user data passed to the callback
*
* Type definition for a function that will be called when fp_async_dev_open
* finishes.
*/
typedef void (*fp_dev_open_cb)(struct fp_dev *dev, int status, void *user_data); typedef void (*fp_dev_open_cb)(struct fp_dev *dev, int status, void *user_data);
int fp_async_dev_open(struct fp_dscv_dev *ddev, fp_dev_open_cb callback, int fp_async_dev_open(struct fp_dscv_dev *ddev, fp_dev_open_cb callback,
void *user_data); void *user_data);
typedef void (*fp_dev_close_cb)(struct fp_dev *dev, void *user_data); void fp_async_dev_close(struct fp_dev *dev, fp_operation_stop_cb callback,
void fp_async_dev_close(struct fp_dev *dev, fp_dev_close_cb callback,
void *user_data); void *user_data);
/**
* fp_enroll_stage_cb:
* @dev: the #fp_dev device
* @result: a #fp_enroll_result on success, or a negative value on failure
* @print: the enrollment data from the final stage
* @img: an #fp_img to free with fp_img_free()
* @user_data: user data passed to the callback
*
* Type definition for a function that will be called when
* fp_async_enroll_start() finishes.
*/
typedef void (*fp_enroll_stage_cb)(struct fp_dev *dev, int result, typedef void (*fp_enroll_stage_cb)(struct fp_dev *dev, int result,
struct fp_print_data *print, struct fp_img *img, void *user_data); struct fp_print_data *print, struct fp_img *img, void *user_data);
int fp_async_enroll_start(struct fp_dev *dev, fp_enroll_stage_cb callback, int fp_async_enroll_start(struct fp_dev *dev, fp_enroll_stage_cb callback,
void *user_data); void *user_data);
typedef void (*fp_enroll_stop_cb)(struct fp_dev *dev, void *user_data); int fp_async_enroll_stop(struct fp_dev *dev, fp_operation_stop_cb callback,
int fp_async_enroll_stop(struct fp_dev *dev, fp_enroll_stop_cb callback,
void *user_data); void *user_data);
typedef void (*fp_verify_cb)(struct fp_dev *dev, int result,
struct fp_img *img, void *user_data);
int fp_async_verify_start(struct fp_dev *dev, struct fp_print_data *data, int fp_async_verify_start(struct fp_dev *dev, struct fp_print_data *data,
fp_verify_cb callback, void *user_data); fp_img_operation_cb callback, void *user_data);
typedef void (*fp_verify_stop_cb)(struct fp_dev *dev, void *user_data); int fp_async_verify_stop(struct fp_dev *dev, fp_operation_stop_cb callback,
int fp_async_verify_stop(struct fp_dev *dev, fp_verify_stop_cb callback,
void *user_data); void *user_data);
/**
* fp_identify_cb:
* @dev: the #fp_dev device
* @result: a #fp_verify_result on success, or a negative value on error.
* @match_offset: the array index of the matched gallery print (if any was found).
* Only valid if %FP_VERIFY_MATCH was returned.
* @img: the scan image, it must be freed with fp_img_free() after use.
* @user_data: user data passed to the callback
*
* Type definition for a function that will be called when fp_async_identify_start()
* finishes.
*/
typedef void (*fp_identify_cb)(struct fp_dev *dev, int result, typedef void (*fp_identify_cb)(struct fp_dev *dev, int result,
size_t match_offset, struct fp_img *img, void *user_data); size_t match_offset, struct fp_img *img, void *user_data);
int fp_async_identify_start(struct fp_dev *dev, struct fp_print_data **gallery, int fp_async_identify_start(struct fp_dev *dev, struct fp_print_data **gallery,
fp_identify_cb callback, void *user_data); fp_identify_cb callback, void *user_data);
typedef void (*fp_identify_stop_cb)(struct fp_dev *dev, void *user_data); int fp_async_identify_stop(struct fp_dev *dev, fp_operation_stop_cb callback,
int fp_async_identify_stop(struct fp_dev *dev, fp_identify_stop_cb callback,
void *user_data); void *user_data);
typedef void (*fp_capture_cb)(struct fp_dev *dev, int result, int fp_async_capture_start(struct fp_dev *dev, int unconditional, fp_img_operation_cb callback, void *user_data);
struct fp_img *img, void *user_data);
int fp_async_capture_start(struct fp_dev *dev, int unconditional, fp_capture_cb callback, void *user_data);
typedef void (*fp_capture_stop_cb)(struct fp_dev *dev, void *user_data); int fp_async_capture_stop(struct fp_dev *dev, fp_operation_stop_cb callback, void *user_data);
int fp_async_capture_stop(struct fp_dev *dev, fp_capture_stop_cb callback, void *user_data);
#ifdef __cplusplus #ifdef __cplusplus
} }
+111 -36
View File
@@ -28,19 +28,22 @@
#include "nbis/include/bozorth.h" #include "nbis/include/bozorth.h"
#include "nbis/include/lfs.h" #include "nbis/include/lfs.h"
/** @defgroup img Image operations /**
* SECTION:img
* @title: Image operations
*
* libfprint offers several ways of retrieving images from imaging devices, * libfprint offers several ways of retrieving images from imaging devices,
* one example being the fp_dev_img_capture() function. The functions * one example being the fp_dev_img_capture() function. The functions
* documented below allow you to work with such images. * documented below allow you to work with such images.
* *
* \section img_fmt Image format * # Image format # {#img_fmt}
* All images are represented as 8-bit greyscale data. * All images are represented as 8-bit greyscale data.
* *
* \section img_std Image standardization * # Image standardization # {#img_std}
* In some contexts, images you are provided through libfprint are raw images * In some contexts, images you are provided through libfprint are raw images
* from the hardware. The orientation of these varies from device-to-device, * from the hardware. The orientation of these varies from device-to-device,
* as does the color scheme (black-on-white or white-on-black?). libfprint * as does the color scheme (black-on-white or white-on-black?). libfprint
* provides the fp_img_standardize function to convert images into standard * provides the fp_img_standardize() function to convert images into standard
* form, which is defined to be: finger flesh as black on white surroundings, * form, which is defined to be: finger flesh as black on white surroundings,
* natural upright orientation. * natural upright orientation.
*/ */
@@ -82,9 +85,11 @@ struct fp_img *fpi_img_resize(struct fp_img *img, size_t newsize)
return g_realloc(img, sizeof(*img) + newsize); return g_realloc(img, sizeof(*img) + newsize);
} }
/** \ingroup img /**
* fp_img_free:
* @img: the image to destroy. If NULL, function simply returns.
*
* Frees an image. Must be called when you are finished working with an image. * Frees an image. Must be called when you are finished working with an image.
* \param img the image to destroy. If NULL, function simply returns.
*/ */
API_EXPORTED void fp_img_free(struct fp_img *img) API_EXPORTED void fp_img_free(struct fp_img *img)
{ {
@@ -98,43 +103,55 @@ API_EXPORTED void fp_img_free(struct fp_img *img)
g_free(img); g_free(img);
} }
/** \ingroup img /**
* fp_img_get_height:
* @img: an image
*
* Gets the pixel height of an image. * Gets the pixel height of an image.
* \param img an image *
* \returns the height of the image * Returns: the height of the image
*/ */
API_EXPORTED int fp_img_get_height(struct fp_img *img) API_EXPORTED int fp_img_get_height(struct fp_img *img)
{ {
return img->height; return img->height;
} }
/** \ingroup img /**
* fp_img_get_width:
* @img: an image
*
* Gets the pixel width of an image. * Gets the pixel width of an image.
* \param img an image *
* \returns the width of the image * Returns: the width of the image
*/ */
API_EXPORTED int fp_img_get_width(struct fp_img *img) API_EXPORTED int fp_img_get_width(struct fp_img *img)
{ {
return img->width; return img->width;
} }
/** \ingroup img /**
* fp_img_get_data:
* @img: an image
*
* Gets the greyscale data for an image. This data must not be modified or * Gets the greyscale data for an image. This data must not be modified or
* freed, and must not be used after fp_img_free() has been called. * freed, and must not be used after fp_img_free() has been called.
* \param img an image *
* \returns a pointer to libfprint's internal data for the image * Returns: a pointer to libfprint's internal data for the image
*/ */
API_EXPORTED unsigned char *fp_img_get_data(struct fp_img *img) API_EXPORTED unsigned char *fp_img_get_data(struct fp_img *img)
{ {
return img->data; return img->data;
} }
/** \ingroup img /**
* fp_img_save_to_file:
* @img: the image to save
* @path: the path to save the image. Existing files will be overwritten.
*
* A quick convenience function to save an image to a file in * A quick convenience function to save an image to a file in
* <a href="http://netpbm.sourceforge.net/doc/pgm.html">PGM format</a>. * [PGM format](http://netpbm.sourceforge.net/doc/pgm.html).
* \param img the image to save *
* \param path the path to save the image. Existing files will be overwritten. * Returns: 0 on success, non-zero on error.
* \returns 0 on success, non-zero on error.
*/ */
API_EXPORTED int fp_img_save_to_file(struct fp_img *img, char *path) API_EXPORTED int fp_img_save_to_file(struct fp_img *img, char *path)
{ {
@@ -149,12 +166,14 @@ API_EXPORTED int fp_img_save_to_file(struct fp_img *img, char *path)
r = fprintf(fd, "P5 %d %d 255\n", img->width, img->height); r = fprintf(fd, "P5 %d %d 255\n", img->width, img->height);
if (r < 0) { if (r < 0) {
fclose(fd);
fp_err("pgm header write failed, error %d", r); fp_err("pgm header write failed, error %d", r);
return r; return r;
} }
r = fwrite(img->data, 1, write_size, fd); r = fwrite(img->data, 1, write_size, fd);
if (r < write_size) { if (r < write_size) {
fclose(fd);
fp_err("short write (%d)", r); fp_err("short write (%d)", r);
return -EIO; return -EIO;
} }
@@ -209,12 +228,14 @@ static void invert_colors(struct fp_img *img)
img->data[i] = 0xff - img->data[i]; img->data[i] = 0xff - img->data[i];
} }
/** \ingroup img /**
* \ref img_std "Standardizes" an image by normalizing its orientation, colors, * fp_img_standardize:
* @img: the image to standardize
*
* [Standardizes](libfprint-Image-operations.html#img_std) an image by normalizing its orientation, colors,
* etc. It is safe to call this multiple times on an image, libfprint keeps * etc. It is safe to call this multiple times on an image, libfprint keeps
* track of the work it needs to do to make an image standard and will not * track of the work it needs to do to make an image standard and will not
* perform these operations more than once for a given image. * perform these operations more than once for a given image.
* \param img the image to standardize
*/ */
API_EXPORTED void fp_img_standardize(struct fp_img *img) API_EXPORTED void fp_img_standardize(struct fp_img *img)
{ {
@@ -267,7 +288,7 @@ static void minutiae_to_xyt(struct fp_minutiae *minutiae, int bwidth,
xyt->nrows = nmin; xyt->nrows = nmin;
} }
int fpi_img_detect_minutiae(struct fp_img *img) static int fpi_img_detect_minutiae(struct fp_img *img)
{ {
struct fp_minutiae *minutiae; struct fp_minutiae *minutiae;
int r; int r;
@@ -419,23 +440,25 @@ int fpi_img_compare_print_data_to_gallery(struct fp_print_data *print,
return FP_VERIFY_NO_MATCH; return FP_VERIFY_NO_MATCH;
} }
/** \ingroup img /**
* fp_img_binarize:
* @img: a standardized image
*
* Get a binarized form of a standardized scanned image. This is where the * Get a binarized form of a standardized scanned image. This is where the
* fingerprint image has been "enhanced" and is a set of pure black ridges * fingerprint image has been "enhanced" and is a set of pure black ridges
* on a pure white background. Internally, image processing happens on top * on a pure white background. Internally, image processing happens on top
* of the binarized image. * of the binarized image.
* *
* The image must have been \ref img_std "standardized" otherwise this function * The image must have been [standardized](libfprint-Image-operations.html#img_std)
* will fail. * otherwise this function will fail.
* *
* It is safe to binarize an image and free the original while continuing * It is safe to binarize an image and free the original while continuing
* to use the binarized version. * to use the binarized version.
* *
* You cannot binarize an image twice. * You cannot binarize an image twice.
* *
* \param img a standardized image * Returns: a new image representing the binarized form of the original, or
* \returns a new image representing the binarized form of the original, or * %NULL on error. Must be freed with fp_img_free() after use.
* NULL on error. Must be freed with fp_img_free() after use.
*/ */
API_EXPORTED struct fp_img *fp_img_binarize(struct fp_img *img) API_EXPORTED struct fp_img *fp_img_binarize(struct fp_img *img)
{ {
@@ -467,15 +490,19 @@ API_EXPORTED struct fp_img *fp_img_binarize(struct fp_img *img)
return ret; return ret;
} }
/** \ingroup img /**
* fp_img_get_minutiae:
* @img: a standardized image
* @nr_minutiae: an output location to store minutiae list length
*
* Get a list of minutiae detected in an image. A minutia point is a feature * Get a list of minutiae detected in an image. A minutia point is a feature
* detected on a fingerprint, typically where ridges end or split. * detected on a fingerprint, typically where ridges end or split.
* libfprint's image processing code relies upon comparing sets of minutiae, * libfprint's image processing code relies upon comparing sets of minutiae,
* so accurate placement of minutia points is critical for good imaging * so accurate placement of minutia points is critical for good imaging
* performance. * performance.
* *
* The image must have been \ref img_std "standardized" otherwise this function * The image must have been [standardized](libfprint-Image-operations.html#img_std)
* will fail. * otherwise this function will fail.
* *
* You cannot pass a binarized image to this function. Instead, pass the * You cannot pass a binarized image to this function. Instead, pass the
* original image. * original image.
@@ -485,9 +512,7 @@ API_EXPORTED struct fp_img *fp_img_binarize(struct fp_img *img)
* valid while the parent image has not been freed, and the minutiae data * valid while the parent image has not been freed, and the minutiae data
* must not be modified or freed. * must not be modified or freed.
* *
* \param img a standardized image * Returns: a list of minutiae points. Must not be modified or freed.
* \param nr_minutiae an output location to store minutiae list length
* \returns a list of minutiae points. Must not be modified or freed.
*/ */
API_EXPORTED struct fp_minutia **fp_img_get_minutiae(struct fp_img *img, API_EXPORTED struct fp_minutia **fp_img_get_minutiae(struct fp_img *img,
int *nr_minutiae) int *nr_minutiae)
@@ -511,6 +536,56 @@ API_EXPORTED struct fp_minutia **fp_img_get_minutiae(struct fp_img *img,
return img->minutiae->list; return img->minutiae->list;
} }
libusb_device_handle *
fpi_imgdev_get_usb_dev(struct fp_img_dev *dev)
{
return dev->udev;
}
void
fpi_imgdev_set_user_data(struct fp_img_dev *imgdev,
void *user_data)
{
imgdev->priv = user_data;
}
void *
fpi_imgdev_get_user_data(struct fp_img_dev *imgdev)
{
return imgdev->priv;
}
struct fp_dev *
fpi_imgdev_get_dev(struct fp_img_dev *imgdev)
{
return imgdev->dev;
}
enum fp_imgdev_enroll_state
fpi_imgdev_get_action_state(struct fp_img_dev *imgdev)
{
return imgdev->action_state;
}
enum fp_imgdev_action
fpi_imgdev_get_action(struct fp_img_dev *imgdev)
{
return imgdev->action;
}
int
fpi_imgdev_get_action_result(struct fp_img_dev *imgdev)
{
return imgdev->action_result;
}
void
fpi_imgdev_set_action_result(struct fp_img_dev *imgdev,
int action_result)
{
imgdev->action_result = action_result;
}
/* Calculate squared standand deviation */ /* Calculate squared standand deviation */
int fpi_std_sq_dev(const unsigned char *buf, int size) int fpi_std_sq_dev(const unsigned char *buf, int size)
{ {
+2 -2
View File
@@ -231,7 +231,7 @@ void fpi_imgdev_image_captured(struct fp_img_dev *imgdev, struct fp_img *img)
{ {
struct fp_print_data *print; struct fp_print_data *print;
int r; int r;
fp_dbg(""); G_DEBUG_HERE();
if (imgdev->action_state != IMG_ACQUIRE_STATE_AWAIT_IMAGE) { if (imgdev->action_state != IMG_ACQUIRE_STATE_AWAIT_IMAGE) {
fp_dbg("ignoring due to current state %d", imgdev->action_state); fp_dbg("ignoring due to current state %d", imgdev->action_state);
@@ -360,7 +360,7 @@ void fpi_imgdev_activate_complete(struct fp_img_dev *imgdev, int status)
void fpi_imgdev_deactivate_complete(struct fp_img_dev *imgdev) void fpi_imgdev_deactivate_complete(struct fp_img_dev *imgdev)
{ {
fp_dbg(""); G_DEBUG_HERE();
switch (imgdev->action) { switch (imgdev->action) {
case IMG_ACTION_ENROLL: case IMG_ACTION_ENROLL:
+206
View File
@@ -0,0 +1,206 @@
libfprint_sources = [
'fp_internal.h',
'drivers_api.h',
'async.c',
'core.c',
'data.c',
'drv.c',
'img.c',
'imgdev.c',
'poll.c',
'sync.c',
'assembling.c',
'assembling.h',
'drivers/driver_ids.h',
]
nbis_sources = [
'nbis/include/bozorth.h',
'nbis/include/bz_array.h',
'nbis/include/defs.h',
'nbis/include/lfs.h',
'nbis/include/log.h',
'nbis/include/morph.h',
'nbis/include/sunrast.h',
'nbis/bozorth3/bozorth3.c',
'nbis/bozorth3/bz_alloc.c',
'nbis/bozorth3/bz_drvrs.c',
'nbis/bozorth3/bz_gbls.c',
'nbis/bozorth3/bz_io.c',
'nbis/bozorth3/bz_sort.c',
'nbis/mindtct/binar.c',
'nbis/mindtct/block.c',
'nbis/mindtct/contour.c',
'nbis/mindtct/detect.c',
'nbis/mindtct/dft.c',
'nbis/mindtct/free.c',
'nbis/mindtct/globals.c',
'nbis/mindtct/imgutil.c',
'nbis/mindtct/init.c',
'nbis/mindtct/line.c',
'nbis/mindtct/log.c',
'nbis/mindtct/loop.c',
'nbis/mindtct/maps.c',
'nbis/mindtct/matchpat.c',
'nbis/mindtct/minutia.c',
'nbis/mindtct/morph.c',
'nbis/mindtct/quality.c',
'nbis/mindtct/remove.c',
'nbis/mindtct/ridges.c',
'nbis/mindtct/shape.c',
'nbis/mindtct/sort.c',
'nbis/mindtct/util.c',
]
aeslib = false
aesx660 = false
aes3k = false
drivers_sources = []
drivers_cflags = []
foreach driver: drivers
if driver == 'upekts'
drivers_sources += [ 'drivers/upekts.c' ]
endif
if driver == 'upektc'
drivers_sources += [ 'drivers/upektc.c', 'drivers/upektc.h' ]
endif
if driver == 'upeksonly'
drivers_sources += [ 'drivers/upeksonly.c', 'drivers/upeksonly.h' ]
endif
if driver == 'uru4000'
drivers_sources += [ 'drivers/uru4000.c' ]
endif
if driver == 'aes1610'
drivers_sources += [ 'drivers/aes1610.c' ]
aeslib = true
endif
if driver == 'aes1660'
drivers_sources += [ 'drivers/aes1660.c', 'drivers/aes1660.h' ]
aeslib = true
aesx660 = true
endif
if driver == 'aes2501'
drivers_sources += [ 'drivers/aes2501.c', 'drivers/aes2501.h' ]
aeslib = true
endif
if driver == 'aes2550'
drivers_sources += [ 'drivers/aes2550.c', 'drivers/aes2550.h' ]
aeslib = true
endif
if driver == 'aes2660'
drivers_sources += [ 'drivers/aes2660.c', 'drivers/aes2660.h' ]
aeslib = true
aesx660 = true
endif
if driver == 'aes3500'
drivers_sources += [ 'drivers/aes3500.c' ]
aeslib = true
aes3k = true
endif
if driver == 'aes4000'
drivers_sources += [ 'drivers/aes4000.c' ]
aeslib = true
aes3k = true
endif
if driver == 'fdu2000'
drivers_sources += [ 'drivers/fdu2000.c' ]
endif
if driver == 'vcom5s'
drivers_sources += [ 'drivers/vcom5s.c' ]
endif
if driver == 'vfs101'
drivers_sources += [ 'drivers/vfs101.c' ]
endif
if driver == 'vfs301'
drivers_sources += [ 'drivers/vfs301.c', 'drivers/vfs301_proto.c', 'drivers/vfs301_proto.h', 'drivers/vfs301_proto_fragments.h' ]
endif
if driver == 'vfs5011'
drivers_sources += [ 'drivers/vfs5011.c', 'drivers/vfs5011_proto.h' ]
endif
if driver == 'upektc_img'
drivers_sources += [ 'drivers/upektc_img.c', 'drivers/upektc_img.h' ]
endif
if driver == 'etes603'
drivers_sources += [ 'drivers/etes603.c' ]
endif
if driver == 'vfs0050'
drivers_sources += [ 'drivers/vfs0050.c', 'drivers/vfs0050.h' ]
endif
if driver == 'elan'
drivers_sources += [ 'drivers/elan.c', 'drivers/elan.h' ]
endif
endforeach
if aeslib
drivers_sources += [ 'aeslib.c', 'aeslib.h' ]
endif
if aesx660
drivers_sources += ['drivers/aesx660.c', 'drivers/aesx660.h' ]
endif
if aes3k
drivers_sources += ['drivers/aes3k.c', 'drivers/aes3k.h' ]
endif
other_sources = []
if imaging_dep.found()
other_sources += [ 'pixman.c' ]
endif
libfprint_sources += configure_file(input: 'empty_file',
output: 'drivers_definitions.h',
capture: true,
command: [
'/bin/echo',
drivers_struct_list
])
libfprint_sources += configure_file(input: 'empty_file',
output: 'drivers_arrays.h',
capture: true,
command: [
'/bin/echo',
drivers_primitive_array + '\n\n' + drivers_img_array
])
deps = [ mathlib_dep, glib_dep, libusb_dep, nss_dep, imaging_dep ]
libfprint = library('fprint',
libfprint_sources + drivers_sources + nbis_sources + other_sources,
soversion: soversion,
version: libversion,
c_args: common_cflags + drivers_cflags,
include_directories: [
root_inc,
include_directories('nbis/include'),
],
dependencies: deps,
install: true)
libfprint_dep = declare_dependency(link_with: libfprint,
include_directories: root_inc)
install_headers(['fprint.h'], subdir: 'libfprint')
udev_rules = executable('fprint-list-udev-rules',
'fprint-list-udev-rules.c',
include_directories: [
root_inc,
],
dependencies: [ deps, libfprint_dep ],
install: false)
if get_option('udev_rules')
custom_target('udev-rules',
output: '60-fprint-autosuspend.rules',
capture: true,
command: [ udev_rules ],
install: true,
install_dir: udev_rules_dir)
endif
supported_devices = executable('fprint-list-supported-devices',
'fprint-list-supported-devices.c',
include_directories: [
root_inc,
],
dependencies: [ deps, libfprint_dep ],
install: false)
+1 -1
View File
@@ -23,7 +23,7 @@ Do not remove this notice.
* 734.3(b)(3)(i). libfprint qualifies as publicly available technology as per * 734.3(b)(3)(i). libfprint qualifies as publicly available technology as per
* the definition in section 734.7(a)(1). * the definition in section 734.7(a)(1).
* *
* For further information, see http://reactivated.net/fprint/US_export_control * For further information, see https://fprint.freedesktop.org/us-export-control.html
*/ */
/******************************************************************************* /*******************************************************************************
+1 -1
View File
@@ -23,7 +23,7 @@ Do not remove this notice.
* 734.3(b)(3)(i). libfprint qualifies as publicly available technology as per * 734.3(b)(3)(i). libfprint qualifies as publicly available technology as per
* the definition in section 734.7(a)(1). * the definition in section 734.7(a)(1).
* *
* For further information, see http://reactivated.net/fprint/US_export_control * For further information, see https://fprint.freedesktop.org/us-export-control.html
*/ */
/******************************************************************************* /*******************************************************************************
+1 -1
View File
@@ -23,7 +23,7 @@ Do not remove this notice.
* 734.3(b)(3)(i). libfprint qualifies as publicly available technology as per * 734.3(b)(3)(i). libfprint qualifies as publicly available technology as per
* the definition in section 734.7(a)(1). * the definition in section 734.7(a)(1).
* *
* For further information, see http://reactivated.net/fprint/US_export_control * For further information, see https://fprint.freedesktop.org/us-export-control.html
*/ */
/******************************************************************************* /*******************************************************************************
+1 -1
View File
@@ -23,7 +23,7 @@ Do not remove this notice.
* 734.3(b)(3)(i). libfprint qualifies as publicly available technology as per * 734.3(b)(3)(i). libfprint qualifies as publicly available technology as per
* the definition in section 734.7(a)(1). * the definition in section 734.7(a)(1).
* *
* For further information, see http://reactivated.net/fprint/US_export_control * For further information, see https://fprint.freedesktop.org/us-export-control.html
*/ */
/******************************************************************************* /*******************************************************************************
+1 -1
View File
@@ -23,7 +23,7 @@ Do not remove this notice.
* 734.3(b)(3)(i). libfprint qualifies as publicly available technology as per * 734.3(b)(3)(i). libfprint qualifies as publicly available technology as per
* the definition in section 734.7(a)(1). * the definition in section 734.7(a)(1).
* *
* For further information, see http://reactivated.net/fprint/US_export_control * For further information, see https://fprint.freedesktop.org/us-export-control.html
*/ */
/******************************************************************************* /*******************************************************************************
+1 -1
View File
@@ -23,7 +23,7 @@ Do not remove this notice.
* 734.3(b)(3)(i). libfprint qualifies as publicly available technology as per * 734.3(b)(3)(i). libfprint qualifies as publicly available technology as per
* the definition in section 734.7(a)(1). * the definition in section 734.7(a)(1).
* *
* For further information, see http://reactivated.net/fprint/US_export_control * For further information, see https://fprint.freedesktop.org/us-export-control.html
*/ */
/******************************************************************************* /*******************************************************************************
+4 -4
View File
@@ -151,7 +151,7 @@ char get_south8_2(char *ptr, const int row, const int iw, const int ih,
{ {
if (row >= ih-1) /* catch case where image is undefined southwards */ if (row >= ih-1) /* catch case where image is undefined southwards */
return failcode; /* use plane geometry and return code. */ return failcode; /* use plane geometry and return code. */
else
return *(ptr+iw); return *(ptr+iw);
} }
@@ -175,7 +175,7 @@ char get_north8_2(char *ptr, const int row, const int iw,
{ {
if (row < 1) /* catch case where image is undefined northwards */ if (row < 1) /* catch case where image is undefined northwards */
return failcode; /* use plane geometry and return code. */ return failcode; /* use plane geometry and return code. */
else
return *(ptr-iw); return *(ptr-iw);
} }
@@ -199,7 +199,7 @@ char get_east8_2(char *ptr, const int col, const int iw,
{ {
if (col >= iw-1) /* catch case where image is undefined eastwards */ if (col >= iw-1) /* catch case where image is undefined eastwards */
return failcode; /* use plane geometry and return code. */ return failcode; /* use plane geometry and return code. */
else
return *(ptr+ 1); return *(ptr+ 1);
} }
@@ -221,6 +221,6 @@ char get_west8_2(char *ptr, const int col, const int failcode)
{ {
if (col < 1) /* catch case where image is undefined westwards */ if (col < 1) /* catch case where image is undefined westwards */
return failcode; /* use plane geometry and return code. */ return failcode; /* use plane geometry and return code. */
else
return *(ptr- 1); return *(ptr- 1);
} }
+47 -24
View File
@@ -19,6 +19,8 @@
#define FP_COMPONENT "poll" #define FP_COMPONENT "poll"
#include "fp_internal.h"
#include <config.h> #include <config.h>
#include <errno.h> #include <errno.h>
#include <time.h> #include <time.h>
@@ -27,10 +29,10 @@
#include <glib.h> #include <glib.h>
#include <libusb.h> #include <libusb.h>
#include "fp_internal.h"
/** /**
* @defgroup poll Polling and timing operations * SECTION:events
* @title: Initialisation and events handling
*
* These functions are only applicable to users of libfprint's asynchronous * These functions are only applicable to users of libfprint's asynchronous
* API. * API.
* *
@@ -50,11 +52,15 @@
* If there are no events pending, fp_handle_events() will block for a few * If there are no events pending, fp_handle_events() will block for a few
* seconds (and will handle any new events should anything occur in that time). * seconds (and will handle any new events should anything occur in that time).
* If you wish to customise this timeout, you can use * If you wish to customise this timeout, you can use
* fp_handle_events_timeout() instead. If you wish to do a nonblocking * fp_handle_events_timeout() instead. If you wish to do a non-blocking
* iteration, call fp_handle_events_timeout() with a zero timeout. * iteration, call fp_handle_events_timeout() with a zero timeout.
* *
* TODO: document how application is supposed to know when to call these * How to integrate events handling depends on your main loop implementation.
* functions. * The sister fprintd project includes an implementation of main loop handling
* that integrates into GLib's main loop. The
* [libusb documentation](http://libusb.sourceforge.net/api-1.0/group__poll.html#details)
* also includes more details about how to integrate libfprint events into
* your main loop.
*/ */
/* this is a singly-linked list of pending timers, sorted with the timer that /* this is a singly-linked list of pending timers, sorted with the timer that
@@ -124,7 +130,7 @@ struct fpi_timeout *fpi_timeout_add(unsigned int msec, fpi_timeout_fn callback,
void fpi_timeout_cancel(struct fpi_timeout *timeout) void fpi_timeout_cancel(struct fpi_timeout *timeout)
{ {
fp_dbg(""); G_DEBUG_HERE();
active_timers = g_slist_remove(active_timers, timeout); active_timers = g_slist_remove(active_timers, timeout);
g_free(timeout); g_free(timeout);
} }
@@ -161,7 +167,7 @@ static int get_next_timeout_expiry(struct timeval *out,
timerclear(out); timerclear(out);
} else { } else {
timersub(&next_timeout->expiry, &tv, out); timersub(&next_timeout->expiry, &tv, out);
fp_dbg("next timeout in %d.%06ds", out->tv_sec, out->tv_usec); fp_dbg("next timeout in %ld.%06lds", out->tv_sec, out->tv_usec);
} }
return 1; return 1;
@@ -170,7 +176,7 @@ static int get_next_timeout_expiry(struct timeval *out,
/* handle a timeout that has expired */ /* handle a timeout that has expired */
static void handle_timeout(struct fpi_timeout *timeout) static void handle_timeout(struct fpi_timeout *timeout)
{ {
fp_dbg(""); G_DEBUG_HERE();
timeout->callback(timeout->data); timeout->callback(timeout->data);
active_timers = g_slist_remove(active_timers, timeout); active_timers = g_slist_remove(active_timers, timeout);
g_free(timeout); g_free(timeout);
@@ -192,14 +198,16 @@ static int handle_timeouts(void)
return 0; return 0;
} }
/** \ingroup poll /**
* fp_handle_events_timeout:
* @timeout: Maximum timeout for this blocking function
*
* Handle any pending events. If a non-zero timeout is specified, the function * Handle any pending events. If a non-zero timeout is specified, the function
* will potentially block for the specified amount of time, although it may * will potentially block for the specified amount of time, although it may
* return sooner if events have been handled. The function acts as non-blocking * return sooner if events have been handled. The function acts as non-blocking
* for a zero timeout. * for a zero timeout.
* *
* \param timeout Maximum timeout for this blocking function * Returns: 0 on success, non-zero on error.
* \returns 0 on success, non-zero on error.
*/ */
API_EXPORTED int fp_handle_events_timeout(struct timeval *timeout) API_EXPORTED int fp_handle_events_timeout(struct timeval *timeout)
{ {
@@ -236,12 +244,14 @@ API_EXPORTED int fp_handle_events_timeout(struct timeval *timeout)
return handle_timeouts(); return handle_timeouts();
} }
/** \ingroup poll /**
* fp_handle_events:
*
* Convenience function for calling fp_handle_events_timeout() with a sensible * Convenience function for calling fp_handle_events_timeout() with a sensible
* default timeout value of two seconds (subject to change if we decide another * default timeout value of two seconds (subject to change if we decide another
* value is more sensible). * value is more sensible).
* *
* \returns 0 on success, non-zero on error. * Returns: 0 on success, non-zero on error.
*/ */
API_EXPORTED int fp_handle_events(void) API_EXPORTED int fp_handle_events(void)
{ {
@@ -251,10 +261,14 @@ API_EXPORTED int fp_handle_events(void)
return fp_handle_events_timeout(&tv); return fp_handle_events_timeout(&tv);
} }
/* FIXME: docs /**
* returns 0 if no timeouts active * fp_get_next_timeout:
* returns 1 if timeout returned * @tv: a %timeval structure containing the duration to the next timeout.
* zero timeout means events are to be handled immediately */ *
* A zero filled @tv timeout means events are to be handled immediately
*
* Returns: returns 0 if no timeouts active, or 1 if timeout returned.
*/
API_EXPORTED int fp_get_next_timeout(struct timeval *tv) API_EXPORTED int fp_get_next_timeout(struct timeval *tv)
{ {
struct timeval fprint_timeout; struct timeval fprint_timeout;
@@ -286,16 +300,18 @@ API_EXPORTED int fp_get_next_timeout(struct timeval *tv)
return 1; return 1;
} }
/** \ingroup poll /**
* fp_get_pollfds:
* @pollfds: output location for a list of pollfds. If non-%NULL, must be
* released with free() when done.
*
* Retrieve a list of file descriptors that should be polled for events * Retrieve a list of file descriptors that should be polled for events
* interesting to libfprint. This function is only for users who wish to * interesting to libfprint. This function is only for users who wish to
* combine libfprint's file descriptor set with other event sources - more * combine libfprint's file descriptor set with other event sources more
* simplistic users will be able to call fp_handle_events() or a variant * simplistic users will be able to call fp_handle_events() or a variant
* directly. * directly.
* *
* \param pollfds output location for a list of pollfds. If non-NULL, must be * Returns: the number of pollfds in the resultant list, or negative on error.
* released with free() when done.
* \returns the number of pollfds in the resultant list, or negative on error.
*/ */
API_EXPORTED size_t fp_get_pollfds(struct fp_pollfd **pollfds) API_EXPORTED size_t fp_get_pollfds(struct fp_pollfd **pollfds)
{ {
@@ -326,7 +342,14 @@ API_EXPORTED size_t fp_get_pollfds(struct fp_pollfd **pollfds)
return cnt; return cnt;
} }
/* FIXME: docs */ /**
* fp_set_pollfd_notifiers:
* @added_cb: a #fp_pollfd_added_cb callback or %NULL
* @removed_cb: a #fp_pollfd_removed_cb callback or %NULL
*
* This sets the callback functions to call for every new or removed
* file descriptor used as an event source.
*/
API_EXPORTED void fp_set_pollfd_notifiers(fp_pollfd_added_cb added_cb, API_EXPORTED void fp_set_pollfd_notifiers(fp_pollfd_added_cb added_cb,
fp_pollfd_removed_cb removed_cb) fp_pollfd_removed_cb removed_cb)
{ {
+140 -62
View File
@@ -19,11 +19,11 @@
#define FP_COMPONENT "sync" #define FP_COMPONENT "sync"
#include "fp_internal.h"
#include <config.h> #include <config.h>
#include <errno.h> #include <errno.h>
#include "fp_internal.h"
struct sync_open_data { struct sync_open_data {
struct fp_dev *dev; struct fp_dev *dev;
int status; int status;
@@ -37,12 +37,15 @@ static void sync_open_cb(struct fp_dev *dev, int status, void *user_data)
odata->status = status; odata->status = status;
} }
/** \ingroup dev /**
* fp_dev_open:
* @ddev: the discovered device to open
*
* Opens and initialises a device. This is the function you call in order * Opens and initialises a device. This is the function you call in order
* to convert a \ref dscv_dev "discovered device" into an actual device handle * to convert a #fp_dscv_dev discovered device into an actual device handle
* that you can perform operations with. * that you can perform operations with.
* \param ddev the discovered device to open *
* \returns the opened device handle, or NULL on error * Returns: the opened device handle, or %NULL on error
*/ */
API_EXPORTED struct fp_dev *fp_dev_open(struct fp_dscv_dev *ddev) API_EXPORTED struct fp_dev *fp_dev_open(struct fp_dscv_dev *ddev)
{ {
@@ -50,7 +53,7 @@ API_EXPORTED struct fp_dev *fp_dev_open(struct fp_dscv_dev *ddev)
struct sync_open_data *odata = g_malloc0(sizeof(*odata)); struct sync_open_data *odata = g_malloc0(sizeof(*odata));
int r; int r;
fp_dbg(""); G_DEBUG_HERE();
r = fp_async_dev_open(ddev, sync_open_cb, odata); r = fp_async_dev_open(ddev, sync_open_cb, odata);
if (r) if (r)
goto out; goto out;
@@ -71,15 +74,17 @@ out:
static void sync_close_cb(struct fp_dev *dev, void *user_data) static void sync_close_cb(struct fp_dev *dev, void *user_data)
{ {
fp_dbg(""); G_DEBUG_HERE();
gboolean *closed = user_data; gboolean *closed = user_data;
*closed = TRUE; *closed = TRUE;
} }
/** \ingroup dev /**
* fp_dev_close:
* @dev: the device to close. If %NULL, function simply returns.
*
* Close a device. You must call this function when you are finished using * Close a device. You must call this function when you are finished using
* a fingerprint device. * a fingerprint device.
* \param dev the device to close. If NULL, function simply returns.
*/ */
API_EXPORTED void fp_dev_close(struct fp_dev *dev) API_EXPORTED void fp_dev_close(struct fp_dev *dev)
{ {
@@ -88,7 +93,7 @@ API_EXPORTED void fp_dev_close(struct fp_dev *dev)
if (!dev) if (!dev)
return; return;
fp_dbg(""); G_DEBUG_HERE();
fp_async_dev_close(dev, sync_close_cb, &closed); fp_async_dev_close(dev, sync_close_cb, &closed);
while (!closed) while (!closed)
if (fp_handle_events() < 0) if (fp_handle_events() < 0)
@@ -116,13 +121,21 @@ static void sync_enroll_cb(struct fp_dev *dev, int result,
static void enroll_stop_cb(struct fp_dev *dev, void *user_data) static void enroll_stop_cb(struct fp_dev *dev, void *user_data)
{ {
gboolean *stopped = user_data; gboolean *stopped = user_data;
fp_dbg(""); G_DEBUG_HERE();
*stopped = TRUE; *stopped = TRUE;
} }
/** \ingroup dev /**
* Performs an enroll stage. See \ref enrolling for an explanation of enroll * fp_enroll_finger_img:
* stages. * @dev: the device
* @print_data: a location to return the resultant enrollment data from
* the final stage. Must be freed with fp_print_data_free() after use.
* @img: location to store the scan image. accepts %NULL for no image
* storage. If an image is returned, it must be freed with fp_img_free() after
* use.
*
* Performs an enroll stage. See [Enrolling](libfprint-Devices-operations.html#enrolling)
* for an explanation of enroll stages.
* *
* If no enrollment is in process, this kicks of the process and runs the * If no enrollment is in process, this kicks of the process and runs the
* first stage. If an enrollment is already in progress, calling this * first stage. If an enrollment is already in progress, calling this
@@ -137,23 +150,23 @@ static void enroll_stop_cb(struct fp_dev *dev, void *user_data)
* The RETRY codes from #fp_enroll_result may be returned from any enroll * The RETRY codes from #fp_enroll_result may be returned from any enroll
* stage. These codes indicate that the scan was not succesful in that the * stage. These codes indicate that the scan was not succesful in that the
* user did not position their finger correctly or similar. When a RETRY code * user did not position their finger correctly or similar. When a RETRY code
* is returned, the enrollment stage is <b>not</b> advanced, so the next call * is returned, the enrollment stage is <emphasis role="strong">not</emphasis> advanced, so the next call
* into this function will retry the current stage again. The current stage may * into this function will retry the current stage again. The current stage may
* need to be retried several times. * need to be retried several times.
* *
* The fp_enroll_result#FP_ENROLL_FAIL code may be returned from any enroll * The %FP_ENROLL_FAIL code may be returned from any enroll
* stage. This code indicates that even though the scans themselves have been * stage. This code indicates that even though the scans themselves have been
* acceptable, data processing applied to these scans produces incomprehensible * acceptable, data processing applied to these scans produces incomprehensible
* results. In other words, the user may have been scanning a different finger * results. In other words, the user may have been scanning a different finger
* for each stage or something like that. Like negative error codes, this * for each stage or something like that. Like negative error codes, this
* return code indicates that the enrollment process has been aborted. * return code indicates that the enrollment process has been aborted.
* *
* The fp_enroll_result#FP_ENROLL_PASS code will only ever be returned for * The %FP_ENROLL_PASS code will only ever be returned for
* non-final stages. This return code indicates that the scan was acceptable * non-final stages. This return code indicates that the scan was acceptable
* and the next call into this function will advance onto the next enroll * and the next call into this function will advance onto the next enroll
* stage. * stage.
* *
* The fp_enroll_result#FP_ENROLL_COMPLETE code will only ever be returned * The %FP_ENROLL_COMPLETE code will only ever be returned
* from the final enroll stage. It indicates that enrollment completed * from the final enroll stage. It indicates that enrollment completed
* successfully, and that print_data has been assigned to point to the * successfully, and that print_data has been assigned to point to the
* resultant enrollment data. The print_data parameter will not be modified * resultant enrollment data. The print_data parameter will not be modified
@@ -165,13 +178,7 @@ static void enroll_stop_cb(struct fp_dev *dev, void *user_data)
* to call this function even on non-imaging devices, just don't expect them to * to call this function even on non-imaging devices, just don't expect them to
* provide images. * provide images.
* *
* \param dev the device * Returns: negative code on error, otherwise a code from #fp_enroll_result
* \param print_data a location to return the resultant enrollment data from
* the final stage. Must be freed with fp_print_data_free() after use.
* \param img location to store the scan image. accepts NULL for no image
* storage. If an image is returned, it must be freed with fp_img_free() after
* use.
* \return negative code on error, otherwise a code from #fp_enroll_result
*/ */
API_EXPORTED int fp_enroll_finger_img(struct fp_dev *dev, API_EXPORTED int fp_enroll_finger_img(struct fp_dev *dev,
struct fp_print_data **print_data, struct fp_img **img) struct fp_print_data **print_data, struct fp_img **img)
@@ -182,7 +189,7 @@ API_EXPORTED int fp_enroll_finger_img(struct fp_dev *dev,
gboolean stopped = FALSE; gboolean stopped = FALSE;
struct sync_enroll_data *edata = NULL; struct sync_enroll_data *edata = NULL;
int r; int r;
fp_dbg(""); G_DEBUG_HERE();
/* FIXME __enroll_stage is ugly, can we replace it by some function that /* FIXME __enroll_stage is ugly, can we replace it by some function that
* says whether we're enrolling or not, and then put __enroll_stage into * says whether we're enrolling or not, and then put __enroll_stage into
@@ -280,6 +287,25 @@ err:
return r; return r;
} }
/**
* fp_enroll_finger:
* @dev: the device
* @print_data: a location to return the resultant enrollment data from
* the final stage. Must be freed with fp_print_data_free() after use.
*
* Performs an enroll stage. See [Enrolling](libfprint-Devices-operations.html#enrolling)
* for an explanation of enroll stages. This function is just a shortcut to
* calling fp_enroll_finger_img() with a %NULL image parameter. Be sure to read
* the description of fp_enroll_finger_img() in order to understand its behaviour.
*
* Returns: negative code on error, otherwise a code from #fp_enroll_result
*/
API_EXPORTED int fp_enroll_finger(struct fp_dev *dev,
struct fp_print_data **print_data)
{
return fp_enroll_finger_img(dev, print_data, NULL);
}
struct sync_verify_data { struct sync_verify_data {
gboolean populated; gboolean populated;
int result; int result;
@@ -298,24 +324,26 @@ static void sync_verify_cb(struct fp_dev *dev, int result, struct fp_img *img,
static void verify_stop_cb(struct fp_dev *dev, void *user_data) static void verify_stop_cb(struct fp_dev *dev, void *user_data)
{ {
gboolean *stopped = user_data; gboolean *stopped = user_data;
fp_dbg(""); G_DEBUG_HERE();
*stopped = TRUE; *stopped = TRUE;
} }
/** \ingroup dev /**
* fp_verify_finger_img:
* @dev: the device to perform the scan.
* @enrolled_print: the print to verify against. Must have been previously
* enrolled with a device compatible to the device selected to perform the scan.
* @img: location to store the scan image. accepts %NULL for no image
* storage. If an image is returned, it must be freed with fp_img_free() after
* use.
* Performs a new scan and verify it against a previously enrolled print. * Performs a new scan and verify it against a previously enrolled print.
* If the device is an imaging device, it can also return the image from * If the device is an imaging device, it can also return the image from
* the scan, even when the verify fails with a RETRY code. It is legal to * the scan, even when the verify fails with a RETRY code. It is legal to
* call this function even on non-imaging devices, just don't expect them to * call this function even on non-imaging devices, just don't expect them to
* provide images. * provide images.
* *
* \param dev the device to perform the scan. * Returns: negative code on error, otherwise a code from #fp_verify_result
* \param enrolled_print the print to verify against. Must have been previously
* enrolled with a device compatible to the device selected to perform the scan.
* \param img location to store the scan image. accepts NULL for no image
* storage. If an image is returned, it must be freed with fp_img_free() after
* use.
* \return negative code on error, otherwise a code from #fp_verify_result
*/ */
API_EXPORTED int fp_verify_finger_img(struct fp_dev *dev, API_EXPORTED int fp_verify_finger_img(struct fp_dev *dev,
struct fp_print_data *enrolled_print, struct fp_img **img) struct fp_print_data *enrolled_print, struct fp_img **img)
@@ -392,6 +420,26 @@ err:
return r; return r;
} }
/**
* fp_verify_finger:
* @dev: the device to perform the scan.
* @enrolled_print: the print to verify against. Must have been previously
* enrolled with a device compatible to the device selected to perform the scan.
*
* Performs a new scan and verify it against a previously enrolled print. This
* function is just a shortcut to calling fp_verify_finger_img() with a NULL
* image output parameter.
*
* See also fp_verify_finger_img().
*
* Returns: negative code on error, otherwise a code from #fp_verify_result
*/
API_EXPORTED int fp_verify_finger(struct fp_dev *dev,
struct fp_print_data *enrolled_print)
{
return fp_verify_finger_img(dev, enrolled_print, NULL);
}
struct sync_identify_data { struct sync_identify_data {
gboolean populated; gboolean populated;
int result; int result;
@@ -412,11 +460,23 @@ static void sync_identify_cb(struct fp_dev *dev, int result,
static void identify_stop_cb(struct fp_dev *dev, void *user_data) static void identify_stop_cb(struct fp_dev *dev, void *user_data)
{ {
gboolean *stopped = user_data; gboolean *stopped = user_data;
fp_dbg(""); G_DEBUG_HERE();
*stopped = TRUE; *stopped = TRUE;
} }
/** \ingroup dev /**
* fp_identify_finger_img:
* @dev: the device to perform the scan.
* @print_gallery: NULL-terminated array of pointers to the prints to
* identify against. Each one must have been previously enrolled with a device
* compatible to the device selected to perform the scan.
* @match_offset: output location to store the array index of the matched
* gallery print (if any was found). Only valid if %FP_VERIFY_MATCH was
* returned.
* @img: location to store the scan image. accepts %NULL for no image
* storage. If an image is returned, it must be freed with fp_img_free() after
* use.
* Performs a new scan and attempts to identify the scanned finger against * Performs a new scan and attempts to identify the scanned finger against
* a collection of previously enrolled fingerprints. * a collection of previously enrolled fingerprints.
* If the device is an imaging device, it can also return the image from * If the device is an imaging device, it can also return the image from
@@ -425,7 +485,7 @@ static void identify_stop_cb(struct fp_dev *dev, void *user_data)
* provide images. * provide images.
* *
* This function returns codes from #fp_verify_result. The return code * This function returns codes from #fp_verify_result. The return code
* fp_verify_result#FP_VERIFY_MATCH indicates that the scanned fingerprint * %FP_VERIFY_MATCH indicates that the scanned fingerprint
* does appear in the print gallery, and the match_offset output parameter * does appear in the print gallery, and the match_offset output parameter
* will indicate the index into the print gallery array of the matched print. * will indicate the index into the print gallery array of the matched print.
* *
@@ -435,17 +495,7 @@ static void identify_stop_cb(struct fp_dev *dev, void *user_data)
* Not all devices support identification. -ENOTSUP will be returned when * Not all devices support identification. -ENOTSUP will be returned when
* this is the case. * this is the case.
* *
* \param dev the device to perform the scan. * Returns: negative code on error, otherwise a code from #fp_verify_result
* \param print_gallery NULL-terminated array of pointers to the prints to
* identify against. Each one must have been previously enrolled with a device
* compatible to the device selected to perform the scan.
* \param match_offset output location to store the array index of the matched
* gallery print (if any was found). Only valid if FP_VERIFY_MATCH was
* returned.
* \param img location to store the scan image. accepts NULL for no image
* storage. If an image is returned, it must be freed with fp_img_free() after
* use.
* \return negative code on error, otherwise a code from #fp_verify_result
*/ */
API_EXPORTED int fp_identify_finger_img(struct fp_dev *dev, API_EXPORTED int fp_identify_finger_img(struct fp_dev *dev,
struct fp_print_data **print_gallery, size_t *match_offset, struct fp_print_data **print_gallery, size_t *match_offset,
@@ -512,6 +562,31 @@ err:
return r; return r;
} }
/**
* fp_identify_finger:
* @dev: the device to perform the scan.
* @print_gallery: %NULL-terminated array of pointers to the prints to
* identify against. Each one must have been previously enrolled with a device
* compatible to the device selected to perform the scan.
* @match_offset: output location to store the array index of the matched
* gallery print (if any was found). Only valid if %FP_VERIFY_MATCH was
* returned.
* Performs a new scan and attempts to identify the scanned finger against a
* collection of previously enrolled fingerprints. This function is just a
* shortcut to calling fp_identify_finger_img() with a %NULL image output
* parameter.
*
* See also fp_identify_finger_img().
*
* Returns: negative code on error, otherwise a code from #fp_verify_result
*/
API_EXPORTED int fp_identify_finger(struct fp_dev *dev,
struct fp_print_data **print_gallery, size_t *match_offset)
{
return fp_identify_finger_img(dev, print_gallery, match_offset, NULL);
}
struct sync_capture_data { struct sync_capture_data {
gboolean populated; gboolean populated;
int result; int result;
@@ -530,26 +605,29 @@ static void sync_capture_cb(struct fp_dev *dev, int result, struct fp_img *img,
static void capture_stop_cb(struct fp_dev *dev, void *user_data) static void capture_stop_cb(struct fp_dev *dev, void *user_data)
{ {
gboolean *stopped = user_data; gboolean *stopped = user_data;
fp_dbg(""); G_DEBUG_HERE();
*stopped = TRUE; *stopped = TRUE;
} }
/** \ingroup dev /**
* Captures an \ref img "image" from a device. The returned image is the raw * fp_dev_img_capture:
* image provided by the device, you may wish to \ref img_std "standardize" it. * @dev: the device
* @unconditional: whether to unconditionally capture an image, or to only capture when a finger is detected
* @img: a location to return the captured image. Must be freed with
* fp_img_free() after use.
* *
* If set, the <tt>unconditional</tt> flag indicates that the device should * Captures a #fp_img from a device. The returned image is the raw
* image provided by the device, you may wish to [standardize](libfprint-Image-operations.html#img_std) it.
*
* If set, the @unconditional flag indicates that the device should
* capture an image unconditionally, regardless of whether a finger is there * capture an image unconditionally, regardless of whether a finger is there
* or not. If unset, this function will block until a finger is detected on * or not. If unset, this function will block until a finger is detected on
* the sensor. * the sensor.
* *
* \param dev the device * See fp_dev_supports_imaging().
* \param unconditional whether to unconditionally capture an image, or to only capture when a finger is detected *
* \param img a location to return the captured image. Must be freed with * Returns: 0 on success, non-zero on error. -ENOTSUP indicates that either the
* fp_img_free() after use. * @unconditional flag was set but the device does not support this, or that the
* \return 0 on success, non-zero on error. -ENOTSUP indicates that either the
* unconditional flag was set but the device does not support this, or that the
* device does not support imaging. * device does not support imaging.
* \sa fp_dev_supports_imaging()
*/ */
API_EXPORTED int fp_dev_img_capture(struct fp_dev *dev, int unconditional, API_EXPORTED int fp_dev_img_capture(struct fp_dev *dev, int unconditional,
struct fp_img **img) struct fp_img **img)
-11147
View File
File diff suppressed because it is too large Load Diff
-8369
View File
File diff suppressed because it is too large Load Diff
-437
View File
@@ -1,437 +0,0 @@
# Helper functions for option handling. -*- Autoconf -*-
#
# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software
# Foundation, Inc.
# Written by Gary V. Vaughan, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 8 ltoptions.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
# ------------------------------------------
m4_define([_LT_MANGLE_OPTION],
[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
# ---------------------------------------
# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
# matching handler defined, dispatch to it. Other OPTION-NAMEs are
# saved as a flag.
m4_define([_LT_SET_OPTION],
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
_LT_MANGLE_DEFUN([$1], [$2]),
[m4_warning([Unknown $1 option '$2'])])[]dnl
])
# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
# ------------------------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
m4_define([_LT_IF_OPTION],
[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
# -------------------------------------------------------
# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
# are set.
m4_define([_LT_UNLESS_OPTIONS],
[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
[m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
[m4_define([$0_found])])])[]dnl
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
])[]dnl
])
# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
# ----------------------------------------
# OPTION-LIST is a space-separated list of Libtool options associated
# with MACRO-NAME. If any OPTION has a matching handler declared with
# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
# the unknown option and exit.
m4_defun([_LT_SET_OPTIONS],
[# Set options
m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
[_LT_SET_OPTION([$1], _LT_Option)])
m4_if([$1],[LT_INIT],[
dnl
dnl Simply set some default values (i.e off) if boolean options were not
dnl specified:
_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
])
_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
])
dnl
dnl If no reference was made to various pairs of opposing options, then
dnl we run the default mode handler for the pair. For example, if neither
dnl 'shared' nor 'disable-shared' was passed, we enable building of shared
dnl archives by default:
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
[_LT_ENABLE_FAST_INSTALL])
_LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4],
[_LT_WITH_AIX_SONAME([aix])])
])
])# _LT_SET_OPTIONS
## --------------------------------- ##
## Macros to handle LT_INIT options. ##
## --------------------------------- ##
# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
# -----------------------------------------
m4_define([_LT_MANGLE_DEFUN],
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
# -----------------------------------------------
m4_define([LT_OPTION_DEFINE],
[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
])# LT_OPTION_DEFINE
# dlopen
# ------
LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
])
AU_DEFUN([AC_LIBTOOL_DLOPEN],
[_LT_SET_OPTION([LT_INIT], [dlopen])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the 'dlopen' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
# win32-dll
# ---------
# Declare package support for building win32 dll's.
LT_OPTION_DEFINE([LT_INIT], [win32-dll],
[enable_win32_dll=yes
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
AC_CHECK_TOOL(AS, as, false)
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(OBJDUMP, objdump, false)
;;
esac
test -z "$AS" && AS=as
_LT_DECL([], [AS], [1], [Assembler program])dnl
test -z "$DLLTOOL" && DLLTOOL=dlltool
_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
test -z "$OBJDUMP" && OBJDUMP=objdump
_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
])# win32-dll
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
_LT_SET_OPTION([LT_INIT], [win32-dll])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the 'win32-dll' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
# _LT_ENABLE_SHARED([DEFAULT])
# ----------------------------
# implement the --enable-shared flag, and supports the 'shared' and
# 'disable-shared' LT_INIT options.
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
m4_define([_LT_ENABLE_SHARED],
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([shared],
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for pkg in $enableval; do
IFS=$lt_save_ifs
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
_LT_DECL([build_libtool_libs], [enable_shared], [0],
[Whether or not to build shared libraries])
])# _LT_ENABLE_SHARED
LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
# Old names:
AC_DEFUN([AC_ENABLE_SHARED],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
])
AC_DEFUN([AC_DISABLE_SHARED],
[_LT_SET_OPTION([LT_INIT], [disable-shared])
])
AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_ENABLE_SHARED], [])
dnl AC_DEFUN([AM_DISABLE_SHARED], [])
# _LT_ENABLE_STATIC([DEFAULT])
# ----------------------------
# implement the --enable-static flag, and support the 'static' and
# 'disable-static' LT_INIT options.
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
m4_define([_LT_ENABLE_STATIC],
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([static],
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for pkg in $enableval; do
IFS=$lt_save_ifs
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
_LT_DECL([build_old_libs], [enable_static], [0],
[Whether or not to build static libraries])
])# _LT_ENABLE_STATIC
LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
# Old names:
AC_DEFUN([AC_ENABLE_STATIC],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
])
AC_DEFUN([AC_DISABLE_STATIC],
[_LT_SET_OPTION([LT_INIT], [disable-static])
])
AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_ENABLE_STATIC], [])
dnl AC_DEFUN([AM_DISABLE_STATIC], [])
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
# ----------------------------------
# implement the --enable-fast-install flag, and support the 'fast-install'
# and 'disable-fast-install' LT_INIT options.
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
m4_define([_LT_ENABLE_FAST_INSTALL],
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([fast-install],
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_fast_install=yes ;;
no) enable_fast_install=no ;;
*)
enable_fast_install=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for pkg in $enableval; do
IFS=$lt_save_ifs
if test "X$pkg" = "X$p"; then
enable_fast_install=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
_LT_DECL([fast_install], [enable_fast_install], [0],
[Whether or not to optimize for fast installation])dnl
])# _LT_ENABLE_FAST_INSTALL
LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
# Old names:
AU_DEFUN([AC_ENABLE_FAST_INSTALL],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
the 'fast-install' option into LT_INIT's first parameter.])
])
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
the 'disable-fast-install' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
# _LT_WITH_AIX_SONAME([DEFAULT])
# ----------------------------------
# implement the --with-aix-soname flag, and support the `aix-soname=aix'
# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'.
m4_define([_LT_WITH_AIX_SONAME],
[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
shared_archive_member_spec=
case $host,$enable_shared in
power*-*-aix[[5-9]]*,yes)
AC_MSG_CHECKING([which variant of shared library versioning to provide])
AC_ARG_WITH([aix-soname],
[AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
[shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
[case $withval in
aix|svr4|both)
;;
*)
AC_MSG_ERROR([Unknown argument to --with-aix-soname])
;;
esac
lt_cv_with_aix_soname=$with_aix_soname],
[AC_CACHE_VAL([lt_cv_with_aix_soname],
[lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
with_aix_soname=$lt_cv_with_aix_soname])
AC_MSG_RESULT([$with_aix_soname])
if test aix != "$with_aix_soname"; then
# For the AIX way of multilib, we name the shared archive member
# based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
# and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
# Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
# the AIX toolchain works better with OBJECT_MODE set (default 32).
if test 64 = "${OBJECT_MODE-32}"; then
shared_archive_member_spec=shr_64
else
shared_archive_member_spec=shr
fi
fi
;;
*)
with_aix_soname=aix
;;
esac
_LT_DECL([], [shared_archive_member_spec], [0],
[Shared archive member basename, for filename based shared library versioning on AIX])dnl
])# _LT_WITH_AIX_SONAME
LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])])
LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])])
LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
# _LT_WITH_PIC([MODE])
# --------------------
# implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
# LT_INIT options.
# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'.
m4_define([_LT_WITH_PIC],
[AC_ARG_WITH([pic],
[AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
[lt_p=${PACKAGE-default}
case $withval in
yes|no) pic_mode=$withval ;;
*)
pic_mode=default
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for lt_pkg in $withval; do
IFS=$lt_save_ifs
if test "X$lt_pkg" = "X$lt_p"; then
pic_mode=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[pic_mode=m4_default([$1], [default])])
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
])# _LT_WITH_PIC
LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
# Old name:
AU_DEFUN([AC_LIBTOOL_PICMODE],
[_LT_SET_OPTION([LT_INIT], [pic-only])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the 'pic-only' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
## ----------------- ##
## LTDL_INIT Options ##
## ----------------- ##
m4_define([_LTDL_MODE], [])
LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
[m4_define([_LTDL_MODE], [nonrecursive])])
LT_OPTION_DEFINE([LTDL_INIT], [recursive],
[m4_define([_LTDL_MODE], [recursive])])
LT_OPTION_DEFINE([LTDL_INIT], [subproject],
[m4_define([_LTDL_MODE], [subproject])])
m4_define([_LTDL_TYPE], [])
LT_OPTION_DEFINE([LTDL_INIT], [installable],
[m4_define([_LTDL_TYPE], [installable])])
LT_OPTION_DEFINE([LTDL_INIT], [convenience],
[m4_define([_LTDL_TYPE], [convenience])])
-124
View File
@@ -1,124 +0,0 @@
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
#
# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software
# Foundation, Inc.
# Written by Gary V. Vaughan, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 6 ltsugar.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
# lt_join(SEP, ARG1, [ARG2...])
# -----------------------------
# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
# associated separator.
# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
# versions in m4sugar had bugs.
m4_define([lt_join],
[m4_if([$#], [1], [],
[$#], [2], [[$2]],
[m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
m4_define([_lt_join],
[m4_if([$#$2], [2], [],
[m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
# lt_car(LIST)
# lt_cdr(LIST)
# ------------
# Manipulate m4 lists.
# These macros are necessary as long as will still need to support
# Autoconf-2.59, which quotes differently.
m4_define([lt_car], [[$1]])
m4_define([lt_cdr],
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
[$#], 1, [],
[m4_dquote(m4_shift($@))])])
m4_define([lt_unquote], $1)
# lt_append(MACRO-NAME, STRING, [SEPARATOR])
# ------------------------------------------
# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'.
# Note that neither SEPARATOR nor STRING are expanded; they are appended
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
# No SEPARATOR is output if MACRO-NAME was previously undefined (different
# than defined and empty).
#
# This macro is needed until we can rely on Autoconf 2.62, since earlier
# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
m4_define([lt_append],
[m4_define([$1],
m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
# ----------------------------------------------------------
# Produce a SEP delimited list of all paired combinations of elements of
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
# has the form PREFIXmINFIXSUFFIXn.
# Needed until we can rely on m4_combine added in Autoconf 2.62.
m4_define([lt_combine],
[m4_if(m4_eval([$# > 3]), [1],
[m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
[[m4_foreach([_Lt_prefix], [$2],
[m4_foreach([_Lt_suffix],
]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
# -----------------------------------------------------------------------
# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
m4_define([lt_if_append_uniq],
[m4_ifdef([$1],
[m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
[lt_append([$1], [$2], [$3])$4],
[$5])],
[lt_append([$1], [$2], [$3])$4])])
# lt_dict_add(DICT, KEY, VALUE)
# -----------------------------
m4_define([lt_dict_add],
[m4_define([$1($2)], [$3])])
# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
# --------------------------------------------
m4_define([lt_dict_add_subkey],
[m4_define([$1($2:$3)], [$4])])
# lt_dict_fetch(DICT, KEY, [SUBKEY])
# ----------------------------------
m4_define([lt_dict_fetch],
[m4_ifval([$3],
m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
# -----------------------------------------------------------------
m4_define([lt_if_dict_fetch],
[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
[$5],
[$6])])
# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
# --------------------------------------------------------------
m4_define([lt_dict_filter],
[m4_if([$5], [], [],
[lt_join(m4_quote(m4_default([$4], [[, ]])),
lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
[lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
])
-23
View File
@@ -1,23 +0,0 @@
# ltversion.m4 -- version numbers -*- Autoconf -*-
#
# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc.
# Written by Scott James Remnant, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# @configure_input@
# serial 4179 ltversion.m4
# This file is part of GNU Libtool
m4_define([LT_PACKAGE_VERSION], [2.4.6])
m4_define([LT_PACKAGE_REVISION], [2.4.6])
AC_DEFUN([LTVERSION_VERSION],
[macro_version='2.4.6'
macro_revision='2.4.6'
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
_LT_DECL(, macro_revision, 0)
])
-99
View File
@@ -1,99 +0,0 @@
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
#
# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software
# Foundation, Inc.
# Written by Scott James Remnant, 2004.
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 5 lt~obsolete.m4
# These exist entirely to fool aclocal when bootstrapping libtool.
#
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN),
# which have later been changed to m4_define as they aren't part of the
# exported API, or moved to Autoconf or Automake where they belong.
#
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
# using a macro with the same name in our local m4/libtool.m4 it'll
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
# and doesn't know about Autoconf macros at all.)
#
# So we provide this file, which has a silly filename so it's always
# included after everything else. This provides aclocal with the
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
# because those macros already exist, or will be overwritten later.
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
#
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
# Yes, that means every name once taken will need to remain here until
# we give up compatibility with versions before 1.7, at which point
# we need to keep only those names which we still refer to.
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
+129
View File
@@ -0,0 +1,129 @@
project('libfprint', [ 'c', 'cpp' ],
version: '0.8.1',
license: 'LGPLv2.1+',
default_options: [
'buildtype=debugoptimized',
'warning_level=1',
'c_std=c99',
],
meson_version: '>= 0.45.0')
add_project_arguments([ '-D_GNU_SOURCE' ], language: 'c')
add_project_arguments([ '-DG_LOG_DOMAIN="libfprint"' ], language: 'c')
libfprint_conf = configuration_data()
cc = meson.get_compiler('c')
cpp = meson.get_compiler('cpp')
host_system = host_machine.system()
common_cflags = cc.get_supported_arguments([
'-fgnu89-inline',
'-fvisibility=hidden',
'-std=gnu99',
'-Wall',
'-Wundef',
'-Wunused',
'-Wstrict-prototypes',
'-Werror-implicit-function-declaration',
'-Wno-pointer-sign',
'-Wshadow'
])
# maintaining compatibility with the previous libtool versioning
# current = binary - interface
# revision = interface
soversion = 0
current = 0
revision = 0
libversion = '@0@.@1@.@2@'.format(soversion, current, revision)
# Dependencies
glib_dep = dependency('glib-2.0', version: '>= 2.28')
libusb_dep = dependency('libusb-1.0', version: '>= 0.9.1')
mathlib_dep = cc.find_library('m', required: false)
# Drivers
drivers = get_option('drivers').split(',')
all_drivers = [ 'upekts', 'upektc', 'upeksonly', 'vcom5s', 'uru4000', 'aes1610', 'aes1660', 'aes2501', 'aes2550', 'aes2660', 'aes3500', 'aes4000', 'vfs101', 'vfs301', 'vfs5011', 'upektc_img', 'etes603', 'vfs0050', 'elan' ]
primitive_drivers = [ 'upekts' ]
if drivers == [ 'all' ]
drivers = all_drivers
endif
nss_dep = []
imaging_dep = []
foreach driver: drivers
if driver == 'uru4000'
nss_dep = dependency('nss', required: false)
if not nss_dep.found()
error('NSS is required for the URU4000/URU4500 driver')
endif
endif
if driver == 'aes3500' or driver == 'aes4000'
imaging_dep = dependency('pixman-1', required: false)
if not imaging_dep.found()
error('pixman is required for imaging support')
endif
endif
if not all_drivers.contains(driver)
error('Invalid driver \'' + driver + '\'')
endif
endforeach
# Export the drivers' structures to the core code
drivers_struct_list = ''
drivers_img_array = 'static struct fp_img_driver * const img_drivers[] = {\n'
drivers_primitive_array = 'static struct fp_driver * const primitive_drivers[] = {\n'
foreach driver: drivers
if primitive_drivers.contains(driver)
drivers_struct_list += 'extern struct fp_driver ' + driver + '_driver;\n'
drivers_primitive_array += ' &' + driver + '_driver,\n'
else
drivers_struct_list += 'extern struct fp_img_driver ' + driver + '_driver;\n'
drivers_img_array += ' &' + driver + '_driver,\n'
endif
endforeach
drivers_img_array += '};'
drivers_primitive_array += '};'
root_inc = include_directories('.')
if get_option('udev_rules')
udev_rules_dir = get_option('udev_rules_dir')
if udev_rules_dir == 'auto'
udev_dep = dependency('udev')
udev_rules_dir = udev_dep.get_pkgconfig_variable('udevdir') + '/rules.d'
endif
endif
if get_option('x11-examples')
x11_dep = cc.find_library('X11')
xv_dep = dependency('xv', required: false)
if not xv_dep.found()
error('XV is required for X11 examples')
endif
endif
libfprint_conf.set('API_EXPORTED', '__attribute__((visibility("default")))')
configure_file(output: 'config.h', configuration: libfprint_conf)
subdir('libfprint')
subdir('examples')
if get_option('doc')
gnome = import('gnome')
subdir('doc')
endif
pkgconfig = import('pkgconfig')
pkgconfig.generate(
name: 'libfprint',
description: 'Generic C API for fingerprint reader access',
version: meson.project_version(),
libraries: libfprint,
subdirs: 'libfprint',
filebase: 'libfprint',
install_dir: join_paths(get_option('libdir'), 'pkgconfig'),
)
+20
View File
@@ -0,0 +1,20 @@
option('drivers',
description: 'Drivers to integrate',
type: 'string',
value: 'all')
option('udev_rules',
description: 'Whether to create a udev rules file',
type: 'boolean',
value: true)
option('udev_rules_dir',
description: 'Installation path for udev rules',
type: 'string',
value: 'auto')
option('x11-examples',
description: 'Whether to build X11 example applications',
type: 'boolean',
value: true)
option('doc',
description: 'Whether to build the API documentation',
type: 'boolean',
value: true)

Some files were not shown because too many files have changed in this diff Show More