[Spice-commits] gtk/usb-device-manager.c

Uri Lublin uril at kemper.freedesktop.org
Mon Jul 16 00:25:21 PDT 2012


 gtk/usb-device-manager.c |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit f054f702701beecdaf499e733b4763b9d44749be
Author: Uri Lublin <uril at redhat.com>
Date:   Thu Jul 12 16:58:42 2012 +0300

    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.

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,


More information about the Spice-commits mailing list