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

Commit eaab0bf1 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Better CoD logging for tracking it's corruption

It looks like CoD (dev_class) value is being corrupted at time when we
receive "User Confirmation Request". This patch adds extra logging of
this value, hopefully next time CoD corruption is reported we would be
able to further pin point it's source.

Once the source of corruption is found, those logs can be safely
deleted.

Test: m -j32; observe logs for "CoD:"
Bug: 328677864
Bug: 347795501
Flag: exempt, log only change
Change-Id: I9789307ef0ad18b052708a8010266423982e82a1
parent e7bd4bc6
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -212,6 +212,7 @@ static void bta_dm_pinname_cback(const tBTM_REMOTE_DEV_NAME* p_data) {
    /* Retrieved saved device class and bd_addr */
    sec_event.cfm_req.bd_addr = bta_dm_sec_cb.pin_bd_addr;
    sec_event.cfm_req.dev_class = bta_dm_sec_cb.pin_dev_class;
    log::info("CoD: sec_event.cfm_req.dev_class = {}", dev_class_text(sec_event.cfm_req.dev_class));

    if (p_result && p_result->status == BTM_SUCCESS) {
      bd_name_copy(sec_event.cfm_req.bd_name, p_result->remote_bd_name);
@@ -439,6 +440,8 @@ static tBTM_STATUS bta_dm_sp_cback(tBTM_SP_EVT event,
           copy these values into key_notif from cfm_req */
        sec_event.key_notif.bd_addr = p_data->cfm_req.bd_addr;
        sec_event.key_notif.dev_class = p_data->cfm_req.dev_class;
        log::info("CoD: sec_event.key_notif.dev_class = {}",
                  dev_class_text(sec_event.key_notif.dev_class));
        bd_name_copy(sec_event.key_notif.bd_name, p_data->cfm_req.bd_name);
        /* Due to the switch case falling through below to BTM_SP_KEY_NOTIF_EVT,
           call remote name request using values from cfm_req */
@@ -451,6 +454,8 @@ static tBTM_STATUS bta_dm_sp_cback(tBTM_SP_EVT event,
          bta_dm_sec_cb.loc_auth_req = sec_event.cfm_req.loc_auth_req;

          bta_dm_sec_cb.pin_dev_class = p_data->cfm_req.dev_class;
          log::info("CoD: bta_dm_sec_cb.pin_dev_class = {}",
                    dev_class_text(bta_dm_sec_cb.pin_dev_class));
          {
            const tBTM_STATUS btm_status =
                get_btm_client_interface().peer.BTM_ReadRemoteDeviceName(
+3 −3
Original line number Diff line number Diff line
@@ -1057,9 +1057,9 @@ static void btif_dm_ssp_cfm_req_evt(tBTA_DM_SP_CFM_REQ* p_ssp_cfm_req) {
  bool is_incoming = !(pairing_cb.state == BT_BOND_STATE_BONDING);
  int dev_type;

  log::verbose("addr:{}, just_works:{}, loc_auth_req={}, rmt_auth_req={}",
               p_ssp_cfm_req->bd_addr, p_ssp_cfm_req->just_works,
               p_ssp_cfm_req->loc_auth_req, p_ssp_cfm_req->rmt_auth_req);
  log::info("addr:{}, CoD: {}, just_works:{}, loc_auth_req={}, rmt_auth_req={}",
            p_ssp_cfm_req->bd_addr, dev_class_text(p_ssp_cfm_req->dev_class),
            p_ssp_cfm_req->just_works, p_ssp_cfm_req->loc_auth_req, p_ssp_cfm_req->rmt_auth_req);
  /* Remote properties update */
  if (get_btm_client_interface().peer.BTM_GetPeerDeviceTypeFromFeatures(
          p_ssp_cfm_req->bd_addr) == BT_DEVICE_TYPE_DUMO) {
+7 −3
Original line number Diff line number Diff line
@@ -2683,8 +2683,9 @@ void btm_io_capabilities_req(RawAddress p) {

  btm_sec_cb.pairing_bda = evt_data.bd_addr;

  if (evt_data.bd_addr == btm_sec_cb.connecting_bda)
  if (evt_data.bd_addr == btm_sec_cb.connecting_bda) {
    p_dev_rec->dev_class = btm_sec_cb.connecting_dc;
  }

  btm_sec_cb.change_pairing_state(BTM_PAIR_STATE_WAIT_LOCAL_IOCAPS);

@@ -2807,6 +2808,7 @@ void btm_proc_sp_req_evt(tBTM_SP_EVT event, const RawAddress bda,
      (btm_sec_cb.pairing_bda == p_bda)) {
    evt_data.cfm_req.bd_addr = p_dev_rec->bd_addr;
    evt_data.cfm_req.dev_class = p_dev_rec->dev_class;
    log::info("CoD: evt_data.cfm_req.dev_class = {}", dev_class_text(evt_data.cfm_req.dev_class));
    bd_name_copy(evt_data.cfm_req.bd_name, p_dev_rec->sec_bd_name);

    switch (event) {
@@ -4471,9 +4473,11 @@ void btm_sec_pin_code_request(const RawAddress p_bda) {
  }

  /* Use the connecting device's CoD for the connection */
  if ((p_bda == p_cb->connecting_bda) &&
      (p_cb->connecting_dc != kDevClassEmpty))
  if ((p_bda == p_cb->connecting_bda) && (p_cb->connecting_dc != kDevClassEmpty)) {
    log::info("CoD: previous value {}, replaced with {}", dev_class_text(p_dev_rec->dev_class),
              dev_class_text(p_cb->connecting_dc));
    p_dev_rec->dev_class = p_cb->connecting_dc;
  }

  /* We could have started connection after asking user for the PIN code */
  if (btm_sec_cb.pin_code_len != 0) {