[Spice-devel] [PATCH] usb-device-manager: do not try to connect a usb device that was removed
Hans de Goede
hdegoede at redhat.com
Wed Jul 11 06:08:21 PDT 2012
Good one, ACK.
On 07/11/2012 11:50 AM, Uri Lublin wrote:
> If a device that is asked to be shared with the guest, is unplugged out
> of the machine before being redirected, then let the user know that
> usbredir of that device failed (and cleanup nicely).
>
> For Windows client, the time between request and redir is larger, as
> it includes the time it takes to install the libusb driver.
> ---
> gtk/usb-device-manager.c | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c
> index 9dab4c6..e5f84d0 100644
> --- a/gtk/usb-device-manager.c
> +++ b/gtk/usb-device-manager.c
> @@ -1073,6 +1073,13 @@ _spice_usb_device_manager_connect_device_async(SpiceUsbDeviceManager *self,
> continue; /* Skip already used channels */
>
> libdev = spice_usb_device_manager_device_to_libdev(self, device);
> + if (libdev == NULL) {
> + g_simple_async_result_set_error(result,
> + SPICE_CLIENT_ERROR,
> + SPICE_CLIENT_ERROR_FAILED,
> + _("Device was not found"));
> + goto done;
> + }
> spice_usbredir_channel_connect_device_async(channel,
> libdev,
> cancellable,
>
More information about the Spice-devel
mailing list