<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 22 Sep 2015, at 19:14 PM, Christophe Fergeau <<a href="mailto:cfergeau@redhat.com" class="">cfergeau@redhat.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">On Sun, Aug 16, 2015 at 03:35:45PM +0300, Dmitry Fleytman wrote:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">From: Kirill Moizik <<a href="mailto:kmoizik@redhat.com" class="">kmoizik@redhat.com</a>><br class=""><br class="">Signed-off-by: Kirill Moizik <<a href="mailto:kmoizik@redhat.com" class="">kmoizik@redhat.com</a>><br class="">Signed-off-by: Dmitry Fleytman <<a href="mailto:dfleytma@redhat.com" class="">dfleytma@redhat.com</a>><br class="">---<br class="">src/usb-device-manager.c | 71 ++++++++++++++++++++++++++++++++++++++++++------<br class="">1 file changed, 62 insertions(+), 9 deletions(-)<br class=""><br class="">diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c<br class="">index af2c87a..f133907 100644<br class="">--- a/src/usb-device-manager.c<br class="">+++ b/src/usb-device-manager.c<br class="">@@ -122,6 +122,7 @@ struct _SpiceUsbDeviceManagerPrivate {<br class="">    GUdevClient *udev;<br class="">    libusb_device **coldplug_list; /* Avoid needless reprobing during init */<br class="">#else<br class="">+    gboolean redirecting;<br class="">    libusb_hotplug_callback_handle hp_handle;<br class="">#endif<br class="">#ifdef G_OS_WIN32<br class="">@@ -205,10 +206,25 @@ _spice_usb_device_manager_connect_device_async(SpiceUsbDeviceManager *self,<br class="">                                               GAsyncReadyCallback callback,<br class="">                                               gpointer user_data);<br class=""><br class="">+static<br class="">+void _connect_device_async_cb(GObject *gobject,<br class="">+                              GAsyncResult *channel_res,<br class="">+                              gpointer user_data);<br class="">+<br class="">G_DEFINE_BOXED_TYPE(SpiceUsbDevice, spice_usb_device,<br class="">                    (GBoxedCopyFunc)spice_usb_device_ref,<br class="">                    (GBoxedFreeFunc)spice_usb_device_unref)<br class=""><br class="">+static void<br class="">+_set_redirecting(SpiceUsbDeviceManager *self, gboolean is_redirecting)<br class="">+{<br class="">+#ifdef USE_GUDEV<br class="">+    g_object_set(self->priv->udev, "redirecting", is_redirecting, NULL);<br class="">+#else<br class="">+    self->priv->redirecting = is_redirecting;<br class="">+#endif<br class="">+}<br class="">+<br class="">#else<br class="">G_DEFINE_BOXED_TYPE(SpiceUsbDevice, spice_usb_device, g_object_ref, g_object_unref)<br class="">#endif<br class="">@@ -1103,6 +1119,13 @@ static void spice_usb_device_manager_channel_connect_cb(<br class="">    g_object_unref(result);<br class="">}<br class=""><br class="">+typedef struct _connect_cb_data<br class="">+{<br class="">+    SpiceUsbDeviceManager  *self;<br class="">+    GAsyncReadyCallback     callback;<br class="">+    gpointer                user_data;<br class="">+} connect_cb_data;<br class="">+<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">This looks like a GSimpleAsyncResult could be passed around instead of</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">this new structure?</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>True. Fixed, thanks.</div><br class=""><blockquote type="cite" class=""><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">#ifdef G_OS_WIN32<br class=""><br class="">typedef struct _UsbInstallCbInfo {<br class="">@@ -1138,7 +1161,7 @@ static void spice_usb_device_manager_drv_install_cb(GObject *gobject,<br class="">    SpiceUsbDevice *device;<br class="">    UsbInstallCbInfo *cbinfo;<br class="">    GCancellable *cancellable;<br class="">-    GAsyncReadyCallback callback;<br class="">+    connect_cb_data *data;<br class=""><br class="">    g_return_if_fail(user_data != NULL);<br class=""><br class="">@@ -1147,8 +1170,7 @@ static void spice_usb_device_manager_drv_install_cb(GObject *gobject,<br class="">    device      = cbinfo->device;<br class="">    installer   = cbinfo->installer;<br class="">    cancellable = cbinfo->cancellable;<br class="">-    callback    = cbinfo->callback;<br class="">-    user_data   = cbinfo->user_data;<br class="">+    data        = cbinfo->user_data;<br class=""><br class="">    g_free(cbinfo);<br class=""><br class="">@@ -1170,8 +1192,8 @@ static void spice_usb_device_manager_drv_install_cb(GObject *gobject,<br class="">    _spice_usb_device_manager_connect_device_async(self,<br class="">                                                   device,<br class="">                                                   cancellable,<br class="">-                                                   callback,<br class="">-                                                   user_data);<br class="">+                                                   _connect_device_async_cb,<br class="">+                                                   data);<br class=""><br class="">    spice_usb_device_unref(device);<br class="">}<br class="">@@ -1552,8 +1574,17 @@ void spice_usb_device_manager_connect_device_async(SpiceUsbDeviceManager *self,<br class="">                                             GAsyncReadyCallback callback,<br class="">                                             gpointer user_data)<br class="">{<br class="">+    g_return_if_fail(SPICE_IS_USB_DEVICE_MANAGER(self));<br class="">+#ifdef USE_USBREDIR<br class="">+    _set_redirecting(self, TRUE);<br class="">+<br class="">+    connect_cb_data *data = g_new(connect_cb_data, 1);<br class="">+    data->self = self;<br class="">+    data->callback  = callback;<br class="">+    data->user_data = user_data;<br class="">+<br class="">    if (self->priv->use_usbclerk) {<br class="">-#if defined(USE_USBREDIR) && defined(G_OS_WIN32)<br class="">+#ifdef G_OS_WIN32<br class="">        SpiceWinUsbDriver *installer;<br class="">        UsbInstallCbInfo *cbinfo;<br class=""><br class="">@@ -1568,7 +1599,7 @@ void spice_usb_device_manager_connect_device_async(SpiceUsbDeviceManager *self,<br class="">        cbinfo->installer   = installer;<br class="">        cbinfo->cancellable = cancellable;<br class="">        cbinfo->callback    = callback;<br class="">-        cbinfo->user_data   = user_data;<br class="">+        cbinfo->user_data   = data;<br class=""><br class="">        spice_win_usb_driver_install_async(installer, device, cancellable,<br class="">                                           spice_usb_device_manager_drv_install_cb,<br class="">@@ -1580,9 +1611,10 @@ void spice_usb_device_manager_connect_device_async(SpiceUsbDeviceManager *self,<br class="">        _spice_usb_device_manager_connect_device_async(self,<br class="">                                                       device,<br class="">                                                       cancellable,<br class="">-                                                       callback,<br class="">-                                                       user_data);<br class="">+                                                       _connect_device_async_cb,<br class="">+                                                       data);<br class="">    }<br class="">+#endif<br class="">}<br class=""><br class="">gboolean spice_usb_device_manager_connect_device_finish(<br class="">@@ -1600,6 +1632,27 @@ gboolean spice_usb_device_manager_connect_device_finish(<br class="">    return TRUE;<br class="">}<br class=""><br class="">+#ifdef USE_USBREDIR<br class="">+static<br class="">+void _connect_device_async_cb(GObject *gobject,<br class="">+                              GAsyncResult *channel_res,<br class="">+                              gpointer user_data)<br class="">+{<br class="">+    connect_cb_data    *data    = user_data;<br class="">+    GSimpleAsyncResult *result  = g_simple_async_result_new(<br class="">+                                    G_OBJECT(data->self),<br class="">+                                    data->callback,<br class="">+                                    data->user_data,<br class="">+                                    spice_usb_device_manager_connect_device_async);<br class="">+<br class="">+    _set_redirecting(data->self, FALSE);<br class="">+<br class="">+    g_simple_async_result_complete(result);<br class="">+    g_object_unref(result);<br class="">+    g_free(data);<br class="">+}<br class="">+#endif<br class="">+<br class="">/**<br class=""> * spice_usb_device_manager_disconnect_device:<br class=""> * @manager: the #SpiceUsbDeviceManager manager<br class="">--<span class="Apple-converted-space"> </span><br class="">2.4.3<br class=""><br class="">_______________________________________________<br class="">Spice-devel mailing list<br class=""><a href="mailto:Spice-devel@lists.freedesktop.org" class="">Spice-devel@lists.freedesktop.org</a><br class=""><a href="http://lists.freedesktop.org/mailman/listinfo/spice-devel" class="">http://lists.freedesktop.org/mailman/listinfo/spice-devel</a></blockquote></div></blockquote></div><br class=""></body></html>