Skip to content

Commit

Permalink
Merge branch 'NimBLE/fix_esp_nimble_hci_delay_v4.0' into 'release/v4.0'
Browse files Browse the repository at this point in the history
NimBLE: Misc changes in NimBLE porting layer and menuconfig option (Backport v4.0)

See merge request espressif/esp-idf!6321
  • Loading branch information
mahavirj committed Oct 18, 2019
2 parents 2cde888 + 6a60c4a commit 57a13b0
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
9 changes: 9 additions & 0 deletions components/bt/host/nimble/Kconfig.in
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ config BT_NIMBLE_DEBUG
help
This enables extra runtime asserts and host debugging

config BT_NIMBLE_SM_SC_DEBUG_KEYS
bool "Use predefined public-private key pair"
default n
depends on BT_NIMBLE_SM_SC
help
If this option is enabled, SM uses predefined DH key pair as described
in Core Specification, Vol. 3, Part H, 2.3.5.6.1. This allows to
decrypt air traffic easily and thus should only be used for debugging.

config BT_NIMBLE_SVC_GAP_DEVICE_NAME
string "BLE GAP default device name"
depends on BT_NIMBLE_ENABLED
Expand Down
11 changes: 8 additions & 3 deletions components/bt/host/nimble/esp-hci/src/esp_nimble_hci.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ static os_membuf_t ble_hci_evt_lo_buf[
MYNEWT_VAL(BLE_HCI_EVT_BUF_SIZE))
];

const static char *TAG = "NimBLE";

void ble_hci_trans_cfg_hs(ble_hci_trans_rx_cmd_fn *cmd_cb,
void *cmd_arg,
ble_hci_trans_rx_acl_fn *acl_cb,
Expand All @@ -85,7 +87,9 @@ int ble_hci_trans_hs_cmd_tx(uint8_t *cmd)
assert(cmd != NULL);
*cmd = BLE_HCI_UART_H4_CMD;
len = BLE_HCI_CMD_HDR_LEN + cmd[3] + 1;
while (!esp_vhci_host_check_send_available()) {
if (!esp_vhci_host_check_send_available()) {
ESP_LOGE(TAG, "Controller not ready to receive packets from host at this time, try again after sometime");
return BLE_HS_EAGAIN;
}
esp_vhci_host_send_packet(cmd, len);

Expand Down Expand Up @@ -115,8 +119,9 @@ int ble_hci_trans_hs_acl_tx(struct os_mbuf *om)
data[0] = BLE_HCI_UART_H4_ACL;
len++;

while (!esp_vhci_host_check_send_available()) {
vTaskDelay(1000 / portTICK_PERIOD_MS);
if (!esp_vhci_host_check_send_available()) {
ESP_LOGE(TAG, "Controller not ready to receive packets from host at this time, try again after sometime");
return BLE_HS_EAGAIN;
}

os_mbuf_copydata(om, 0, OS_MBUF_PKTLEN(om), &data[1]);
Expand Down
8 changes: 8 additions & 0 deletions components/bt/host/nimble/port/include/esp_nimble_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,14 @@
#endif
#endif

#ifndef MYNEWT_VAL_BLE_SM_SC_DEBUG_KEYS
#ifdef CONFIG_BT_NIMBLE_SM_SC_DEBUG_KEYS
#define MYNEWT_VAL_BLE_SM_SC_DEBUG_KEYS (1)
#else
#define MYNEWT_VAL_BLE_SM_SC_DEBUG_KEYS (0)
#endif
#endif

#ifndef MYNEWT_VAL_BLE_HS_AUTO_START
#define MYNEWT_VAL_BLE_HS_AUTO_START (1)
#endif
Expand Down

0 comments on commit 57a13b0

Please sign in to comment.