patches/packages/modules/Bluetooth/0001-gd-hci-Ignore-unexpected-status-events.patch
Peter Cai 6e4f421edb bluetooth: Revert utterly broken MTK patch
MTK please stop sending completely broken patches to AOSP thanks
2024-03-12 22:50:46 -04:00

44 lines
1.8 KiB
Diff

From 638bd11ae1854619a40a5abbedcfdf397e2e1f53 Mon Sep 17 00:00:00 2001
From: Peter Cai <peter@typeblog.net>
Date: Wed, 24 Aug 2022 10:41:29 -0400
Subject: [PATCH 1/3] gd: hci: Ignore unexpected status events
For some reason, on some old devices, the controller will report a
remote to support SNIFF_SUBRATING even when it does not. Just ignore the
error here (the status event comes from the failure response).
Change-Id: Ifb9a65fd77f21d15a8dc1ced9240194d38218ef6
---
system/gd/hci/hci_layer.cc | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/system/gd/hci/hci_layer.cc b/system/gd/hci/hci_layer.cc
index 0889aa69e9..0b61fd4a4a 100644
--- a/system/gd/hci/hci_layer.cc
+++ b/system/gd/hci/hci_layer.cc
@@ -213,14 +213,13 @@ struct HciLayer::impl {
command_queue_.front().GetCallback<CommandCompleteView>()->Invoke(
std::move(command_complete_view));
} else {
- ASSERT_LOG(
- command_queue_.front().waiting_for_status_ == is_status,
- "0x%02hx (%s) was not expecting %s event",
- op_code,
- OpCodeText(op_code).c_str(),
- logging_id.c_str());
-
- command_queue_.front().GetCallback<TResponse>()->Invoke(std::move(response_view));
+ if (command_queue_.front().waiting_for_status_ == is_status) {
+ command_queue_.front().GetCallback<TResponse>()->Invoke(std::move(response_view));
+ } else {
+ CommandCompleteView command_complete_view = CommandCompleteView::Create(
+ EventView::Create(PacketView<kLittleEndian>(std::make_shared<std::vector<uint8_t>>(std::vector<uint8_t>()))));
+ command_queue_.front().GetCallback<CommandCompleteView>()->Invoke(std::move(command_complete_view));
+ }
}
command_queue_.pop_front();
--
2.43.1