[Spice-devel] [spice-gtk PATCH 2/9] win-usb-dev: compare vid:pid instead of bus.addr (Windows)

Uri Lublin uril at redhat.com
Mon Mar 25 03:01:23 PDT 2013


It seems that sometimes, on Win7 clients, bus.addr is changing
when WinUSB driver is being installed (e.g. 4.1 -> 4.2).

So compare vid:pid instead.
---
 gtk/win-usb-dev.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gtk/win-usb-dev.c b/gtk/win-usb-dev.c
index 0bccc7c..9c95ac4 100644
--- a/gtk/win-usb-dev.c
+++ b/gtk/win-usb-dev.c
@@ -320,20 +320,20 @@ static gboolean get_usb_dev_info(libusb_device *dev, GUdevDeviceInfo *udevinfo)
     return TRUE;
 }

-/* Only bus,addr are compared */
+/* Only vid:pid are compared */
 static gboolean gudev_devices_are_equal(GUdevDevice *a, GUdevDevice *b)
 {
     GUdevDeviceInfo *ai, *bi;
-    gboolean same_bus;
-    gboolean same_addr;
+    gboolean same_vid;
+    gboolean same_pid;

     ai = a->priv->udevinfo;
     bi = b->priv->udevinfo;

-    same_bus  = (ai->bus  == bi->bus);
-    same_addr = (ai->addr == bi->addr);
+    same_vid  = (ai->vid == bi->vid);
+    same_pid  = (ai->pid == bi->pid);

-    return (same_bus && same_addr);
+    return (same_pid && same_vid);
 }


-- 
1.8.1.4



More information about the Spice-devel mailing list