From f4617c531abe2cd263ce3b9ba7ba77dc5859215c Mon Sep 17 00:00:00 2001 From: Ye He Date: Wed, 26 Feb 2025 16:52:04 +0800 Subject: [PATCH] adapter: Prepend the new added device to the adapter devices list When the DUT is paired with a mobile phone using RPA multiple times, multiple device contexts with the same bdaddr will be cached. When we query the device context through bdaddr, we always get the context at the head of adapter->devices, but its status is inactive. Fixes: https://github.com/bluez/bluez/issues/1095 --- src/adapter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/adapter.c b/src/adapter.c index cbe5b1979..c0d647efd 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -5252,7 +5252,7 @@ void device_resolved_drivers(struct btd_adapter *adapter, static void adapter_add_device(struct btd_adapter *adapter, struct btd_device *device) { - adapter->devices = g_slist_append(adapter->devices, device); + adapter->devices = g_slist_prepend(adapter->devices, device); device_added_drivers(adapter, device); } -- 2.47.3