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

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

Remove return value from btsnd_hcic_* functions

btsnd_hcic_* functions are always returning true, so this return value
is not really useful.

Test: unit tests pass
Change-Id: I06ced65392d180ceed565e45b7831de6aede283c
parent 611a44d2
Loading
Loading
Loading
Loading
+9 −21
Original line number Diff line number Diff line
@@ -841,8 +841,10 @@ tBTM_STATUS BTM_SetLinkPolicy (BD_ADDR remote_bda, uint16_t *settings)
        }
    }

    if ((p = btm_bda_to_acl(remote_bda, BT_TRANSPORT_BR_EDR)) != NULL)
        return(btsnd_hcic_write_policy_set (p->hci_handle, *settings) ? BTM_CMD_STARTED : BTM_NO_RESOURCES);
    if ((p = btm_bda_to_acl(remote_bda, BT_TRANSPORT_BR_EDR)) != NULL) {
        btsnd_hcic_write_policy_set(p->hci_handle, *settings);
        return BTM_CMD_STARTED;
    }

    /* If here, no BD Addr found */
    return(BTM_UNKNOWN_ADDR);
@@ -2045,7 +2047,6 @@ tBTM_STATUS BTM_ReadLinkQuality (BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb)
tBTM_STATUS BTM_ReadTxPower (BD_ADDR remote_bda, tBT_TRANSPORT transport, tBTM_CMPL_CB *p_cb)
{
    tACL_CONN   *p;
    bool        ret;
#define BTM_READ_RSSI_TYPE_CUR  0x00
#define BTM_READ_RSSI_TYPE_MAX  0X01

@@ -2070,20 +2071,14 @@ tBTM_STATUS BTM_ReadTxPower (BD_ADDR remote_bda, tBT_TRANSPORT transport, tBTM_C
        if (p->transport == BT_TRANSPORT_LE)
        {
            memcpy(btm_cb.devcb.read_tx_pwr_addr, remote_bda, BD_ADDR_LEN);
            ret = btsnd_hcic_ble_read_adv_chnl_tx_power();
            btsnd_hcic_ble_read_adv_chnl_tx_power();
        }
        else
#endif
        {
            ret = btsnd_hcic_read_tx_power (p->hci_handle, BTM_READ_RSSI_TYPE_CUR);
            btsnd_hcic_read_tx_power(p->hci_handle, BTM_READ_RSSI_TYPE_CUR);
        }
        if (!ret)
        {
            btm_cb.devcb.p_tx_power_cmpl_cb = NULL;
            alarm_cancel(btm_cb.devcb.read_tx_power_timer);
            return(BTM_NO_RESOURCES);
        }
        else

        return(BTM_CMD_STARTED);
    }

@@ -2385,7 +2380,6 @@ uint8_t BTM_SetTraceLevel (uint8_t new_level)
void btm_cont_rswitch (tACL_CONN *p, tBTM_SEC_DEV_REC *p_dev_rec,
                                     uint8_t hci_status)
{
    bool    sw_ok = true;
    BTM_TRACE_DEBUG ("btm_cont_rswitch");
    /* Check to see if encryption needs to be turned off if pending
       change of link key or role switch */
@@ -2411,14 +2405,8 @@ void btm_cont_rswitch (tACL_CONN *p, tBTM_SEC_DEV_REC *p_dev_rec,
                if (p_dev_rec)
                    p_dev_rec->rs_disc_pending = BTM_SEC_RS_PENDING;
#endif
                sw_ok = btsnd_hcic_switch_role (p->remote_addr, (uint8_t)!p->link_role);
            }
                btsnd_hcic_switch_role(p->remote_addr, (uint8_t)!p->link_role);
            }

        if (!sw_ok)
        {
            p->switch_role_state = BTM_ACL_SWKEY_STATE_IDLE;
            btm_acl_report_role_change(hci_status, p->remote_addr);
        }
    }
}
+16 −9
Original line number Diff line number Diff line
@@ -142,30 +142,37 @@ bool btm_add_dev_to_controller (bool to_add, BD_ADDR bd_addr)
    if (p_dev_rec != NULL && p_dev_rec->device_type & BT_DEVICE_TYPE_BLE) {
        if (to_add) {
            if (p_dev_rec->ble.ble_addr_type == BLE_ADDR_PUBLIC || !BTM_BLE_IS_RESOLVE_BDA(bd_addr)) {
                started = btsnd_hcic_ble_add_white_list(p_dev_rec->ble.ble_addr_type, bd_addr);
                btsnd_hcic_ble_add_white_list(p_dev_rec->ble.ble_addr_type, bd_addr);
                started = true;
                p_dev_rec->ble.in_controller_list |= BTM_WHITE_LIST_BIT;
            } else if (memcmp(p_dev_rec->ble.static_addr, bd_addr, BD_ADDR_LEN) != 0 &&
                memcmp(p_dev_rec->ble.static_addr, dummy_bda, BD_ADDR_LEN) != 0) {
                started = btsnd_hcic_ble_add_white_list(p_dev_rec->ble.static_addr_type,
                btsnd_hcic_ble_add_white_list(p_dev_rec->ble.static_addr_type,
                                              p_dev_rec->ble.static_addr);
                started = true;
                p_dev_rec->ble.in_controller_list |= BTM_WHITE_LIST_BIT;
            }
        } else {
            if (p_dev_rec->ble.ble_addr_type == BLE_ADDR_PUBLIC || !BTM_BLE_IS_RESOLVE_BDA(bd_addr))
                started = btsnd_hcic_ble_remove_from_white_list(p_dev_rec->ble.ble_addr_type, bd_addr);
            if (p_dev_rec->ble.ble_addr_type == BLE_ADDR_PUBLIC || !BTM_BLE_IS_RESOLVE_BDA(bd_addr)) {
                btsnd_hcic_ble_remove_from_white_list(p_dev_rec->ble.ble_addr_type, bd_addr);
                started = true;
            }

            if (memcmp(p_dev_rec->ble.static_addr, dummy_bda, BD_ADDR_LEN) != 0 &&
                memcmp(p_dev_rec->ble.static_addr, bd_addr, BD_ADDR_LEN) != 0)
                started = btsnd_hcic_ble_remove_from_white_list(p_dev_rec->ble.static_addr_type, p_dev_rec->ble.static_addr);
                memcmp(p_dev_rec->ble.static_addr, bd_addr, BD_ADDR_LEN) != 0) {
                btsnd_hcic_ble_remove_from_white_list(p_dev_rec->ble.static_addr_type, p_dev_rec->ble.static_addr);
                started = true;
            }

            p_dev_rec->ble.in_controller_list &= ~BTM_WHITE_LIST_BIT;
        }
    } else {
        /* not a known device, i.e. attempt to connect to device never seen before */
        uint8_t addr_type = BTM_IS_PUBLIC_BDA(bd_addr) ? BLE_ADDR_PUBLIC : BLE_ADDR_RANDOM;
        started = btsnd_hcic_ble_remove_from_white_list(addr_type, bd_addr);
        btsnd_hcic_ble_remove_from_white_list(addr_type, bd_addr);
        started = true;
        if (to_add)
            started = btsnd_hcic_ble_add_white_list(addr_type, bd_addr);
            btsnd_hcic_ble_add_white_list(addr_type, bd_addr);
    }

    return started;
