[Spice-devel] [PATCH v6 10/10] win-usbredir: Use UsbDk backend when available

Jonathon Jongsma jjongsma at redhat.com
Fri Feb 5 16:41:36 UTC 2016


On Thu, 2015-10-29 at 17:26 +0200, Dmitry Fleytman wrote:
> Signed-off-by: Dmitry Fleytman <dmitry at daynix.com>
> ---
>  src/usb-device-manager.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
> index 53820b4..f4e48eb 100644
> --- a/src/usb-device-manager.c
> +++ b/src/usb-device-manager.c
> @@ -231,7 +231,8 @@ static void
> spice_usb_device_manager_init(SpiceUsbDeviceManager *self)
>      self->priv = priv;
>  
>  #if defined(G_OS_WIN32) && defined(USE_USBREDIR)
> -    priv->use_usbclerk = TRUE;
> +    priv->use_usbclerk = !usbdk_is_driver_installed() ||
> +                         !usbdk_api_load(&priv->usbdk_api);

as I just mentioned in another mail, the api needs to be loaded before it is
used. So this patch will need to be re-ordered. 

>  #endif
>      priv->channels = g_ptr_array_new();
>  #ifdef USE_USBREDIR
> @@ -381,6 +382,8 @@ static void spice_usb_device_manager_finalize(GObject
> *gobject)
>      if (!priv->use_usbclerk) {
>          if(priv->auto_connect)
>              _usbdk_autoredir_disable(self);
> +
> +        usbdk_api_unload(priv->usbdk_api);

Since loading the API can fail, i think it would be better to check if priv
->usbdk_api is non-NULL before unloading it. 

>      }
>  #endif
>      /* Chain up to the parent class */

Reviewed-by: Jonathon Jongsma <jjongsma at redhat.com>


More information about the Spice-devel mailing list