From 1ad45caeecd81ac6b646f336dc49d9ff2db253cd Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Sat, 22 Jul 2017 21:07:42 +0100 Subject: [PATCH] Use new GUsb functionality to fix flashing Unifying devices This avoids open()ing and close()ing multiple times on hotplug -- which in itself isn't a huge problem as the requests are refcounted in libusb, but it matters hugely when a plugin accidentally closes a device that was not opened. As all the devices are going to be opened anyway (to read the vendor strings) and the cost of keeping the device is open is tiny, just get libgusb to auto-open *all* devices and keep them open for the duration. Fixes: https://github.com/hughsie/fwupd/issues/155 --- src/fu-engine.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/fu-engine.c b/src/fu-engine.c index dfc0c3762..3cc36f8fa 100644 --- a/src/fu-engine.c +++ b/src/fu-engine.c @@ -2419,6 +2419,10 @@ fu_engine_load (FuEngine *self, GError **error) g_prefix_error (error, "Failed to get USB context: "); return FALSE; } +#if G_USB_CHECK_VERSION(0,2,11) + g_usb_context_set_flags (self->usb_ctx, + G_USB_CONTEXT_FLAGS_AUTO_OPEN_DEVICES); +#endif #if AS_CHECK_VERSION(0,6,13) /* load the hwids */