diff --git a/libfprint/Makefile.am b/libfprint/Makefile.am index ddfa327..7f79828 100644 --- a/libfprint/Makefile.am +++ b/libfprint/Makefile.am @@ -1,9 +1,14 @@ lib_LTLIBRARIES = libfprint.la +UPEKTS_SRC = drivers/upekts.c + +DRIVER_SRC = $(UPEKTS_SRC) + libfprint_la_CFLAGS = -fvisibility=hidden $(LIBUSB_CFLAGS) $(GLIB_CFLAGS) libfprint_la_LDFLAGS = -version-info @lt_major@:@lt_revision@:@lt_age@ libfprint_la_LIBADD = $(LIBUSB_LIBS) $(GLIB_LIBS) -libfprint_la_SOURCES = \ - core.c +libfprint_la_SOURCES = \ + core.c \ + $(DRIVER_SRC) diff --git a/libfprint/core.c b/libfprint/core.c index d96a78d..e7ee538 100644 --- a/libfprint/core.c +++ b/libfprint/core.c @@ -19,7 +19,31 @@ #include +#include + +#include "fp_internal.h" + +static GList *registered_drivers = NULL; + +static void register_driver(const struct fp_driver *drv) +{ + registered_drivers = g_list_prepend(registered_drivers, (gpointer) drv); +} + +static const struct fp_driver * const drivers[] = { + &upekts_driver, +}; + +static void register_drivers(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(drivers); i++) + register_driver(drivers[i]); +} + API_EXPORTED int fp_init(void) { + register_drivers(); return 0; } diff --git a/libfprint/drivers/upekts.c b/libfprint/drivers/upekts.c new file mode 100644 index 0000000..fdf97a3 --- /dev/null +++ b/libfprint/drivers/upekts.c @@ -0,0 +1,32 @@ +/* + * UPEK TouchStrip driver for libfprint + * Copyright (C) 2007 Daniel Drake + * + * 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 + +static const struct usb_id id_table[] = { + { .vendor = 0x0483, .product = 0x2016 }, + { 0 }, /* terminating entry */ +}; + +const struct fp_driver upekts_driver = { + .name = "upekts", + .full_name = "UPEK TouchStrip", + .id_table = id_table, +}; + diff --git a/libfprint/fp_internal.h b/libfprint/fp_internal.h new file mode 100644 index 0000000..19f5ee5 --- /dev/null +++ b/libfprint/fp_internal.h @@ -0,0 +1,42 @@ +/* + * Internal/private definitions for libfprint + * Copyright (C) 2007 Daniel Drake + * + * 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 __FPRINT_INTERNAL_H__ +#define __FPRINT_INTERNAL_H__ + +#include + +#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*a)) + +struct usb_id { + uint16_t vendor; + uint16_t product; + unsigned long driver_data; +}; + +struct fp_driver { + const char *name; + const char *full_name; + const struct usb_id * const id_table; +}; + +extern const struct fp_driver upekts_driver; + +#endif + diff --git a/libfprint/fprint.h b/libfprint/fprint.h new file mode 100644 index 0000000..889dda7 --- /dev/null +++ b/libfprint/fprint.h @@ -0,0 +1,26 @@ +/* + * Main definitions for libfprint + * Copyright (C) 2007 Daniel Drake + * + * 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 __FPRINT_H__ +#define __FPRINT_H__ + +int fp_init(void); + +#endif +