Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2627e7b authored by Yun-Hao Chung's avatar Yun-Hao Chung
Browse files

Floss: Ignore the timeout-ed HCI command instead of crash

Some old controllers are known to be non-responsive in some random
situations. Since these controllers are unlikely to get updated and
ChromeOS doesn't like crashes, this patch skips the debug info
collecting procedures on timeout and directly terminates the process.

Bug: 259344636
Tag: #floss
Test: mmm packages/modules/Bluetooth
Flag: EXEMPT, Floss-only change
Change-Id: I27fa56761521efed5d5cbdf170214bf77c70b03c
parent d4a7e3c8
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -279,6 +279,17 @@ struct HciLayer::impl {
    command_queue_.clear();
    command_queue_.clear();
    command_credits_ = 1;
    command_credits_ = 1;
    waiting_command_ = OpCode::NONE;
    waiting_command_ = OpCode::NONE;

#ifdef TARGET_FLOSS
    log::warn("Ignoring the timeouted HCI command {}.", OpCodeText(op_code));
    // Terminate the process to trigger controller reset, also mark the controller
    // is broken to prevent further error while terminating.
    auto hal = module_.GetDependency<hal::HciHal>();
    hal->markControllerBroken();
    kill(getpid(), SIGTERM);
    return;
#endif

    // Ignore the response, since we don't know what might come back.
    // Ignore the response, since we don't know what might come back.
    enqueue_command(ControllerDebugInfoBuilder::Create(),
    enqueue_command(ControllerDebugInfoBuilder::Create(),
                    module_.GetHandler()->BindOnce([](CommandCompleteView) {}));
                    module_.GetHandler()->BindOnce([](CommandCompleteView) {}));