[PATCH v7 02/10] Simplify spice_usb_device_manager_device_to_libdev()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Christophe Fergeau <cfergeau@xxxxxxxxxx>

The Windows-specific version duplicates some code from
spice_usb_device_equal_libdev(), this commit
switches to using that helper instead.
---
 src/usb-device-manager.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 344b4bf..2859d7e 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -1935,7 +1935,6 @@ spice_usb_device_manager_device_to_libdev(SpiceUsbDeviceManager *self,
      */
 
     libusb_device *d, **devlist;
-    int bus, addr;
     int i;
 
     g_return_val_if_fail(SPICE_IS_USB_DEVICE_MANAGER(self), NULL);
@@ -1943,16 +1942,12 @@ spice_usb_device_manager_device_to_libdev(SpiceUsbDeviceManager *self,
     g_return_val_if_fail(self->priv != NULL, NULL);
     g_return_val_if_fail(self->priv->context != NULL, NULL);
 
-    /* On windows we match by vid / pid, since the address may change */
-    bus  = spice_usb_device_get_vid(device);
-    addr = spice_usb_device_get_pid(device);
-
     libusb_get_device_list(self->priv->context, &devlist);
     if (!devlist)
         return NULL;
 
     for (i = 0; (d = devlist[i]) != NULL; i++) {
-        if (spice_usb_device_manager_libdev_match(d, bus, addr)) {
+        if (spice_usb_device_equal_libdev(device, d)) {
             libusb_ref_device(d);
             break;
         }
-- 
2.5.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]