Re: [Spice-devel] [spice-gtk 04/13] usb-redir: do not add device if one with the same bus:addr exists

2019-03-13 Thread Christophe Fergeau
On Wed, Mar 13, 2019 at 09:40:14AM +0200, Yuri Benditovich wrote:
> On Mon, Mar 11, 2019 at 7:17 PM Christophe Fergeau  
> wrote:
> >
> > On Sun, Mar 10, 2019 at 04:46:03PM +0200, Yuri Benditovich wrote:
> > > In initial device enumeration hotplug notification can be
> > > called twice with the same libusb device. For details, see
> > > http://libusb.sourceforge.net/api-1.0/group__libusb__hotplug.html#ga00e0c69ddf1fb1b6774dc918192e8dc7
> > > Filter out devices that already present in the list.
> > > Remove indentical call in spice_usb_device_manager_add_udev,
> > > which add devices under Windows.
> > >
> > > Signed-off-by: Yuri Benditovich 
> > > ---
> > >  src/usb-device-manager.c | 22 +++---
> > >  1 file changed, 11 insertions(+), 11 deletions(-)
> > >
> > > diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
> > > index debba4d..5cf7ebb 100644
> > > --- a/src/usb-device-manager.c
> > > +++ b/src/usb-device-manager.c
> > > @@ -962,6 +962,17 @@ static void 
> > > spice_usb_device_manager_add_dev(SpiceUsbDeviceManager  *self,
> > >  if (desc.bDeviceClass == LIBUSB_CLASS_HUB)
> > >  return;
> > >
> > > +if (spice_usb_device_manager_find_device(self,
> > > +libusb_get_bus_number(libdev),
> > > +libusb_get_device_address(libdev))) {
> >
> > Forgot to mention that indentation is slightly off.
> 
> Please refer exact rule in coding conventions which explains how many
> spaces should be inserted to make you think the indentation is ideal.

I don't know if this is mentioned in a coding style document or not, but
aligning with the opening ( is what is done in most of the file.

Christophe


signature.asc
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel

Re: [Spice-devel] [spice-gtk 04/13] usb-redir: do not add device if one with the same bus:addr exists

2019-03-13 Thread Yuri Benditovich
On Mon, Mar 11, 2019 at 7:17 PM Christophe Fergeau  wrote:
>
> On Sun, Mar 10, 2019 at 04:46:03PM +0200, Yuri Benditovich wrote:
> > In initial device enumeration hotplug notification can be
> > called twice with the same libusb device. For details, see
> > http://libusb.sourceforge.net/api-1.0/group__libusb__hotplug.html#ga00e0c69ddf1fb1b6774dc918192e8dc7
> > Filter out devices that already present in the list.
> > Remove indentical call in spice_usb_device_manager_add_udev,
> > which add devices under Windows.
> >
> > Signed-off-by: Yuri Benditovich 
> > ---
> >  src/usb-device-manager.c | 22 +++---
> >  1 file changed, 11 insertions(+), 11 deletions(-)
> >
> > diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
> > index debba4d..5cf7ebb 100644
> > --- a/src/usb-device-manager.c
> > +++ b/src/usb-device-manager.c
> > @@ -962,6 +962,17 @@ static void 
> > spice_usb_device_manager_add_dev(SpiceUsbDeviceManager  *self,
> >  if (desc.bDeviceClass == LIBUSB_CLASS_HUB)
> >  return;
> >
> > +if (spice_usb_device_manager_find_device(self,
> > +libusb_get_bus_number(libdev),
> > +libusb_get_device_address(libdev))) {
>
> Forgot to mention that indentation is slightly off.

Please refer exact rule in coding conventions which explains how many
spaces should be inserted to make you think the indentation is ideal.

>
> Christophe
> -BEGIN PGP SIGNATURE-
>
> iQIzBAEBCAAdFiEElKn3VmH3emFoZJsjqdjCFCmsbIIFAlyGmBEACgkQqdjCFCms
> bIJ4eA//bL+Vfa0yM6oSOVWdeJ+YCflqfvYMCcuznjVZZNVamN3I0/vN4YXTBzIB
> 0natkh86+sMERadKFsdPs6Zy69xgGoTva+jovfiYEC+nCUyvBVMomgTQ9P1bN3kM
> NebhrRD4PiTD4hQUB2mq5Z/Gz8UNcfaBc1VldkQJyTUE08mZusArG4mc//XErfOZ
> aoVTeu14QLBNvUsUEw22/BKSUAPw+T1w0l2Tl50D3XwS+BQCF+Gew04RL6DFloh4
> jsHcGzkQrmAoHnz3gzAzHS4jRfPqTxcHtqz714p9y0+TYF551kh7Qh4X+69e+CGT
> IKZo673rR88yQgJFUvdhsGYzD9R9+fvS1V7+HVDlKt7DuuGRtDNMVrOkzurCJD+u
> nu6H4TDycMzat7uihH56mL7G64htOkTe1mmBMlD2pRZQ0d7ZOn3++dz+Golspp9y
> fdvTQ3y5Ug60vHPzsTsDBDluVL1YX7GHYUNgTyvwtakpsDZ1WzDZOSeaEbcTZJaU
> hsLMIZkh/j4osgIgWlMxdjFddiaW19HX3tKm+Prt43b86XKyOW1yYCJU+zX6YZO7
> zFl8jDo2oCa+ZAELrmhGYZy2CQVkRObaUXoyJZS5+JDu9MmDtxSWfmkIyAXkBHBx
> rbAwuivLxI/O3zsgHqyKGgLUsxN1+VoxJkFUIzZcqHSln7l9n10=
> =UbTl
> -END PGP SIGNATURE-
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel

Re: [Spice-devel] [spice-gtk 04/13] usb-redir: do not add device if one with the same bus:addr exists

2019-03-11 Thread Christophe Fergeau
On Sun, Mar 10, 2019 at 04:46:03PM +0200, Yuri Benditovich wrote:
> In initial device enumeration hotplug notification can be
> called twice with the same libusb device. For details, see
> http://libusb.sourceforge.net/api-1.0/group__libusb__hotplug.html#ga00e0c69ddf1fb1b6774dc918192e8dc7
> Filter out devices that already present in the list.
> Remove indentical call in spice_usb_device_manager_add_udev,
> which add devices under Windows.
> 
> Signed-off-by: Yuri Benditovich 
> ---
>  src/usb-device-manager.c | 22 +++---
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
> index debba4d..5cf7ebb 100644
> --- a/src/usb-device-manager.c
> +++ b/src/usb-device-manager.c
> @@ -962,6 +962,17 @@ static void 
> spice_usb_device_manager_add_dev(SpiceUsbDeviceManager  *self,
>  if (desc.bDeviceClass == LIBUSB_CLASS_HUB)
>  return;
>  
> +if (spice_usb_device_manager_find_device(self,
> +libusb_get_bus_number(libdev),
> +libusb_get_device_address(libdev))) {

Forgot to mention that indentation is slightly off.

Christophe


signature.asc
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel

Re: [Spice-devel] [spice-gtk 04/13] usb-redir: do not add device if one with the same bus:addr exists

2019-03-11 Thread Christophe Fergeau
On Sun, Mar 10, 2019 at 04:46:03PM +0200, Yuri Benditovich wrote:
> In initial device enumeration hotplug notification can be

"In initial device enumeration, hotplug notification..."

> called twice with the same libusb device. For details, see
> http://libusb.sourceforge.net/api-1.0/group__libusb__hotplug.html#ga00e0c69ddf1fb1b6774dc918192e8dc7
> Filter out devices that already present in the list.

"This commit filters out the devices that are already known to
SpiceUsbDeviceManager."

> Remove indentical call in spice_usb_device_manager_add_udev,
> which add devices under Windows.

"It also removes the identical call ..., which adds devices..."

Acked-by: Christophe Fergeau 


> 
> Signed-off-by: Yuri Benditovich 
> ---
>  src/usb-device-manager.c | 22 +++---
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
> index debba4d..5cf7ebb 100644
> --- a/src/usb-device-manager.c
> +++ b/src/usb-device-manager.c
> @@ -962,6 +962,17 @@ static void 
> spice_usb_device_manager_add_dev(SpiceUsbDeviceManager  *self,
>  if (desc.bDeviceClass == LIBUSB_CLASS_HUB)
>  return;
>  
> +if (spice_usb_device_manager_find_device(self,
> +libusb_get_bus_number(libdev),
> +libusb_get_device_address(libdev))) {
> +SPICE_DEBUG("device not added %d:%d %04x:%04x",
> +libusb_get_bus_number(libdev),
> +libusb_get_device_address(libdev),
> +desc.idVendor,
> +desc.idProduct);
> +return;
> +}
> +
>  device = (SpiceUsbDevice*)spice_usb_device_new(libdev);
>  if (!device)
>  return;
> @@ -1025,7 +1036,6 @@ static void 
> spice_usb_device_manager_add_udev(SpiceUsbDeviceManager  *self,
>  {
>  SpiceUsbDeviceManagerPrivate *priv = self->priv;
>  libusb_device *libdev = NULL, **dev_list = NULL;
> -SpiceUsbDevice *device;
>  const gchar *devtype;
>  int i, bus, address;
>  
> @@ -1039,16 +1049,6 @@ static void 
> spice_usb_device_manager_add_udev(SpiceUsbDeviceManager  *self,
>  return;
>  }
>  
> -device = spice_usb_device_manager_find_device(self, bus, address);
> -if (device) {
> -SPICE_DEBUG("USB device 0x%04x:0x%04x at %d.%d already exists, 
> ignored",
> -spice_usb_device_get_vid(device),
> -spice_usb_device_get_pid(device),
> -spice_usb_device_get_busnum(device),
> -spice_usb_device_get_devaddr(device));
> -return;
> -}
> -
>  if (priv->coldplug_list)
>  dev_list = priv->coldplug_list;
>  else
> -- 
> 2.17.1
> 
> ___
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel


signature.asc
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Spice-devel] [spice-gtk 04/13] usb-redir: do not add device if one with the same bus:addr exists

2019-03-10 Thread Yuri Benditovich
In initial device enumeration hotplug notification can be
called twice with the same libusb device. For details, see
http://libusb.sourceforge.net/api-1.0/group__libusb__hotplug.html#ga00e0c69ddf1fb1b6774dc918192e8dc7
Filter out devices that already present in the list.
Remove indentical call in spice_usb_device_manager_add_udev,
which add devices under Windows.

Signed-off-by: Yuri Benditovich 
---
 src/usb-device-manager.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index debba4d..5cf7ebb 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -962,6 +962,17 @@ static void 
spice_usb_device_manager_add_dev(SpiceUsbDeviceManager  *self,
 if (desc.bDeviceClass == LIBUSB_CLASS_HUB)
 return;
 
+if (spice_usb_device_manager_find_device(self,
+libusb_get_bus_number(libdev),
+libusb_get_device_address(libdev))) {
+SPICE_DEBUG("device not added %d:%d %04x:%04x",
+libusb_get_bus_number(libdev),
+libusb_get_device_address(libdev),
+desc.idVendor,
+desc.idProduct);
+return;
+}
+
 device = (SpiceUsbDevice*)spice_usb_device_new(libdev);
 if (!device)
 return;
@@ -1025,7 +1036,6 @@ static void 
spice_usb_device_manager_add_udev(SpiceUsbDeviceManager  *self,
 {
 SpiceUsbDeviceManagerPrivate *priv = self->priv;
 libusb_device *libdev = NULL, **dev_list = NULL;
-SpiceUsbDevice *device;
 const gchar *devtype;
 int i, bus, address;
 
@@ -1039,16 +1049,6 @@ static void 
spice_usb_device_manager_add_udev(SpiceUsbDeviceManager  *self,
 return;
 }
 
-device = spice_usb_device_manager_find_device(self, bus, address);
-if (device) {
-SPICE_DEBUG("USB device 0x%04x:0x%04x at %d.%d already exists, 
ignored",
-spice_usb_device_get_vid(device),
-spice_usb_device_get_pid(device),
-spice_usb_device_get_busnum(device),
-spice_usb_device_get_devaddr(device));
-return;
-}
-
 if (priv->coldplug_list)
 dev_list = priv->coldplug_list;
 else
-- 
2.17.1

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel