lib: Fix mess with driver IDs
ID is just a some magic number to make fingerprint from one scanner model incompatible with another scanner model. Get rid of "magic", declare enum and use it. https://bugs.freedesktop.org/show_bug.cgi?id=56956
This commit is contained in:
parent
ed2c75842a
commit
ea6d5ba6d6
14 changed files with 78 additions and 13 deletions
|
@ -32,6 +32,8 @@
|
||||||
#include <aeslib.h>
|
#include <aeslib.h>
|
||||||
#include <fp_internal.h>
|
#include <fp_internal.h>
|
||||||
|
|
||||||
|
#include "driver_ids.h"
|
||||||
|
|
||||||
static void start_capture(struct fp_img_dev *dev);
|
static void start_capture(struct fp_img_dev *dev);
|
||||||
static void complete_deactivation(struct fp_img_dev *dev);
|
static void complete_deactivation(struct fp_img_dev *dev);
|
||||||
static int adjust_gain(unsigned char *buffer, int status);
|
static int adjust_gain(unsigned char *buffer, int status);
|
||||||
|
@ -935,7 +937,7 @@ static const struct usb_id id_table[] = {
|
||||||
|
|
||||||
struct fp_img_driver aes1610_driver = {
|
struct fp_img_driver aes1610_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.id = 6,
|
.id = AES1610_ID,
|
||||||
.name = FP_COMPONENT,
|
.name = FP_COMPONENT,
|
||||||
.full_name = "AuthenTec AES1610",
|
.full_name = "AuthenTec AES1610",
|
||||||
.id_table = id_table,
|
.id_table = id_table,
|
||||||
|
|
|
@ -30,7 +30,9 @@
|
||||||
|
|
||||||
#include <aeslib.h>
|
#include <aeslib.h>
|
||||||
#include <fp_internal.h>
|
#include <fp_internal.h>
|
||||||
|
|
||||||
#include "aes2501.h"
|
#include "aes2501.h"
|
||||||
|
#include "driver_ids.h"
|
||||||
|
|
||||||
static void start_capture(struct fp_img_dev *dev);
|
static void start_capture(struct fp_img_dev *dev);
|
||||||
static void complete_deactivation(struct fp_img_dev *dev);
|
static void complete_deactivation(struct fp_img_dev *dev);
|
||||||
|
@ -963,7 +965,7 @@ static const struct usb_id id_table[] = {
|
||||||
|
|
||||||
struct fp_img_driver aes2501_driver = {
|
struct fp_img_driver aes2501_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.id = 4,
|
.id = AES2501_ID,
|
||||||
.name = FP_COMPONENT,
|
.name = FP_COMPONENT,
|
||||||
.full_name = "AuthenTec AES2501",
|
.full_name = "AuthenTec AES2501",
|
||||||
.id_table = id_table,
|
.id_table = id_table,
|
||||||
|
|
|
@ -30,7 +30,9 @@
|
||||||
|
|
||||||
#include <aeslib.h>
|
#include <aeslib.h>
|
||||||
#include <fp_internal.h>
|
#include <fp_internal.h>
|
||||||
|
|
||||||
#include "aes2550.h"
|
#include "aes2550.h"
|
||||||
|
#include "driver_ids.h"
|
||||||
|
|
||||||
static void start_capture(struct fp_img_dev *dev);
|
static void start_capture(struct fp_img_dev *dev);
|
||||||
static void complete_deactivation(struct fp_img_dev *dev);
|
static void complete_deactivation(struct fp_img_dev *dev);
|
||||||
|
@ -735,7 +737,7 @@ static const struct usb_id id_table[] = {
|
||||||
|
|
||||||
struct fp_img_driver aes2550_driver = {
|
struct fp_img_driver aes2550_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.id = 4,
|
.id = AES2550_ID,
|
||||||
.name = FP_COMPONENT,
|
.name = FP_COMPONENT,
|
||||||
.full_name = "AuthenTec AES2550/AES2810",
|
.full_name = "AuthenTec AES2550/AES2810",
|
||||||
.id_table = id_table,
|
.id_table = id_table,
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#include <aeslib.h>
|
#include <aeslib.h>
|
||||||
#include <fp_internal.h>
|
#include <fp_internal.h>
|
||||||
|
|
||||||
|
#include "driver_ids.h"
|
||||||
|
|
||||||
#define CTRL_TIMEOUT 1000
|
#define CTRL_TIMEOUT 1000
|
||||||
#define EP_IN (1 | LIBUSB_ENDPOINT_IN)
|
#define EP_IN (1 | LIBUSB_ENDPOINT_IN)
|
||||||
#define EP_OUT (2 | LIBUSB_ENDPOINT_OUT)
|
#define EP_OUT (2 | LIBUSB_ENDPOINT_OUT)
|
||||||
|
@ -249,7 +251,7 @@ static const struct usb_id id_table[] = {
|
||||||
|
|
||||||
struct fp_img_driver aes4000_driver = {
|
struct fp_img_driver aes4000_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.id = 3,
|
.id = AES4000_ID,
|
||||||
.name = FP_COMPONENT,
|
.name = FP_COMPONENT,
|
||||||
.full_name = "AuthenTec AES4000",
|
.full_name = "AuthenTec AES4000",
|
||||||
.id_table = id_table,
|
.id_table = id_table,
|
||||||
|
|
39
libfprint/drivers/driver_ids.h
Normal file
39
libfprint/drivers/driver_ids.h
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* Driver IDs
|
||||||
|
* Copyright (C) 2012 Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
*
|
||||||
|
* 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,
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -26,6 +26,8 @@
|
||||||
#define FP_COMPONENT "fdu2000"
|
#define FP_COMPONENT "fdu2000"
|
||||||
#include <fp_internal.h>
|
#include <fp_internal.h>
|
||||||
|
|
||||||
|
#include "driver_ids.h"
|
||||||
|
|
||||||
#ifndef HAVE_MEMMEM
|
#ifndef HAVE_MEMMEM
|
||||||
gpointer
|
gpointer
|
||||||
memmem(const gpointer haystack, size_t haystack_len, const gpointer needle, size_t needle_len) {
|
memmem(const gpointer haystack, size_t haystack_len, const gpointer needle, size_t needle_len) {
|
||||||
|
@ -305,7 +307,7 @@ static const struct usb_id id_table[] = {
|
||||||
|
|
||||||
struct fp_img_driver fdu2000_driver = {
|
struct fp_img_driver fdu2000_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.id = 7,
|
.id = FDU2000_ID,
|
||||||
.name = FP_COMPONENT,
|
.name = FP_COMPONENT,
|
||||||
.full_name = "Secugen FDU 2000",
|
.full_name = "Secugen FDU 2000",
|
||||||
.id_table = id_table,
|
.id_table = id_table,
|
||||||
|
|
|
@ -37,6 +37,8 @@
|
||||||
|
|
||||||
#include <fp_internal.h>
|
#include <fp_internal.h>
|
||||||
|
|
||||||
|
#include "driver_ids.h"
|
||||||
|
|
||||||
#define EP_IN (1 | LIBUSB_ENDPOINT_IN)
|
#define EP_IN (1 | LIBUSB_ENDPOINT_IN)
|
||||||
#define EP_OUT (2 | LIBUSB_ENDPOINT_OUT)
|
#define EP_OUT (2 | LIBUSB_ENDPOINT_OUT)
|
||||||
#define TIMEOUT 5000
|
#define TIMEOUT 5000
|
||||||
|
@ -1456,7 +1458,7 @@ static const struct usb_id id_table[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct fp_driver upeke2_driver = {
|
struct fp_driver upeke2_driver = {
|
||||||
.id = 1,
|
.id = UPEKE2_ID,
|
||||||
.name = FP_COMPONENT,
|
.name = FP_COMPONENT,
|
||||||
.full_name = "UPEK Eikon 2",
|
.full_name = "UPEK Eikon 2",
|
||||||
.id_table = id_table,
|
.id_table = id_table,
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
|
|
||||||
#include <fp_internal.h>
|
#include <fp_internal.h>
|
||||||
|
|
||||||
|
#include "driver_ids.h"
|
||||||
|
|
||||||
#define CTRL_TIMEOUT 1000
|
#define CTRL_TIMEOUT 1000
|
||||||
#define IMG_WIDTH 288
|
#define IMG_WIDTH 288
|
||||||
#define NUM_BULK_TRANSFERS 24
|
#define NUM_BULK_TRANSFERS 24
|
||||||
|
@ -1267,7 +1269,7 @@ static const struct usb_id id_table[] = {
|
||||||
|
|
||||||
struct fp_img_driver upeksonly_driver = {
|
struct fp_img_driver upeksonly_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.id = 9,
|
.id = UPEKSONLY_ID,
|
||||||
.name = FP_COMPONENT,
|
.name = FP_COMPONENT,
|
||||||
.full_name = "UPEK TouchStrip Sensor-Only",
|
.full_name = "UPEK TouchStrip Sensor-Only",
|
||||||
.id_table = id_table,
|
.id_table = id_table,
|
||||||
|
|
|
@ -24,7 +24,9 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <libusb.h>
|
#include <libusb.h>
|
||||||
#include <fp_internal.h>
|
#include <fp_internal.h>
|
||||||
|
|
||||||
#include "upektc.h"
|
#include "upektc.h"
|
||||||
|
#include "driver_ids.h"
|
||||||
|
|
||||||
#define EP_IN (2 | LIBUSB_ENDPOINT_IN)
|
#define EP_IN (2 | LIBUSB_ENDPOINT_IN)
|
||||||
#define EP_OUT (3 | LIBUSB_ENDPOINT_OUT)
|
#define EP_OUT (3 | LIBUSB_ENDPOINT_OUT)
|
||||||
|
@ -446,7 +448,7 @@ static const struct usb_id id_table[] = {
|
||||||
|
|
||||||
struct fp_img_driver upektc_driver = {
|
struct fp_img_driver upektc_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.id = 5,
|
.id = UPEKTC_ID,
|
||||||
.name = FP_COMPONENT,
|
.name = FP_COMPONENT,
|
||||||
.full_name = "UPEK TouchChip",
|
.full_name = "UPEK TouchChip",
|
||||||
.id_table = id_table,
|
.id_table = id_table,
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
|
|
||||||
#include <fp_internal.h>
|
#include <fp_internal.h>
|
||||||
|
|
||||||
|
#include "driver_ids.h"
|
||||||
|
|
||||||
#define EP_IN (1 | LIBUSB_ENDPOINT_IN)
|
#define EP_IN (1 | LIBUSB_ENDPOINT_IN)
|
||||||
#define EP_OUT (2 | LIBUSB_ENDPOINT_OUT)
|
#define EP_OUT (2 | LIBUSB_ENDPOINT_OUT)
|
||||||
#define TIMEOUT 5000
|
#define TIMEOUT 5000
|
||||||
|
@ -1464,7 +1466,7 @@ static const struct usb_id id_table[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct fp_driver upekts_driver = {
|
struct fp_driver upekts_driver = {
|
||||||
.id = 1,
|
.id = UPEKTS_ID,
|
||||||
.name = FP_COMPONENT,
|
.name = FP_COMPONENT,
|
||||||
.full_name = "UPEK TouchStrip",
|
.full_name = "UPEK TouchStrip",
|
||||||
.id_table = id_table,
|
.id_table = id_table,
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
|
|
||||||
#include <fp_internal.h>
|
#include <fp_internal.h>
|
||||||
|
|
||||||
|
#include "driver_ids.h"
|
||||||
|
|
||||||
#define EP_INTR (1 | LIBUSB_ENDPOINT_IN)
|
#define EP_INTR (1 | LIBUSB_ENDPOINT_IN)
|
||||||
#define EP_DATA (2 | LIBUSB_ENDPOINT_IN)
|
#define EP_DATA (2 | LIBUSB_ENDPOINT_IN)
|
||||||
#define USB_RQ 0x04
|
#define USB_RQ 0x04
|
||||||
|
@ -1359,7 +1361,7 @@ static const struct usb_id id_table[] = {
|
||||||
|
|
||||||
struct fp_img_driver uru4000_driver = {
|
struct fp_img_driver uru4000_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.id = 2,
|
.id = URU4000_ID,
|
||||||
.name = FP_COMPONENT,
|
.name = FP_COMPONENT,
|
||||||
.full_name = "Digital Persona U.are.U 4000/4000B/4500",
|
.full_name = "Digital Persona U.are.U 4000/4000B/4500",
|
||||||
.id_table = id_table,
|
.id_table = id_table,
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
|
|
||||||
#include <fp_internal.h>
|
#include <fp_internal.h>
|
||||||
|
|
||||||
|
#include "driver_ids.h"
|
||||||
|
|
||||||
#define CTRL_IN 0xc0
|
#define CTRL_IN 0xc0
|
||||||
#define CTRL_OUT 0x40
|
#define CTRL_OUT 0x40
|
||||||
#define CTRL_TIMEOUT 1000
|
#define CTRL_TIMEOUT 1000
|
||||||
|
@ -368,7 +370,7 @@ static const struct usb_id id_table[] = {
|
||||||
|
|
||||||
struct fp_img_driver vcom5s_driver = {
|
struct fp_img_driver vcom5s_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.id = 8,
|
.id = VCOM5S_ID,
|
||||||
.name = FP_COMPONENT,
|
.name = FP_COMPONENT,
|
||||||
.full_name = "Veridicom 5thSense",
|
.full_name = "Veridicom 5thSense",
|
||||||
.id_table = id_table,
|
.id_table = id_table,
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
#include <fp_internal.h>
|
#include <fp_internal.h>
|
||||||
|
|
||||||
|
#include "driver_ids.h"
|
||||||
|
|
||||||
/* Input-Output usb endpoint */
|
/* Input-Output usb endpoint */
|
||||||
#define EP_IN(n) (n | LIBUSB_ENDPOINT_IN)
|
#define EP_IN(n) (n | LIBUSB_ENDPOINT_IN)
|
||||||
#define EP_OUT(n) (n | LIBUSB_ENDPOINT_OUT)
|
#define EP_OUT(n) (n | LIBUSB_ENDPOINT_OUT)
|
||||||
|
@ -1549,7 +1551,7 @@ struct fp_img_driver vfs101_driver =
|
||||||
/* Driver specification */
|
/* Driver specification */
|
||||||
.driver =
|
.driver =
|
||||||
{
|
{
|
||||||
.id = 10,
|
.id = VFS101_ID,
|
||||||
.name = FP_COMPONENT,
|
.name = FP_COMPONENT,
|
||||||
.full_name = "Validity VFS101",
|
.full_name = "Validity VFS101",
|
||||||
.id_table = id_table,
|
.id_table = id_table,
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
|
|
||||||
#include <fp_internal.h>
|
#include <fp_internal.h>
|
||||||
|
|
||||||
|
#include "driver_ids.h"
|
||||||
|
|
||||||
/************************** GENERIC STUFF *************************************/
|
/************************** GENERIC STUFF *************************************/
|
||||||
|
|
||||||
/* Callback of asynchronous sleep */
|
/* Callback of asynchronous sleep */
|
||||||
|
@ -285,7 +287,7 @@ struct fp_img_driver vfs301_driver =
|
||||||
/* Driver specification */
|
/* Driver specification */
|
||||||
.driver =
|
.driver =
|
||||||
{
|
{
|
||||||
.id = 11,
|
.id = VFS301_ID,
|
||||||
.name = FP_COMPONENT,
|
.name = FP_COMPONENT,
|
||||||
.full_name = "Validity VFS301",
|
.full_name = "Validity VFS301",
|
||||||
.id_table = id_table,
|
.id_table = id_table,
|
||||||
|
|
Loading…
Add table
Reference in a new issue