diff --git a/src/hci.c b/src/hci.c index 343a55b82..b07461226 100644 --- a/src/hci.c +++ b/src/hci.c @@ -2155,8 +2155,15 @@ static void event_handler(uint8_t *packet, int size){ if (!packet[2]){ conn->state = OPEN; conn->con_handle = little_endian_read_16(packet, 3); + + // queue get remote feature conn->bonding_flags |= BONDING_REQUEST_REMOTE_FEATURES; + // queue set supervision timeout + if (hci_stack->link_supervision_timeout != 0){ + connectionSetAuthenticationFlags(conn, WRITE_SUPERVISION_TIMEOUT); + } + // restart timer btstack_run_loop_set_timer(&conn->timeout, HCI_CONNECTION_TIMEOUT_MS); btstack_run_loop_add_timer(&conn->timeout); @@ -3601,6 +3608,12 @@ static void hci_run(void){ return; } + if (connection->authentication_flags & WRITE_SUPERVISION_TIMEOUT){ + connectionClearAuthenticationFlags(connection, WRITE_SUPERVISION_TIMEOUT); + hci_send_cmd(&hci_write_link_supervision_timeout, connection->con_handle, hci_stack->link_supervision_timeout); + return; + } + #ifdef ENABLE_CLASSIC if (connection->authentication_flags & HANDLE_LINK_KEY_REQUEST){ log_info("responding to link key request"); diff --git a/src/hci.h b/src/hci.h index 8a029ed43..8def94f02 100644 --- a/src/hci.h +++ b/src/hci.h @@ -209,6 +209,8 @@ typedef enum { // errands READ_RSSI = 0x10000, + WRITE_SUPERVISION_TIMEOUT = 0x20000, + } hci_authentication_flags_t; /**