diff options
author | Daniël van de Giessen <daniel@dvdgiessen.nl> | 2023-12-12 15:56:13 +0100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2024-02-29 14:25:59 +1100 |
commit | d1e15b928107e2459b65c7a2484517e9e2a830cc (patch) | |
tree | 52dbb267d033542f4d22b005a7a9b1d40077eaee | |
parent | 3460b48a6d3af423e8592add99432172523639ba (diff) | |
download | micropython-d1e15b928107e2459b65c7a2484517e9e2a830cc.tar.gz micropython-d1e15b928107e2459b65c7a2484517e9e2a830cc.zip |
extmod/nimble: Enable key distribution to support bonding.
This sets the BLE key distribution parameters at runtime. This isn't
needed in most ports since we already set the default values in
`extmod/nimble/syscfg/syscfg.h`; however in the ESP32 port that
headerfile is not used, and the default values in the ESP-IDF don't
enable key distribution nor can we change those defaults via
`sdkconfig`. Thus we're setting these values explicitly at runtime.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
-rw-r--r-- | extmod/nimble/modbluetooth_nimble.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/extmod/nimble/modbluetooth_nimble.c b/extmod/nimble/modbluetooth_nimble.c index b4610564cd..5bab43a0cc 100644 --- a/extmod/nimble/modbluetooth_nimble.c +++ b/extmod/nimble/modbluetooth_nimble.c @@ -617,6 +617,8 @@ int mp_bluetooth_init(void) { ble_hs_cfg.store_status_cb = ble_store_util_status_rr; #if MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING + ble_hs_cfg.sm_our_key_dist = BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID | BLE_SM_PAIR_KEY_DIST_SIGN; + ble_hs_cfg.sm_their_key_dist = BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID | BLE_SM_PAIR_KEY_DIST_SIGN; ble_hs_cfg.store_read_cb = ble_secret_store_read; ble_hs_cfg.store_write_cb = ble_secret_store_write; ble_hs_cfg.store_delete_cb = ble_secret_store_delete; |