Bluetooth: BR/EDR: Enable SSP mode in controller

Turns on Secure Simple Pairing mode in controller. Since there's a prerequisite
the controller is 4.0+, turning the mode is unconditional.

Change-Id: Id4a10ccf8892a430b0daaa6750835516b17b7e8a
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
This commit is contained in:
Arkadiusz Lichwa 2016-01-16 22:29:59 +01:00 committed by Gerrit Code Review
parent 13d064c58c
commit 73e201cbce
2 changed files with 19 additions and 0 deletions

View file

@ -241,6 +241,11 @@ struct bt_hci_cp_host_num_completed_packets {
struct bt_hci_handle_count h[0];
} __packed;
#define BT_HCI_OP_WRITE_SSP_MODE BT_OP(BT_OGF_BASEBAND, 0x0056)
struct bt_hci_cp_write_ssp_mode {
uint8_t mode;
} __packed;
#define BT_HCI_OP_LE_WRITE_LE_HOST_SUPP BT_OP(BT_OGF_BASEBAND, 0x006d)
struct bt_hci_cp_write_le_host_supp {
uint8_t le;

View file

@ -2184,6 +2184,7 @@ static int le_init(void)
static int br_init(void)
{
struct net_buf *buf;
struct bt_hci_cp_write_ssp_mode *cp;
int err;
/* Get BR/EDR buffer size */
@ -2195,6 +2196,19 @@ static int br_init(void)
read_buffer_size_complete(buf);
net_buf_unref(buf);
/* Set SSP mode */
buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_SSP_MODE, sizeof(*cp));
if (!buf) {
return -ENOBUFS;
}
cp = net_buf_add(buf, sizeof(*cp));
cp->mode = 0x01;
err = bt_hci_cmd_send_sync(BT_HCI_OP_WRITE_SSP_MODE, buf, NULL);
if (err) {
return err;
}
return 0;
}
#else