From a1d9e0e6f0c5df8fc962021527cb6e2cdde60638 Mon Sep 17 00:00:00 2001 From: Jun Zhang Date: Tue, 11 Feb 2025 19:45:51 +0800 Subject: [PATCH 2/4] bluez: fix repeatedly connect and disconnect BT: connect failed do not remove device [1/1] PD#SWPL-148149 Problem: pair failed ,scan list device is none. Solution: connect failed do not remove device Verify: t5w Change-Id: Ieff3d59faad9f051d8e21ea9acfca032667c2dbe Signed-off-by: hong.wang BT:fix reboot rcu can not reconnect.[1/1] PD#SWPL-89256 Problem: reboot rcu can not reconnect Solution: set undriect adv reconnect. Verify: AM301 Change-Id: I6589428614105b0f2b263238eca5da8e8956c9fa BT: fix repeatedly connect disconnect error [1/1] PD#SWPL-88448 Problem: 1. default auto-connect is ALWAYS_CONNECT, would connect RC when RC reenter paring mode and send ADV_IND broadcast. 2. bluez will do nothing when auth fail disconnection received. Solution: 1. Change to DIRECT_IND only. 2. remove bonding after auth fail disconnection. Verify: AP222 Change-Id: Ifc487b46b9da01f3e04edab7b06abc9de1a3ac7b Signed-off-by: Weiguang Ruan --- src/adapter.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/adapter.c b/src/adapter.c index b159d21..e5a5222 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -8155,6 +8155,14 @@ static void dev_disconnected(struct btd_adapter *adapter, if (device) { adapter_remove_connection(adapter, device, addr->type); disconnect_notify(device, reason); + DBG("device found, checking reason and addr type"); + if (reason == 4 //mgmt auth failure + && addr->type != BDADDR_BREDR + && device_is_paired(device, addr->type)) { + DBG("BLE device and auth failure, remove device"); + btd_adapter_remove_device(adapter, device); + } + } bonding_attempt_complete(adapter, &addr->bdaddr, addr->type, @@ -9326,9 +9334,11 @@ static void connect_failed_callback(uint16_t index, uint16_t length, /* In the case the bonding was canceled or did exists, remove the device * when it is temporary. */ +/* if (device && !device_is_bonding(device, NULL) && device_is_temporary(device)) btd_adapter_remove_device(adapter, device); +*/ } static void remove_keys(struct btd_adapter *adapter, -- 2.25.1