diff --git a/components/bt/host/nimble/Kconfig.in b/components/bt/host/nimble/Kconfig.in index c469323ba81..bcfe46d2be0 100644 --- a/components/bt/host/nimble/Kconfig.in +++ b/components/bt/host/nimble/Kconfig.in @@ -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 diff --git a/components/bt/host/nimble/esp-hci/src/esp_nimble_hci.c b/components/bt/host/nimble/esp-hci/src/esp_nimble_hci.c index 545334e9202..3c9c81790ca 100644 --- a/components/bt/host/nimble/esp-hci/src/esp_nimble_hci.c +++ b/components/bt/host/nimble/esp-hci/src/esp_nimble_hci.c @@ -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, @@ -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); @@ -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]); diff --git a/components/bt/host/nimble/nimble b/components/bt/host/nimble/nimble index 6c91a9a153c..5f6348d0ddd 160000 --- a/components/bt/host/nimble/nimble +++ b/components/bt/host/nimble/nimble @@ -1 +1 @@ -Subproject commit 6c91a9a153c421231b686d30c822e53fea7510c0 +Subproject commit 5f6348d0ddd7f98841e458bbc808e8f7f5f23b23 diff --git a/components/bt/host/nimble/port/include/esp_nimble_cfg.h b/components/bt/host/nimble/port/include/esp_nimble_cfg.h index c0b329c465a..9cd59415f68 100644 --- a/components/bt/host/nimble/port/include/esp_nimble_cfg.h +++ b/components/bt/host/nimble/port/include/esp_nimble_cfg.h @@ -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