summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2022-12-09 12:47:52 +0000
committerRichard Hughes <richard@hughsie.com>2022-12-09 12:47:52 +0000
commit5f3cb20207dd8619e7937702d5376a4bd437c05c (patch)
tree964f1e90614abbed7456df1df2182c3c7aba77f0
parentacfab41711ab8f329a656952b7da07aa3a06d7e3 (diff)
downloadgusb-5f3cb20207dd8619e7937702d5376a4bd437c05c.tar.gz
Work around a libusb1 bug which causes devices to appear in the list twice
-rw-r--r--gusb/gusb-context.c6
1 files changed, 6 insertions, 0 deletions
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);