OSDN Git Service

Minor improvements in LE Create Connection handling
authorJakub Pawlowski <jpawlowski@google.com>
Tue, 23 Jan 2018 17:07:59 +0000 (09:07 -0800)
committerJakub Pawlowski <jpawlowski@google.com>
Wed, 24 Jan 2018 01:18:13 +0000 (01:18 +0000)
1. According to spec, controller should never send "Command Complete" event
after "LE Create Connection" or "LE Extened Create Connection" command.
Add error message in such case.

2. Parse Comand Status for LE Enhanced Create Connection.

3. Fix NPE in btm_ble_update_mode_operation, when called from
btm_ble_create_ll_conn_complete.

Test: Bond/unbond with few LE devices while connected.
Change-Id: Ic135d9a8d096634afe33997afb42d054237598c2

stack/btm/btm_ble_gap.cc
stack/btu/btu_hcif.cc

index 14cf952..b9d9e7d 100644 (file)
@@ -2569,7 +2569,7 @@ void btm_ble_update_mode_operation(uint8_t link_role, const RawAddress* bd_addr,
 
   /* in case of disconnected, we must cancel bgconn and restart
      in order to add back device to white list in order to reconnect */
-  btm_ble_bgconn_cancel_if_disconnected(*bd_addr);
+  if (bd_addr) btm_ble_bgconn_cancel_if_disconnected(*bd_addr);
 
   /* when no connection is attempted, and controller is not rejecting last
      request
index 03e8bf8..a95c5ed 100644 (file)
@@ -968,7 +968,9 @@ static void btu_hcif_hdl_command_complete(uint16_t opcode, uint8_t* p,
       break;
 
     case HCI_BLE_CREATE_LL_CONN:
-      btm_ble_create_ll_conn_complete(*p);
+    case HCI_LE_EXTENDED_CREATE_CONNECTION:
+      // No command complete event for those commands according to spec
+      LOG(ERROR) << "No command complete expected, but received!";
       break;
 
     case HCI_BLE_TRANSMITTER_TEST:
@@ -1143,6 +1145,7 @@ static void btu_hcif_hdl_command_status(uint16_t opcode, uint8_t status,
             break;
 
           case HCI_BLE_CREATE_LL_CONN:
+          case HCI_LE_EXTENDED_CREATE_CONNECTION:
             btm_ble_create_ll_conn_complete(status);
             break;