From: Jakub Pawlowski Date: Tue, 23 Jan 2018 17:07:59 +0000 (-0800) Subject: Minor improvements in LE Create Connection handling X-Git-Tag: android-x86-9.0-r1~138^2~2^2^2^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=659e34f3435d0a5765a6859964154b442f0f7f62;p=android-x86%2Fsystem-bt.git Minor improvements in LE Create Connection handling 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 --- diff --git a/stack/btm/btm_ble_gap.cc b/stack/btm/btm_ble_gap.cc index 14cf952ec..b9d9e7d97 100644 --- a/stack/btm/btm_ble_gap.cc +++ b/stack/btm/btm_ble_gap.cc @@ -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 diff --git a/stack/btu/btu_hcif.cc b/stack/btu/btu_hcif.cc index 03e8bf8d7..a95c5ed42 100644 --- a/stack/btu/btu_hcif.cc +++ b/stack/btu/btu_hcif.cc @@ -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;