62 lines
2.1 KiB
Diff
62 lines
2.1 KiB
Diff
From e416038419174a7a85ec56046d5e022a347e6d74 Mon Sep 17 00:00:00 2001
|
|
From: Hans de Goede <hdegoede@redhat.com>
|
|
Date: Thu, 27 Sep 2012 17:31:54 +0200
|
|
Subject: [PATCH 04/21] channel-usbredir: Properly reset state from reset
|
|
callback
|
|
|
|
This is necessary to be able to use the usbredir channel after a
|
|
non seamless migration.
|
|
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Resolves: rhbz#861332
|
|
---
|
|
gtk/channel-usbredir.c | 17 +++++++++++++++--
|
|
1 file changed, 15 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/gtk/channel-usbredir.c b/gtk/channel-usbredir.c
|
|
index 5f8fb16..02edcd3 100644
|
|
--- a/gtk/channel-usbredir.c
|
|
+++ b/gtk/channel-usbredir.c
|
|
@@ -66,6 +66,7 @@ enum SpiceUsbredirChannelState {
|
|
|
|
struct _SpiceUsbredirChannelPrivate {
|
|
libusb_device *device;
|
|
+ libusb_context *context;
|
|
struct usbredirhost *host;
|
|
/* To catch usbredirhost error messages and report them as a GError */
|
|
GError **catch_error;
|
|
@@ -109,9 +110,20 @@ static void spice_usbredir_channel_init(SpiceUsbredirChannel *channel)
|
|
}
|
|
|
|
#ifdef USE_USBREDIR
|
|
-static void spice_usbredir_channel_reset(SpiceChannel *channel, gboolean migrating)
|
|
+static void spice_usbredir_channel_reset(SpiceChannel *c, gboolean migrating)
|
|
{
|
|
- SPICE_CHANNEL_CLASS(spice_usbredir_channel_parent_class)->channel_reset(channel, migrating);
|
|
+ SpiceUsbredirChannel *channel = SPICE_USBREDIR_CHANNEL(c);
|
|
+ SpiceUsbredirChannelPrivate *priv = channel->priv;
|
|
+
|
|
+ if (priv->host) {
|
|
+ if (priv->state == STATE_CONNECTED)
|
|
+ spice_usbredir_channel_disconnect_device(channel);
|
|
+ usbredirhost_close(priv->host);
|
|
+ priv->host = NULL;
|
|
+ /* Call set_context to re-create the host */
|
|
+ spice_usbredir_channel_set_context(channel, priv->context);
|
|
+ }
|
|
+ SPICE_CHANNEL_CLASS(spice_usbredir_channel_parent_class)->channel_reset(c, migrating);
|
|
}
|
|
#endif
|
|
|
|
@@ -190,6 +202,7 @@ void spice_usbredir_channel_set_context(SpiceUsbredirChannel *channel,
|
|
|
|
g_return_if_fail(priv->host == NULL);
|
|
|
|
+ priv->context = context;
|
|
priv->host = usbredirhost_open_full(
|
|
context, NULL,
|
|
usbredir_log,
|
|
--
|
|
1.7.12.1
|
|
|