Skip to content

Commit

Permalink
[chip-tool] Allow to specify BLE adapter (#15078)
Browse files Browse the repository at this point in the history
chip-tool always uses hci0 adapter on Linux. Add an optional
argument: "--ble-adapter <int>" for choosing a different BLE
adapter.
  • Loading branch information
Damian-Nordic authored and pull[bot] committed Oct 6, 2023
1 parent 749c15c commit 2865369
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/chip-tool/commands/common/CHIPCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 2 additions & 0 deletions examples/chip-tool/commands/common/CHIPCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 /////////
Expand Down Expand Up @@ -106,6 +107,7 @@ class CHIPCommand : public Command
chip::FabricId CurrentCommissionerId();
std::map<std::string, std::unique_ptr<ChipDeviceCommissioner>> mCommissioners;
chip::Optional<char *> mCommissionerName;
chip::Optional<uint16_t> mBleAdapterId;

static void RunQueuedCommand(intptr_t commandArg);

Expand Down

0 comments on commit 2865369

Please sign in to comment.