summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2015-06-15 12:57:14 +0300
committerPavel Grunt <pgrunt@redhat.com>2015-10-09 11:31:26 +0200
commit873c25487791914d0e025bbf7508b1381bf07824 (patch)
tree8e8c3869ce96aff6deaf227142dd9c136ab63264
parent2f1c336f94443e5678c4191dedbb4e8d0327c24b (diff)
Simplify spice_usb_device_manager_device_to_libdev()
The Windows-specific version duplicates some code from spice_usb_device_equal_libdev(), this commit switches to using that helper instead.
-rw-r--r--src/usb-device-manager.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index da36763..af3b422 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -1906,7 +1906,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);
@@ -1914,16 +1913,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;
}