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

Commit bca95368 authored by Vaibhav Devmurari's avatar Vaibhav Devmurari
Browse files

Correctly restore country code info for connected BT device.

For BT Physical keyboard, when BT is restarted, country code is
not correctly restored for an already added BT device.

Connect a BT keyboard > Check country code in sysfs (say '21') >
Switch BT off then on / restart device > reconnect BT keyboard >
Check country code in sysfs (always '0').

Bug: 240257081
Test: manual
Tag: #compatibility

Change-Id: I2e12a15a8c25a18d6c388bfc00d02e47096bedb8
parent 401c603c
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -265,12 +265,12 @@ static void bta_hh_di_sdp_cback(tSDP_RESULT result) {
      /* always update information with primary DI record */
      if (SDP_GetDiRecord(1, &di_rec, bta_hh_cb.p_disc_db) == SDP_SUCCESS) {
        bta_hh_update_di_info(p_cb, di_rec.rec.vendor, di_rec.rec.product,
                              di_rec.rec.version, 0);
                              di_rec.rec.version, 0, 0);
      }

    } else /* no DI recrod available */
    {
      bta_hh_update_di_info(p_cb, BTA_HH_VENDOR_ID_INVALID, 0, 0, 0);
      bta_hh_update_di_info(p_cb, BTA_HH_VENDOR_ID_INVALID, 0, 0, 0, 0);
    }

    ret = HID_HostGetSDPRecord(p_cb->addr, bta_hh_cb.p_disc_db,
@@ -949,10 +949,11 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) {
          dev_info.status = BTA_HH_OK;

          /* update DI information */
          bta_hh_update_di_info(p_cb, p_dev_info->dscp_info.vendor_id,
                                p_dev_info->dscp_info.product_id,
                                p_dev_info->dscp_info.version,
                                p_dev_info->dscp_info.flag);
          bta_hh_update_di_info(
              p_cb, p_dev_info->dscp_info.vendor_id,
              p_dev_info->dscp_info.product_id, p_dev_info->dscp_info.version,
              p_dev_info->dscp_info.flag, p_dev_info->dscp_info.ctry_code);

          /* add to BTA device list */
          bta_hh_add_device_to_list(
              p_cb, dev_handle, p_dev_info->attr_mask,
+1 −1
Original line number Diff line number Diff line
@@ -293,7 +293,7 @@ extern void bta_hh_add_device_to_list(tBTA_HH_DEV_CB* p_cb, uint8_t handle,
                                      uint16_t min_tout, uint8_t app_id);
extern void bta_hh_update_di_info(tBTA_HH_DEV_CB* p_cb, uint16_t vendor_id,
                                  uint16_t product_id, uint16_t version,
                                  uint8_t flag);
                                  uint8_t flag, uint8_t ctry_code);
extern void bta_hh_cleanup_disable(tBTA_HH_STATUS status);

extern uint8_t bta_hh_dev_handle_to_cb_idx(uint8_t dev_handle);
+2 −1
Original line number Diff line number Diff line
@@ -2041,7 +2041,8 @@ uint8_t bta_hh_le_add_device(tBTA_HH_DEV_CB* p_cb,
  /* update DI information */
  bta_hh_update_di_info(
      p_cb, p_dev_info->dscp_info.vendor_id, p_dev_info->dscp_info.product_id,
      p_dev_info->dscp_info.version, p_dev_info->dscp_info.flag);
      p_dev_info->dscp_info.version, p_dev_info->dscp_info.flag,
      p_dev_info->dscp_info.ctry_code);

  /* add to BTA device list */
  bta_hh_add_device_to_list(
+3 −3
Original line number Diff line number Diff line
@@ -144,9 +144,8 @@ void bta_hh_clean_up_kdev(tBTA_HH_DEV_CB* p_cb) {
 *
 ******************************************************************************/
void bta_hh_update_di_info(tBTA_HH_DEV_CB* p_cb, uint16_t vendor_id,
                           uint16_t product_id, uint16_t version,
                           uint8_t flag)
{
                           uint16_t product_id, uint16_t version, uint8_t flag,
                           uint8_t ctry_code) {
#if (BTA_HH_DEBUG == TRUE)
  APPL_TRACE_DEBUG("vendor_id = 0x%2x product_id = 0x%2x version = 0x%2x",
                   vendor_id, product_id, version);
@@ -155,6 +154,7 @@ void bta_hh_update_di_info(tBTA_HH_DEV_CB* p_cb, uint16_t vendor_id,
  p_cb->dscp_info.product_id = product_id;
  p_cb->dscp_info.version = version;
  p_cb->dscp_info.flag = flag;
  p_cb->dscp_info.ctry_code = ctry_code;
}
/*******************************************************************************
 *
+3 −3
Original line number Diff line number Diff line
@@ -101,11 +101,11 @@ void bta_hh_trace_dev_db(void) {
  test::mock::bta_hh_utils::bta_hh_trace_dev_db();
}
void bta_hh_update_di_info(tBTA_HH_DEV_CB* p_cb, uint16_t vendor_id,
                           uint16_t product_id, uint16_t version,
                           uint8_t flag) {
                           uint16_t product_id, uint16_t version, uint8_t flag,
                           uint8_t ctry_code) {
  mock_function_count_map[__func__]++;
  test::mock::bta_hh_utils::bta_hh_update_di_info(p_cb, vendor_id, product_id,
                                                  version, flag);
                                                  version, flag, ctry_code);
}
// Mocked functions complete
// END mockcify generation
Loading