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

Commit cbe60899 authored by Myles Watson's avatar Myles Watson
Browse files

BQR: Print common BQR events

Bug: 183057550
Test: Enable BQR events
Tag: #logging
Change-Id: Ibda9f7041c7f68b0bb9fff203fea556a47c12079
parent ca105918
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -716,6 +716,7 @@ cc_test {
        "test/btm/stack_btm_test.cc",
        "test/btm/stack_btm_test.cc",
        "test/common/mock_bta_dm_act.cc",
        "test/common/mock_bta_dm_act.cc",
        "test/common/mock_bta_sys_conn.cc",
        "test/common/mock_bta_sys_conn.cc",
        "test/common/mock_btif_bqr.cc",
        "test/common/mock_btif_dm.cc",
        "test/common/mock_btif_dm.cc",
        "test/common/mock_btif_storage.cc",
        "test/common/mock_btif_storage.cc",
        "test/common/mock_btu_hcif.cc",
        "test/common/mock_btu_hcif.cc",
+41 −3
Original line number Original line Diff line number Diff line
@@ -32,6 +32,7 @@
#include "bta/dm/bta_dm_int.h"
#include "bta/dm/bta_dm_int.h"
#include "bta/sys/bta_sys.h"
#include "bta/sys/bta_sys.h"
#include "btcore/include/module.h"
#include "btcore/include/module.h"
#include "btif/include/btif_bqr.h"
#include "btm_int.h"
#include "btm_int.h"
#include "btu.h"
#include "btu.h"
#include "common/message_loop_thread.h"
#include "common/message_loop_thread.h"
@@ -541,9 +542,6 @@ tBTM_STATUS BTM_RegisterForVSEvents(tBTM_VS_EVT_CB* p_cb, bool is_register) {
 *
 *
 * Description      Process event HCI_VENDOR_SPECIFIC_EVT
 * Description      Process event HCI_VENDOR_SPECIFIC_EVT
 *
 *
 *                  Note: Some controllers do not send command complete, so
 *                  the callback and busy flag are cleared here also.
 *
 * Returns          void
 * Returns          void
 *
 *
 ******************************************************************************/
 ******************************************************************************/
@@ -552,6 +550,46 @@ void btm_vendor_specific_evt(uint8_t* p, uint8_t evt_len) {


  BTM_TRACE_DEBUG("BTM Event: Vendor Specific event from controller");
  BTM_TRACE_DEBUG("BTM Event: Vendor Specific event from controller");


  // Handle BQR events
  uint8_t* bqr_ptr = p;
  uint8_t event_code;
  uint8_t len;
  STREAM_TO_UINT8(event_code, bqr_ptr);
  STREAM_TO_UINT8(len, bqr_ptr);
  // Check if there's at least a subevent code
  if (len > 1 && evt_len > 1 && event_code == HCI_VENDOR_SPECIFIC_EVT) {
    uint8_t sub_event_code;
    STREAM_TO_UINT8(sub_event_code, bqr_ptr);
    if (sub_event_code == HCI_VSE_SUBCODE_BQR_SUB_EVT) {
      // Excluding the HCI Event packet header and 1 octet sub-event code
      int16_t bqr_parameter_length = evt_len - HCIE_PREAMBLE_SIZE - 1;
      uint8_t* p_bqr_event = bqr_ptr;
      // The stream currently points to the BQR sub-event parameters
      switch (sub_event_code) {
        case bluetooth::bqr::QUALITY_REPORT_ID_LMP_LL_MESSAGE_TRACE:
          if (bqr_parameter_length >= bluetooth::bqr::kLogDumpParamTotalLen) {
            bluetooth::bqr::DumpLmpLlMessage(bqr_parameter_length, p_bqr_event);
          } else {
            LOG_INFO("Malformed LMP event of length %hd", bqr_parameter_length);
          }

          break;

        case bluetooth::bqr::QUALITY_REPORT_ID_BT_SCHEDULING_TRACE:
          if (bqr_parameter_length >= bluetooth::bqr::kLogDumpParamTotalLen) {
            bluetooth::bqr::DumpBtScheduling(bqr_parameter_length, p_bqr_event);
          } else {
            LOG_INFO("Malformed TRACE event of length %hd",
                     bqr_parameter_length);
          }
          break;

        default:
          LOG_INFO("Unhandled BQR subevent 0x%02hxx", sub_event_code);
      }
    }
  }

  for (i = 0; i < BTM_MAX_VSE_CALLBACKS; i++) {
  for (i = 0; i < BTM_MAX_VSE_CALLBACKS; i++) {
    if (btm_cb.devcb.p_vend_spec_cb[i])
    if (btm_cb.devcb.p_vend_spec_cb[i])
      (*btm_cb.devcb.p_vend_spec_cb[i])(evt_len, p);
      (*btm_cb.devcb.p_vend_spec_cb[i])(evt_len, p);
+40 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * Generated mock file from original source file
 *   Functions generated:51
 */

#include <cstdint>
#include <map>
#include <string>

extern std::map<std::string, int> mock_function_count_map;

namespace bluetooth {
namespace bqr {

void DumpLmpLlMessage(uint8_t length, uint8_t* p_event) {
  mock_function_count_map[__func__]++;
}

void DumpBtScheduling(uint8_t length, uint8_t* p_event) {
  mock_function_count_map[__func__]++;
}

}  // namespace bqr
}  // namespace bluetooth