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

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

Use RawAddress.ToString() instead of manual conversion

Test: compilation
Change-Id: I66040a4f3d339ac0473052d916b9a0b4e3045e8e
parent cf3d2d85
Loading
Loading
Loading
Loading
+4 −10
Original line number Original line Diff line number Diff line
@@ -278,16 +278,10 @@ void bta_hh_co_open(uint8_t dev_handle, uint8_t sub_class,
        p_dev->dev_handle == dev_handle) {
        p_dev->dev_handle == dev_handle) {
      // We found a device with the same handle. Must be a device reconnected.
      // We found a device with the same handle. Must be a device reconnected.
      APPL_TRACE_WARNING(
      APPL_TRACE_WARNING(
          "%s: Found an existing device with the same handle "
          "%s: Found an existing device with the same handle dev_status=%d, "
          "dev_status = %d",
          "address=%s, attr_mask=0x%04x, sub_class=0x%02x, app_id=%d",
          __func__, p_dev->dev_status);
          __func__, p_dev->dev_status, p_dev->bd_addr.ToString().c_str(),
      APPL_TRACE_WARNING("%s:     bd_addr = [%02X:%02X:%02X:%02X:%02X:]",
          p_dev->attr_mask, p_dev->sub_class, p_dev->app_id);
                         __func__, p_dev->bd_addr.address[0],
                         p_dev->bd_addr.address[1], p_dev->bd_addr.address[2],
                         p_dev->bd_addr.address[3], p_dev->bd_addr.address[4]);
      APPL_TRACE_WARNING(
          "%s:     attr_mask = 0x%04x, sub_class = 0x%02x, app_id = %d",
          __func__, p_dev->attr_mask, p_dev->sub_class, p_dev->app_id);


      if (p_dev->fd < 0) {
      if (p_dev->fd < 0) {
        p_dev->fd = open(dev_path, O_RDWR | O_CLOEXEC);
        p_dev->fd = open(dev_path, O_RDWR | O_CLOEXEC);
+2 −4
Original line number Original line Diff line number Diff line
@@ -200,10 +200,8 @@ static void btif_hd_upstreams_evt(uint16_t event, char* p_param) {


    case BTA_HD_OPEN_EVT: {
    case BTA_HD_OPEN_EVT: {
      RawAddress* addr = (RawAddress*)&p_data->conn.bda;
      RawAddress* addr = (RawAddress*)&p_data->conn.bda;
      BTIF_TRACE_WARNING(
      BTIF_TRACE_WARNING("BTA_HD_OPEN_EVT, address=%s",
          "BTA_HD_OPEN_EVT, address (%02x:%02x:%02x:%02x:%02x:%02x)",
                         addr->ToString().c_str());
          addr->address[0], addr->address[1], addr->address[2],
          addr->address[3], addr->address[4], addr->address[5]);
      /* Check if the connection is from hid host and not hid device */
      /* Check if the connection is from hid host and not hid device */
      if (check_cod_hid(addr)) {
      if (check_cod_hid(addr)) {
        /* Incoming connection from hid device, reject it */
        /* Incoming connection from hid device, reject it */
+4 −10
Original line number Original line Diff line number Diff line
@@ -534,10 +534,6 @@ bool btif_hh_copy_hid_info(tBTA_HH_DEV_DSCP_INFO* dest,
bt_status_t btif_hh_virtual_unplug(const RawAddress* bd_addr) {
bt_status_t btif_hh_virtual_unplug(const RawAddress* bd_addr) {
  BTIF_TRACE_DEBUG("%s", __func__);
  BTIF_TRACE_DEBUG("%s", __func__);
  btif_hh_device_t* p_dev;
  btif_hh_device_t* p_dev;
  char bd_str[18];
  snprintf(bd_str, sizeof(bd_str), "%02X:%02X:%02X:%02X:%02X:%02X",
           bd_addr->address[0], bd_addr->address[1], bd_addr->address[2],
           bd_addr->address[3], bd_addr->address[4], bd_addr->address[5]);
  p_dev = btif_hh_find_dev_by_bda(*bd_addr);
  p_dev = btif_hh_find_dev_by_bda(*bd_addr);
  if ((p_dev != NULL) && (p_dev->dev_status == BTHH_CONN_STATE_CONNECTED) &&
  if ((p_dev != NULL) && (p_dev->dev_status == BTHH_CONN_STATE_CONNECTED) &&
      (p_dev->attr_mask & HID_VIRTUAL_CABLE)) {
      (p_dev->attr_mask & HID_VIRTUAL_CABLE)) {
@@ -548,7 +544,8 @@ bt_status_t btif_hh_virtual_unplug(const RawAddress* bd_addr) {
    BTA_HhSendCtrl(p_dev->dev_handle, BTA_HH_CTRL_VIRTUAL_CABLE_UNPLUG);
    BTA_HhSendCtrl(p_dev->dev_handle, BTA_HH_CTRL_VIRTUAL_CABLE_UNPLUG);
    return BT_STATUS_SUCCESS;
    return BT_STATUS_SUCCESS;
  } else {
  } else {
    BTIF_TRACE_ERROR("%s: Error, device %s not opened.", __func__, bd_str);
    BTIF_TRACE_ERROR("%s: Error, device %s not opened.", __func__,
                     bd_addr->ToString().c_str());
    return BT_STATUS_FAIL;
    return BT_STATUS_FAIL;
  }
  }
}
}
@@ -1265,17 +1262,14 @@ static bt_status_t virtual_unplug(RawAddress* bd_addr) {
  CHECK_BTHH_INIT();
  CHECK_BTHH_INIT();
  BTIF_TRACE_EVENT("BTHH: %s", __func__);
  BTIF_TRACE_EVENT("BTHH: %s", __func__);
  btif_hh_device_t* p_dev;
  btif_hh_device_t* p_dev;
  char bd_str[18];
  snprintf(bd_str, sizeof(bd_str), "%02X:%02X:%02X:%02X:%02X:%02X",
           bd_addr->address[0], bd_addr->address[1], bd_addr->address[2],
           bd_addr->address[3], bd_addr->address[4], bd_addr->address[5]);
  if (btif_hh_cb.status == BTIF_HH_DISABLED) {
  if (btif_hh_cb.status == BTIF_HH_DISABLED) {
    BTIF_TRACE_ERROR("%s: Error, HH status = %d", __func__, btif_hh_cb.status);
    BTIF_TRACE_ERROR("%s: Error, HH status = %d", __func__, btif_hh_cb.status);
    return BT_STATUS_FAIL;
    return BT_STATUS_FAIL;
  }
  }
  p_dev = btif_hh_find_dev_by_bda(*bd_addr);
  p_dev = btif_hh_find_dev_by_bda(*bd_addr);
  if (!p_dev) {
  if (!p_dev) {
    BTIF_TRACE_ERROR("%s: Error, device %s not opened.", __func__, bd_str);
    BTIF_TRACE_ERROR("%s: Error, device %s not opened.", __func__,
                     bd_addr->ToString().c_str());
    return BT_STATUS_FAIL;
    return BT_STATUS_FAIL;
  }
  }
  btif_transfer_context(btif_hh_handle_evt, BTIF_HH_VUP_REQ_EVT, (char*)bd_addr,
  btif_transfer_context(btif_hh_handle_evt, BTIF_HH_VUP_REQ_EVT, (char*)bd_addr,