<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 11 Feb 2016, at 24:41 AM, Jonathon Jongsma <<a href="mailto:jjongsma@redhat.com" class="">jjongsma@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 Thu, 2015-10-29 at 17:27 +0200, 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/channel-usbredir.c | 36 +++++++++++++++++++++++++++++-------<br class="">src/map-file           |  1 +<br class="">2 files changed, 30 insertions(+), 7 deletions(-)<br class=""><br class="">diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c<br class="">index 8519957..ed4a937 100644<br class="">--- a/src/channel-usbredir.c<br class="">+++ b/src/channel-usbredir.c<br class="">@@ -114,20 +114,42 @@ static void<br class="">spice_usbredir_channel_init(SpiceUsbredirChannel *channel)<br class="">}<br class=""><br class="">#ifdef USE_USBREDIR<br class="">+<br class="">+static void _channel_reset_cb(GObject *gobject,<br class="">+                                            GAsyncResult *result,<br class="">+                                            gpointer user_data)<br class="">+{<br class="">+    SpiceChannel *spice_channel =  SPICE_CHANNEL(gobject);<br class="">+    SpiceUsbredirChannel *channel = SPICE_USBREDIR_CHANNEL(spice_channel);<br class="">+    SpiceUsbredirChannelPrivate *priv = channel->priv;<br class="">+    gboolean migrating = GPOINTER_TO_UINT(user_data);<br class="">+    g_mutex_lock(priv->flows_mutex);<br class="">+<br class="">+    usbredirhost_close(priv->host);<br class="">+    priv->host = NULL;<br class="">+    /* Call set_context to re-create the host */<br class="">+    spice_usbredir_channel_set_context(channel, priv->context);<br class="">+    SPICE_CHANNEL_CLASS(spice_usbredir_channel_parent_class)<br class="">->channel_reset(spice_channel, migrating);<br class="">+    g_mutex_unlock(priv->flows_mutex);<br class="">+    g_object_unref(result);<br class="">+}<br class="">+<br class="">static void spice_usbredir_channel_reset(SpiceChannel *c, gboolean migrating)<br class="">{<br class="">    SpiceUsbredirChannel *channel = SPICE_USBREDIR_CHANNEL(c);<br class="">    SpiceUsbredirChannelPrivate *priv = channel->priv;<br class=""><br class="">+    GSimpleAsyncResult *result;<br class="">    if (priv->host) {<br class="">-        if (priv->state == STATE_CONNECTED)<br class="">-            spice_usbredir_channel_disconnect_device(channel);<br class="">-        usbredirhost_close(priv->host);<br class="">-        priv->host = NULL;<br class="">-        /* Call set_context to re-create the host */<br class="">-        spice_usbredir_channel_set_context(channel, priv->context);<br class="">+        if (priv->state == STATE_CONNECTED) {<br class="">+            result = g_simple_async_result_new(G_OBJECT(c),<br class="">+                       _channel_reset_cb, GUINT_TO_POINTER(migrating),<br class="">+                       spice_usbredir_channel_reset);<br class="">+            spice_usbredir_channel_disconnect_device_async(channel, result,<br class="">NULL);<br class="">+        }<br class="">+    } else {<br class="">+        SPICE_CHANNEL_CLASS(spice_usbredir_channel_parent_class)<br class="">->channel_reset(c, migrating);<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 section will need to be refactored a bit if we change the signature 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="">_disconnect_device_async() as I suggested on the earlier patch.</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><br class=""></div><div>Done.</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="">    }<br class="">-    SPICE_CHANNEL_CLASS(spice_usbredir_channel_parent_class)<br class="">->channel_reset(c, migrating);<br class="">}<br class="">#endif<br class=""><br class="">diff --git a/src/map-file b/src/map-file<br class="">index 92a9883..1f7755b 100644<br class="">--- a/src/map-file<br class="">+++ b/src/map-file<br class="">@@ -127,6 +127,7 @@ spice_usb_device_manager_can_redirect_device;<br class="">spice_usb_device_manager_connect_device_async;<br class="">spice_usb_device_manager_connect_device_finish;<br class="">spice_usb_device_manager_disconnect_device;<br class="">+spice_usb_device_manager_disconnect_device_async;<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 should be moved to the patch which introduces this function.</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>Moved. 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="">spice_usb_device_manager_get;<br class="">spice_usb_device_manager_get_devices;<br class="">spice_usb_device_manager_get_devices_with_filter;<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=""><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="">Reviewed-by: Jonathon Jongsma <</span><a href="mailto:jjongsma@redhat.com" 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="">jjongsma@redhat.com</a><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="">></span></div></blockquote></div><br class=""></body></html>