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

Commit acce2edf authored by Ying Hsu's avatar Ying Hsu Committed by Gerrit Code Review
Browse files

Merge "floss: Reset BT controller on HW error event" into main

parents 9a4cff38 dc27b22b
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -16,6 +16,10 @@

#include "hci/hci_layer.h"

#ifdef TARGET_FLOSS
#include <signal.h>
#endif

#include "common/bind.h"
#include "common/init_flags.h"
#include "common/stop_watch.h"
@@ -443,7 +447,15 @@ struct HciLayer::impl {
  void on_hardware_error(EventView event) {
    HardwareErrorView event_view = HardwareErrorView::Create(event);
    ASSERT(event_view.IsValid());
#ifdef TARGET_FLOSS
    LOG_WARN("Hardware Error Event with code 0x%02x", event_view.GetHardwareCode());
    // Sending SIGINT to process the exception from BT controller.
    // The Floss daemon will be restarted. HCI reset during restart will clear the
    // error state of the BT controller.
    kill(getpid(), SIGINT);
#else
    LOG_ALWAYS_FATAL("Hardware Error Event with code 0x%02x", event_view.GetHardwareCode());
#endif
  }

  void on_le_meta_event(EventView event) {