+2 −1
Original line number Diff line number Diff line
@@ -805,8 +805,9 @@ bool btm_ble_resolving_list_load_dev(tBTM_SEC_DEV_REC *p_dev_rec)

                    BTM_TRACE_DEBUG("%s:adding device to controller resolving list", __func__);
                    // use identical IRK for now
                    rt = btsnd_hcic_ble_add_device_resolving_list(p_dev_rec->ble.static_addr_type,
                    btsnd_hcic_ble_add_device_resolving_list(p_dev_rec->ble.static_addr_type,
                              p_dev_rec->ble.static_addr, peer_irk, local_irk);
                    rt = true;
                }
                else
                {
+13 −22
Original line number Diff line number Diff line
@@ -2215,8 +2215,6 @@ tBTM_STATUS btm_initiate_rem_name (BD_ADDR remote_bda, tBTM_INQ_INFO *p_cur,
                                    tBTM_CMPL_CB *p_cb)
{
    tBTM_INQUIRY_VAR_ST *p_inq = &btm_cb.btm_inq_vars;
    bool                 cmd_ok;


    /*** Make sure the device is ready ***/
    if (!BTM_IsDeviceUp())
@@ -2225,12 +2223,9 @@ tBTM_STATUS btm_initiate_rem_name (BD_ADDR remote_bda, tBTM_INQ_INFO *p_cur,

    if (origin == BTM_RMT_NAME_SEC)
    {
        cmd_ok = btsnd_hcic_rmt_name_req (remote_bda, HCI_PAGE_SCAN_REP_MODE_R1,
        btsnd_hcic_rmt_name_req(remote_bda, HCI_PAGE_SCAN_REP_MODE_R1,
                                HCI_MANDATARY_PAGE_SCAN_MODE, 0);
        if (cmd_ok)
        return BTM_CMD_STARTED;
        else
            return BTM_NO_RESOURCES;
    }
    /* Make sure there are no two remote name requests from external API in progress */
    else if (origin == BTM_RMT_NAME_EXT)
@@ -2252,7 +2247,7 @@ tBTM_STATUS btm_initiate_rem_name (BD_ADDR remote_bda, tBTM_INQ_INFO *p_cur,
            /* If the database entry exists for the device, use its clock offset */
            if (p_cur)
            {
                cmd_ok = btsnd_hcic_rmt_name_req (remote_bda,
                btsnd_hcic_rmt_name_req(remote_bda,
                                        p_cur->results.page_scan_rep_mode,
                                        p_cur->results.page_scan_mode,
                                        (uint16_t)(p_cur->results.clock_offset |
@@ -2260,17 +2255,13 @@ tBTM_STATUS btm_initiate_rem_name (BD_ADDR remote_bda, tBTM_INQ_INFO *p_cur,
            }
            else /* Otherwise use defaults and mark the clock offset as invalid */
            {
                cmd_ok = btsnd_hcic_rmt_name_req (remote_bda, HCI_PAGE_SCAN_REP_MODE_R1,
                btsnd_hcic_rmt_name_req(remote_bda, HCI_PAGE_SCAN_REP_MODE_R1,
                                        HCI_MANDATARY_PAGE_SCAN_MODE, 0);
            }
            if (cmd_ok)
            {

            p_inq->remname_active = true;
            return BTM_CMD_STARTED;
        }
            else
                return BTM_NO_RESOURCES;
        }
    }
    else
    {
+5 −12
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ static tBTM_SEC_SERV_REC *btm_sec_find_mx_serv (uint8_t is_originator, uint16_t

static tBTM_STATUS btm_sec_execute_procedure (tBTM_SEC_DEV_REC *p_dev_rec);
static bool     btm_sec_start_get_name (tBTM_SEC_DEV_REC *p_dev_rec);
static bool     btm_sec_start_authentication (tBTM_SEC_DEV_REC *p_dev_rec);
static void     btm_sec_start_authentication (tBTM_SEC_DEV_REC *p_dev_rec);
static void     btm_sec_start_encryption (tBTM_SEC_DEV_REC *p_dev_rec);
static void     btm_sec_collision_timeout(void *data);
static void     btm_restore_mode(void);
@@ -1092,8 +1092,7 @@ tBTM_STATUS btm_sec_bond_by_transport (BD_ADDR bd_addr, tBT_TRANSPORT transport,
    /* If connection already exists... */
    if (p && p->hci_handle != BTM_SEC_INVALID_HANDLE)
    {
        if (!btm_sec_start_authentication (p_dev_rec))
            return(BTM_NO_RESOURCES);
        btm_sec_start_authentication(p_dev_rec);

        btm_sec_change_pairing_state (BTM_PAIR_STATE_WAIT_PIN_REQ);

@@ -5373,10 +5372,7 @@ static tBTM_STATUS btm_sec_execute_procedure (tBTM_SEC_DEV_REC *p_dev_rec)
                    | BTM_SEC_AUTHENTICATED);
        }

        if (!btm_sec_start_authentication (p_dev_rec))
        {
            return(BTM_NO_RESOURCES);
        }
        btm_sec_start_authentication(p_dev_rec);
        return(BTM_CMD_STARTED);
    }

@@ -5473,14 +5469,11 @@ static bool btm_sec_start_get_name (tBTM_SEC_DEV_REC *p_dev_rec)
**
** Description      This function is called to start authentication
**
** Returns          true if started
**
*******************************************************************************/
static bool    btm_sec_start_authentication (tBTM_SEC_DEV_REC *p_dev_rec)
static void btm_sec_start_authentication(tBTM_SEC_DEV_REC *p_dev_rec)
{
    p_dev_rec->sec_state = BTM_SEC_STATE_AUTHENTICATING;

    return(btsnd_hcic_auth_request (p_dev_rec->hci_handle));
    btsnd_hcic_auth_request(p_dev_rec->hci_handle);
}

/*******************************************************************************
Loading