lib: Split off fpi_print_data helpers

And rename data.c to fpi-data.c
This commit is contained in:
Bastien Nocera 2018-09-27 16:36:09 +02:00
parent 36f527269b
commit ca06fae22e
5 changed files with 60 additions and 56 deletions

View file

@ -34,6 +34,7 @@
#include "fpi-poll.h" #include "fpi-poll.h"
#include "fpi-dev.h" #include "fpi-dev.h"
#include "fpi-usb.h" #include "fpi-usb.h"
#include "fpi-data.h"
#include "assembling.h" #include "assembling.h"
#include "drivers/driver_ids.h" #include "drivers/driver_ids.h"
@ -124,29 +125,6 @@ struct fp_img_driver {
void (*deactivate)(struct fp_img_dev *dev); void (*deactivate)(struct fp_img_dev *dev);
}; };
enum fp_print_data_type {
PRINT_DATA_RAW = 0, /* memset-imposed default */
PRINT_DATA_NBIS_MINUTIAE,
};
struct fp_print_data_item {
size_t length;
unsigned char data[0];
};
struct fp_print_data {
uint16_t driver_id;
uint32_t devtype;
enum fp_print_data_type type;
GSList *prints;
};
struct fp_print_data *fpi_print_data_new(struct fp_dev *dev);
struct fp_print_data_item *fpi_print_data_item_new(size_t length);
gboolean fpi_print_data_compatible(uint16_t driver_id1, uint32_t devtype1,
enum fp_print_data_type type1, uint16_t driver_id2, uint32_t devtype2,
enum fp_print_data_type type2);
struct fp_minutiae; struct fp_minutiae;
/* bit values for fp_img.flags */ /* bit values for fp_img.flags */

View file

@ -30,6 +30,7 @@
#include "fprint.h" #include "fprint.h"
#include "fpi-log.h" #include "fpi-log.h"
#include "fpi-dev.h" #include "fpi-dev.h"
#include "fpi-data.h"
#include "drivers/driver_ids.h" #include "drivers/driver_ids.h"
#define container_of(ptr, type, member) ({ \ #define container_of(ptr, type, member) ({ \
@ -237,39 +238,7 @@ struct fp_dscv_print {
char *path; char *path;
}; };
enum fp_print_data_type {
PRINT_DATA_RAW = 0, /* memset-imposed default */
PRINT_DATA_NBIS_MINUTIAE,
};
struct fp_print_data_item {
size_t length;
unsigned char data[0];
};
struct fp_print_data {
uint16_t driver_id;
uint32_t devtype;
enum fp_print_data_type type;
GSList *prints;
};
struct fpi_print_data_fp2 {
char prefix[3];
uint16_t driver_id;
uint32_t devtype;
unsigned char data_type;
unsigned char data[0];
} __attribute__((__packed__));
struct fpi_print_data_item_fp2 {
uint32_t length;
unsigned char data[0];
} __attribute__((__packed__));
void fpi_data_exit(void); void fpi_data_exit(void);
struct fp_print_data *fpi_print_data_new(struct fp_dev *dev);
struct fp_print_data_item *fpi_print_data_item_new(size_t length);
gboolean fpi_print_data_compatible(uint16_t driver_id1, uint32_t devtype1, gboolean fpi_print_data_compatible(uint16_t driver_id1, uint32_t devtype1,
enum fp_print_data_type type1, uint16_t driver_id2, uint32_t devtype2, enum fp_print_data_type type1, uint16_t driver_id2, uint32_t devtype2,
enum fp_print_data_type type2); enum fp_print_data_type type2);

View file

@ -32,6 +32,19 @@
#define DIR_PERMS 0700 #define DIR_PERMS 0700
struct fpi_print_data_fp2 {
char prefix[3];
uint16_t driver_id;
uint32_t devtype;
unsigned char data_type;
unsigned char data[0];
} __attribute__((__packed__));
struct fpi_print_data_item_fp2 {
uint32_t length;
unsigned char data[0];
} __attribute__((__packed__));
/** /**
* SECTION: print_data * SECTION: print_data
* @title: Stored prints * @title: Stored prints

43
libfprint/fpi-data.h Normal file
View file

@ -0,0 +1,43 @@
/*
* Copyright (C) 2007-2008 Daniel Drake <dsd@gentoo.org>
* Copyright (C) 2018 Bastien Nocera <hadess@hadess.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
*/
#ifndef __FPI_DATA_H__
#define __FPI_DATA_H__
enum fp_print_data_type {
PRINT_DATA_RAW = 0, /* memset-imposed default */
PRINT_DATA_NBIS_MINUTIAE
};
struct fp_print_data_item {
size_t length;
unsigned char data[0];
};
struct fp_print_data {
uint16_t driver_id;
uint32_t devtype;
enum fp_print_data_type type;
GSList *prints;
};
struct fp_print_data *fpi_print_data_new(struct fp_dev *dev);
struct fp_print_data_item *fpi_print_data_item_new(size_t length);
#endif

View file

@ -3,7 +3,8 @@ libfprint_sources = [
'drivers_api.h', 'drivers_api.h',
'async.c', 'async.c',
'core.c', 'core.c',
'data.c', 'fpi-data.c',
'fpi-data.h',
'fpi-dev.c', 'fpi-dev.c',
'fpi-dev.h', 'fpi-dev.h',
'fpi-log.h', 'fpi-log.h',