[Spice-devel] [PATCH] usb-device-manager: mingw: connect: cleanup device if it's libdev is missing
Uri Lublin
uril at redhat.com
Thu Jul 12 07:07:02 PDT 2012
For Windows client, when connecting a device to the guest, if a libusb
device (libdev) does not exist, cleanup and forget about that device.
Most likely, the device was plugged out at driver installation
time, and its remove-device event was ignored.
---
An alternative patch for the same fix can be:
- split spice_usb_device_manager_remove_dev, such that the lower part
is kept in another static function and accepts a SpiceUsbDevice
- call it from _spice_usb_device_manager_connect_device_async.
---
gtk/usb-device-manager.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c
index e5f84d0..bdef24e 100644
--- a/gtk/usb-device-manager.c
+++ b/gtk/usb-device-manager.c
@@ -1074,6 +1074,15 @@ _spice_usb_device_manager_connect_device_async(SpiceUsbDeviceManager *self,
libdev = spice_usb_device_manager_device_to_libdev(self, device);
if (libdev == NULL) {
+#ifdef G_OS_WIN32
+ /* Most likely, the device was plugged out at driver installation
+ * time, and its remove-device event was ignored.
+ * So remove the device now
+ */
+ SPICE_DEBUG("libdev does not exist for %p -- removing", device);
+ g_signal_emit(self, signals[DEVICE_REMOVED], 0, device);
+ g_ptr_array_remove(priv->devices, device);
+#endif
g_simple_async_result_set_error(result,
SPICE_CLIENT_ERROR,
SPICE_CLIENT_ERROR_FAILED,
--
1.7.7.6
More information about the Spice-devel
mailing list