diff --git a/libfprint/Makefile.am b/libfprint/Makefile.am index 056eb67..026a710 100644 --- a/libfprint/Makefile.am +++ b/libfprint/Makefile.am @@ -1,4 +1,5 @@ lib_LTLIBRARIES = libfprint.la +noinst_PROGRAMS = fprint-list-hal-info UPEKTS_SRC = drivers/upekts.c UPEKTC_SRC = drivers/upektc.c @@ -54,6 +55,17 @@ libfprint_la_CFLAGS = -fvisibility=hidden -I$(srcdir)/nbis/include $(LIBUSB_CFLA libfprint_la_LDFLAGS = -version-info @lt_major@:@lt_revision@:@lt_age@ libfprint_la_LIBADD = -lm $(LIBUSB_LIBS) $(GLIB_LIBS) $(CRYPTO_LIBS) +fprint_list_hal_info_SOURCES = fprint-list-hal-info.c +fprint_list_hal_info_CFLAGS = -fvisibility=hidden -I$(srcdir)/nbis/include $(LIBUSB_CFLAGS) $(GLIB_CFLAGS) $(IMAGEMAGICK_CFLAGS) $(CRYPTO_CFLAGS) $(AM_CFLAGS) +fprint_list_hal_info_LDADD = $(builddir)/libfprint.la + +hal_fdi_DATA = 10-fingerprint-reader-fprint.fdi +hal_fdidir = $(datadir)/hal/fdi/information/20thirdparty/ + +$(hal_fdi_DATA): fprint-list-hal-info + $(builddir)/fprint-list-hal-info > $@ + + if ENABLE_UPEKTS DRIVER_SRC += $(UPEKTS_SRC) endif diff --git a/libfprint/core.c b/libfprint/core.c index 4bd617c..acbe08f 100644 --- a/libfprint/core.c +++ b/libfprint/core.c @@ -375,6 +375,24 @@ static void register_drivers(void) } } +API_EXPORTED struct fp_driver **fprint_get_drivers (void) +{ + GPtrArray *array; + unsigned int i; + + array = g_ptr_array_new (); + for (i = 0; i < G_N_ELEMENTS(primitive_drivers); i++) + g_ptr_array_add (array, primitive_drivers[i]); + + for (i = 0; i < G_N_ELEMENTS(img_drivers); i++) + g_ptr_array_add (array, &(img_drivers[i]->driver)); + + /* Add a null item terminating the array */ + g_ptr_array_add (array, NULL); + + return (struct fp_driver **) g_ptr_array_free (array, FALSE); +} + static struct fp_driver *find_supporting_driver(libusb_device *udev, const struct usb_id **usb_id) { diff --git a/libfprint/fp_internal.h b/libfprint/fp_internal.h index 01f5565..5483d11 100644 --- a/libfprint/fp_internal.h +++ b/libfprint/fp_internal.h @@ -91,6 +91,8 @@ enum fp_dev_state { DEV_STATE_IDENTIFY_STOPPING, }; +struct fp_driver **fprint_get_drivers (void); + struct fp_dev { struct fp_driver *drv; libusb_device_handle *udev; diff --git a/libfprint/fprint-list-hal-info.c b/libfprint/fprint-list-hal-info.c new file mode 100644 index 0000000..6182b13 --- /dev/null +++ b/libfprint/fprint-list-hal-info.c @@ -0,0 +1,84 @@ +/* + * Helper binary for creating a HAL FDI file for supported devices + * Copyright (C) 2008 Bastien Nocera + * Copyright (C) 2008 Timo Hoenig , + * + * 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 +#include + +#include "fp_internal.h" + +/* FDI entry example: + * + * + * + * + * biometric.fingerprint_reader + * libfprint + * biometric + * biometric.fingerprint_reader + * aes2501 + * true + * + * + * + */ + +static void print_driver (struct fp_driver *driver) +{ + int i; + + for (i = 0; driver->id_table[i].vendor != 0; i++) { + printf (" \n", fp_driver_get_full_name (driver)); + printf (" \n", driver->id_table[i].vendor); + printf (" \n", driver->id_table[i].product); + printf (" biometric.fingerprint_reader\n"); + printf (" libfprint\n"); + printf (" biometric\n"); + printf (" biometric.fingerprint_reader\n"); + printf (" %s\n", driver->name); + printf (" true\n"); + printf (" \n"); + printf (" \n"); + } +} + +static void print_imaging_driver (struct fp_img_driver *driver) +{ + print_driver (&(driver->driver)); +} + +int main (int argc, char **argv) +{ + struct fp_driver **list; + guint i; + + list = fprint_get_drivers (); + + printf ("\n"); + printf ("\n", VERSION); + printf ("\n"); + + for (i = 0; list[i] != NULL; i++) { + print_driver (list[i]); + } + + printf ("\n"); + + return 0; +}