mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-13 15:41:17 +00:00
answer link key request in non-bonadable mode
This commit is contained in:
parent
458bf4e848
commit
74d716b5f5
@ -622,7 +622,8 @@ static void event_handler(uint8_t *packet, int size){
|
|||||||
case HCI_EVENT_LINK_KEY_REQUEST:
|
case HCI_EVENT_LINK_KEY_REQUEST:
|
||||||
log_info("HCI_EVENT_LINK_KEY_REQUEST\n");
|
log_info("HCI_EVENT_LINK_KEY_REQUEST\n");
|
||||||
hci_add_connection_flags_for_flipped_bd_addr(&packet[2], RECV_LINK_KEY_REQUEST);
|
hci_add_connection_flags_for_flipped_bd_addr(&packet[2], RECV_LINK_KEY_REQUEST);
|
||||||
if (!hci_stack.remote_device_db) break;
|
// non-bondable mode: link key negative reply will be sent by HANDLE_LINK_KEY_REQUEST
|
||||||
|
if (hci_stack.bondable && !hci_stack.remote_device_db) break;
|
||||||
hci_add_connection_flags_for_flipped_bd_addr(&packet[2], HANDLE_LINK_KEY_REQUEST);
|
hci_add_connection_flags_for_flipped_bd_addr(&packet[2], HANDLE_LINK_KEY_REQUEST);
|
||||||
hci_run();
|
hci_run();
|
||||||
// request handled by hci_run() as HANDLE_LINK_KEY_REQUEST gets set
|
// request handled by hci_run() as HANDLE_LINK_KEY_REQUEST gets set
|
||||||
@ -1186,7 +1187,7 @@ void hci_run(){
|
|||||||
if (connection->authentication_flags & HANDLE_LINK_KEY_REQUEST){
|
if (connection->authentication_flags & HANDLE_LINK_KEY_REQUEST){
|
||||||
link_key_t link_key;
|
link_key_t link_key;
|
||||||
log_info("responding to link key request\n");
|
log_info("responding to link key request\n");
|
||||||
if ( hci_stack.remote_device_db->get_link_key( &connection->address, &link_key)){
|
if ( hci_stack.bondable && hci_stack.remote_device_db && hci_stack.remote_device_db->get_link_key( &connection->address, &link_key)){
|
||||||
hci_send_cmd(&hci_link_key_request_reply, connection->address, &link_key);
|
hci_send_cmd(&hci_link_key_request_reply, connection->address, &link_key);
|
||||||
} else {
|
} else {
|
||||||
hci_send_cmd(&hci_link_key_request_negative_reply, connection->address);
|
hci_send_cmd(&hci_link_key_request_negative_reply, connection->address);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user