libfprint/examples/verify.c
Daniel Drake f81aa47a19 Add 'verify' example skeleton
This will become an example program to enroll a fingerprint and then
verify a finger against it.
2007-10-08 17:37:33 +01:00

68 lines
1.7 KiB
C

/*
* Example fingerprint verification program
* Copyright (C) 2007 Daniel Drake <dsd@gentoo.org>
*
* 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 <stdio.h>
#include <stdlib.h>
#include <libfprint/fprint.h>
struct fp_dscv_dev *discover_device(struct fp_dscv_dev **discovered_devs)
{
struct fp_dscv_dev *ddev = NULL;
struct fp_dscv_dev *tmpdev;
int i;
for (i = 0; tmpdev = discovered_devs[i]; i++) {
const struct fp_driver *drv = fp_dscv_dev_get_driver(tmpdev);
printf("Found device claimed by %s driver\n",
fp_driver_get_full_name(drv));
return ddev;
}
return ddev;
}
int main(void)
{
int r;
struct fp_dscv_dev *ddev;
struct fp_dscv_dev **discovered_devs;
r = fp_init();
if (r < 0) {
fprintf(stderr, "Failed to initialize libfprint\n");
exit(1);
}
discovered_devs = fp_discover_devs();
if (!discovered_devs) {
fprintf(stderr, "Could not discover devices\n");
exit(1);
}
ddev = discover_device(discovered_devs);
if (!ddev) {
fprintf(stderr, "No devices detected.\n");
exit(1);
}
fp_dscv_devs_free(discovered_devs);
}