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

Commit 5cbfa411 authored by Chris Manton's avatar Chris Manton Committed by Gerrit Code Review
Browse files

Merge "sockets: Minor code cleanup and logging" into main

parents 01397e9c e941f67c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@
#include "include/macros.h"
#include "internal_include/bt_target.h"
#include "stack/include/bt_hdr.h"
#include "stack/include/l2cap_interface.h"
#include "stack/include/l2cap_types.h"
#include "stack/include/rfcdefs.h"
#include "types/bluetooth/uuid.h"
#include "types/raw_address.h"
+7 −10
Original line number Diff line number Diff line
@@ -1901,26 +1901,23 @@ void bta_jv_rfcomm_write(uint32_t handle, uint32_t req_id, tBTA_JV_RFC_CB* p_cb,

/* Set or free power mode profile for a JV application */
void bta_jv_set_pm_profile(uint32_t handle, tBTA_JV_PM_ID app_id, tBTA_JV_CONN_STATE init_st) {
  tBTA_JV_STATUS status;
  tBTA_JV_PM_CB* p_cb;

  log::verbose("handle=0x{:x}, app_id={}, init_st={}", handle, app_id,
               bta_jv_conn_state_text(init_st));

  /* clear PM control block */
  if (app_id == BTA_JV_PM_ID_CLEAR) {
    status = bta_jv_free_set_pm_profile_cb(handle);

    tBTA_JV_STATUS status = bta_jv_free_set_pm_profile_cb(handle);
    if (status != tBTA_JV_STATUS::SUCCESS) {
      log::warn("free pm cb failed: reason={}", bta_jv_status_text(status));
      log::warn("Unable to free a power mode profile handle:0x:{:x} app_id:{} state:{} status:{}",
                handle, app_id, init_st, bta_jv_status_text(status));
    }
  } else { /* set PM control block */
    p_cb = bta_jv_alloc_set_pm_profile_cb(handle, app_id);

    if (NULL != p_cb) {
    tBTA_JV_PM_CB* p_cb = bta_jv_alloc_set_pm_profile_cb(handle, app_id);
    if (p_cb) {
      bta_jv_pm_state_change(p_cb, init_st);
    } else {
      log::warn("failed");
      log::warn("Unable to allocate a power mode profile handle:0x:{:x} app_id:{} state:{}", handle,
                app_id, init_st);
    }
  }
}
+1 −2
Original line number Diff line number Diff line
@@ -607,12 +607,11 @@ static void on_cl_l2cap_psm_connect_l(tBTA_JV_L2CAP_OPEN* p_open, l2cap_socket*
}

static void on_l2cap_connect(tBTA_JV* p_data, uint32_t id) {
  l2cap_socket* sock;
  tBTA_JV_L2CAP_OPEN* psm_open = &p_data->l2c_open;
  tBTA_JV_L2CAP_LE_OPEN* le_open = &p_data->l2c_le_open;

  std::unique_lock<std::mutex> lock(state_lock);
  sock = btsock_l2cap_find_by_id_l(id);
  l2cap_socket* sock = btsock_l2cap_find_by_id_l(id);
  if (!sock) {
    log::error("Unable to find l2cap socket with socket_id:{}", id);
    return;
+3 −2
Original line number Diff line number Diff line
@@ -212,8 +212,9 @@ void l2c_csm_execute(tL2C_CCB* p_ccb, tL2CEVT event, void* p_data) {
  // Log all but data events
  if (event != L2CEVT_L2CAP_DATA && event != L2CEVT_L2CA_DATA_READ &&
      event != L2CEVT_L2CA_DATA_WRITE) {
    log::info("Enter CSM, chnl_state:{} [{}], event:{} [{}]", channel_state_text(p_ccb->chnl_state),
              p_ccb->chnl_state, l2c_csm_get_event_name(event), event);
    log::info("Enter CSM, chnl_state:{} [{}] event:{} lcid:0x{:04x} rcid:0x{:04x}",
              channel_state_text(p_ccb->chnl_state), p_ccb->chnl_state,
              l2c_csm_get_event_name(event), p_ccb->local_cid, p_ccb->remote_cid);
  }

  switch (p_ccb->chnl_state) {