From efee7262b60a7caa640519cfeb5047c12608c192 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Wed, 5 Sep 2018 17:15:20 +0200 Subject: [PATCH] lib: Split off timeout helpers And rename poll.c to fpi-poll.c --- libfprint/drivers_api.h | 10 +--------- libfprint/fp_internal.h | 4 +--- libfprint/{poll.c => fpi-poll.c} | 1 + libfprint/fpi-poll.h | 26 ++++++++++++++++++++++++++ libfprint/meson.build | 3 ++- 5 files changed, 31 insertions(+), 13 deletions(-) rename libfprint/{poll.c => fpi-poll.c} (99%) create mode 100644 libfprint/fpi-poll.h diff --git a/libfprint/drivers_api.h b/libfprint/drivers_api.h index 02fe43ca..cba678a9 100644 --- a/libfprint/drivers_api.h +++ b/libfprint/drivers_api.h @@ -37,6 +37,7 @@ #include "fprint.h" #include "fpi-ssm.h" +#include "fpi-poll.h" #include "assembling.h" #include "drivers/driver_ids.h" @@ -203,15 +204,6 @@ struct fp_img *fpi_img_new_for_imgdev(struct fp_img_dev *dev); struct fp_img *fpi_img_resize(struct fp_img *img, size_t newsize); struct fp_img *fpi_im_resize(struct fp_img *img, unsigned int w_factor, unsigned int h_factor); -/* polling and timeouts */ - -typedef void (*fpi_timeout_fn)(void *data); - -struct fpi_timeout; -struct fpi_timeout *fpi_timeout_add(unsigned int msec, fpi_timeout_fn callback, - void *data); -void fpi_timeout_cancel(struct fpi_timeout *timeout); - void fpi_drvcb_open_complete(struct fp_dev *dev, int status); void fpi_drvcb_close_complete(struct fp_dev *dev); diff --git a/libfprint/fp_internal.h b/libfprint/fp_internal.h index 48a25182..9aa03f27 100644 --- a/libfprint/fp_internal.h +++ b/libfprint/fp_internal.h @@ -341,13 +341,11 @@ int fpi_img_compare_print_data_to_gallery(struct fp_print_data *print, struct fp_print_data **gallery, int match_threshold, size_t *match_offset); struct fp_img *fpi_im_resize(struct fp_img *img, unsigned int w_factor, unsigned int h_factor); -/* polling and timeouts */ +/* polling */ void fpi_poll_init(void); void fpi_poll_exit(void); -typedef void (*fpi_timeout_fn)(void *data); - void fpi_drvcb_open_complete(struct fp_dev *dev, int status); void fpi_drvcb_close_complete(struct fp_dev *dev); diff --git a/libfprint/poll.c b/libfprint/fpi-poll.c similarity index 99% rename from libfprint/poll.c rename to libfprint/fpi-poll.c index 615ba40f..b572e56e 100644 --- a/libfprint/poll.c +++ b/libfprint/fpi-poll.c @@ -20,6 +20,7 @@ #define FP_COMPONENT "poll" #include "fp_internal.h" +#include "fpi-poll.h" #include #include diff --git a/libfprint/fpi-poll.h b/libfprint/fpi-poll.h new file mode 100644 index 00000000..be2de9c3 --- /dev/null +++ b/libfprint/fpi-poll.h @@ -0,0 +1,26 @@ +/* + * Polling/timing management + * Copyright (C) 2008 Daniel Drake + * Copyright (C) 2018 Bastien Nocera + * + * 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 + */ + +typedef void (*fpi_timeout_fn)(void *data); + +struct fpi_timeout; +struct fpi_timeout *fpi_timeout_add(unsigned int msec, fpi_timeout_fn callback, + void *data); +void fpi_timeout_cancel(struct fpi_timeout *timeout); diff --git a/libfprint/meson.build b/libfprint/meson.build index 0a9ed021..c6d1ac9b 100644 --- a/libfprint/meson.build +++ b/libfprint/meson.build @@ -6,9 +6,10 @@ libfprint_sources = [ 'data.c', 'fpi-ssm.c', 'fpi-ssm.h', + 'fpi-poll.h', + 'fpi-poll.c', 'img.c', 'imgdev.c', - 'poll.c', 'sync.c', 'assembling.c', 'assembling.h',