[Spice-devel] [spice-gtk v2] usb-device-manager: Set UsbDk backend on libusb 1.0.22
Victor Toso
victortoso at redhat.com
Tue Aug 7 08:53:49 UTC 2018
From: 王凡 <wangfan1987.good at 163.com>
In libusb 1.0.21, UsbDk is enabled at compile time with --enable-usbdk
option. In libusb 1.0.22, the backend is selected at runtime.
This patch avoids a crash when spice client is compiled against libusb
1.0.22 and UsbDk is not installed.
* Enabling dynamic backend selection in Windows
https://github.com/libusb/libusb/commit/54884e84d024e761450287ab56aca
https://gitlab.freedesktop.org/spice/spice-gtk/issues/74
Signed-off-by: Victor Toso <victortoso at redhat.com>
---
src/usb-device-manager.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 55bf67e..50fb491 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -303,6 +303,12 @@ static gboolean spice_usb_device_manager_initable_init(GInitable *initable,
return FALSE;
}
+#ifdef G_OS_WIN32
+#if LIBUSB_API_VERSION >= 0x01000106
+ libusb_set_option(priv->context, LIBUSB_OPTION_USE_USBDK);
+#endif
+#endif
+
/* Start listening for usb devices plug / unplug */
#ifdef USE_GUDEV
priv->udev = g_udev_client_new(subsystems);
--
2.17.1
More information about the Spice-devel
mailing list