From 3045d1ca3f78a8898d680d6b015f29e6a4ca5967 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Thu, 22 Jun 2017 09:35:33 +0100 Subject: [PATCH] unifying: Do not poll when we're waiting for device replug If we happen to poll when the device is in the *process* of closing then the open() fails in a weird way. If we're flashing it's probably a good idea to not be too clever anyway... --- plugins/unifying/lu-context.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/unifying/lu-context.c b/plugins/unifying/lu-context.c index 7146ba555..49fcf71c6 100644 --- a/plugins/unifying/lu-context.c +++ b/plugins/unifying/lu-context.c @@ -403,6 +403,13 @@ static gboolean lu_context_poll_cb (gpointer user_data) { LuContext *ctx = LU_CONTEXT (user_data); + + /* do not poll when we're waiting for device replug */ + if (g_hash_table_size (ctx->hash_replug) > 0) { + g_warning ("NOT POLLING"); + return TRUE; + } + for (guint i = 0; i < ctx->devices->len; i++) { LuDevice *device = g_ptr_array_index (ctx->devices, i); g_autoptr(GError) error = NULL;