From 451a4c0969d34f2ea16ee983ad8dd123b0ef4e08 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Fri, 30 Nov 2018 16:05:23 +0100 Subject: [PATCH] lib: Remove duplicated structs from fp_internal.h They are already declared in fpi-core.h. Also move their API docs to fpi-core.h. --- libfprint/fp_internal.h | 84 +---------------------------------------- libfprint/fpi-core.h | 34 +++++++++++++++++ 2 files changed, 36 insertions(+), 82 deletions(-) diff --git a/libfprint/fp_internal.h b/libfprint/fp_internal.h index cb0a982..d985738 100644 --- a/libfprint/fp_internal.h +++ b/libfprint/fp_internal.h @@ -28,8 +28,9 @@ #include #include "fprint.h" -#include "fpi-log.h" #include "fpi-dev.h" +#include "fpi-core.h" +#include "fpi-log.h" #include "fpi-dev-img.h" #include "fpi-data.h" #include "fpi-img.h" @@ -145,72 +146,6 @@ struct fp_img_dev { /* fp_driver structure definition */ -/** - * usb_id: - * @vendor: the USB vendor ID - * @product: the USB product ID - * @driver_data: data to differentiate devices of different - * vendor and product IDs. - * - * The struct #usb_id is used to declare devices supported by a - * particular driver. The @driver_data information is used to - * differentiate different models of devices which only need - * small changes compared to the default driver behaviour to function. - * - * For example, a device might have a different initialisation from - * the stock device, so the driver could do: - * - * |[ - * if (driver_data == MY_DIFFERENT_DEVICE_QUIRK) { - * ... - * } else { - * ... - * } - * ]| - * - * The default value is zero, so the @driver_data needs to be a - * non-zero to be useful. - */ -struct usb_id { - uint16_t vendor; - uint16_t product; - unsigned long driver_data; -}; - -/** - * fp_driver_type: - * @DRIVER_PRIMITIVE: primitive, non-imaging, driver - * @DRIVER_IMAGING: imaging driver - * - * The type of device the driver supports. - */ -enum fp_driver_type { - DRIVER_PRIMITIVE = 0, - DRIVER_IMAGING = 1, -}; - -struct fp_driver { - const uint16_t id; - const char *name; - const char *full_name; - const struct usb_id * const id_table; - enum fp_driver_type type; - enum fp_scan_type scan_type; - - /* Device operations */ - int (*discover)(struct libusb_device_descriptor *dsc, uint32_t *devtype); - int (*open)(struct fp_dev *dev, unsigned long driver_data); - void (*close)(struct fp_dev *dev); - int (*enroll_start)(struct fp_dev *dev); - int (*enroll_stop)(struct fp_dev *dev); - int (*verify_start)(struct fp_dev *dev); - int (*verify_stop)(struct fp_dev *dev, gboolean iterating); - int (*identify_start)(struct fp_dev *dev); - int (*identify_stop)(struct fp_dev *dev, gboolean iterating); - int (*capture_start)(struct fp_dev *dev); - int (*capture_stop)(struct fp_dev *dev); -}; - /* fp_img_driver structure definition */ #define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ @@ -218,21 +153,6 @@ struct fp_driver { #define fpi_driver_to_img_driver(drv) \ container_of((drv), struct fp_img_driver, driver) -struct fp_img_driver { - struct fp_driver driver; - uint16_t flags; - int img_width; - int img_height; - int bz3_threshold; - - /* Device operations */ - int (*open)(struct fp_img_dev *dev, unsigned long driver_data); - void (*close)(struct fp_img_dev *dev); - int (*activate)(struct fp_img_dev *dev, enum fp_imgdev_state state); - int (*change_state)(struct fp_img_dev *dev, enum fp_imgdev_state state); - void (*deactivate)(struct fp_img_dev *dev); -}; - /* fp_dscv_dev structure definition */ struct fp_dscv_dev { struct libusb_device *udev; diff --git a/libfprint/fpi-core.h b/libfprint/fpi-core.h index 7cf0e57..a5a0a44 100644 --- a/libfprint/fpi-core.h +++ b/libfprint/fpi-core.h @@ -21,13 +21,47 @@ #define __FPI_CORE_H__ #include +#include "fpi-dev-img.h" +/** + * usb_id: + * @vendor: the USB vendor ID + * @product: the USB product ID + * @driver_data: data to differentiate devices of different + * vendor and product IDs. + * + * The struct #usb_id is used to declare devices supported by a + * particular driver. The @driver_data information is used to + * differentiate different models of devices which only need + * small changes compared to the default driver behaviour to function. + * + * For example, a device might have a different initialisation from + * the stock device, so the driver could do: + * + * |[ + * if (driver_data == MY_DIFFERENT_DEVICE_QUIRK) { + * ... + * } else { + * ... + * } + * ]| + * + * The default value is zero, so the @driver_data needs to be a + * non-zero to be useful. + */ struct usb_id { uint16_t vendor; uint16_t product; unsigned long driver_data; }; +/** + * fp_driver_type: + * @DRIVER_PRIMITIVE: primitive, non-imaging, driver + * @DRIVER_IMAGING: imaging driver + * + * The type of device the driver supports. + */ enum fp_driver_type { DRIVER_PRIMITIVE = 0, DRIVER_IMAGING = 1,