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

Commit d866e18d authored by Thomas.TT_Lin's avatar Thomas.TT_Lin Committed by Matthew Xie
Browse files

Bluetooth: fix the HOGP device(iBUFFALO BSMBB09DS) pair and reconnect problem.



in bta_hh_le.c (fix reconnect issue)
Since new LE security flags are import, (BTM_SEC_LE_AUTHENTICATED, BTM_SEC_LE_ENCRYPTED,
BTM_SEC_LE_NAME_KNOWN, BTM_SEC_LE_LINK_KEY_KNOWN, BTM_SEC_LE_LINK_KEY_AUTHED),
we have to use new BTM_GetSecurityFlagsByTransport() function with LE transport to get right sec_flag,
or will cause cannot correctly add to white list and cause reconnect fail.

in btif_dm.c (fix HOGP mouse pair issue)
the HOGP mouse will become abnormal if we update connection parameter too many times.
Therefore the is_hid case is not suitable for HOGP mouse,
it will trigger call to L2CA_EnableUpdateBleConnParams() several times due to service discovery and bonded state.
L2CA_EnableUpdateBleConnParams() update connection cause mouse abnormal.
The change will make the flow: complete bonding procedure first, then do service discovery, connect to mouse.

in gap_ble.c (fix HOGP device pair issue)
After pairing status is bonded, host start to create ATT layer to get some information from HOGP device.
If host send "disconnect" command during period. Device will stop to feedback anything.
Suggest to delete it.

in smp_act.c (fix HOGP device pair issue)
update connection parameter too many times may cause mouse abnormal,
so remove this code since this will be called again after service discovery.
Suggest to delete it.

Change-Id: I4b722343c2b08d33530bc6b928bc9ffe89fd09e9
Signed-off-by: default avatarThomas.TT_Lin <Thomas.TT_Lin@htc.com>
parent f2768e15
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2612,7 +2612,7 @@ static void bta_hh_le_add_dev_bg_conn(tBTA_HH_DEV_CB *p_cb, BOOLEAN check_bond)
    {
        /* start reconnection if remote is a bonded device */
        /* verify bond */
        BTM_GetSecurityFlags(p_cb->addr, &sec_flag);
        BTM_GetSecurityFlagsByTransport(p_cb->addr, &sec_flag, BT_TRANSPORT_LE);

        if ((sec_flag & BTM_SEC_FLAG_LKEY_KNOWN) == 0)
            to_add = FALSE;
+22 −19
Original line number Diff line number Diff line
@@ -501,19 +501,8 @@ static void btif_dm_cb_hid_remote_name(tBTM_REMOTE_DEV_NAME *p_remote_name)
static void btif_dm_cb_create_bond(bt_bdaddr_t *bd_addr)
{
    BOOLEAN is_hid = check_cod(bd_addr, COD_HID_POINTING);


    bond_state_changed(BT_STATUS_SUCCESS, bd_addr, BT_BOND_STATE_BONDING);

    if (is_hid){

            int status;
            status = btif_hh_connect(bd_addr);
            if(status != BT_STATUS_SUCCESS)
                bond_state_changed(status, bd_addr, BT_BOND_STATE_NONE);
    }
    else
    {
#if BLE_INCLUDED == TRUE
    int device_type;
    int addr_type;
@@ -526,6 +515,20 @@ static void btif_dm_cb_create_bond(bt_bdaddr_t *bd_addr)
        BTA_DmAddBleDevice(bd_addr->address, addr_type, BT_DEVICE_TYPE_BLE);
    }
#endif

#if BLE_INCLUDED == TRUE
    if(is_hid && device_type != BT_DEVICE_TYPE_BLE)
#else
    if(is_hid)
#endif
    {
        int status;
        status = btif_hh_connect(bd_addr);
        if(status != BT_STATUS_SUCCESS)
            bond_state_changed(status, bd_addr, BT_BOND_STATE_NONE);
    }
    else
    {
        BTA_DmBond ((UINT8 *)bd_addr->address);
    }
    /*  Track  originator of bond creation  */
+0 −1
Original line number Diff line number Diff line
@@ -513,7 +513,6 @@ void gap_ble_cl_op_cmpl(tGAP_CLCB *p_clcb, BOOLEAN status, UINT16 len, UINT8 *p_
            (* p_dev_name_cback)(status, p_clcb->bda, len, (char *)p_name);
    }

        GATT_Disconnect(p_clcb->conn_id);

}

+0 −1
Original line number Diff line number Diff line
@@ -908,7 +908,6 @@ void smp_pairing_cmpl(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)

    SMP_TRACE_DEBUG ("smp_pairing_cmpl ");

    (void)L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, TRUE);
    if ((p_cb->status == SMP_SUCCESS) ||
        (p_cb->status <= SMP_REPEATED_ATTEMPTS && p_cb->status != SMP_SUCCESS))
    {