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

Unverified Commit 1daae3e2 authored by Billy Laws's avatar Billy Laws Committed by Michael Bestas
Browse files

bluetooth: do not fatally error on unknown packet types



The bcm4356 in nx sends unknown packets, but it is not fatal if
they are not handled.

Co-authored-by: default avatarBilly Laws <blaws05@gmail.com>
Co-authored-by: default avatarThomas Makin <halorocker89@gmail.com>

Change-Id: I0db97491d8a57add810aabdb133b7c29c736dcad
parent 603fa778
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -92,6 +92,9 @@ void H4Protocol::OnPacketReady() {
    case HCI_PACKET_TYPE_ISO_DATA:
      iso_cb_(hci_packetizer_.GetPacket());
      break;
    case HCI_PACKET_TYPE_UNKNOWN:
      ALOGE("%s: Unknown packet sent", __func__);
      break;
    default:
      LOG_ALWAYS_FATAL("%s: Unimplemented packet type %d", __func__,
                       static_cast<int>(hci_packet_type_));
@@ -119,7 +122,9 @@ void H4Protocol::OnDataReady(int fd) {
      }
    }
    hci_packet_type_ = static_cast<HciPacketType>(buffer[0]);
    if (hci_packet_type_ != HCI_PACKET_TYPE_ACL_DATA &&
    if (hci_packet_type_ == HCI_PACKET_TYPE_UNKNOWN) {
        ALOGE("%s: Unknown packet sent", __func__);
    } else if (hci_packet_type_ != HCI_PACKET_TYPE_ACL_DATA &&
        hci_packet_type_ != HCI_PACKET_TYPE_SCO_DATA &&
        hci_packet_type_ != HCI_PACKET_TYPE_ISO_DATA &&
        hci_packet_type_ != HCI_PACKET_TYPE_EVENT) {
+4 −0
Original line number Diff line number Diff line
@@ -44,6 +44,10 @@ size_t MctProtocol::Send(uint8_t type, const uint8_t* data, size_t length) {
    return WriteSafely(uart_fds_[CH_CMD], data, length);
  if (type == HCI_PACKET_TYPE_ACL_DATA)
    return WriteSafely(uart_fds_[CH_ACL_OUT], data, length);
  if (type == HCI_PACKET_TYPE_UNKNOWN) {
    ALOGE("%s: Unknown packet sent", __func__);
    return 0;
  }
  LOG_ALWAYS_FATAL("%s: Unimplemented packet type = %d", __func__, type);
  return 0;
}