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

Submitted by Uri Lublin on March 25, 2013, 10:01 a.m.

Details

Message ID 1364205690-12784-3-git-send-email-uril@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Uri Lublin March 25, 2013, 10:01 a.m.
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(-)

Patch hide | download patch | download mbox

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);
 }