From cbf1dcca29b97f718be6889c465bddf8a2c364fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Tue, 16 Jun 2020 22:48:51 +0200
Subject: [PATCH] fpi-image-device: Improve debugging messages

---
 libfprint/fpi-image-device.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libfprint/fpi-image-device.c b/libfprint/fpi-image-device.c
index 11399a1..8fc1b92 100644
--- a/libfprint/fpi-image-device.c
+++ b/libfprint/fpi-image-device.c
@@ -94,6 +94,8 @@ static void
 fp_image_device_change_state (FpImageDevice *self, FpiImageDeviceState state)
 {
   FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
+  g_autofree char *prev_state_str = NULL;
+  g_autofree char *state_str = NULL;
 
   /* Cannot change to inactive using this function. */
   g_assert (state != FPI_IMAGE_DEVICE_STATE_INACTIVE);
@@ -102,7 +104,10 @@ fp_image_device_change_state (FpImageDevice *self, FpiImageDeviceState state)
    * next operation. */
   g_clear_handle_id (&priv->pending_activation_timeout_id, g_source_remove);
 
-  fp_dbg ("Image device internal state change from %d to %d\n", priv->state, state);
+  prev_state_str = g_enum_to_string (FPI_TYPE_IMAGE_DEVICE_STATE, priv->state);
+  state_str = g_enum_to_string (FPI_TYPE_IMAGE_DEVICE_STATE, state);
+  fp_dbg ("Image device internal state change from %s to %s\n",
+          prev_state_str, state_str);
 
   priv->state = state;
   g_object_notify (G_OBJECT (self), "fpi-image-device-state");
@@ -121,6 +126,7 @@ fp_image_device_enroll_maybe_await_finger_on (FpImageDevice *self)
     }
   else
     {
+      fp_dbg ("Awaiting finger on");
       priv->enroll_await_on_pending = TRUE;
     }
 }