[Spice-devel] [PATCH v7 09/14] UsbDeviceManager: Track device disconnection operations in progress
Jonathon Jongsma
jjongsma at redhat.com
Thu Mar 10 20:37:59 UTC 2016
Previously acked
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
On Tue, 2016-03-08 at 16:05 +0200, Dmitry Fleytman wrote:
> From: Kirill Moizik <kmoizik at redhat.com>
>
> During device disconnection, unwanted hotplug events may happen.
> We need to ignore those therefore we track disconnection operations
> in progress.
>
> See also comment to commit
> "Do not process USB hotplug events while redirection is in progress"
> that introduces corresponding filtering out logic.
>
> Signed-off-by: Kirill Moizik <kmoizik at redhat.com>
> Signed-off-by: Dmitry Fleytman <dfleytma at redhat.com>
> ---
> src/usb-device-manager.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
> index 639e5cc..73f9083 100644
> --- a/src/usb-device-manager.c
> +++ b/src/usb-device-manager.c
> @@ -1746,16 +1746,17 @@ void _disconnect_device_async_cb(GObject *gobject,
> SpiceUsbredirChannel *channel = SPICE_USBREDIR_CHANNEL(gobject);
> disconnect_cb_data *data = user_data;
> GSimpleAsyncResult *result = G_SIMPLE_ASYNC_RESULT(data->result);
> + SpiceUsbDeviceManager *self = SPICE_USB_DEVICE_MANAGER(data->self);
> GError *err = NULL;
>
> #ifdef G_OS_WIN32
> - SpiceUsbDeviceManager *self = SPICE_USB_DEVICE_MANAGER(data->self);
> -
> if (self->priv->use_usbclerk) {
> _spice_usb_device_manager_uninstall_driver_async(self, data->device);
> }
> #endif
>
> + _set_redirecting(self, FALSE);
> +
> spice_usbredir_channel_disconnect_device_finish(channel, channel_res,
> &err);
> if (err) {
> g_simple_async_result_take_error(result, err);
> @@ -1783,6 +1784,8 @@ void
> spice_usb_device_manager_disconnect_device_async(SpiceUsbDeviceManager *sel
>
> SpiceUsbredirChannel *channel;
>
> + _set_redirecting(self, TRUE);
> +
> channel = spice_usb_device_manager_get_channel_for_dev(self, device);
> nested = g_simple_async_result_new(G_OBJECT(self), callback, user_data,
>
> spice_usb_device_manager_disconnect_device_async);
More information about the Spice-devel
mailing list