----------------------------------- Daynix Computing LTD Dmitry Fleytman, CTO Email: dmi...@daynix.com <mailto:y...@daynix.com> Phone: +972-54-2819481 Web: www.daynix.com <http://www.daynix.com/>
> On 22 Sep 2015, at 18:52 PM, Christophe Fergeau <cferg...@redhat.com> wrote: > > On Sun, Aug 16, 2015 at 03:35:41PM +0300, Dmitry Fleytman wrote: >> From: Kirill Moizik <kmoi...@redhat.com <mailto:kmoi...@redhat.com>> >> >> USB redirection flow on Windows includes a number of reset requests issued >> to the port that hosts the device deing redirected. >> >> Each port reset emulates device removal and reinsertion and produces >> corresponding hotplug events and a number of device list updates on >> different levels of USB stack and USB redirection engine. >> >> As a result, queriyng USB device list performed by spice-gtk's hotplug >> event handler may return inconsistens results if performed in parallel > > 'inconsistent' > >> to redirection flow. >> >> This patch suppresses handling of USB hotplug events during redirection >> and injects a simulated hotplug event after redirection completion >> in order to properly process real device list changes in case they >> happened during the redirection flow. >> >> Signed-off-by: Kirill Moizik <kmoi...@redhat.com> >> Signed-off-by: Dmitry Fleytman <dfley...@redhat.com> >> --- >> src/win-usb-dev.c | 17 +++++++++++++++++ >> 1 file changed, 17 insertions(+) >> >> diff --git a/src/win-usb-dev.c b/src/win-usb-dev.c >> index 60bc434..78f1877 100644 >> --- a/src/win-usb-dev.c >> +++ b/src/win-usb-dev.c >> @@ -305,10 +305,18 @@ static void g_udev_client_set_property(GObject >> *gobject, >> { >> GUdevClient *self = G_UDEV_CLIENT(gobject); >> GUdevClientPrivate *priv = self->priv; >> + gboolean old_val; >> >> switch (prop_id) { >> case PROP_REDIRECTING: >> + old_val = priv->redirecting; >> priv->redirecting = g_value_get_boolean(value); >> + if (old_val && !priv->redirecting) { >> + /* This is a redirection completion case. >> + Inject hotplug event in case we missed device changes >> + during redirection processing. */ >> + handle_dev_change(self); >> + } >> break; >> default: >> G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec); >> @@ -409,6 +417,15 @@ static void handle_dev_change(GUdevClient *self) >> GList *lit, *sit; /* iterators for long-list and short-list */ >> GUdevDevice *ldev, *sdev; /* devices on long-list and short-list */ >> >> + if (priv->redirecting == TRUE) { >> + /* On Windows, queriyng USB device list may return inconsistent >> results > > 'querying' > >> + if performed in parallel to redirection flow. >> + A simulated hotplug event will be injected after redirection >> + completion in order to process real device list changes that may >> + had place during redirection process. */ > > 'had taken place’ All 3 issues fixed. thanks. > >> + return; >> + } >> + >> dev_count = g_udev_client_list_devices(self, &now_devs, &err, >> __FUNCTION__); >> g_return_if_fail(dev_count >= 0); >> -- >> 2.4.3 >> >> _______________________________________________ >> Spice-devel mailing list >> Spice-devel@lists.freedesktop.org <mailto:Spice-devel@lists.freedesktop.org> >> http://lists.freedesktop.org/mailman/listinfo/spice-devel >> <http://lists.freedesktop.org/mailman/listinfo/spice-devel>
_______________________________________________ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel