From 7a906ba8bbea95a3b2895951e65573701457dc34 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 24 Nov 2023 08:02:20 +0100 Subject: BTAdapter::mgmtEvDeviceFoundHCI: Only unpair() shared and non-discovered device if not pre-paired Avoid losing device pairing if performed via Direct-BT in case explicit startDiscovery() purged discovered devices. --- src/direct_bt/BTAdapter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/direct_bt') diff --git a/src/direct_bt/BTAdapter.cpp b/src/direct_bt/BTAdapter.cpp index 7081d633..16e9550e 100644 --- a/src/direct_bt/BTAdapter.cpp +++ b/src/direct_bt/BTAdapter.cpp @@ -2597,7 +2597,7 @@ void BTAdapter::mgmtEvDeviceFoundHCI(const MgmtEvent& e) noexcept { printDeviceLists(); } - { + if( !dev_shared->isPrePaired() ) { HCIStatusCode res = dev_shared->unpair(); if( HCIStatusCode::SUCCESS != res && HCIStatusCode::NOT_PAIRED != res ) { WARN_PRINT("(dev_id %d): Unpair device failed: %s, %s", -- cgit v1.2.3