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

Commit 742b8de7 authored by Himanshu Rawat's avatar Himanshu Rawat Committed by Gerrit Code Review
Browse files

Merge changes I574f3346,I5142beb6 into main

* changes:
  HidHost: Initialize HID DB version
  HidHost: Do not reject first outgoing connection attempt
parents 1bb40fcc dc5ba2f4
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -501,13 +501,24 @@ static void hh_open_handler(tBTA_HH_CONN& conn) {
    // Use current state if the device instance already exists
    btif_hh_device_t* p_dev = btif_hh_find_dev_by_link_spec(conn.link_spec);
    if (p_dev != nullptr) {
      log::debug("Device instance found: {}, state: {}",
                 p_dev->link_spec.ToRedactedStringForLogging(),
                 bthh_connection_state_text(p_dev->dev_status));
      dev_status = p_dev->dev_status;
    }

    if (btif_hh_cb.pending_link_spec == conn.link_spec) {
      log::verbose("Device connection was pending for: {}, status: {}",
                   conn.link_spec.ToRedactedStringForLogging(),
                   btif_hh_status_text(btif_hh_cb.status));
      dev_status = BTHH_CONN_STATE_CONNECTING;
    }

    if (dev_status != BTHH_CONN_STATE_ACCEPTING &&
        dev_status != BTHH_CONN_STATE_CONNECTING) {
      log::warn("Reject Incoming HID Connection, device: {}, state: {}",
                conn.link_spec.ToRedactedStringForLogging(), dev_status);
                conn.link_spec.ToRedactedStringForLogging(),
                bthh_connection_state_text(dev_status));

      if (p_dev != nullptr) {
        p_dev->dev_status = BTHH_CONN_STATE_DISCONNECTED;
+2 −2
Original line number Diff line number Diff line
@@ -339,7 +339,7 @@ bt_status_t btif_storage_remove_hid_info(const tAclLinkSpec& link_spec) {
  btif_config_remove(bdstr, BTIF_STORAGE_KEY_HID_RECONNECT_ALLOWED);

  if (IS_FLAG_ENABLED(allow_switching_hid_and_hogp)) {
    int db_version;
    int db_version = 0;
    btif_config_get_int(bdstr, BTIF_STORAGE_KEY_HID_DB_VERSION, &db_version);
    if (db_version == STORAGE_HID_DB_VERSION) {
      btif_config_remove(bdstr, BTIF_STORAGE_KEY_HOGP_ATTR_MASK);
@@ -350,9 +350,9 @@ bt_status_t btif_storage_remove_hid_info(const tAclLinkSpec& link_spec) {
      btif_config_remove(bdstr, BTIF_STORAGE_KEY_HOGP_VERSION);
      btif_config_remove(bdstr, BTIF_STORAGE_KEY_HOGP_COUNTRY_CODE);
      btif_config_remove(bdstr, BTIF_STORAGE_KEY_HOGP_DESCRIPTOR);
      btif_config_remove(bdstr, BTIF_STORAGE_KEY_HID_DB_VERSION);
      btif_config_remove(bdstr, BTIF_STORAGE_KEY_HOGP_RECONNECT_ALLOWED);
    }
    btif_config_remove(bdstr, BTIF_STORAGE_KEY_HID_DB_VERSION);
  }
  return BT_STATUS_SUCCESS;
}