[Spice-devel] [spice-gtk Win32 v5 21/22] usb-device-manager: mingw: keep driver install/uninstall state of a device

Uri Lublin uril at redhat.com
Mon Jul 9 05:15:04 PDT 2012


Currently only driver install/unsinstall is of interest, such that
extra udev events can be ignored.
---
 gtk/usb-device-manager.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c
index 306b22b..65119ad 100644
--- a/gtk/usb-device-manager.c
+++ b/gtk/usb-device-manager.c
@@ -820,6 +820,8 @@ static void spice_usb_device_manager_drv_install_cb(GObject *gobject,
     g_object_unref(installer);
     spice_usb_device_unref(device);
 
+    spice_usb_device_set_state(device, SPICE_USB_DEVICE_STATE_NONE);
+
     if (err) {
         g_warning("win usb driver %s failed -- %s", opstr, err->message);
         g_error_free(err);
@@ -1091,6 +1093,7 @@ void spice_usb_device_manager_connect_device_async(SpiceUsbDeviceManager *self,
     SpiceWinUsbDriver *installer;
     UsbInstallCbInfo *cbinfo;
 
+    spice_usb_device_set_state(device, SPICE_USB_DEVICE_STATE_INSTALLING);
     installer = spice_win_usb_driver_new();
     cbinfo = g_new0(UsbInstallCbInfo, 1);
     cbinfo->manager     = self;
@@ -1156,6 +1159,7 @@ void spice_usb_device_manager_disconnect_device(SpiceUsbDeviceManager *self,
 
     g_warn_if_fail(device != NULL);
 
+    spice_usb_device_set_state(device, SPICE_USB_DEVICE_STATE_UNINSTALLING);
     installer = spice_win_usb_driver_new();
     cbinfo = g_new0(UsbInstallCbInfo, 1);
     cbinfo->manager     = self;
-- 
1.7.1



More information about the Spice-devel mailing list