Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 17fa4b9d authored by Johan Hedberg's avatar Johan Hedberg Committed by Gustavo Padovan
Browse files

Bluetooth: Add set_io_capability management command



This patch adds a new set_io_capability management command which is used
to set the IO capability for Secure Simple Pairing (SSP) as well as the
Security Manager Protocol (SMP). The value is per hci_dev and each
hci_conn object inherits it upon creation.

Signed-off-by: default avatarJohan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent 980e1a53
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -402,6 +402,14 @@ struct hci_cp_reject_sync_conn_req {
	__u8     reason;
} __packed;

#define HCI_OP_IO_CAPABILITY_REPLY	0x042b
struct hci_cp_io_capability_reply {
	bdaddr_t bdaddr;
	__u8     capability;
	__u8     oob_data;
	__u8     authentication;
} __packed;

#define HCI_OP_IO_CAPABILITY_NEG_REPLY	0x0434
struct hci_cp_io_capability_neg_reply {
	bdaddr_t bdaddr;
+2 −0
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ struct hci_dev {
	__u16		manufacturer;
	__le16		lmp_subver;
	__u16		voice_setting;
	__u8		io_capability;

	__u16		pkt_type;
	__u16		esco_type;
@@ -214,6 +215,7 @@ struct hci_conn {
	__u8             sec_level;
	__u8		 pending_sec_level;
	__u8		 pin_length;
	__u8		 io_capability;
	__u8             power_save;
	__u16            disc_timeout;
	unsigned long	 pend;
+6 −0
Original line number Diff line number Diff line
@@ -154,6 +154,12 @@ struct mgmt_cp_pin_code_neg_reply {
	bdaddr_t bdaddr;
} __packed;

#define MGMT_OP_SET_IO_CAPABILITY	0x0013
struct mgmt_cp_set_io_capability {
	__le16 index;
	__u8 io_capability;
} __packed;

#define MGMT_EV_CMD_COMPLETE		0x0001
struct mgmt_ev_cmd_complete {
	__le16 opcode;
+1 −0
Original line number Diff line number Diff line
@@ -234,6 +234,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
	conn->mode  = HCI_CM_ACTIVE;
	conn->state = BT_OPEN;
	conn->auth_type = HCI_AT_GENERAL_BONDING;
	conn->io_capability = hdev->io_capability;

	conn->power_save = 1;
	conn->disc_timeout = HCI_DISCONN_TIMEOUT;
+1 −0
Original line number Diff line number Diff line
@@ -1084,6 +1084,7 @@ int hci_register_dev(struct hci_dev *hdev)
	hdev->pkt_type  = (HCI_DM1 | HCI_DH1 | HCI_HV1);
	hdev->esco_type = (ESCO_HV1);
	hdev->link_mode = (HCI_LM_ACCEPT);
	hdev->io_capability = 0x03; /* No Input No Output */

	hdev->idle_timeout = 0;
	hdev->sniff_max_interval = 800;
Loading