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

Commit 51a0eb21 authored by Jacky Cheung's avatar Jacky Cheung Committed by Andre Eisenbach
Browse files

Add BT_HCI_TIMEOUT and BT_CONFIG_SOURCE log events.

These events are used to track HCI timeout and configuration file
usage respectively.

Change-Id: I5c8b6ef20b61f03b9ccb74f3b1c9784e4653b770
parent 5ab506a4
Loading
Loading
Loading
Loading

EventLogTags.logtags

0 → 100644
+37 −0
Original line number Diff line number Diff line
# The entries in this file map a sparse set of log tag numbers to tag names.
# This is installed on the device, in /system/etc, and parsed by logcat.
#
# Tag numbers are decimal integers, from 0 to 2^31.  (Let's leave the
# negative values alone for now.)
#
# Tag names are one or more ASCII letters and numbers or underscores, i.e.
# "[A-Z][a-z][0-9]_".  Do not include spaces or punctuation (the former
# impacts log readability, the latter makes regex searches more annoying).
#
# Tag numbers and names are separated by whitespace.  Blank lines and lines
# starting with '#' are ignored.
#
# Optionally, after the tag names can be put a description for the value(s)
# of the tag. Description are in the format
#    (<name>|data type[|data unit])
# Multiple values are separated by commas.
#
# The data type is a number from the following values:
# 1: int
# 2: long
# 3: string
# 4: list
#
# The data unit is a number taken from the following list:
# 1: Number of objects
# 2: Number of bytes
# 3: Number of milliseconds
# 4: Number of allocations
# 5: Id
# 6: Percent
# Default value for data of type int/long is 2 (bytes).
#
# TODO: generate ".java" and ".h" files with integer constants from this file.

1010000 bt_hci_timeout (opcode|1)
1010001 bt_config_source (opcode|1)
+2 −1
Original line number Diff line number Diff line
@@ -23,7 +23,8 @@ LOCAL_PATH := $(call my-dir)

# HAL layer
btifCommonSrc := \
  src/bluetooth.c
  src/bluetooth.c \
  ../../EventLogTags.logtags

# BTIF implementation
btifCommonSrc += \
+4 −0
Original line number Diff line number Diff line
@@ -52,6 +52,8 @@
#include <cutils/properties.h>
#endif  /* !defined(OS_GENERIC) */

#define BT_CONFIG_SOURCE_TAG_NUM 1010001

#define INFO_SECTION "Info"
#define FILE_TIMESTAMP "TimeCreated"
#define FILE_SOURCE "FileSource"
@@ -199,6 +201,8 @@ static future_t *init(void) {
    goto error;
  }

  LOG_EVENT_INT(BT_CONFIG_SOURCE_TAG_NUM, btif_config_source);

  pthread_mutex_unlock(&lock);
  return future_new_immediate(FUTURE_SUCCESS);

+2 −1
Original line number Diff line number Diff line
@@ -19,7 +19,8 @@ LOCAL_SRC_FILES := \
    src/hci_packet_parser.c \
    src/low_power_manager.c \
    src/packet_fragmenter.c \
    src/vendor.c
    src/vendor.c \
    ../../EventLogTags.logtags

LOCAL_C_INCLUDES += \
    $(LOCAL_PATH)/include \
+3 −0
Original line number Diff line number Diff line
@@ -55,6 +55,8 @@ bt_bdaddr_t btif_local_bd_addr;
#define PREAMBLE_BUFFER_SIZE 4 // max preamble size, ACL
#define RETRIEVE_ACL_LENGTH(preamble) ((((preamble)[3]) << 8) | (preamble)[2])

#define BT_HCI_TIMEOUT_TAG_NUM 1010000

static const uint8_t preamble_sizes[] = {
  HCI_COMMAND_PREAMBLE_SIZE,
  HCI_ACL_PREAMBLE_SIZE,
@@ -534,6 +536,7 @@ static void command_timed_out(UNUSED_ATTR void *context) {
    // We shouldn't try to recover the stack from this command timeout.
    // If it's caused by a software bug, fix it. If it's a hardware bug, fix it.
    LOG_ERROR(LOG_TAG, "%s hci layer timeout waiting for response to a command. opcode: 0x%x", __func__, wait_entry->opcode);
    LOG_EVENT_INT(BT_HCI_TIMEOUT_TAG_NUM, wait_entry->opcode);
  }

  LOG_ERROR(LOG_TAG, "%s restarting the bluetooth process.", __func__);