From 46257ff36e01326985375d0baee54f67fad1d98b Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Tue, 28 Feb 2023 13:00:59 +0100 Subject: linux: Fix warning when a duplicate device appears When a kernel device appears after the Bluetooth device, we could be trying to bind the model property onto itself on the Bluetooth device. Avoid this possibility by always binding the property from the bluez device to the non-bluez device. GLib-GObject-WARNING **: 20:20:50.644: Unable to bind the same property on the same instance Fixes: 778b93a336bef ("linux: Hide duplicate Logitech Bluetooth devices") --- src/linux/up-backend.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/linux/up-backend.c b/src/linux/up-backend.c index 8853b0c..a47460e 100644 --- a/src/linux/up-backend.c +++ b/src/linux/up-backend.c @@ -155,16 +155,22 @@ update_duplicate_bluez_device (UpBackend *backend, { g_autoptr(UpDevice) other_device = NULL; UpDevice *bluez_device = NULL; + UpDevice *non_bluez_device = NULL; g_autofree char *name = NULL; g_autofree char *serial = NULL; other_device = find_duplicate_device (backend, added_device); if (!other_device) return; - bluez_device = UP_IS_DEVICE_BLUEZ (added_device) ? - added_device : other_device; + if (UP_IS_DEVICE_BLUEZ (added_device)) { + bluez_device = added_device; + non_bluez_device = other_device; + } else { + bluez_device = other_device; + non_bluez_device = added_device; + } g_object_bind_property (bluez_device, "model", - other_device, "model", + non_bluez_device, "model", G_BINDING_SYNC_CREATE); g_object_get (G_OBJECT (bluez_device), "serial", &serial, NULL); up_device_unregister (bluez_device); -- cgit v1.2.1