From 5f3cb20207dd8619e7937702d5376a4bd437c05c Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Fri, 9 Dec 2022 12:47:52 +0000 Subject: Work around a libusb1 bug which causes devices to appear in the list twice --- gusb/gusb-context.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gusb/gusb-context.c b/gusb/gusb-context.c index e7a49b4..eb85e8a 100644 --- a/gusb/gusb-context.c +++ b/gusb/gusb-context.c @@ -578,6 +578,12 @@ g_usb_context_hotplug_cb(struct libusb_context *ctx, g_assert(locker != NULL); + /* libusb is returning devices but LIBUSB_HOTPLUG_ENUMERATE is not set! */ + if (!priv->done_enumerate) { + g_debug("ignoring device as no enumerate!!"); + return 0; + } + helper = g_new0(GUsbContextIdleHelper, 1); helper->self = g_object_ref(self); helper->dev = libusb_ref_device(dev); -- cgit v1.2.1