From 9e755e2a5c38299ddf98a1a3a1443c590093348f Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Mon, 6 Apr 2020 18:42:48 +0100 Subject: [PATCH] logitech-hidpp: Do not add peripheral devices for receiver in BL mode This should fix flashing firmware when there are >= 2 receivers plugged in. Fixes https://github.com/fwupd/fwupd/issues/1951 --- .../logitech-hidpp/fu-logitech-hidpp-peripheral.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/logitech-hidpp/fu-logitech-hidpp-peripheral.c b/plugins/logitech-hidpp/fu-logitech-hidpp-peripheral.c index 08c65ad55..019a1e74e 100644 --- a/plugins/logitech-hidpp/fu-logitech-hidpp-peripheral.c +++ b/plugins/logitech-hidpp/fu-logitech-hidpp-peripheral.c @@ -163,7 +163,8 @@ fu_logitech_hidpp_peripheral_ping (FuLogitechHidPpPeripheral *self, GError **err fu_logitech_hidpp_peripheral_refresh_updatable (self); /* if the HID++ ID is unset, grab it from the reply */ - if (self->hidpp_id == HIDPP_DEVICE_ID_UNSET) { + if (self->hidpp_id == HIDPP_DEVICE_ID_UNSET && + msg->device_id != HIDPP_DEVICE_ID_UNSET) { self->hidpp_id = msg->device_id; g_debug ("HID++ ID is %02x", self->hidpp_id); } @@ -504,6 +505,15 @@ fu_logitech_hidpp_peripheral_setup (FuDevice *device, GError **error) if (!fu_logitech_hidpp_peripheral_ping (self, error)) return FALSE; + /* did not get ID */ + if (self->hidpp_id == HIDPP_DEVICE_ID_UNSET) { + g_set_error_literal (error, + G_IO_ERROR, + G_IO_ERROR_FAILED, + "no HID++ ID"); + return FALSE; + } + /* add known root for HID++2.0 */ g_ptr_array_set_size (self->feature_index, 0); if (self->hidpp_version >= 2.f) {