From 56c318bf3cc9208c772c7e6d01e88380d2155c67 Mon Sep 17 00:00:00 2001 From: "tzu-hsien.huang" Date: Fri, 26 Aug 2022 11:22:03 +0200 Subject: [PATCH] Additionally check le_set_event_mask command resturn status with UNSUPPORTED_LMP_OR_LL_PARAMETER MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In GD BT stack, stack will check each return status of HCI Commands. E.g. reset , le_set_event_mask, set_event_mask …etc. In BT spec 5.2, SIG add some parameters for le_set_event_mask for le audio, like LE Terminate BIG Complete event: Supported. However, some legacy chips do not support LE Audio feature, and controller will return Status: Unsupported LMP Parameter Value when it receives this HCI Command When it checks the return value and find the status is not SUCCESS, it will cause FAIL and cannot be compatible with old legacy chip. After brushing GSI, Bluetooth will turn off automatically when it is turned on. So all CTS test will always fail. Check le_set_event_mask command return status with SUCCESS or UNSUPPORTED_LMP_OR_LL_PARAMETER Bug: 239662211 Test: CtsBluetoothTestCases Change-Id: I2b0cede7f47eecd2124a386e958773289eb6f11c --- system/gd/hci/controller.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/system/gd/hci/controller.cc b/system/gd/hci/controller.cc index da5986fcb7..8be21a20a3 100644 --- a/system/gd/hci/controller.cc +++ b/system/gd/hci/controller.cc @@ -540,7 +540,7 @@ struct Controller::impl { void le_set_event_mask(uint64_t le_event_mask) { std::unique_ptr packet = LeSetEventMaskBuilder::Create(le_event_mask); hci_->EnqueueCommand(std::move(packet), module_.GetHandler()->BindOnceOn( - this, &Controller::impl::check_status)); + this, &Controller::impl::check_event_mask_status)); } template @@ -551,6 +551,15 @@ struct Controller::impl { ASSERT(status_view.GetStatus() == ErrorCode::SUCCESS); } + template + void check_event_mask_status(CommandCompleteView view) { + ASSERT(view.IsValid()); + auto status_view = T::Create(view); + ASSERT(status_view.IsValid()); + ASSERT(status_view.GetStatus() == ErrorCode::SUCCESS || + status_view.GetStatus() == ErrorCode::UNSUPPORTED_LMP_OR_LL_PARAMETER); + } + #define OP_CODE_MAPPING(name) \ case OpCode::name: { \ uint16_t index = (uint16_t)OpCodeIndex::name; \