diff --git a/doc/advanced-topics.xml b/doc/advanced-topics.xml
index 5af6f71..1c9419d 100644
--- a/doc/advanced-topics.xml
+++ b/doc/advanced-topics.xml
@@ -71,10 +71,7 @@
Driver IDs
- Each driver is assigned a unique ID by the project maintainer. These
- assignments are
-
- documented in the sources and will never change.
+ Each driver is assigned a unique ID automatically based on the driver name.
diff --git a/doc/meson.build b/doc/meson.build
index 37d515d..1e7e825 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -17,7 +17,6 @@ private_headers = [
'aes2660.h',
'aes3k.h',
'aesx660.h',
- 'driver_ids.h',
'elan.h',
'upek_proto.h',
'upeksonly.h',
diff --git a/libfprint/drivers/aes1610.c b/libfprint/drivers/aes1610.c
index 1e7b3b9..f3b31cf 100644
--- a/libfprint/drivers/aes1610.c
+++ b/libfprint/drivers/aes1610.c
@@ -817,7 +817,6 @@ static const struct usb_id id_table[] = {
struct fp_img_driver aes1610_driver = {
.driver = {
- .id = AES1610_ID,
.name = FP_COMPONENT,
.full_name = "AuthenTec AES1610",
.id_table = id_table,
diff --git a/libfprint/drivers/aes1660.c b/libfprint/drivers/aes1660.c
index f27b9bf..26f0a01 100644
--- a/libfprint/drivers/aes1660.c
+++ b/libfprint/drivers/aes1660.c
@@ -94,7 +94,6 @@ static const struct usb_id id_table[] = {
struct fp_img_driver aes1660_driver = {
.driver = {
- .id = AES1660_ID,
.name = FP_COMPONENT,
.full_name = "AuthenTec AES1660",
.id_table = id_table,
diff --git a/libfprint/drivers/aes2501.c b/libfprint/drivers/aes2501.c
index 2a03173..337142d 100644
--- a/libfprint/drivers/aes2501.c
+++ b/libfprint/drivers/aes2501.c
@@ -859,7 +859,6 @@ static const struct usb_id id_table[] = {
struct fp_img_driver aes2501_driver = {
.driver = {
- .id = AES2501_ID,
.name = FP_COMPONENT,
.full_name = "AuthenTec AES2501",
.id_table = id_table,
diff --git a/libfprint/drivers/aes2550.c b/libfprint/drivers/aes2550.c
index ce5b6c2..cbdf9de 100644
--- a/libfprint/drivers/aes2550.c
+++ b/libfprint/drivers/aes2550.c
@@ -603,7 +603,6 @@ static const struct usb_id id_table[] = {
struct fp_img_driver aes2550_driver = {
.driver = {
- .id = AES2550_ID,
.name = FP_COMPONENT,
.full_name = "AuthenTec AES2550/AES2810",
.id_table = id_table,
diff --git a/libfprint/drivers/aes2660.c b/libfprint/drivers/aes2660.c
index de380e7..cd97a69 100644
--- a/libfprint/drivers/aes2660.c
+++ b/libfprint/drivers/aes2660.c
@@ -97,7 +97,6 @@ static const struct usb_id id_table[] = {
struct fp_img_driver aes2660_driver = {
.driver = {
- .id = AES2660_ID,
.name = FP_COMPONENT,
.full_name = "AuthenTec AES2660",
.id_table = id_table,
diff --git a/libfprint/drivers/aes3500.c b/libfprint/drivers/aes3500.c
index c083c4e..0183062 100644
--- a/libfprint/drivers/aes3500.c
+++ b/libfprint/drivers/aes3500.c
@@ -162,7 +162,6 @@ static const struct usb_id id_table[] = {
struct fp_img_driver aes3500_driver = {
.driver = {
- .id = AES3500_ID,
.name = FP_COMPONENT,
.full_name = "AuthenTec AES3500",
.id_table = id_table,
diff --git a/libfprint/drivers/aes4000.c b/libfprint/drivers/aes4000.c
index 6ea79d1..c03aa8d 100644
--- a/libfprint/drivers/aes4000.c
+++ b/libfprint/drivers/aes4000.c
@@ -159,7 +159,6 @@ static const struct usb_id id_table[] = {
struct fp_img_driver aes4000_driver = {
.driver = {
- .id = AES4000_ID,
.name = FP_COMPONENT,
.full_name = "AuthenTec AES4000",
.id_table = id_table,
diff --git a/libfprint/drivers/driver_ids.h b/libfprint/drivers/driver_ids.h
deleted file mode 100644
index 8839a74..0000000
--- a/libfprint/drivers/driver_ids.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Driver IDs
- * Copyright (C) 2012 Vasily Khoruzhick
- *
- * 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 __DRIVER_IDS
-#define __DRIVER_IDS
-
-enum {
- UPEKTS_ID = 1,
- URU4000_ID = 2,
- AES4000_ID = 3,
- AES2501_ID = 4,
- UPEKTC_ID = 5,
- AES1610_ID = 6,
- FDU2000_ID = 7,
- VCOM5S_ID = 8,
- UPEKSONLY_ID = 9,
- VFS101_ID = 10,
- VFS301_ID = 11,
- AES2550_ID = 12,
- /* UPEKE2_ID = 13 */
- AES1660_ID = 14,
- AES2660_ID = 15,
- AES3500_ID = 16,
- UPEKTC_IMG_ID = 17,
- ETES603_ID = 18,
- VFS5011_ID = 19,
- VFS0050_ID = 20,
- ELAN_ID = 21,
-};
-
-#endif
diff --git a/libfprint/drivers/elan.c b/libfprint/drivers/elan.c
index 3314d8d..10b1e9f 100644
--- a/libfprint/drivers/elan.c
+++ b/libfprint/drivers/elan.c
@@ -970,7 +970,6 @@ static void dev_deactivate(struct fp_img_dev *dev)
struct fp_img_driver elan_driver = {
.driver = {
- .id = ELAN_ID,
.name = FP_COMPONENT,
.full_name = "ElanTech Fingerprint Sensor",
.id_table = elan_id_table,
diff --git a/libfprint/drivers/etes603.c b/libfprint/drivers/etes603.c
index 8f3ec45..858749d 100644
--- a/libfprint/drivers/etes603.c
+++ b/libfprint/drivers/etes603.c
@@ -36,7 +36,6 @@
#define FP_COMPONENT "etes603"
#include "drivers_api.h"
-#include "driver_ids.h"
/* libusb defines */
#define EP_IN 0x81
@@ -1478,7 +1477,6 @@ static const struct usb_id id_table[] = {
struct fp_img_driver etes603_driver = {
.driver = {
- .id = ETES603_ID,
.name = FP_COMPONENT,
.full_name = "EgisTec ES603",
.id_table = id_table,
diff --git a/libfprint/drivers/fdu2000.c b/libfprint/drivers/fdu2000.c
index 44b993d..4274e46 100644
--- a/libfprint/drivers/fdu2000.c
+++ b/libfprint/drivers/fdu2000.c
@@ -302,7 +302,6 @@ static const struct usb_id id_table[] = {
struct fp_img_driver fdu2000_driver = {
.driver = {
- .id = FDU2000_ID,
.name = FP_COMPONENT,
.full_name = "Secugen FDU 2000",
.id_table = id_table,
diff --git a/libfprint/drivers/upeksonly.c b/libfprint/drivers/upeksonly.c
index 99c5ffa..47b87dc 100644
--- a/libfprint/drivers/upeksonly.c
+++ b/libfprint/drivers/upeksonly.c
@@ -1345,7 +1345,6 @@ static const struct usb_id id_table[] = {
struct fp_img_driver upeksonly_driver = {
.driver = {
- .id = UPEKSONLY_ID,
.name = FP_COMPONENT,
.full_name = "UPEK TouchStrip Sensor-Only",
.id_table = id_table,
diff --git a/libfprint/drivers/upektc.c b/libfprint/drivers/upektc.c
index 0042833..e5ee6b9 100644
--- a/libfprint/drivers/upektc.c
+++ b/libfprint/drivers/upektc.c
@@ -460,7 +460,6 @@ static const struct usb_id id_table[] = {
struct fp_img_driver upektc_driver = {
.driver = {
- .id = UPEKTC_ID,
.name = FP_COMPONENT,
.full_name = "UPEK TouchChip/Eikon Touch 300",
.id_table = id_table,
diff --git a/libfprint/drivers/upektc_img.c b/libfprint/drivers/upektc_img.c
index d749ac5..345c570 100644
--- a/libfprint/drivers/upektc_img.c
+++ b/libfprint/drivers/upektc_img.c
@@ -628,7 +628,6 @@ static const struct usb_id id_table[] = {
struct fp_img_driver upektc_img_driver = {
.driver = {
- .id = UPEKTC_IMG_ID,
.name = FP_COMPONENT,
.full_name = "Upek TouchChip Fingerprint Coprocessor",
.id_table = id_table,
diff --git a/libfprint/drivers/upekts.c b/libfprint/drivers/upekts.c
index 476ef34..1951af3 100644
--- a/libfprint/drivers/upekts.c
+++ b/libfprint/drivers/upekts.c
@@ -1421,7 +1421,6 @@ static const struct usb_id id_table[] = {
};
struct fp_driver upekts_driver = {
- .id = UPEKTS_ID,
.name = FP_COMPONENT,
.full_name = "UPEK TouchStrip",
.id_table = id_table,
diff --git a/libfprint/drivers/uru4000.c b/libfprint/drivers/uru4000.c
index 7e54add..d84314a 100644
--- a/libfprint/drivers/uru4000.c
+++ b/libfprint/drivers/uru4000.c
@@ -1428,7 +1428,6 @@ static const struct usb_id id_table[] = {
struct fp_img_driver uru4000_driver = {
.driver = {
- .id = URU4000_ID,
.name = FP_COMPONENT,
.full_name = "Digital Persona U.are.U 4000/4000B/4500",
.id_table = id_table,
diff --git a/libfprint/drivers/vcom5s.c b/libfprint/drivers/vcom5s.c
index 4ed71f6..9ec4519 100644
--- a/libfprint/drivers/vcom5s.c
+++ b/libfprint/drivers/vcom5s.c
@@ -357,7 +357,6 @@ static const struct usb_id id_table[] = {
struct fp_img_driver vcom5s_driver = {
.driver = {
- .id = VCOM5S_ID,
.name = FP_COMPONENT,
.full_name = "Veridicom 5thSense",
.id_table = id_table,
diff --git a/libfprint/drivers/vfs0050.c b/libfprint/drivers/vfs0050.c
index a437df4..aecb8f9 100644
--- a/libfprint/drivers/vfs0050.c
+++ b/libfprint/drivers/vfs0050.c
@@ -770,7 +770,6 @@ static const struct usb_id id_table[] = {
struct fp_img_driver vfs0050_driver = {
/* Driver specification */
.driver = {
- .id = VFS0050_ID,
.name = FP_COMPONENT,
.full_name = "Validity VFS0050",
.id_table = id_table,
diff --git a/libfprint/drivers/vfs101.c b/libfprint/drivers/vfs101.c
index 8faaa23..642d40a 100644
--- a/libfprint/drivers/vfs101.c
+++ b/libfprint/drivers/vfs101.c
@@ -1526,7 +1526,6 @@ struct fp_img_driver vfs101_driver =
/* Driver specification */
.driver =
{
- .id = VFS101_ID,
.name = FP_COMPONENT,
.full_name = "Validity VFS101",
.id_table = id_table,
diff --git a/libfprint/drivers/vfs301.c b/libfprint/drivers/vfs301.c
index 4116e71..7ea2051 100644
--- a/libfprint/drivers/vfs301.c
+++ b/libfprint/drivers/vfs301.c
@@ -268,7 +268,6 @@ struct fp_img_driver vfs301_driver =
/* Driver specification */
.driver =
{
- .id = VFS301_ID,
.name = FP_COMPONENT,
.full_name = "Validity VFS301",
.id_table = id_table,
diff --git a/libfprint/drivers/vfs5011.c b/libfprint/drivers/vfs5011.c
index e185833..795db5c 100644
--- a/libfprint/drivers/vfs5011.c
+++ b/libfprint/drivers/vfs5011.c
@@ -887,7 +887,6 @@ static const struct usb_id id_table[] = {
struct fp_img_driver vfs5011_driver = {
.driver = {
- .id = VFS5011_ID,
.name = "vfs5011",
.full_name = "Validity VFS5011",
.id_table = id_table,
diff --git a/libfprint/drivers_api.h b/libfprint/drivers_api.h
index 7867e34..125c992 100644
--- a/libfprint/drivers_api.h
+++ b/libfprint/drivers_api.h
@@ -34,6 +34,5 @@
#include "fpi-usb.h"
#include "fpi-img.h"
#include "fpi-assembling.h"
-#include "drivers/driver_ids.h"
#endif
diff --git a/libfprint/fp_internal.h b/libfprint/fp_internal.h
index 5c89e18..133b9cf 100644
--- a/libfprint/fp_internal.h
+++ b/libfprint/fp_internal.h
@@ -35,7 +35,6 @@
#include "fpi-dev-img.h"
#include "fpi-data.h"
#include "fpi-img.h"
-#include "drivers/driver_ids.h"
/* Global variables */
extern libusb_context *fpi_usb_ctx;
@@ -145,8 +144,6 @@ struct fp_img_dev {
size_t identify_match_offset;
};
-/* fp_driver structure definition */
-
/* fp_img_driver structure definition */
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
diff --git a/libfprint/fpi-core.c b/libfprint/fpi-core.c
index 6009c82..e7078d3 100644
--- a/libfprint/fpi-core.c
+++ b/libfprint/fpi-core.c
@@ -137,10 +137,13 @@ GSList *opened_devices = NULL;
static GSList *registered_drivers = NULL;
+#define DRV_ID(drv) g_str_hash(drv->name)
+
static void register_driver(struct fp_driver *drv)
{
- if (drv->id == 0) {
- fp_err("not registering driver %s: driver ID is 0", drv->name);
+ if (drv->name == NULL ||
+ strlen(drv->name) <= 2) {
+ fp_err("not registering driver %s, name is too short or absent", drv->name);
return;
}
registered_drivers = g_slist_prepend(registered_drivers, (gpointer) drv);
@@ -411,7 +414,7 @@ API_EXPORTED int fp_dscv_dev_supports_print_data(struct fp_dscv_dev *dev,
g_return_val_if_fail(dev, 0);
g_return_val_if_fail(print, 0);
- return fpi_print_data_compatible(dev->drv->id, dev->devtype,
+ return fpi_print_data_compatible(DRV_ID(dev->drv), dev->devtype,
fpi_driver_get_data_type(dev->drv), print->driver_id, print->devtype,
print->type);
}
@@ -434,7 +437,7 @@ API_EXPORTED int fp_dscv_dev_supports_dscv_print(struct fp_dscv_dev *dev,
g_return_val_if_fail(dev, 0);
g_return_val_if_fail(print, 0);
- return fpi_print_data_compatible(dev->drv->id, dev->devtype, 0,
+ return fpi_print_data_compatible(DRV_ID(dev->drv), dev->devtype, 0,
print->driver_id, print->devtype, 0);
}
@@ -559,7 +562,7 @@ API_EXPORTED int fp_dev_supports_print_data(struct fp_dev *dev,
g_return_val_if_fail(dev, 0);
g_return_val_if_fail(data, 0);
- return fpi_print_data_compatible(dev->drv->id, dev->devtype,
+ return fpi_print_data_compatible(DRV_ID(dev->drv), dev->devtype,
fpi_driver_get_data_type(dev->drv), data->driver_id, data->devtype,
data->type);
}
@@ -582,7 +585,7 @@ API_EXPORTED int fp_dev_supports_dscv_print(struct fp_dev *dev,
g_return_val_if_fail(dev, 0);
g_return_val_if_fail(print, 0);
- return fpi_print_data_compatible(dev->drv->id, dev->devtype,
+ return fpi_print_data_compatible(DRV_ID(dev->drv), dev->devtype,
0, print->driver_id, print->devtype, 0);
}
@@ -628,7 +631,7 @@ API_EXPORTED uint16_t fp_driver_get_driver_id(struct fp_driver *drv)
{
g_return_val_if_fail(drv, 0);
- return drv->id;
+ return DRV_ID(drv);
}
/**
diff --git a/libfprint/fpi-core.h b/libfprint/fpi-core.h
index a5a0a44..64f29d8 100644
--- a/libfprint/fpi-core.h
+++ b/libfprint/fpi-core.h
@@ -68,7 +68,6 @@ enum fp_driver_type {
};
struct fp_driver {
- const uint16_t id;
const char *name;
const char *full_name;
const struct usb_id * const id_table;
diff --git a/libfprint/fpi-data.c b/libfprint/fpi-data.c
index f377404..4b333a4 100644
--- a/libfprint/fpi-data.c
+++ b/libfprint/fpi-data.c
@@ -148,7 +148,7 @@ struct fp_print_data_item *fpi_print_data_item_new(size_t length)
struct fp_print_data *fpi_print_data_new(struct fp_dev *dev)
{
- return print_data_new(dev->drv->id, dev->devtype,
+ return print_data_new(fp_driver_get_driver_id(dev->drv), dev->devtype,
fpi_driver_get_data_type(dev->drv));
}
@@ -349,7 +349,7 @@ static char *__get_path_to_print(uint16_t driver_id, uint32_t devtype,
static char *get_path_to_print(struct fp_dev *dev, enum fp_finger finger)
{
- return __get_path_to_print(dev->drv->id, dev->devtype, finger);
+ return __get_path_to_print(fp_driver_get_driver_id(dev->drv), dev->devtype, finger);
}
/**