mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2026-06-11 02:28:05 +00:00
TOD: Add wrappers for SSM functions that are not compatible with 1.90
Expose new versioned symbols that work with previous API so that we can keep compatibility with old drivers without having to recompile them. We disable the GCancellable API in delayed SSM actions since that was something that wasn't really needed and prone to errors, instead of just re-implementing it as it was in the TOD case.
This commit is contained in:
@@ -747,3 +747,7 @@ fpi_ssm_spi_transfer_with_weak_pointer_cb (FpiSpiTransfer *transfer,
|
||||
|
||||
fpi_ssm_spi_transfer_cb (transfer, device, weak_ptr, error);
|
||||
}
|
||||
|
||||
#ifdef TOD_LIBRARY
|
||||
#include "tod/tod-fpi-ssm.c"
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
LIBFPRINT_TOD_@tod_soversion@.0.0 {
|
||||
global:
|
||||
fpi_*;
|
||||
fpi_ssm_new_full;
|
||||
fpi_ssm_jump_to_state_delayed;
|
||||
fpi_ssm_mark_completed_delayed;
|
||||
fpi_ssm_next_state_delayed;
|
||||
local:
|
||||
*;
|
||||
};
|
||||
|
||||
@@ -26,12 +26,19 @@ libfprint_tod_private = static_library('fprint-tod-private',
|
||||
install: false,
|
||||
)
|
||||
|
||||
tod_sources = []
|
||||
tod_sources = [
|
||||
'tod-wrappers.c',
|
||||
'tod-symbols.h',
|
||||
]
|
||||
foreach source: libfprint_private_sources
|
||||
tod_sources += '..' / source
|
||||
endforeach
|
||||
|
||||
libfprint_tod = library(versioned_libname.split('lib')[1] + '-tod',
|
||||
c_args: [
|
||||
'-DTOD_LIBRARY=1',
|
||||
'-include', '@0@'.format(files('tod-symbols.h')[0]),
|
||||
],
|
||||
sources: [
|
||||
tod_sources,
|
||||
],
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Shared library loader for libfprint
|
||||
* Copyright (C) 2021 Marco Trevisan <marco.trevisan@canonical.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
|
||||
*/
|
||||
|
||||
#include "tod-wrappers.h"
|
||||
#include "fpi-ssm.h"
|
||||
|
||||
static gboolean
|
||||
check_delayed_cancellable (FpiSsm *machine,
|
||||
GCancellable *cancellable)
|
||||
{
|
||||
if (g_cancellable_is_cancelled (cancellable))
|
||||
{
|
||||
fpi_ssm_mark_failed (machine, g_error_new (G_IO_ERROR,
|
||||
G_IO_ERROR_CANCELLED,
|
||||
"Action cancelled"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (cancellable)
|
||||
fp_err ("GCancellable in SSM Delayed actions is ignored as per libfprint 1.92");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
fpi_ssm_next_state_delayed_1_90 (FpiSsm *machine,
|
||||
int delay,
|
||||
GCancellable *cancellable)
|
||||
{
|
||||
if (check_delayed_cancellable (machine, cancellable))
|
||||
fpi_ssm_next_state_delayed (machine, delay);
|
||||
}
|
||||
|
||||
void
|
||||
fpi_ssm_jump_to_state_delayed_1_90 (FpiSsm *machine,
|
||||
int state,
|
||||
int delay,
|
||||
GCancellable *cancellable)
|
||||
{
|
||||
if (check_delayed_cancellable (machine, cancellable))
|
||||
fpi_ssm_jump_to_state_delayed (machine, state, delay);
|
||||
}
|
||||
|
||||
void
|
||||
fpi_ssm_mark_completed_delayed_1_90 (FpiSsm *machine,
|
||||
int delay,
|
||||
GCancellable *cancellable)
|
||||
{
|
||||
if (check_delayed_cancellable (machine, cancellable))
|
||||
fpi_ssm_mark_completed_delayed (machine, delay);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Shared library loader for libfprint
|
||||
* Copyright (C) 2021 Marco Trevisan <marco.trevisan@canonical.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
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define TOD_1_SYMBOL_VERSION_1_90 "LIBFPRINT_TOD_1.0.0"
|
||||
#define TOD_1_SYMBOL_VERSION_1_92 "LIBFPRINT_TOD_1_1.92"
|
||||
#define TOD_1_SYMBOL_VERSION_1_94 "LIBFPRINT_TOD_1_1.94"
|
||||
#define TOD_1_SYMBOL_VERSION(major, minor) \
|
||||
TOD_1_SYMBOL_VERSION_ ## major ## _ ## minor
|
||||
|
||||
#define TOD_DEFAULT_VERSION_SYMBOL(symbol, major, minor) \
|
||||
__asm__ (".symver " # symbol "," # symbol "@@@" \
|
||||
TOD_1_SYMBOL_VERSION (major, minor));
|
||||
#define TOD_VERSIONED_SYMBOL(symbol, major, minor) \
|
||||
__asm__ (".symver " # symbol "_" # major "_" #minor "," # symbol "@" \
|
||||
TOD_1_SYMBOL_VERSION (major, minor));
|
||||
|
||||
TOD_DEFAULT_VERSION_SYMBOL (fpi_ssm_new_full, 1, 92)
|
||||
TOD_VERSIONED_SYMBOL (fpi_ssm_new_full, 1, 90)
|
||||
|
||||
TOD_DEFAULT_VERSION_SYMBOL (fpi_ssm_next_state_delayed, 1, 92)
|
||||
TOD_VERSIONED_SYMBOL (fpi_ssm_next_state_delayed, 1, 90)
|
||||
|
||||
TOD_DEFAULT_VERSION_SYMBOL (fpi_ssm_jump_to_state_delayed, 1, 92)
|
||||
TOD_VERSIONED_SYMBOL (fpi_ssm_jump_to_state_delayed, 1, 90)
|
||||
|
||||
TOD_DEFAULT_VERSION_SYMBOL (fpi_ssm_mark_completed_delayed, 1, 92)
|
||||
TOD_VERSIONED_SYMBOL (fpi_ssm_mark_completed_delayed, 1, 90)
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Shared library loader for libfprint
|
||||
* Copyright (C) 2021 Marco Trevisan <marco.trevisan@canonical.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
|
||||
*/
|
||||
|
||||
#define FP_COMPONENT "tod"
|
||||
|
||||
#include "tod-wrappers.h"
|
||||
|
||||
FpiSsm *
|
||||
fpi_ssm_new_full_1_90 (FpDevice *dev,
|
||||
FpiSsmHandlerCallback handler,
|
||||
int nr_states,
|
||||
const char *machine_name)
|
||||
{
|
||||
return fpi_ssm_new_full (dev, handler, nr_states, nr_states, machine_name);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Shared library loader for libfprint
|
||||
* Copyright (C) 2021 Marco Trevisan <marco.trevisan@canonical.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
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "drivers_api.h"
|
||||
#include "tod-symbols.h"
|
||||
|
||||
extern FpiSsm *fpi_ssm_new_full_1_90 (FpDevice *dev,
|
||||
FpiSsmHandlerCallback handler,
|
||||
int nr_states,
|
||||
const char *machine_name);
|
||||
|
||||
extern void fpi_ssm_next_state_delayed_1_90 (FpiSsm *machine,
|
||||
int delay,
|
||||
GCancellable *cancellable);
|
||||
extern void fpi_ssm_jump_to_state_delayed_1_90 (FpiSsm *machine,
|
||||
int state,
|
||||
int delay,
|
||||
GCancellable *cancellable);
|
||||
extern void fpi_ssm_mark_completed_delayed_1_90 (FpiSsm *machine,
|
||||
int delay,
|
||||
GCancellable *cancellable);
|
||||
Reference in New Issue
Block a user