OSDN Git Service

Bluetooth: fix the HOGP device(iBUFFALO BSMBB09DS) pair and reconnect problem.
authorThomas.TT_Lin <Thomas.TT_Lin@htc.com>
Fri, 18 Jul 2014 04:10:59 +0000 (12:10 +0800)
committerMatthew Xie <mattx@google.com>
Fri, 18 Jul 2014 17:24:16 +0000 (10:24 -0700)
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: Thomas.TT_Lin <Thomas.TT_Lin@htc.com>
bta/hh/bta_hh_le.c
btif/src/btif_dm.c
stack/gap/gap_ble.c
stack/smp/smp_act.c

index 1fa3c8c..a71ee45 100644 (file)
@@ -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;
index cf43cc6..7ec5948 100644 (file)
@@ -501,31 +501,34 @@ 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){
+#if BLE_INCLUDED == TRUE
+    int device_type;
+    int addr_type;
+    bdstr_t bdstr;
+    bd2str(bd_addr, &bdstr);
+    if(btif_config_get_int("Remote", (char const *)&bdstr,"DevType", &device_type) &&
+       (btif_storage_get_remote_addr_type(bd_addr, &addr_type) == BT_STATUS_SUCCESS) &&
+       (device_type == BT_DEVICE_TYPE_BLE))
+    {
+        BTA_DmAddBleDevice(bd_addr->address, addr_type, BT_DEVICE_TYPE_BLE);
+    }
+#endif
 
-            int status;
-            status = btif_hh_connect(bd_addr);
-            if(status != BT_STATUS_SUCCESS)
-                bond_state_changed(status, bd_addr, BT_BOND_STATE_NONE);
+#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
     {
-#if BLE_INCLUDED == TRUE
-        int device_type;
-        int addr_type;
-        bdstr_t bdstr;
-        bd2str(bd_addr, &bdstr);
-        if(btif_config_get_int("Remote", (char const *)&bdstr,"DevType", &device_type) &&
-           (btif_storage_get_remote_addr_type(bd_addr, &addr_type) == BT_STATUS_SUCCESS) &&
-           (device_type == BT_DEVICE_TYPE_BLE))
-        {
-            BTA_DmAddBleDevice(bd_addr->address, addr_type, BT_DEVICE_TYPE_BLE);
-        }
-#endif
         BTA_DmBond ((UINT8 *)bd_addr->address);
     }
     /*  Track  originator of bond creation  */
index d88d2b9..78a7819 100644 (file)
@@ -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);
 
 }
 
index 04c3a80..0c2b774 100644 (file)
@@ -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))
     {