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

Commit 902c1dad authored by Arman Uguray's avatar Arman Uguray
Browse files

gn-build: Get HCI and net_test_hci to compile

This CL fixes the HCI module so that the HCI static library and the net_test_hci
unit test can be compiled using GN + ninja.

BUG=21339022,21444689

Change-Id: If3d8649b25297880e5e674a2026badb1b0e01fee
parent 06548c27
Loading
Loading
Loading
Loading
+3 −11
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ static_library("hci") {
}

executable("net_test_hci") {
  testonly = true
  sources = [
    "//osi/test/AllocationTestHarness.cpp",
    "//osi/test/AlarmTestHarness.cpp",
@@ -54,19 +55,14 @@ executable("net_test_hci") {
    "test/packet_fragmenter_test.cpp",
  ]

  sources += [ "//main/stack_config.c" ]

  include_dirs = [
    "include",
    "//",
    "//include",
    "//btcore/include",
    "//gki/common",
    "//gki/ulinux",
    "//hci/include",
    "//osi/include",
    "//osi/test",
    "//stack/include",
    "//utils/include",
  ]

  cflags = [
@@ -77,11 +73,7 @@ executable("net_test_hci") {
    "//hci",
    "//osi",
    "//btcore",
  ]

  deps += [
    "//gki",
    "//device",
    "//third_party/gtest:gtest_main",
  ]

  libs = [ "-lpthread", "-lrt", "-ldl" ]
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
#include <sys/prctl.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>

#include "osi/include/osi.h"
#include "osi/include/log.h"
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <assert.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>

#include "osi/include/eager_reader.h"
#include "hci_hal.h"
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <assert.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>

#include "bt_vendor_lib.h"
#include "osi/include/eager_reader.h"
+17 −2
Original line number Diff line number Diff line
@@ -19,11 +19,19 @@
#define LOG_TAG "bt_hci"

#include <assert.h>
#include <cutils/properties.h>
#include <pthread.h>
#include <string.h>
#include <signal.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>

// TODO(armansito): cutils/properties.h is only being used to pull-in runtime
// settings on Android. Remove this conditional include once we have a generic
// way to obtain system properties.
#if !defined(OS_GENERIC)
#include <cutils/properties.h>
#endif  // !defined(OS_GENERIC)

#include "buffer_allocator.h"
#include "btsnoop.h"
@@ -175,12 +183,19 @@ static future_t *start_up(void) {

  pthread_mutex_init(&commands_pending_response_lock, NULL);

  // TODO(armansito): cutils/properties.h is only being used to pull-in runtime
  // settings on Android. Remove this conditional include once we have a generic
  // way to obtain system properties. For now, always use the default timeout on
  // non-Android builds.
  period_ms_t startup_timeout_ms = DEFAULT_STARTUP_TIMEOUT_MS;

#if !defined(OS_GENERIC)
  // Grab the override startup timeout ms, if present.
  period_ms_t startup_timeout_ms;
  char timeout_prop[PROPERTY_VALUE_MAX];
  if (!property_get("bluetooth.enable_timeout_ms", timeout_prop, STRING_VALUE_OF(DEFAULT_STARTUP_TIMEOUT_MS))
      || (startup_timeout_ms = atoi(timeout_prop)) < 100)
    startup_timeout_ms = DEFAULT_STARTUP_TIMEOUT_MS;
#endif  // !defined(OS_GENERIC)

  startup_timer = non_repeating_timer_new(startup_timeout_ms, startup_timer_expired, NULL);
  if (!startup_timer) {