[Spice-devel] [spice-gtk] usbredir: Add a few debug logs

Christophe Fergeau cfergeau at redhat.com
Mon Jul 20 05:55:14 PDT 2015


Currently, spice-gtk debugging logs contain no traces of the
values of the auto-redir/redir-on-connect filter, and it does not tell
you about the vid/pid of the devices being connected/redirected.
This commit adds the appropriate SPICE_DEBUG/CHANNEL_DEBUG calls so that
this data is logged.
---
 src/channel-usbredir.c   |  5 ++++-
 src/usb-device-manager.c | 12 ++++++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
index b5745b6..25e9e06 100644
--- a/src/channel-usbredir.c
+++ b/src/channel-usbredir.c
@@ -329,7 +329,10 @@ void spice_usbredir_channel_connect_device_async(
     g_return_if_fail(SPICE_IS_USBREDIR_CHANNEL(channel));
     g_return_if_fail(device != NULL);
 
-    CHANNEL_DEBUG(channel, "connecting usb channel %p", channel);
+    CHANNEL_DEBUG(channel, "connecting device %04x:%04x (%p) to channel %p",
+                  spice_usb_device_get_vid(spice_device),
+                  spice_usb_device_get_pid(spice_device),
+                  spice_device, channel);
 
     result = g_simple_async_result_new(G_OBJECT(channel), callback, user_data,
                                  spice_usbredir_channel_connect_device_async);
diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 12ad4ba..9792217 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -425,6 +425,7 @@ static void spice_usb_device_manager_set_property(GObject       *gobject,
             break;
         }
 
+        SPICE_DEBUG("auto-connect filter set to %s", filter);
         free(priv->auto_conn_filter_rules);
         priv->auto_conn_filter_rules = rules;
         priv->auto_conn_filter_rules_count = count;
@@ -449,6 +450,7 @@ static void spice_usb_device_manager_set_property(GObject       *gobject,
             break;
         }
 
+        SPICE_DEBUG("redirect-on-connect filter set to %s", filter);
         free(priv->redirect_on_connect_rules);
         priv->redirect_on_connect_rules = rules;
         priv->redirect_on_connect_rules_count = count;
@@ -885,7 +887,10 @@ static void spice_usb_device_manager_add_dev(SpiceUsbDeviceManager  *self,
                                    spice_usb_device_ref(device));
     }
 
-    SPICE_DEBUG("device added %p", device);
+    SPICE_DEBUG("device added %04x:%04x (%p)",
+                spice_usb_device_get_vid(device),
+                spice_usb_device_get_pid(device),
+                device);
     g_signal_emit(self, signals[DEVICE_ADDED], 0, device);
 }
 
@@ -914,7 +919,10 @@ static void spice_usb_device_manager_remove_dev(SpiceUsbDeviceManager *self,
 
     spice_usb_device_manager_disconnect_device(self, device);
 
-    SPICE_DEBUG("device removed %p", device);
+    SPICE_DEBUG("device removed %04x:%04x (%p)",
+                spice_usb_device_get_vid(device),
+                spice_usb_device_get_pid(device),
+                device);
     spice_usb_device_ref(device);
     g_ptr_array_remove(priv->devices, device);
     g_signal_emit(self, signals[DEVICE_REMOVED], 0, device);
-- 
2.4.3



More information about the Spice-devel mailing list