diff options
author | Uri Lublin <uril@redhat.com> | 2012-07-12 16:58:42 +0300 |
---|---|---|
committer | Uri Lublin <uril@redhat.com> | 2012-07-16 10:25:06 +0300 |
commit | f054f702701beecdaf499e733b4763b9d44749be (patch) | |
tree | 796809f1b6f2cd0eb1a16f768088e9456489865b | |
parent | 9414fccffe934da493cb8e70740abad482cd27b8 (diff) |
usb-device-manager: mingw: connect: cleanup device if it's libdev is missing
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.
-rw-r--r-- | 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, |