bluetooth: Add support for SSP and refactor AcceptConnection and

CreateConnection

Move expecting commands from RemoteDevice::Authenticate to where they
are called.In SSP we expect for the events after ConnectionComplete.
For the state machine, LINK_KEY_NOTIFY tells us the end of the pairing
in both pairings, so we clear all expected events there for the ones we added in
ConnectionComplete, In SimplePairingComplete we clear the ones added
in IOCapabilityRequest. Tested with both bluetooth 2.1 and older pairing.

Change-Id: Ia208506c9f289d9f44dc3b8b0e4cd8a726a5d726
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10526
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
vighnesh-sawant
2026-03-16 12:19:26 +00:00
committed by waddlesplash
parent dbf6744326
commit aa864b9d41
7 changed files with 283 additions and 62 deletions
+19 -1
View File
@@ -184,7 +184,25 @@ struct hci_command_header {
uint16 voice_setting;
} __attribute__ ((packed));
#define OCF_HOST_BUFFER_SIZE 0x0033
#define OCF_IO_CAPABILITY_REQUEST_REPLY 0x002B
struct hci_cp_io_capability_request_reply {
bdaddr_t bdaddr;
uint8 capability;
uint8 oob_data;
uint8 authentication;
} __attribute__((packed));
#define OCF_USER_CONFIRM_REPLY 0x002C
struct hci_cp_user_confirm_reply {
bdaddr_t bdaddr;
} __attribute__((packed));
#define OCF_USER_CONFIRM_NEG_REPLY 0x002D
struct hci_cp_user_confirm_neg_reply {
bdaddr_t bdaddr;
} __attribute__((packed));
#define OCF_HOST_BUFFER_SIZE 0x0033
struct hci_cp_host_buffer_size {
uint16 acl_mtu;
uint8 sco_mtu;
+33 -1
View File
@@ -292,16 +292,48 @@ struct hci_ev_extended_inquiry_info {
#define HCI_EVENT_ENCRYPTION_KEY_REFRESH_COMPLETE 0x30
#define HCI_EVENT_IO_CAPABILITY_REQUEST 0x31
struct hci_ev_io_capability_request {
bdaddr_t bdaddr;
} __attribute__((packed));
#define HCI_EVENT_IO_CAPABILITY_RESPONSE 0x32
struct hci_ev_io_capability_response {
bdaddr_t bdaddr;
uint8 capability;
uint8 oob_data;
uint8 authentication;
} __attribute__((packed));
#define HCI_EVENT_USER_CONFIRMATION_REQUEST 0x33
#define HCI_IO_CAP_DISPLAY_ONLY 0x00
#define HCI_IO_CAP_DISPLAY_YES_NO 0x01
#define HCI_IO_CAP_KEYBOARD_ONLY 0x02
#define HCI_IO_CAP_NO_INPUT_NO_OUTPUT 0x03
#define HCI_OOB_DATA_NOT_PRESENT 0x00
#define HCI_OOB_DATA_PRESENT 0x01
#define HCI_AUTH_REQ_NO_MITM_NO_BOND 0x00
#define HCI_AUTH_REQ_MITM_NO_BOND 0x01
#define HCI_AUTH_REQ_NO_MITM_DEDICATED_BOND 0x02
#define HCI_AUTH_REQ_MITM_DEDICATED_BOND 0x03
#define HCI_AUTH_REQ_NO_MITM_GENERAL_BOND 0x04
#define HCI_AUTH_REQ_MITM_GENERAL_BOND 0x05
#define HCI_EVENT_USER_CONFIRMATION_REQUEST 0x33
struct hci_ev_user_confirmation_request {
bdaddr_t bdaddr;
uint32 passkey;
} __attribute__((packed));
#define HCI_EVENT_USER_PASSKEY_REQUEST 0x34
#define HCI_EVENT_OOB_DATA_REQUEST 0x35
#define HCI_EVENT_SIMPLE_PAIRING_COMPLETE 0x36
struct hci_ev_simple_pairing_complete {
uint8 status;
bdaddr_t bdaddr;
} __attribute__((packed));
#define HCI_EVENT_LINK_SUPERVISION_TIMEOUT_CHANGED 0x38