Tag fingerprint devices in HAL
Tag all the fprint supported devices in HAL. Patch from myself and Timo Hoenig <thoenig@suse.de>.
This commit is contained in:
parent
7672c43cea
commit
7c83b6d825
4 changed files with 116 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
lib_LTLIBRARIES = libfprint.la
|
||||
noinst_PROGRAMS = fprint-list-hal-info
|
||||
|
||||
UPEKTS_SRC = drivers/upekts.c
|
||||
UPEKTC_SRC = drivers/upektc.c
|
||||
|
@ -54,6 +55,17 @@ libfprint_la_CFLAGS = -fvisibility=hidden -I$(srcdir)/nbis/include $(LIBUSB_CFLA
|
|||
libfprint_la_LDFLAGS = -version-info @lt_major@:@lt_revision@:@lt_age@
|
||||
libfprint_la_LIBADD = -lm $(LIBUSB_LIBS) $(GLIB_LIBS) $(CRYPTO_LIBS)
|
||||
|
||||
fprint_list_hal_info_SOURCES = fprint-list-hal-info.c
|
||||
fprint_list_hal_info_CFLAGS = -fvisibility=hidden -I$(srcdir)/nbis/include $(LIBUSB_CFLAGS) $(GLIB_CFLAGS) $(IMAGEMAGICK_CFLAGS) $(CRYPTO_CFLAGS) $(AM_CFLAGS)
|
||||
fprint_list_hal_info_LDADD = $(builddir)/libfprint.la
|
||||
|
||||
hal_fdi_DATA = 10-fingerprint-reader-fprint.fdi
|
||||
hal_fdidir = $(datadir)/hal/fdi/information/20thirdparty/
|
||||
|
||||
$(hal_fdi_DATA): fprint-list-hal-info
|
||||
$(builddir)/fprint-list-hal-info > $@
|
||||
|
||||
|
||||
if ENABLE_UPEKTS
|
||||
DRIVER_SRC += $(UPEKTS_SRC)
|
||||
endif
|
||||
|
|
|
@ -375,6 +375,24 @@ static void register_drivers(void)
|
|||
}
|
||||
}
|
||||
|
||||
API_EXPORTED struct fp_driver **fprint_get_drivers (void)
|
||||
{
|
||||
GPtrArray *array;
|
||||
unsigned int i;
|
||||
|
||||
array = g_ptr_array_new ();
|
||||
for (i = 0; i < G_N_ELEMENTS(primitive_drivers); i++)
|
||||
g_ptr_array_add (array, primitive_drivers[i]);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS(img_drivers); i++)
|
||||
g_ptr_array_add (array, &(img_drivers[i]->driver));
|
||||
|
||||
/* Add a null item terminating the array */
|
||||
g_ptr_array_add (array, NULL);
|
||||
|
||||
return (struct fp_driver **) g_ptr_array_free (array, FALSE);
|
||||
}
|
||||
|
||||
static struct fp_driver *find_supporting_driver(libusb_device *udev,
|
||||
const struct usb_id **usb_id)
|
||||
{
|
||||
|
|
|
@ -91,6 +91,8 @@ enum fp_dev_state {
|
|||
DEV_STATE_IDENTIFY_STOPPING,
|
||||
};
|
||||
|
||||
struct fp_driver **fprint_get_drivers (void);
|
||||
|
||||
struct fp_dev {
|
||||
struct fp_driver *drv;
|
||||
libusb_device_handle *udev;
|
||||
|
|
84
libfprint/fprint-list-hal-info.c
Normal file
84
libfprint/fprint-list-hal-info.c
Normal file
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Helper binary for creating a HAL FDI file for supported devices
|
||||
* Copyright (C) 2008 Bastien Nocera <hadess@hadess.net>
|
||||
* Copyright (C) 2008 Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
|
||||
*
|
||||
* 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 <config.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "fp_internal.h"
|
||||
|
||||
/* FDI entry example:
|
||||
*
|
||||
* <!-- AuthenTec AES2501 -->
|
||||
* <match key="usb.vendor_id" int="0x08ff">
|
||||
* <match key="usb.product_id" int="0x2580">
|
||||
* <merge key="info.category" type="string">biometric.fingerprint_reader</merge>
|
||||
* <append key="biometric.fingerprint_reader.access_method" type="strlist">libfprint</append>
|
||||
* <append key="info.capabilities" type="strlist">biometric</append>
|
||||
* <append key="info.capabilities" type="strlist">biometric.fingerprint_reader</append>
|
||||
* <merge key="biometric.fingerprint_reader.libfprint.driver" type="string">aes2501</merge>
|
||||
* <merge key="biometric.fingerprint_reader.libfprint.support" type="bool">true</merge>
|
||||
* </match>
|
||||
* </match>
|
||||
*
|
||||
*/
|
||||
|
||||
static void print_driver (struct fp_driver *driver)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; driver->id_table[i].vendor != 0; i++) {
|
||||
printf (" <!-- %s -->\n", fp_driver_get_full_name (driver));
|
||||
printf (" <match key=\"usb.vendor_id\" int=\"0x%04x\">\n", driver->id_table[i].vendor);
|
||||
printf (" <match key=\"usb.product_id\" int=\"0x%04x\">\n", driver->id_table[i].product);
|
||||
printf (" <merge key=\"info.category\" type=\"string\">biometric.fingerprint_reader</merge>\n");
|
||||
printf (" <append key=\"biometric.fingerprint_reader.access_method\" type=\"strlist\">libfprint</append>\n");
|
||||
printf (" <append key=\"info.capabilities\" type=\"strlist\">biometric</append>\n");
|
||||
printf (" <append key=\"info.capabilities\" type=\"strlist\">biometric.fingerprint_reader</append>\n");
|
||||
printf (" <merge key=\"biometric.fingerprint_reader.libfprint.driver\" type=\"string\">%s</merge>\n", driver->name);
|
||||
printf (" <merge key=\"biometric.fingerprint_reader.libfprint.support\" type=\"bool\">true</merge>\n");
|
||||
printf (" </match>\n");
|
||||
printf (" </match>\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void print_imaging_driver (struct fp_img_driver *driver)
|
||||
{
|
||||
print_driver (&(driver->driver));
|
||||
}
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
struct fp_driver **list;
|
||||
guint i;
|
||||
|
||||
list = fprint_get_drivers ();
|
||||
|
||||
printf ("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n");
|
||||
printf ("<!-- Created from libfprint %s -->\n", VERSION);
|
||||
printf ("<deviceinfo version=\"0.2\">\n");
|
||||
|
||||
for (i = 0; list[i] != NULL; i++) {
|
||||
print_driver (list[i]);
|
||||
}
|
||||
|
||||
printf ("</deviceinfo>\n");
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue