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

Yuri Benditovich yuri.benditovich at daynix.com
Mon Jul 3 11:27:29 UTC 2017


On Mon, Jul 3, 2017 at 10:16 AM, Christophe Fergeau <cfergeau at redhat.com>
wrote:

> On Mon, Jul 03, 2017 at 07:48:31AM +0300, 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
>
> There apparently were some issues in the past with bus/addr changing
> when it should not
> https://cgit.freedesktop.org/spice/spice-gtk/commit/?id=f9631cd6f8
>
> Any idea whether this is no longer needed?
>

There is no additional information about case when the same device comes
with different bus.addr
1. From my point of view this should not be a problem - if new device with
different bus.addr comes in, the previous one with
old bus.addr should disappear and be removed anywhere ; new device shall be
redirected automatically if required.
If such flow will be identified/reported with UsbDk, we will be able to
investigate it and solve.
2. Whether the configuration with WinUSB is still used by spice-gtk on
Windows? According to instructions
on https://www.spice-space.org/spice-user-manual.html , UsbDk should be
used and WinUSB is not mentioned.

If we still need to support WinUSB (?) in backward compatible manner, we
can add the condition and with
WinUSB just one drive with vid/pid combination will be recognized on
plug-in.


>
> Christophe
>
> >
> > Signed-off-by: Yuri Benditovich <yuri.benditovich at daynix.com>
> > ---
> >  src/win-usb-dev.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/src/win-usb-dev.c b/src/win-usb-dev.c
> > index ec3dd91..e5cd7c6 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 */
> >  static gint gudev_devices_differ(gconstpointer a, gconstpointer b)
> >  {
> >      GUdevDeviceInfo *ai, *bi;
> > -    gboolean same_vid;
> > -    gboolean same_pid;
> > +    gboolean same_vid, same_pid, same_bus, 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_pid && same_vid && same_bus && same_addr) ? 0 : -1;
> >  }
> >
> >  static void notify_dev_state_change(GUdevClient *self,
> > --
> > 2.9.4
> >
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/spice-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170703/7b8b41cf/attachment-0001.html>


More information about the Spice-devel mailing list