<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="">Thanks, Christophe,<div class="">We’ll modify the patch according to your comments.</div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On May 28, 2015, at 18:09 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; line-height: 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, May 28, 2015 at 01:24:02PM +0300, Kirill Moizik wrote:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; line-height: 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: Pavel Gurvich <<a href="mailto:pavel@daynix.com" class="">pavel@daynix.com</a>><br class=""><br class="">introducing use_usbdk global variable providing functionality of dynamic backend switching<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; line-height: 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 really should not be a global variable, but a member of</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; line-height: 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="">SpiceUsbDeviceManager. This means passing it to a few more functions, or</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; line-height: 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="">moving the if (use_usbdk) checks from an inner function to its caller.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; line-height: 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; line-height: 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="">Signed-off-by: Pavel Gurvich <<a href="mailto:pavel@daynix.com" class="">pavel@daynix.com</a>><br class="">Signed-off-by: Dmitry Fleytman <<a href="mailto:dmitry@daynix.com" class="">dmitry@daynix.com</a>><br class="">---<br class="">gtk/usb-device-manager.c | 264 +++++++++++++++++++++++++++++++++--------------<br class="">1 file changed, 188 insertions(+), 76 deletions(-)<br class=""><br class="">diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c<br class="">index 7739337..841e3a4 100644<br class="">--- a/gtk/usb-device-manager.c<br class="">+++ b/gtk/usb-device-manager.c<br class="">@@ -182,6 +182,7 @@ static SpiceUsbDevice *spice_usb_device_ref(SpiceUsbDevice *device);<br class="">static void spice_usb_device_unref(SpiceUsbDevice *device);<br class=""><br class="">#ifdef USE_WINUSB<br class="">+gboolean use_usbdk;<br class="">static guint8 spice_usb_device_get_state(SpiceUsbDevice *device);<br class="">static void spice_usb_device_set_state(SpiceUsbDevice *device, guint8 s);<br class="">#endif<br class="">@@ -222,8 +223,33 @@ static guint signals[LAST_SIGNAL] = { 0, };<br class="">G_DEFINE_TYPE_WITH_CODE(SpiceUsbDeviceManager, spice_usb_device_manager, G_TYPE_OBJECT,<br class=""> G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, spice_usb_device_manager_initable_iface_init));<br class=""><br class="">+#ifdef USE_WINUSB<br class="">+static gboolean is_usbdk_driver_installed(void)<br class="">+{<br class="">+ gboolean usbdk_installed = FALSE;<br class="">+<br class="">+ SC_HANDLE managerHandle = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);<br class="">+ if (managerHandle)<br class="">+ {<br class="">+ SC_HANDLE serviceHandle = OpenService(managerHandle, TEXT("UsbDk"), GENERIC_READ);<br class="">+ if (serviceHandle)<br class="">+ {<br class="">+ SPICE_DEBUG("UsbDk driver is installed.");<br class="">+ usbdk_installed = TRUE;<br class="">+ CloseServiceHandle(serviceHandle);<br class="">+ }<br class="">+ CloseServiceHandle(managerHandle);<br class="">+ }<br class="">+ return usbdk_installed;<br class="">+}<br class="">+#endif<br class="">+<br class="">static void spice_usb_device_manager_init(SpiceUsbDeviceManager *self)<br class="">{<br class="">+#ifdef USE_WINUSB<br class="">+ use_usbdk = is_usbdk_driver_installed();<br class="">+#endif<br class="">+<br class=""> SpiceUsbDeviceManagerPrivate *priv;<br class=""><br class=""> priv = SPICE_USB_DEVICE_MANAGER_GET_PRIVATE(self);<br class="">@@ -374,8 +400,11 @@ static void spice_usb_device_manager_finalize(GObject *gobject)<br class=""> free(priv->auto_conn_filter_rules);<br class=""> free(priv->redirect_on_connect_rules);<br class="">#ifdef USE_WINUSB<br class="">- if (priv->installer)<br class="">- g_object_unref(priv->installer);<br class="">+ if(! use_usbdk)<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; line-height: 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="">no space between '!' and 'use_usbdk', and { on the same line.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; line-height: 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; line-height: 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 (priv->installer)<br class="">+ g_object_unref(priv->installer);<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; line-height: 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; line-height: 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="">In _finalize, you wantn to unref installer when it's set even if it's</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; line-height: 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="">not supposed to be set. Add a g_warn_if_fail(!use_usbdk) if you want.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; line-height: 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; line-height: 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="">#endif<br class="">#endif<br class=""><br class="">@@ -672,8 +701,16 @@ static gboolean spice_usb_device_manager_get_udev_bus_n_address(<br class=""> bus_str = g_udev_device_get_property(udev, "BUSNUM");<br class=""> address_str = g_udev_device_get_property(udev, "DEVNUM");<br class="">#else /* WinUSB -- request vid:pid instead */<br class="">- bus_str = g_udev_device_get_property(udev, "VID");<br class="">- address_str = g_udev_device_get_property(udev, "PID");<br class="">+ if(! use_usbdk)<br class="">+ {<br class="">+ bus_str = g_udev_device_get_property(udev, "VID");<br class="">+ address_str = g_udev_device_get_property(udev, "PID");<br class="">+ }<br class="">+ else<br class="">+ {<br class="">+ bus_str = g_udev_device_get_property(udev, "BUSNUM");<br class="">+ address_str = g_udev_device_get_property(udev, "DEVNUM");<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; line-height: 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; line-height: 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; line-height: 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="">So here, the if (use_usbdk) block is the same as the linux code, which</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; line-height: 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="">is in a different #ifdef. This happens in other hunks down that file.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; line-height: 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="">Should we change 'use_usbdk' to 'use_usbclerk' or such, which would be</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; line-height: 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="">FALSE on linux, and when usbdk is used, and remove the #ifdef so that we</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; line-height: 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="">don't copy & paste the code between linux and windows/usbdk?</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; line-height: 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; line-height: 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="">#endif<br class=""> if (bus_str)<br class=""> *bus = atoi(bus_str);<br class="">@@ -835,20 +872,36 @@ static gboolean<br class="">spice_usb_device_manager_device_match(SpiceUsbDevice *device,<br class=""> const int vid, const int pid)<br class="">{<br class="">- return (spice_usb_device_get_vid(device) == vid &&<br class="">+ if(! use_usbdk)<br class="">+ {<br class="">+ return (spice_usb_device_get_vid(device) == vid &&<br class=""> spice_usb_device_get_pid(device) == pid);<br class="">+ }<br class="">+ else<br class="">+ {<br class="">+ return (spice_usb_device_get_busnum(device) == vid &&<br class="">+ spice_usb_device_get_devaddr(device) == pid);<br class="">+ }<br class="">}<br class=""><br class="">static gboolean<br class="">spice_usb_device_manager_libdev_match(libusb_device *libdev,<br class=""> const int vid, const int pid)<br class="">{<br class="">- int vid2, pid2;<br class="">+ if(! use_usbdk)<br class="">+ {<br class="">+ int vid2, pid2;<br class=""><br class="">- if (!spice_usb_device_manager_get_libdev_vid_pid(libdev, &vid2, &pid2)) {<br class="">- return FALSE;<br class="">+ if (!spice_usb_device_manager_get_libdev_vid_pid(libdev, &vid2, &pid2)) {<br class="">+ return FALSE;<br class="">+ }<br class="">+ return (vid == vid2 && pid == pid2);<br class="">+ }<br class="">+ else<br class="">+ {<br class="">+ return (libusb_get_bus_number(libdev) == vid &&<br class="">+ libusb_get_device_address(libdev) == pid);<br class=""> }<br class="">- return (vid == vid2 && pid == pid2);<br class="">}<br class="">#endif /* of Win32 -- match functions */<br class=""><br class="">@@ -926,12 +979,15 @@ static void spice_usb_device_manager_remove_dev(SpiceUsbDeviceManager *self,<br class=""> }<br class=""><br class="">#ifdef USE_WINUSB<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 driver",<br class="">- bus, address);<br class="">- return;<br class="">+ if(! use_usbdk)<br class="">+ {<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 driver",<br class="">+ bus, address);<br class="">+ return;<br class="">+ }<br class=""> }<br class="">#endif<br class=""><br class="">@@ -1109,6 +1165,11 @@ static void spice_usb_device_manager_drv_install_cb(GObject *gobject,<br class=""> GAsyncResult *res,<br class=""> gpointer user_data)<br class="">{<br class="">+ if (use_usbdk)<br class="">+ {<br class="">+ return;<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; line-height: 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; line-height: 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 one should never be called when use_usbdk is set as</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; line-height: 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="">spice_win_usb_driver_install() calls using this callback are already</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; line-height: 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="">protected by a if (use_usbdk) test, so this early return can be a</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; line-height: 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="">g_return_if_fail(!use_usbdk);</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; line-height: 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; line-height: 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=""> SpiceUsbDeviceManager *self;<br class=""> SpiceWinUsbDriver *installer;<br class=""> gint status;<br class="">@@ -1484,33 +1545,45 @@ done:<br class=""><br class=""><br class="">void spice_usb_device_manager_connect_device_async(SpiceUsbDeviceManager *self,<br class="">- SpiceUsbDevice *device,<br class="">- GCancellable *cancellable,<br class="">- GAsyncReadyCallback callback,<br class="">- gpointer user_data)<br class="">+ SpiceUsbDevice *device,<br class="">+ GCancellable *cancellable,<br class="">+ GAsyncReadyCallback callback,<br class="">+ gpointer user_data)<br class="">{<br class=""><br class="">#if defined(USE_USBREDIR) && defined(USE_WINUSB)<br class="">- SpiceWinUsbDriver *installer;<br class="">- UsbInstallCbInfo *cbinfo;<br class=""><br class="">- spice_usb_device_set_state(device, SPICE_USB_DEVICE_STATE_INSTALLING);<br class="">- if (! self->priv->installer) {<br class="">- self->priv->installer = spice_win_usb_driver_new();<br class="">+ if (! use_usbdk)<br class="">+ {<br class="">+ SpiceWinUsbDriver *installer;<br class="">+ UsbInstallCbInfo *cbinfo;<br class="">+<br class="">+ spice_usb_device_set_state(device, SPICE_USB_DEVICE_STATE_INSTALLING);<br class="">+ if (! self->priv->installer) {<br class="">+ self->priv->installer = spice_win_usb_driver_new();<br class="">+ }<br class="">+ installer = self->priv->installer;<br class="">+ cbinfo = g_new0(UsbInstallCbInfo, 1);<br class="">+ cbinfo->manager = self;<br class="">+ cbinfo->device = spice_usb_device_ref(device);<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->is_install = TRUE;<br class="">+<br class="">+ spice_win_usb_driver_install(installer, device, cancellable,<br class="">+ spice_usb_device_manager_drv_install_cb,<br class="">+ cbinfo);<br class="">+ }<br class="">+ else<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=""> }<br class="">- installer = self->priv->installer;<br class="">- cbinfo = g_new0(UsbInstallCbInfo, 1);<br class="">- cbinfo->manager = self;<br class="">- cbinfo->device = spice_usb_device_ref(device);<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->is_install = TRUE;<br class="">-<br class="">- spice_win_usb_driver_install(installer, device, cancellable,<br class="">- spice_usb_device_manager_drv_install_cb,<br class="">- cbinfo);<br class="">#else<br class=""> _spice_usb_device_manager_connect_device_async(self,<br class=""> device,<br class="">@@ -1558,36 +1631,39 @@ void spice_usb_device_manager_disconnect_device(SpiceUsbDeviceManager *self,<br class=""> spice_usbredir_channel_disconnect_device(channel);<br class=""><br class="">#ifdef USE_WINUSB<br class="">- SpiceWinUsbDriver *installer;<br class="">- UsbInstallCbInfo *cbinfo;<br class="">- guint8 state;<br class="">-<br class="">- g_warn_if_fail(device != NULL);<br class="">- g_warn_if_fail(self->priv->installer != NULL);<br class="">-<br class="">- state = spice_usb_device_get_state(device);<br class="">- if ((state != SPICE_USB_DEVICE_STATE_INSTALLED) &&<br class="">- (state != SPICE_USB_DEVICE_STATE_CONNECTED)) {<br class="">- return;<br class="">- }<br class="">+ if (! use_usbdk)<br class="">+ {<br class="">+ SpiceWinUsbDriver *installer;<br class="">+ UsbInstallCbInfo *cbinfo;<br class="">+ guint8 state;<br class="">+<br class="">+ g_warn_if_fail(device != NULL);<br class="">+ g_warn_if_fail(self->priv->installer != NULL);<br class="">+<br class="">+ state = spice_usb_device_get_state(device);<br class="">+ if ((state != SPICE_USB_DEVICE_STATE_INSTALLED) &&<br class="">+ (state != SPICE_USB_DEVICE_STATE_CONNECTED)) {<br class="">+ return;<br class="">+ }<br class=""><br class="">- spice_usb_device_set_state(device, SPICE_USB_DEVICE_STATE_UNINSTALLING);<br class="">- if (! self->priv->installer) {<br class="">- self->priv->installer = spice_win_usb_driver_new();<br class="">+ spice_usb_device_set_state(device, SPICE_USB_DEVICE_STATE_UNINSTALLING);<br class="">+ if (! self->priv->installer) {<br class="">+ self->priv->installer = spice_win_usb_driver_new();<br class="">+ }<br class="">+ installer = self->priv->installer;<br class="">+ cbinfo = g_new0(UsbInstallCbInfo, 1);<br class="">+ cbinfo->manager = self;<br class="">+ cbinfo->device = spice_usb_device_ref(device);<br class="">+ cbinfo->installer = installer;<br class="">+ cbinfo->cancellable = NULL;<br class="">+ cbinfo->callback = NULL;<br class="">+ cbinfo->user_data = NULL;<br class="">+ cbinfo->is_install = FALSE;<br class="">+<br class="">+ spice_win_usb_driver_uninstall(installer, device, NULL,<br class="">+ spice_usb_device_manager_drv_install_cb,<br class="">+ cbinfo);<br class=""> }<br class="">- installer = self->priv->installer;<br class="">- cbinfo = g_new0(UsbInstallCbInfo, 1);<br class="">- cbinfo->manager = self;<br class="">- cbinfo->device = spice_usb_device_ref(device);<br class="">- cbinfo->installer = installer;<br class="">- cbinfo->cancellable = NULL;<br class="">- cbinfo->callback = NULL;<br class="">- cbinfo->user_data = NULL;<br class="">- cbinfo->is_install = FALSE;<br class="">-<br class="">- spice_win_usb_driver_uninstall(installer, device, NULL,<br class="">- spice_usb_device_manager_drv_install_cb,<br class="">- cbinfo);<br class="">#endif<br class=""><br class="">#endif<br class="">@@ -1805,6 +1881,11 @@ guint16 spice_usb_device_get_pid(const SpiceUsbDevice *device)<br class="">#ifdef USE_WINUSB<br class="">void spice_usb_device_set_state(SpiceUsbDevice *device, guint8 state)<br class="">{<br class="">+ if (use_usbdk)<br class="">+ {<br class="">+ return;<br class="">+ }<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; line-height: 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; line-height: 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="">Can be a g_return_if_fail too</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; line-height: 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; line-height: 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=""> SpiceUsbDeviceInfo *info = (SpiceUsbDeviceInfo *)device;<br class=""><br class=""> g_return_if_fail(info != NULL);<br class="">@@ -1814,6 +1895,11 @@ void spice_usb_device_set_state(SpiceUsbDevice *device, guint8 state)<br class=""><br class="">guint8 spice_usb_device_get_state(SpiceUsbDevice *device)<br class="">{<br class="">+ if (use_usbdk)<br class="">+ {<br class="">+ return 0;<br class="">+ }<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; line-height: 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; line-height: 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="">Can be a g_return_if_fail too</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; line-height: 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; line-height: 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="">Christophe</span></div></blockquote></div><br class=""></div></body></html>