From 2372685972504e436f0cacedab5c1b995f4b1311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kr=C3=B3lik?= <66667989+Damian-Nordic@users.noreply.github.com> Date: Fri, 11 Feb 2022 20:21:49 +0100 Subject: [PATCH] [chip-tool] Allow to specify BLE adapter (#15078) chip-tool always uses hci0 adapter on Linux. Add an optional argument: "--ble-adapter " for choosing a different BLE adapter. --- examples/chip-tool/commands/common/CHIPCommand.cpp | 2 +- examples/chip-tool/commands/common/CHIPCommand.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/chip-tool/commands/common/CHIPCommand.cpp b/examples/chip-tool/commands/common/CHIPCommand.cpp index 0bdcacfbc22730..7c074249396d60 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.cpp +++ b/examples/chip-tool/commands/common/CHIPCommand.cpp @@ -41,7 +41,7 @@ CHIP_ERROR CHIPCommand::Run() #if CHIP_DEVICE_LAYER_TARGET_LINUX && CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE // By default, Linux device is configured as a BLE peripheral while the controller needs a BLE central. - ReturnLogErrorOnFailure(chip::DeviceLayer::Internal::BLEMgrImpl().ConfigureBle(0, true)); + ReturnLogErrorOnFailure(chip::DeviceLayer::Internal::BLEMgrImpl().ConfigureBle(mBleAdapterId.ValueOr(0), true)); #endif ReturnLogErrorOnFailure(mDefaultStorage.Init()); diff --git a/examples/chip-tool/commands/common/CHIPCommand.h b/examples/chip-tool/commands/common/CHIPCommand.h index 85f7f5d7b30c0a..1cd1ac25aa0731 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.h +++ b/examples/chip-tool/commands/common/CHIPCommand.h @@ -60,6 +60,7 @@ class CHIPCommand : public Command AddArgument("trace_file", &mTraceFile); AddArgument("trace_log", 0, 1, &mTraceLog); #endif // CHIP_CONFIG_TRANSPORT_TRACE_ENABLED + AddArgument("ble-adapter", 0, UINT64_MAX, &mBleAdapterId); } /////////// Command Interface ///////// @@ -106,6 +107,7 @@ class CHIPCommand : public Command chip::FabricId CurrentCommissionerId(); std::map> mCommissioners; chip::Optional mCommissionerName; + chip::Optional mBleAdapterId; static void RunQueuedCommand(intptr_t commandArg);