answer HCI_EVENT_IO_CAPABILITY_REQUEST if hci_stack.io_capability is set

This commit is contained in:
matthias.ringwald@gmail.com 2013-09-01 19:35:49 +00:00
parent a45d6b9ff9
commit 1d6b20ae69
2 changed files with 18 additions and 1 deletions

View File

@ -561,6 +561,12 @@ static void event_handler(uint8_t *packet, int size){
hci_stack.remote_device_db->delete_link_key(&addr);
break;
case HCI_EVENT_IO_CAPABILITY_REQUEST:
hci_add_connection_flags_for_flipped_bd_addr(&packet[2], RECV_IO_CAPABILITIES_REQUEST);
if (hci_stack.ssp_io_capability == SSP_IO_CAPABILITY_UNKNOWN) break;
hci_add_connection_flags_for_flipped_bd_addr(&packet[2], SENT_IO_CAPABILITIES_REPLY);
break;
#ifndef EMBEDDED
case HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE:
if (!hci_stack.remote_device_db) break;
@ -1085,6 +1091,13 @@ void hci_run(){
}
connectionClearAuthenticationFlags(connection, HANDLE_LINK_KEY_REQUEST);
}
if (!hci_can_send_packet_now(HCI_COMMAND_DATA_PACKET)) return;
if (connection->authentication_flags & SENT_IO_CAPABILITIES_REPLY){
hci_send_cmd(&hci_io_capability_request_reply, hci_stack.ssp_io_capability, NULL, hci_stack.ssp_authentication_requirement);
connectionClearAuthenticationFlags(connection, SENT_IO_CAPABILITIES_REPLY);
}
}
if (!hci_can_send_packet_now(HCI_COMMAND_DATA_PACKET)) return;

View File

@ -204,7 +204,10 @@ typedef enum {
RECV_LINK_KEY_NOTIFICATION = 0x10,
RECV_PIN_CODE_REQUEST = 0x20,
SENT_PIN_CODE_REPLY = 0x40,
SENT_PIN_CODE_NEGATIVE_REPLY = 0x80
SENT_PIN_CODE_NEGATIVE_REPLY = 0x80,
// SSP
RECV_IO_CAPABILITIES_REQUEST = 0x100;
SENT_IO_CAPABILITIES_REPLY = 0x200;
} hci_authentication_flags_t;
typedef enum {
@ -273,6 +276,7 @@ typedef struct {
uint8_t ssp_enable;
uint8_t ssp_io_capability;
uint8_t ssp_authentication_requirement;
uint8_t ssp_auto_accept;
// hardware power controller
bt_control_t * control;