[Spice-devel] [spice-gtk PATCH 9/9] usb-device-manager: fix log messages to match vid:pid change
Uri Lublin
uril at redhat.com
Mon Mar 25 03:01:30 PDT 2013
On Windows clients now USB devices are identified by their vid:pid
(sometimes these values are being held by variables "bus" and "addr")
Change log messages accordingly.
---
gtk/usb-device-manager.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c
index 7c59012..a39db34 100644
--- a/gtk/usb-device-manager.c
+++ b/gtk/usb-device-manager.c
@@ -50,6 +50,12 @@
#include <glib/gi18n.h>
+#ifndef G_OS_WIN32 /* Linux -- device id is bus.addr */
+#define DEV_ID_FMT "at %d.%d"
+#else /* Windows -- device id is vid:pid */
+#define DEV_ID_FMT "0x%04x:0x%04x"
+#endif
+
/**
* SECTION:usb-device-manager
* @short_description: USB device management
@@ -788,7 +794,11 @@ static void spice_usb_device_manager_add_dev(SpiceUsbDeviceManager *self,
device = spice_usb_device_manager_find_device(self, bus, address);
if (device) {
- SPICE_DEBUG("USB device at %d.%d already exists, ignored", bus, address);
+ SPICE_DEBUG("USB device 0x%04x:0x%04x at %d.%d already exists, ignored",
+ spice_usb_device_get_vid(device),
+ spice_usb_device_get_pid(device),
+ spice_usb_device_get_busnum(device),
+ spice_usb_device_get_devaddr(device));
return;
}
@@ -854,7 +864,7 @@ static void spice_usb_device_manager_remove_dev(SpiceUsbDeviceManager *self,
device = spice_usb_device_manager_find_device(self, bus, address);
if (!device) {
- g_warning("Could not find USB device to remove at busnum %d devaddr %d",
+ g_warning("Could not find USB device to remove " DEV_ID_FMT,
bus, address);
return;
}
@@ -863,7 +873,7 @@ static void spice_usb_device_manager_remove_dev(SpiceUsbDeviceManager *self,
const guint8 state = spice_usb_device_get_state(device);
if ((state == SPICE_USB_DEVICE_STATE_INSTALLING) ||
(state == SPICE_USB_DEVICE_STATE_UNINSTALLING)) {
- SPICE_DEBUG("skipping device at %d.%d. It is un/installing it's driver",
+ SPICE_DEBUG("skipping " DEV_ID_FMT ". It is un/installing its driver",
bus, address);
return;
}
--
1.8.1.4
More information about the Spice-devel
mailing list