From e88b2961816e518970c8390858b28d5e5ebbe36c Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Fri, 13 May 2016 16:53:44 +0200 Subject: [PATCH] sm: keep track of security request before sm received connection complete --- src/ble/sm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ble/sm.c b/src/ble/sm.c index da3901633..98a7cdcb6 100644 --- a/src/ble/sm.c +++ b/src/ble/sm.c @@ -3011,8 +3011,8 @@ void sm_request_pairing(hci_con_handle_t con_handle){ sm_send_security_request_for_connection(sm_conn); } else { // used as a trigger to start central/master/initiator security procedures - uint16_t ediv; - if (sm_conn->sm_engine_state == SM_INITIATOR_CONNECTED){ + uint16_t ediv; + if (sm_conn->sm_engine_state == SM_INITIATOR_CONNECTED){ switch (sm_conn->sm_irk_lookup_state){ case IRK_LOOKUP_FAILED: sm_conn->sm_engine_state = SM_INITIATOR_PH1_W2_SEND_PAIRING_REQUEST; @@ -3030,6 +3030,8 @@ void sm_request_pairing(hci_con_handle_t con_handle){ sm_conn->sm_bonding_requested = 1; break; } + } else if (sm_conn->sm_engine_state == SM_GENERAL_IDLE){ + sm_conn->sm_bonding_requested = 1; } } sm_run();