[Spice-devel] [PATCH spice-gtk 2/2] channel-usbredir: Properly reset state from reset callback
Christophe Fergeau
cfergeau at redhat.com
Fri Sep 28 12:40:53 PDT 2012
On Thu, Sep 27, 2012 at 05:34:25PM +0200, Hans de Goede wrote:
> This is necesary to be able to use the usbredir channel after a
necessary
> non seamless migration.
>
> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> ---
> 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..d5f8253 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 the re-create the host */
"the" ?
ACK
Christophe
> + 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
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20120928/4e7ba193/attachment.pgp>
More information about the Spice-devel
mailing list