From 701ed7e6dbebbc2118726f203ae576df73ea5e2d Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 22 Oct 2023 05:42:15 +0200 Subject: BTManager::initializeAdapter(): Disable Privacy and reorder modes BREDR -> LE for clarity --- src/direct_bt/BTManager.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/direct_bt/BTManager.cpp b/src/direct_bt/BTManager.cpp index 1dd35be9..84520ada 100644 --- a/src/direct_bt/BTManager.cpp +++ b/src/direct_bt/BTManager.cpp @@ -257,6 +257,11 @@ HCIStatusCode BTManager::initializeAdapter(AdapterInfo& adapterInfo, const uint1 current_settings = adapterInfo.getCurrentSettingMask(); setMode(dev_id, MgmtCommand::Opcode::SET_POWERED, 0, current_settings); + { + jau::uint128_t zero_privacy_irk; + zero_privacy_irk.clear(); + setPrivacy(dev_id, 0x00, zero_privacy_irk, current_settings); + } switch ( btMode ) { case BTMode::DUAL: @@ -264,8 +269,8 @@ HCIStatusCode BTManager::initializeAdapter(AdapterInfo& adapterInfo, const uint1 setDiscoverable(dev_id, 0, 0, current_settings); setMode(dev_id, MgmtCommand::Opcode::SET_LE, 1, current_settings); if constexpr ( USE_LINUX_BT_SECURITY ) { - setMode(dev_id, MgmtCommand::Opcode::SET_SECURE_CONN, sc_on_param, current_settings); setMode(dev_id, MgmtCommand::Opcode::SET_SSP, ssp_on_param, current_settings); + setMode(dev_id, MgmtCommand::Opcode::SET_SECURE_CONN, sc_on_param, current_settings); } break; case BTMode::BREDR: @@ -273,8 +278,8 @@ HCIStatusCode BTManager::initializeAdapter(AdapterInfo& adapterInfo, const uint1 setDiscoverable(dev_id, 0, 0, current_settings); setMode(dev_id, MgmtCommand::Opcode::SET_LE, 0, current_settings); if constexpr ( USE_LINUX_BT_SECURITY ) { - setMode(dev_id, MgmtCommand::Opcode::SET_SECURE_CONN, 0, current_settings); setMode(dev_id, MgmtCommand::Opcode::SET_SSP, ssp_on_param, current_settings); + setMode(dev_id, MgmtCommand::Opcode::SET_SECURE_CONN, 0, current_settings); } break; case BTMode::NONE: @@ -283,8 +288,8 @@ HCIStatusCode BTManager::initializeAdapter(AdapterInfo& adapterInfo, const uint1 setMode(dev_id, MgmtCommand::Opcode::SET_BREDR, 0, current_settings); setMode(dev_id, MgmtCommand::Opcode::SET_LE, 1, current_settings); if constexpr ( USE_LINUX_BT_SECURITY ) { - setMode(dev_id, MgmtCommand::Opcode::SET_SECURE_CONN, sc_on_param, current_settings); setMode(dev_id, MgmtCommand::Opcode::SET_SSP, 0, current_settings); // SSP not available in LE single mode + setMode(dev_id, MgmtCommand::Opcode::SET_SECURE_CONN, sc_on_param, current_settings); } break; } @@ -294,8 +299,8 @@ HCIStatusCode BTManager::initializeAdapter(AdapterInfo& adapterInfo, const uint1 setMode(dev_id, MgmtCommand::Opcode::SET_IO_CAPABILITY, direct_bt::number(BTManager::defaultIOCapability), current_settings); setMode(dev_id, MgmtCommand::Opcode::SET_BONDABLE, 1, current_settings); // required for pairing } else { - setMode(dev_id, MgmtCommand::Opcode::SET_SECURE_CONN, 0, current_settings); setMode(dev_id, MgmtCommand::Opcode::SET_SSP, 0, current_settings); + setMode(dev_id, MgmtCommand::Opcode::SET_SECURE_CONN, 0, current_settings); setMode(dev_id, MgmtCommand::Opcode::SET_DEBUG_KEYS, 0, current_settings); setMode(dev_id, MgmtCommand::Opcode::SET_BONDABLE, 0, current_settings); } -- cgit v1.2.3