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

Commit 4cf8974c authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes I7cc676cb,Ib2a58823,I2795f034,I5bb782f3,I6311bd6d, ...

* changes:
  Add polling thread pid to hid control block
  Streamline stack/acl/btm_acl::BTM_SetLinkSuperTout
  Canonically include crypto in stack/gatt/gatt_sr_hash
  Canonically include stack/gatt::
  Include gd/hal/hci_hal_host::<netinet/in.h>
  Remove useless #def BTM_LE_BR_KEYS_REQ_EVT
parents 02601994 9a9c626e
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -229,7 +229,6 @@ static inline pthread_t create_thread(void* (*start_routine)(void*),
 ******************************************************************************/
static void* btif_hh_poll_event_thread(void* arg) {
  btif_hh_device_t* p_dev = (btif_hh_device_t*)arg;
  APPL_TRACE_DEBUG("%s: Thread created fd = %d", __func__, p_dev->fd);
  struct pollfd pfds[1];

  // This thread is created by bt_main_thread with RT priority. Lower the thread
@@ -241,7 +240,10 @@ static void* btif_hh_poll_event_thread(void* arg) {
    p_dev->hh_poll_thread_id = -1;
    return 0;
  }
  p_dev->pid = gettid();
  pthread_setname_np(pthread_self(), BT_HH_THREAD);
  LOG_DEBUG("Host hid polling thread created name:%s pid:%d fd:%d",
            BT_HH_THREAD, p_dev->pid, p_dev->fd);

  pfds[0].fd = p_dev->fd;
  pfds[0].events = POLLIN;
@@ -265,6 +267,7 @@ static void* btif_hh_poll_event_thread(void* arg) {
  }

  p_dev->hh_poll_thread_id = -1;
  p_dev->pid = -1;
  return 0;
}

+2 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ inline std::string btif_hh_status_text(const BTIF_HH_STATUS& status) {
}
#undef CASE_RETURN_TEXT

// Shared with uhid polling thread
typedef struct {
  bthh_connection_state_t dev_status;
  uint8_t dev_handle;
@@ -85,6 +86,7 @@ typedef struct {
  int fd;
  bool ready_for_data;
  pthread_t hh_poll_thread_id;
  pid_t pid{-1};
  uint8_t hh_keep_polling;
  alarm_t* vup_timer;
  fixed_queue_t* get_rpt_id_queue;
+1 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include "hal/hci_hal_host.h"

#include <netdb.h>
#include <netinet/in.h>
#include <poll.h>
#include <sys/socket.h>
#include <sys/types.h>
+20 −23
Original line number Diff line number Diff line
@@ -1138,31 +1138,28 @@ tBTM_STATUS BTM_GetLinkSuperTout(const RawAddress& remote_bda,
 ******************************************************************************/
tBTM_STATUS BTM_SetLinkSuperTout(const RawAddress& remote_bda,
                                 uint16_t timeout) {
  tACL_CONN* p = internal_.btm_bda_to_acl(remote_bda, BT_TRANSPORT_BR_EDR);
  if (p != (tACL_CONN*)NULL) {
    p->link_super_tout = timeout;
  tACL_CONN* p_acl = internal_.btm_bda_to_acl(remote_bda, BT_TRANSPORT_BR_EDR);
  if (p_acl == nullptr) {
    LOG_WARN("Unable to find active acl");
    return BTM_UNKNOWN_ADDR;
  }

  /* Only send if current role is Central; 2.0 spec requires this */
    if (p->link_role == HCI_ROLE_CENTRAL) {
      LOG_DEBUG("Setting supervison timeout:%.2fms bd_addr:%s",
  if (p_acl->link_role == HCI_ROLE_CENTRAL) {
    p_acl->link_super_tout = timeout;
    btsnd_hcic_write_link_super_tout(LOCAL_BR_EDR_CONTROLLER_ID,
                                     p_acl->hci_handle, timeout);
    LOG_DEBUG("Set supervision timeout:%.2fms bd_addr:%s",
              supervision_timeout_to_seconds(timeout),
              PRIVATE_ADDRESS(remote_bda));

      btsnd_hcic_write_link_super_tout(LOCAL_BR_EDR_CONTROLLER_ID,
                                       p->hci_handle, timeout);
      return (BTM_CMD_STARTED);
    return BTM_CMD_STARTED;
  } else {
    LOG_WARN(
          "Role is peripheral so unable to set supervison timeout:%.2fms "
        "Role is peripheral so unable to set supervision timeout:%.2fms "
        "bd_addr:%s",
        supervision_timeout_to_seconds(timeout), PRIVATE_ADDRESS(remote_bda));
      return (BTM_SUCCESS);
    }
    return BTM_SUCCESS;
  }
  LOG_WARN("Unable to find active acl");

  /* If here, no BD Addr found */
  return (BTM_UNKNOWN_ADDR);
}

bool BTM_IsAclConnectionUp(const RawAddress& remote_bda,
+1 −1
Original line number Diff line number Diff line
@@ -27,12 +27,12 @@
#include <string.h>
#include "bt_common.h"

#include "btm_int.h"
#include "gatt_api.h"
#include "gatt_int.h"
#include "osi/include/osi.h"
#include "stack/btm/btm_ble_int.h"
#include "stack/btm/btm_ble_int_types.h"
#include "stack/btm/btm_int.h"
#include "stack/btm/btm_sec.h"

using base::StringPrintf;
Loading