also skip devices with bad (0) device-address. --- gtk/win-usb-dev.c | 26 ++++++++++++++++++++++++-- 1 files changed, 24 insertions(+), 2 deletions(-) diff --git a/gtk/win-usb-dev.c b/gtk/win-usb-dev.c index bc21e08..c188807 100644 --- a/gtk/win-usb-dev.c +++ b/gtk/win-usb-dev.c @@ -94,6 +94,8 @@ static void g_udev_device_print_list(GList *l, const gchar *msg) {} #endif static void g_udev_device_print(GUdevDevice *udev, const gchar *msg); +static gboolean g_udev_skip_search(GUdevDevice *udev); + GQuark g_udev_client_error_quark(void) { return g_quark_from_static_string("win-gudev-client-error-quark"); @@ -142,13 +144,17 @@ g_udev_client_list_devices(GUdevClient *self, GList **devs, return -4; } - n = rc; - + n = 0; for (dev = lusb_list; *dev; dev++) { udevinfo = g_new0(GUdevDeviceInfo, 1); get_usb_dev_info(*dev, udevinfo); udevice = g_udev_device_new(udevinfo); + if (g_udev_skip_search(udevice)) { + g_object_unref(udevice); + continue; + } *devs = g_list_prepend(*devs, udevice); + n++; } libusb_free_device_list(lusb_list, 1); @@ -508,3 +514,19 @@ static void g_udev_device_print(GUdevDevice *udev, const gchar *msg) udevinfo->bus, udevinfo->addr, udevinfo->vid, udevinfo->pid, udevinfo->class); } + +static gboolean g_udev_skip_search(GUdevDevice *udev) +{ + GUdevDeviceInfo* udevinfo; + gboolean skip; + + g_return_val_if_fail(G_UDEV_DEVICE(udev), FALSE); + + udevinfo = udev->priv->udevinfo; + g_return_val_if_fail(udevinfo != NULL, FALSE); + + skip = ((udevinfo->addr == 0xff) || /* root hub (HCD) */ + (udevinfo->class == LIBUSB_CLASS_HUB) || /* hub*/ + (udevinfo->addr == 0)); /* bad address */ + return skip; +} -- 1.7.7.6 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel