Bluetooth: BR/EDR: Handle IO Capability Response event

Enables IO Capability Response event in controller and adds remote IO Capability
and authentication fields to connection object.
Initializes them using IO exchange values delivered in SSP IO Capability
Response event data set representing remote as a part of incoming pairing
process.

Change-Id: Ia73a912f6fb633d1d1bb086ef3af9a280ac5a864
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
This commit is contained in:
Arkadiusz Lichwa 2016-01-29 12:29:11 +01:00 committed by Johan Hedberg
commit dd8bf892f3
3 changed files with 33 additions and 0 deletions

View file

@ -555,6 +555,14 @@ struct bt_hci_evt_encrypt_key_refresh_complete {
uint16_t handle; uint16_t handle;
} __packed; } __packed;
#define BT_HCI_EVT_IO_CAPA_RESP 0x32
struct bt_hci_evt_io_capa_resp {
bt_addr_t bdaddr;
uint8_t capability;
uint8_t oob_data;
uint8_t authentication;
} __packed;
#define BT_HCI_EVT_LE_META_EVENT 0x3e #define BT_HCI_EVT_LE_META_EVENT 0x3e
struct bt_hci_evt_le_meta_event { struct bt_hci_evt_le_meta_event {
uint8_t subevent; uint8_t subevent;

View file

@ -52,6 +52,8 @@ struct bt_conn_le {
#if defined(CONFIG_BLUETOOTH_BREDR) #if defined(CONFIG_BLUETOOTH_BREDR)
struct bt_conn_br { struct bt_conn_br {
bt_addr_t dst; bt_addr_t dst;
uint8_t remote_io_capa;
uint8_t remote_auth;
}; };
#endif #endif

View file

@ -1114,6 +1114,25 @@ static void link_key_req(struct net_buf *buf)
link_key_reply(&evt->bdaddr, keys->link_key.val); link_key_reply(&evt->bdaddr, keys->link_key.val);
} }
static void io_capa_resp(struct net_buf *buf)
{
struct bt_hci_evt_io_capa_resp *evt = (void *)buf->data;
struct bt_conn *conn;
BT_DBG("remote %s, IOcapa 0x%02x, auth 0x%02x",
bt_addr_str(&evt->bdaddr), evt->capability, evt->authentication);
conn = bt_conn_lookup_addr_br(&evt->bdaddr);
if (!conn) {
BT_ERR("Unable to find conn for %s", bt_addr_str(&evt->bdaddr));
return;
}
conn->br.remote_io_capa = evt->capability;
conn->br.remote_auth = evt->authentication;
bt_conn_unref(conn);
}
#endif #endif
#if defined(CONFIG_BLUETOOTH_SMP) || defined(CONFIG_BLUETOOTH_BREDR) #if defined(CONFIG_BLUETOOTH_SMP) || defined(CONFIG_BLUETOOTH_BREDR)
@ -1794,6 +1813,9 @@ static void hci_event(struct net_buf *buf)
case BT_HCI_EVT_LINK_KEY_REQ: case BT_HCI_EVT_LINK_KEY_REQ:
link_key_req(buf); link_key_req(buf);
break; break;
case BT_HCI_EVT_IO_CAPA_RESP:
io_capa_resp(buf);
break;
#endif #endif
#if defined(CONFIG_BLUETOOTH_CONN) #if defined(CONFIG_BLUETOOTH_CONN)
case BT_HCI_EVT_DISCONN_COMPLETE: case BT_HCI_EVT_DISCONN_COMPLETE:
@ -2253,6 +2275,7 @@ static int set_event_mask(void)
ev->events[2] |= 0x20; /* Pin Code Request */ ev->events[2] |= 0x20; /* Pin Code Request */
ev->events[2] |= 0x40; /* Link Key Request */ ev->events[2] |= 0x40; /* Link Key Request */
ev->events[2] |= 0x80; /* Link Key Notif */ ev->events[2] |= 0x80; /* Link Key Notif */
ev->events[6] |= 0x02; /* IO Capability Response */
#endif #endif
ev->events[1] |= 0x20; /* Command Complete */ ev->events[1] |= 0x20; /* Command Complete */
ev->events[1] |= 0x40; /* Command Status */ ev->events[1] |= 0x40; /* Command Status */