<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></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 5 Feb 2016, at 18:31 PM, 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:26 +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="">Signed-off-by: Dmitry Fleytman <<a href="mailto:dmitry@daynix.com" class="">dmitry@daynix.com</a>><br class="">---<br class="">src/usb-device-manager.c | 50 ++++++++++++++++++++++++++++++-----------------<br class="">-<br class="">1 file changed, 31 insertions(+), 19 deletions(-)<br class=""><br class="">diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c<br class="">index d5fec8f..53820b4 100644<br class="">--- a/src/usb-device-manager.c<br class="">+++ b/src/usb-device-manager.c<br class="">@@ -230,7 +230,7 @@ static void<br class="">spice_usb_device_manager_init(SpiceUsbDeviceManager *self)<br class="">    priv = SPICE_USB_DEVICE_MANAGER_GET_PRIVATE(self);<br class="">    self->priv = priv;<br class=""><br class="">-#ifdef G_OS_WIN32<br class="">+#if defined(G_OS_WIN32) && defined(USE_USBREDIR)<br class="">    priv->use_usbclerk = TRUE;<br class="">#endif<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 particular change seems a bit unrelated to this commit. It probably should</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="">be moved to the patch where priv->use_usbclerk was introduced, no?</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=""><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="">    priv->channels = g_ptr_array_new();<br class="">@@ -255,10 +255,12 @@ static gboolean<br class="">spice_usb_device_manager_initable_init(GInitable  *initable,<br class="">#endif<br class=""><br class="">#ifdef G_OS_WIN32<br class="">-    priv->installer = spice_win_usb_driver_new(err);<br class="">-    if (!priv->installer) {<br class="">-        SPICE_DEBUG("failed to initialize winusb driver");<br class="">-        return FALSE;<br class="">+    if (priv->use_usbclerk) {<br class="">+        priv->installer = spice_win_usb_driver_new(err);<br class="">+        if (!priv->installer) {<br class="">+            SPICE_DEBUG("failed to initialize winusb driver");<br class="">+            return FALSE;<br class="">+        }<br class="">    }<br class="">#endif<br class=""><br class="">@@ -365,15 +367,17 @@ static void spice_usb_device_manager_finalize(GObject<br class="">*gobject)<br class="">    free(priv->auto_conn_filter_rules);<br class="">    free(priv->redirect_on_connect_rules);<br class="">#ifdef G_OS_WIN32<br class="">-    if (priv->installer)<br class="">+    if (priv->installer) {<br class="">+        g_warn_if_fail(priv->use_usbclerk);<br class="">        g_object_unref(priv->installer);<br class="">+    }<br class="">#endif<br class="">#endif<br class=""><br class="">    g_free(priv->auto_connect_filter);<br class="">    g_free(priv->redirect_on_connect);<br class=""><br class="">-#ifdef G_OS_WIN32<br class="">+#if defined(G_OS_WIN32) && defined(USE_USBREDIR)<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="">As I mentioned in the review for patch 8, this change shouldn be done earlier in</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="">an earlier patch. it's not directly related to this 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>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="">    if (!priv->use_usbclerk) {<br class="">        if(priv->auto_connect)<br class="">            _usbdk_autoredir_disable(self);<br class="">@@ -430,7 +434,7 @@ static void spice_usb_device_manager_set_property(GObject<span class="Apple-converted-space"> </span><br class="">     *gobject,<br class="">        break;<br class="">    case PROP_AUTO_CONNECT:<br class="">        priv->auto_connect = g_value_get_boolean(value);<br class="">-#ifdef G_OS_WIN32<br class="">+#if defined(G_OS_WIN32) && defined(USE_USBREDIR)<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="">Same as above. Consider moving to an earlier patch if the change is needed.</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="">        if (!priv->use_usbclerk) {<br class="">            if (priv->auto_connect) {<br class="">                _usbdk_autoredir_enable(self);<br class="">@@ -935,12 +939,14 @@ static void<br class="">spice_usb_device_manager_remove_dev(SpiceUsbDeviceManager *self,<br class="">    }<br class=""><br class="">#ifdef G_OS_WIN32<br class="">-    const guint8 state = spice_usb_device_get_state(device);<br class="">-    if ((state == SPICE_USB_DEVICE_STATE_INSTALLING) ||<br class="">-        (state == SPICE_USB_DEVICE_STATE_UNINSTALLING)) {<br class="">-        SPICE_DEBUG("skipping " DEV_ID_FMT ". It is un/installing its<br class="">driver",<br class="">-                    bus, address);<br class="">-        return;<br class="">+    if (priv->use_usbclerk) {<br class="">+        const guint8 state = spice_usb_device_get_state(device);<br class="">+        if ((state == SPICE_USB_DEVICE_STATE_INSTALLING) ||<br class="">+            (state == SPICE_USB_DEVICE_STATE_UNINSTALLING)) {<br class="">+            SPICE_DEBUG("skipping " DEV_ID_FMT ". It is un/installing its<br class="">driver",<br class="">+                        bus, address);<br class="">+            return;<br class="">+        }<br class="">    }<br class="">#endif<br class=""><br class="">@@ -1141,6 +1147,7 @@ static void<br class="">spice_usb_device_manager_drv_install_cb(GObject *gobject,<br class="">    g_free(cbinfo);<br class=""><br class="">    g_return_if_fail(SPICE_IS_USB_DEVICE_MANAGER(self));<br class="">+    g_return_if_fail(self->priv->use_usbclerk);<br class="">    g_return_if_fail(SPICE_IS_WIN_USB_DRIVER(installer));<br class="">    g_return_if_fail(device!= NULL);<br class=""><br class="">@@ -1173,6 +1180,7 @@ static void<br class="">spice_usb_device_manager_drv_uninstall_cb(GObject *gobject,<br class=""><br class="">    SPICE_DEBUG("Win USB driver uninstall finished");<br class="">    g_return_if_fail(SPICE_IS_USB_DEVICE_MANAGER(self));<br class="">+    g_return_if_fail(self->priv->use_usbclerk);<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="">Minor issue since these statements are only executed on a programming error, but</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="">returning early here will leak cbinfo.</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>Right. This was broken before this patch also.</div><div>I’m adding another patch on top of this series that addresses this issue.</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="">    if (!spice_win_usb_driver_uninstall_finish(cbinfo->installer, res, &err))<br class="">{<br class="">        g_warning("win usb driver uninstall failed -- %s", err->message);<br class="">@@ -1576,15 +1584,18 @@ void<br class="">spice_usb_device_manager_connect_device_async(SpiceUsbDeviceManager *self,<br class="">{<br class=""><br class="">#if defined(USE_USBREDIR) && defined(G_OS_WIN32)<br class="">-    _spice_usb_device_manager_install_driver_async(self, device, cancellable,<br class="">-                                                   callback, user_data);<br class="">-#else<br class="">+    if (self->priv->use_usbclerk) {<br class="">+        _spice_usb_device_manager_install_driver_async(self, device,<br class="">cancellable,<br class="">+                                                       callback, user_data);<br class="">+        return;<br class="">+    }<br class="">+#endif<br class="">+<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="">-#endif<br class="">}<br class=""><br class="">/**<br class="">@@ -1637,7 +1648,8 @@ void<br class="">spice_usb_device_manager_disconnect_device(SpiceUsbDeviceManager *self,<br class="">        spice_usbredir_channel_disconnect_device(channel);<br class=""><br class="">#ifdef G_OS_WIN32<br class="">-    _spice_usb_device_manager_uninstall_driver_async(self, device);<br class="">+    if(self->priv->use_usbclerk)<br class="">+        _spice_usb_device_manager_uninstall_driver_async(self, device);<br class="">#endif<br class=""><br class="">#endif<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="">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>