mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2025-11-15 07:38:12 +00:00
test-device-fake: Add more logging showing the current device action
This commit is contained in:
committed by
Marco Trevisan
parent
36bcb24b3a
commit
1f1ed80dbf
@@ -20,6 +20,7 @@
|
||||
|
||||
#define FP_COMPONENT "fake_test_dev"
|
||||
|
||||
#include "fpi-log.h"
|
||||
#include "test-device-fake.h"
|
||||
|
||||
G_DEFINE_TYPE (FpiDeviceFake, fpi_device_fake, FP_TYPE_DEVICE)
|
||||
@@ -29,12 +30,28 @@ static const FpIdEntry driver_ids[] = {
|
||||
{ .virtual_envvar = NULL }
|
||||
};
|
||||
|
||||
static void
|
||||
(debug_action) (FpDevice * device,
|
||||
const gchar *func)
|
||||
{
|
||||
g_autofree char *action_str = NULL;
|
||||
|
||||
action_str = g_enum_to_string (FPI_TYPE_DEVICE_ACTION,
|
||||
fpi_device_get_current_action (device));
|
||||
|
||||
fp_dbg ("%s: Device %s in action %s\n",
|
||||
func, fp_device_get_name (device), action_str);
|
||||
}
|
||||
|
||||
#define debug_action(d) (debug_action) ((d), G_STRFUNC)
|
||||
|
||||
static void
|
||||
fpi_device_fake_probe (FpDevice *device)
|
||||
{
|
||||
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_probe;
|
||||
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_PROBE);
|
||||
|
||||
@@ -55,6 +72,7 @@ fpi_device_fake_open (FpDevice *device)
|
||||
{
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_open;
|
||||
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_OPEN);
|
||||
|
||||
@@ -72,6 +90,7 @@ fpi_device_fake_close (FpDevice *device)
|
||||
{
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_close;
|
||||
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_CLOSE);
|
||||
|
||||
@@ -90,6 +109,7 @@ fpi_device_fake_enroll (FpDevice *device)
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
FpPrint *print = fake_dev->ret_print;
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_enroll;
|
||||
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_ENROLL);
|
||||
|
||||
@@ -118,6 +138,7 @@ fpi_device_fake_verify (FpDevice *device)
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
FpPrint *print = fake_dev->ret_print;
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_verify;
|
||||
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_VERIFY);
|
||||
|
||||
@@ -149,6 +170,7 @@ fpi_device_fake_identify (FpDevice *device)
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
FpPrint *match = fake_dev->ret_match;
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_identify;
|
||||
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_IDENTIFY);
|
||||
|
||||
@@ -197,6 +219,7 @@ fpi_device_fake_capture (FpDevice *device)
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
gboolean wait_for_finger;
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_capture;
|
||||
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_CAPTURE);
|
||||
|
||||
@@ -216,6 +239,7 @@ fpi_device_fake_list (FpDevice *device)
|
||||
{
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_list;
|
||||
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_LIST);
|
||||
|
||||
@@ -233,6 +257,7 @@ fpi_device_fake_delete (FpDevice *device)
|
||||
{
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_delete;
|
||||
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_DELETE);
|
||||
|
||||
@@ -251,6 +276,7 @@ fpi_device_fake_clear_storage (FpDevice *device)
|
||||
{
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_clear_storage;
|
||||
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_CLEAR_STORAGE);
|
||||
|
||||
@@ -268,6 +294,7 @@ fpi_device_fake_cancel (FpDevice *device)
|
||||
{
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_cancel;
|
||||
g_assert_cmpuint (fpi_device_get_current_action (device), !=, FPI_DEVICE_ACTION_NONE);
|
||||
}
|
||||
@@ -277,6 +304,7 @@ fpi_device_fake_suspend (FpDevice *device)
|
||||
{
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_suspend;
|
||||
|
||||
fpi_device_suspend_complete (device, g_steal_pointer (&fake_dev->ret_suspend));
|
||||
@@ -287,6 +315,7 @@ fpi_device_fake_resume (FpDevice *device)
|
||||
{
|
||||
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
|
||||
|
||||
debug_action (device);
|
||||
fake_dev->last_called_function = fpi_device_fake_resume;
|
||||
|
||||
fpi_device_resume_complete (device, g_steal_pointer (&fake_dev->ret_resume));
|
||||
|
||||
Reference in New Issue
Block a user