[fprint] [PATCH 7/8] drivers: prep the drivers for building as shared objects.
Kunal Gangakhedkar
kunal.gangakhedkar at gmail.com
Mon Oct 8 07:39:31 PDT 2012
Add entry/exit point functions that simply register/unregister
the driver as of now.
These are guarded with ENABLE_DYNAMIC_DRIVERS - so, should not
interfere when building libfprint with statically linked drivers.
While at it, remove a control char from drivers/aes1610.c.
Signed-off-by: Kunal Gangakhedkar <kunal.gangakhedkar at gmail.com>
---
libfprint/drivers/aes1610.c | 22 +++++++++++++++++++++-
libfprint/drivers/aes2501.c | 18 ++++++++++++++++++
libfprint/drivers/aes4000.c | 18 ++++++++++++++++++
libfprint/drivers/fdu2000.c | 19 +++++++++++++++++++
libfprint/drivers/upeke2.c | 17 +++++++++++++++++
libfprint/drivers/upeksonly.c | 18 ++++++++++++++++++
libfprint/drivers/upekts.c | 16 ++++++++++++++++
libfprint/drivers/uru4000.c | 18 ++++++++++++++++++
libfprint/drivers/vcom5s.c | 17 +++++++++++++++++
libfprint/drivers/vfs101.c | 19 +++++++++++++++++++
libfprint/drivers/vfs301.c | 18 ++++++++++++++++++
11 files changed, 199 insertions(+), 1 deletion(-)
diff --git a/libfprint/drivers/aes1610.c b/libfprint/drivers/aes1610.c
index 8b81a80..d0f6331 100644
--- a/libfprint/drivers/aes1610.c
+++ b/libfprint/drivers/aes1610.c
@@ -29,8 +29,11 @@
#include <libusb.h>
+#include <config.h>
+
#include <aeslib.h>
#include <fp_internal.h>
+#include <module.h>
static void start_capture(struct fp_img_dev *dev);
static void complete_deactivation(struct fp_img_dev *dev);
@@ -462,7 +465,8 @@ out:
}
-static void finger_det_none_cb(struct fp_img_dev *dev, int result, void *user_data) {
+static void finger_det_none_cb(struct fp_img_dev *dev, int result, void *user_data)
+{
fpi_imgdev_report_finger_status(dev, FALSE);
start_finger_detection(dev);
}
@@ -1128,3 +1132,19 @@ struct fp_img_driver aes1610_driver = {
.deactivate = dev_deactivate,
};
+#ifdef ENABLE_DYNAMIC_DRIVERS
+static int init_aes1610(void)
+{
+ register_driver(&aes1610_driver.driver);
+ fpi_img_driver_setup(&aes1610_driver);
+ return 0;
+}
+
+static void exit_aes1610(void)
+{
+ unregister_driver(&aes1610_driver.driver);
+}
+
+module_init(init_aes1610)
+module_exit(exit_aes1610)
+#endif /* ENABLE_DYNAMIC_DRIVERS */
diff --git a/libfprint/drivers/aes2501.c b/libfprint/drivers/aes2501.c
index 617bb64..12fb8e5 100644
--- a/libfprint/drivers/aes2501.c
+++ b/libfprint/drivers/aes2501.c
@@ -30,6 +30,8 @@
#include <aeslib.h>
#include <fp_internal.h>
+#include <module.h>
+
#include "aes2501.h"
static void start_capture(struct fp_img_dev *dev);
@@ -961,3 +963,19 @@ struct fp_img_driver aes2501_driver = {
.deactivate = dev_deactivate,
};
+#ifdef ENABLE_DYNAMIC_DRIVERS
+static int init_aes2501(void)
+{
+ register_driver(&aes2501_driver.driver);
+ fpi_img_driver_setup(&aes2501_driver);
+ return 0;
+}
+
+static void exit_aes2501(void)
+{
+ unregister_driver(&aes2501_driver.driver);
+}
+
+module_init(init_aes2501)
+module_exit(exit_aes2501)
+#endif /* ENABLE_DYNAMIC_DRIVERS */
diff --git a/libfprint/drivers/aes4000.c b/libfprint/drivers/aes4000.c
index 02dc9e8..7fface8 100644
--- a/libfprint/drivers/aes4000.c
+++ b/libfprint/drivers/aes4000.c
@@ -24,8 +24,10 @@
#include <glib.h>
#include <libusb.h>
+#include <config.h>
#include <aeslib.h>
#include <fp_internal.h>
+#include <module.h>
#define CTRL_TIMEOUT 1000
#define EP_IN (1 | LIBUSB_ENDPOINT_IN)
@@ -268,3 +270,19 @@ struct fp_img_driver aes4000_driver = {
.deactivate = dev_deactivate,
};
+#ifdef ENABLE_DYNAMIC_DRIVERS
+static int init_aes4000(void)
+{
+ register_driver(&aes4000_driver.driver);
+ fpi_img_driver_setup(&aes4000_driver);
+ return 0;
+}
+
+static void exit_aes4000(void)
+{
+ unregister_driver(&aes4000_driver.driver);
+}
+
+module_init(init_aes4000)
+module_exit(exit_aes4000)
+#endif /* ENABLE_DYNAMIC_DRIVERS */
diff --git a/libfprint/drivers/fdu2000.c b/libfprint/drivers/fdu2000.c
index c9afb0b..bc5f4af 100644
--- a/libfprint/drivers/fdu2000.c
+++ b/libfprint/drivers/fdu2000.c
@@ -26,6 +26,8 @@
#define FP_COMPONENT "fdu2000"
#include <fp_internal.h>
+#include <module.h>
+
#ifndef HAVE_MEMMEM
gpointer
memmem(const gpointer haystack, size_t haystack_len, const gpointer needle, size_t needle_len) {
@@ -319,3 +321,20 @@ struct fp_img_driver fdu2000_driver = {
.exit = dev_exit,
.capture = capture,
};
+
+#ifdef ENABLE_DYNAMIC_DRIVERS
+static int init_fdu2000(void)
+{
+ register_driver(&fdu2000_driver.driver);
+ fpi_img_driver_setup(&fdu2000_driver);
+ return 0;
+}
+
+static void exit_fdu2000(void)
+{
+ unregister_driver(&fdu2000_driver.driver);
+}
+
+module_init(init_fdu2000)
+module_exit(exit_fdu2000)
+#endif /* ENABLE_DYNAMIC_DRIVERS */
diff --git a/libfprint/drivers/upeke2.c b/libfprint/drivers/upeke2.c
index 3a7c2d8..37906c4 100644
--- a/libfprint/drivers/upeke2.c
+++ b/libfprint/drivers/upeke2.c
@@ -35,7 +35,9 @@
#include <glib.h>
#include <libusb.h>
+#include <config.h>
#include <fp_internal.h>
+#include <module.h>
#define EP_IN (1 | LIBUSB_ENDPOINT_IN)
#define EP_OUT (2 | LIBUSB_ENDPOINT_OUT)
@@ -1470,3 +1472,18 @@ struct fp_driver upeke2_driver = {
.verify_stop = verify_stop,
};
+#ifdef ENABLE_DYNAMIC_DRIVERS
+static int init_upeke2(void)
+{
+ register_driver(&upeke2_driver);
+ return 0;
+}
+
+void exit_upeke2(void)
+{
+ unregister_driver(&upeke2_driver);
+}
+
+module_init(init_upeke2)
+module_exit(exit_upeke2)
+#endif /* ENABLE_DYNAMIC_DRIVERS */
diff --git a/libfprint/drivers/upeksonly.c b/libfprint/drivers/upeksonly.c
index 6ca9706..ef19d93 100644
--- a/libfprint/drivers/upeksonly.c
+++ b/libfprint/drivers/upeksonly.c
@@ -28,7 +28,9 @@
#include <glib.h>
#include <libusb.h>
+#include <config.h>
#include <fp_internal.h>
+#include <module.h>
#define CTRL_TIMEOUT 1000
#define IMG_WIDTH 288
@@ -1289,3 +1291,19 @@ struct fp_img_driver upeksonly_driver = {
.deactivate = dev_deactivate,
};
+#ifdef ENABLE_DYNAMIC_DRIVERS
+static int init_upeksonly(void)
+{
+ register_driver(&upeksonly_driver.driver);
+ fpi_img_driver_setup(&upeksonly_driver);
+ return 0;
+}
+
+static void exit_upeksonly(void)
+{
+ unregister_driver(&upeksonly_driver.driver);
+}
+
+module_init(init_upeksonly)
+module_exit(exit_upeksonly)
+#endif /* ENABLE_DYNAMIC_DRIVERS */
diff --git a/libfprint/drivers/upekts.c b/libfprint/drivers/upekts.c
index a67cd94..4ef237c 100644
--- a/libfprint/drivers/upekts.c
+++ b/libfprint/drivers/upekts.c
@@ -34,6 +34,7 @@
#include <libusb.h>
#include <fp_internal.h>
+#include <module.h>
#define EP_IN (1 | LIBUSB_ENDPOINT_IN)
#define EP_OUT (2 | LIBUSB_ENDPOINT_OUT)
@@ -1477,3 +1478,18 @@ struct fp_driver upekts_driver = {
.verify_stop = verify_stop,
};
+#ifdef ENABLE_DYNAMIC_DRIVERS
+static int init_upekts(void)
+{
+ register_driver(&upekts_driver);
+ return 0;
+}
+
+static void exit_upekts(void)
+{
+ unregister_driver(&upekts_driver);
+}
+
+module_init(init_upekts)
+module_exit(exit_upekts)
+#endif /* ENABLE_DYNAMIC_DRIVERS */
diff --git a/libfprint/drivers/uru4000.c b/libfprint/drivers/uru4000.c
index 0dbea96..b2cd80d 100644
--- a/libfprint/drivers/uru4000.c
+++ b/libfprint/drivers/uru4000.c
@@ -28,6 +28,7 @@
#include <libusb.h>
#include <fp_internal.h>
+#include <module.h>
#define EP_INTR (1 | LIBUSB_ENDPOINT_IN)
#define EP_DATA (2 | LIBUSB_ENDPOINT_IN)
@@ -1293,3 +1294,20 @@ struct fp_img_driver uru4000_driver = {
.change_state = dev_change_state,
};
+#ifdef ENABLE_DYNAMIC_DRIVERS
+static int init_uru4000(void)
+{
+ register_driver(&uru4000_driver.driver);
+ fpi_img_driver_setup(&uru4000_driver);
+ return 0;
+}
+
+static void exit_uru4000(void)
+{
+ fp_dbg("URU4000 exiting..\n");
+ unregister_driver(&uru4000_driver.driver);
+}
+
+module_init(init_uru4000)
+module_exit(exit_uru4000)
+#endif /* ENABLE_DYNAMIC_DRIVERS */
diff --git a/libfprint/drivers/vcom5s.c b/libfprint/drivers/vcom5s.c
index 0bc5724..80ac6c7 100644
--- a/libfprint/drivers/vcom5s.c
+++ b/libfprint/drivers/vcom5s.c
@@ -33,6 +33,7 @@
#include <libusb.h>
#include <fp_internal.h>
+#include <module.h>
#define CTRL_IN 0xc0
#define CTRL_OUT 0x40
@@ -384,3 +385,19 @@ struct fp_img_driver vcom5s_driver = {
.deactivate = dev_deactivate,
};
+#ifdef ENABLE_DYNAMIC_DRIVERS
+static int init_vcom5s(void)
+{
+ register_driver(&vcom5s_driver.driver);
+ fpi_img_driver_setup(&vcom5s_driver);
+ return 0;
+}
+
+static void exit_vcom5s(void)
+{
+ unregister_driver(&vcom5s_driver.driver);
+}
+
+module_init(init_vcom5s)
+module_exit(exit_vcom5s)
+#endif /* ENABLE_DYNAMIC_DRIVERS */
diff --git a/libfprint/drivers/vfs101.c b/libfprint/drivers/vfs101.c
index c2d9a1c..40e3a0b 100644
--- a/libfprint/drivers/vfs101.c
+++ b/libfprint/drivers/vfs101.c
@@ -24,6 +24,7 @@
#define FP_COMPONENT "vfs101"
#include <fp_internal.h>
+#include <module.h>
/* Input-Output usb endpoint */
#define EP_IN(n) (n | LIBUSB_ENDPOINT_IN)
@@ -1568,3 +1569,21 @@ struct fp_img_driver vfs101_driver =
.activate = dev_activate,
.deactivate = dev_deactivate,
};
+
+#ifdef ENABLE_DYNAMIC_DRIVERS
+static int init_vfs101(void)
+{
+ register_driver(&vfs101_driver.driver);
+ fpi_img_driver_setup(&vfs101_driver);
+ return 0;
+}
+
+static void exit_vfs101(void)
+{
+ fp_dbg("VFS 101 exiting..\n");
+ unregister_driver(&vfs101_driver.driver);
+}
+
+module_init(init_vfs101)
+module_exit(exit_vfs101)
+#endif /* ENABLE_DYNAMIC_DRIVERS */
diff --git a/libfprint/drivers/vfs301.c b/libfprint/drivers/vfs301.c
index a27a945..81e7c6c 100644
--- a/libfprint/drivers/vfs301.c
+++ b/libfprint/drivers/vfs301.c
@@ -33,6 +33,7 @@
#include <unistd.h>
#include <fp_internal.h>
+#include <module.h>
/************************** GENERIC STUFF *************************************/
@@ -304,3 +305,20 @@ struct fp_img_driver vfs301_driver =
.activate = dev_activate,
.deactivate = dev_deactivate,
};
+
+#ifdef ENABLE_DYNAMIC_DRIVERS
+static int init_vfs301(void)
+{
+ register_driver(&vfs301_driver.driver);
+ fpi_img_driver_setup(&vfs301_driver);
+ return 0;
+}
+
+static void exit_vfs301(void)
+{
+ unregister_driver(&vfs301_driver.driver);
+}
+
+module_init(init_vfs301)
+module_exit(exit_vfs301)
+#endif /* ENABLE_DYNAMIC_DRIVERS */
--
1.7.9.5
More information about the fprint
mailing list