[Spice-devel] [PATCH spice-gtk v2] win-usb-dev: fix device arrival event logic

Marc-André Lureau marcandre.lureau at gmail.com
Thu Jul 13 10:24:54 UTC 2017


On Wed, Jul 12, 2017 at 10:02 AM Uri Lublin <uril at redhat.com> wrote:

> Hi Yuri,
>
> I'd mention in the Subject/Log that a device is now identified
> by its bus.addr instead of vid:pid.
>
> On 07/05/2017 08:21 AM, Yuri Benditovich wrote:
> > https://bugzilla.redhat.com/show_bug.cgi?id=1425961
> > If attached new device when one device with the same vid
> > and pid already present, the notification is ignored and
> > attached device is not redirected (if auto share set) and
> > not displayed in USB devices widget.
> >
> > This commit reverts older commit f9631cd6f8, which was
> > intended to solve problem when bus:addr is sometimes changed when
> > using WinUSB. The same commit creates the limitation for automatic
> > redirection of second device with the same pid:vid.
> > Now the preferred backend for Spice-GTK on Windows is UsbDk.
> > In case users of newer WinUSB will still need backward compatible
> > behavior, consider backend-aware comparison procedure.
> >
> > Signed-off-by: Yuri Benditovich <yuri.benditovich at daynix.com>
>
> Acked-by: Uri Lublin <uril at redhat.com>
>
>
pushed with commit comment addition:

commit de41d93285461264d7d1c14a1e649433d3911da6
Author: Yuri Benditovich <yuri.benditovich at daynix.com>
Date:   Wed Jul 5 08:21:46 2017 +0300

    win-usb-dev: fix device arrival event logic

Thanks,
>      Uri.
>
> > ---
> >   src/win-usb-dev.c | 12 ++++++------
> >   1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/src/win-usb-dev.c b/src/win-usb-dev.c
> > index ec3dd91..e2d77b3 100644
> > --- a/src/win-usb-dev.c
> > +++ b/src/win-usb-dev.c
> > @@ -380,20 +380,20 @@ static gboolean get_usb_dev_info(libusb_device
> *dev, GUdevDeviceInfo *udevinfo)
> >       return TRUE;
> >   }
> >
> > -/* Only vid:pid are compared */
> > +/* Only bus:addr are compared */
> >   static gint gudev_devices_differ(gconstpointer a, gconstpointer b)
> >   {
> >       GUdevDeviceInfo *ai, *bi;
> > -    gboolean same_vid;
> > -    gboolean same_pid;
> > +    gboolean same_bus;
> > +    gboolean same_addr;
> >
> >       ai = G_UDEV_DEVICE(a)->priv->udevinfo;
> >       bi = G_UDEV_DEVICE(b)->priv->udevinfo;
> >
> > -    same_vid  = (ai->vid == bi->vid);
> > -    same_pid  = (ai->pid == bi->pid);
> > +    same_bus = (ai->bus == bi->bus);
> > +    same_addr = (ai->addr == bi->addr);
> >
> > -    return (same_pid && same_vid) ? 0 : -1;
> > +    return (same_bus && same_addr) ? 0 : -1;
> >   }
> >
> >   static void notify_dev_state_change(GUdevClient *self,
> >
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
>
-- 
Marc-André Lureau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170713/3ff716d6/attachment.html>


More information about the Spice-devel mailing list