From 1d94edb24168dfe2a4cdd959aea4999c32010d8a Mon Sep 17 00:00:00 2001 From: hmz007 Date: Tue, 22 Apr 2025 18:13:21 +0800 Subject: [PATCH] Bluetooth: add support to ignore HCI reset timeout Signed-off-by: hmz007 --- packages/modules/Bluetooth/system/gd/hci/hci_layer.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/modules/Bluetooth/system/gd/hci/hci_layer.cc b/packages/modules/Bluetooth/system/gd/hci/hci_layer.cc index c3312a557ce..e937e573503 100644 --- a/packages/modules/Bluetooth/system/gd/hci/hci_layer.cc +++ b/packages/modules/Bluetooth/system/gd/hci/hci_layer.cc @@ -23,6 +23,7 @@ #include "os/alarm.h" #include "os/metrics.h" #include "os/queue.h" +#include "os/system_properties.h" #include "packet/packet_builder.h" #include "storage/storage_module.h" @@ -230,6 +231,11 @@ struct HciLayer::impl { } void on_hci_timeout(OpCode op_code) { + if (op_code == OpCode::RESET && ignore_reset_timeout_) { + LOG_WARN("Ignoring timeout for HCI Reset"); + return; + } + common::StopWatch::DumpStopWatchLog(); LOG_ERROR("Timed out waiting for 0x%02hx (%s)", op_code, OpCodeText(op_code).c_str()); // TODO: LogMetricHciTimeoutEvent(static_cast(op_code)); @@ -432,6 +438,7 @@ struct HciLayer::impl { uint8_t command_credits_{1}; // Send reset first Alarm* hci_timeout_alarm_{nullptr}; Alarm* hci_abort_alarm_{nullptr}; + const bool ignore_reset_timeout_ = !os::GetSystemPropertyBool("persist.bluetooth.hci.reset_timeout", true); // Acl packets BidiQueue acl_queue_{3 /* TODO: Set queue depth */};