Allow drivers to be included/excluded at compile time

This commit is contained in:
Pavel Herrman
2008-08-10 14:21:58 -05:00
committed by Daniel Drake
parent b6dabaacc8
commit bba1c1085f
6 changed files with 176 additions and 8 deletions

View File

@@ -10,8 +10,8 @@ AES4000_SRC = drivers/aes4000.c
FDU2000_SRC = drivers/fdu2000.c
VCOM5S_SRC = drivers/vcom5s.c
DRIVER_SRC = $(UPEKTS_SRC) $(AES4000_SRC) $(AES2501_SRC) $(URU4000_SRC) $(VCOM5S_SRC) $(UPEKSONLY_SRC)
#DRIVER_SRC = $(AES1610_SRC) $(UPEKTC_SRC) $(FDU2000_SRC)
DRIVER_SRC = ""
OTHER_SRC = ""
NBIS_SRC = \
nbis/include/bozorth.h \
@@ -50,9 +50,54 @@ NBIS_SRC = \
nbis/mindtct/sort.c \
nbis/mindtct/util.c
libfprint_la_CFLAGS = -fvisibility=hidden -I$(srcdir)/nbis/include $(LIBUSB_CFLAGS) $(GLIB_CFLAGS) $(IMAGEMAGICK_CFLAGS) $(CRYPTO_CFLAGS) $(AM_CFLAGS)
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) $(IMAGEMAGICK_LIBS) $(CRYPTO_LIBS)
libfprint_la_LIBADD = -lm $(LIBUSB_LIBS) $(GLIB_LIBS) $(CRYPTO_LIBS)
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_AES2501
DRIVER_SRC += $(AES2501_SRC)
endif
if ENABLE_AES4000
DRIVER_SRC += $(AES4000_SRC)
endif
if REQUIRE_IMAGEMAGICK
libfprint_la_CFLAGS += $(IMAGEMAGICK_CFLAGS) -DREQUIRE_IMAGEMAGICK
libfprint_la_LIBADD += $(IMAGEMAGICK_LIBS)
endif
if REQUIRE_AESLIB
OTHER_SRC += aeslib.c aeslib.h
endif
libfprint_la_SOURCES = \
fp_internal.h \
@@ -64,9 +109,8 @@ libfprint_la_SOURCES = \
imgdev.c \
poll.c \
sync.c \
aeslib.c \
aeslib.h \
$(DRIVER_SRC) \
$(OTHER_SRC) \
$(NBIS_SRC)
pkginclude_HEADERS = fprint.h

View File

@@ -327,18 +327,38 @@ static void register_driver(struct fp_driver *drv)
}
static struct fp_driver * const primitive_drivers[] = {
#ifdef ENABLE_UPEKTS
&upekts_driver,
#endif
};
static struct fp_img_driver * const img_drivers[] = {
#ifdef ENABLE_AES4000
&aes4000_driver,
#endif
#ifdef ENABLE_AES2501
&aes2501_driver,
#endif
#ifdef ENABLE_URU4000
&uru4000_driver,
#endif
#ifdef ENABLE_VCOM5S
&vcom5s_driver,
#endif
#ifdef ENABLE_UPEKSONLY
&upeksonly_driver,
/* &aes1610_driver,
#endif
/*
#ifdef ENABLE_AES1610
&aes1610_driver,
#endif
#ifdef ENABLE_UPEKTC
&upektc_driver,
&fdu2000_driver, */
#endif
#ifdef ENABLE_FDU2000
&fdu2000_driver,
#endif
*/
};
static void register_drivers(void)

View File

@@ -233,15 +233,33 @@ struct fp_img_driver {
void (*deactivate)(struct fp_img_dev *dev);
};
#ifdef ENABLE_UPEKTS
extern struct fp_driver upekts_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_AES2501
extern struct fp_img_driver aes2501_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
extern libusb_context *fpi_usb_ctx;
extern GSList *opened_devices;

View File

@@ -20,7 +20,9 @@
#include <errno.h>
#include <glib.h>
#ifdef REQUIRE_IMAGEMAGICK
#include <magick/ImageMagick.h>
#endif
#include "fp_internal.h"
@@ -87,6 +89,7 @@ static int dev_change_state(struct fp_img_dev *imgdev,
return imgdrv->change_state(imgdev, state);
}
#ifdef REQUIRE_IMAGEMAGICK
static struct fp_img *im_resize(struct fp_img *img, unsigned int factor)
{
Image *mimg;
@@ -129,6 +132,7 @@ static struct fp_img *im_resize(struct fp_img *img, unsigned int factor)
return newimg;
}
#endif
/* check image properties and resize it if necessary. potentially returns a new
* image after freeing the old one. */
@@ -157,6 +161,7 @@ static int sanitize_image(struct fp_img_dev *imgdev, struct fp_img **_img)
return -EINVAL;
}
#ifdef REQUIRE_IMAGEMAGICK
if (imgdrv->enlarge_factor > 1) {
/* FIXME: enlarge_factor should not exist! instead, MINDTCT should
* actually look at the value of the pixels-per-mm parameter and
@@ -166,6 +171,7 @@ static int sanitize_image(struct fp_img_dev *imgdev, struct fp_img **_img)
fp_img_free(img);
*_img = tmp;
}
#endif
return 0;
}