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

Commit bb8f2cb2 authored by John W. Linville's avatar John W. Linville
Browse files

Merge branch 'master' of git://github.com/padovan/bluetooth-next

parents ed46fdfc ab0ff76d
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -716,6 +716,16 @@ struct hci_rp_read_bd_addr {
	bdaddr_t bdaddr;
} __packed;

#define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY	0x0c1c
struct hci_cp_write_page_scan_activity {
	__le16   interval;
	__le16   window;
} __packed;

#define HCI_OP_WRITE_PAGE_SCAN_TYPE	0x0c47
	#define PAGE_SCAN_TYPE_STANDARD		0x00
	#define PAGE_SCAN_TYPE_INTERLACED	0x01

#define HCI_OP_LE_SET_EVENT_MASK	0x2001
struct hci_cp_le_set_event_mask {
	__u8     mask[8];
+21 −4
Original line number Diff line number Diff line
@@ -195,8 +195,6 @@ struct hci_dev {

	__u16			init_last_cmd;

	struct crypto_blkcipher	*tfm;

	struct inquiry_cache	inq_cache;
	struct hci_conn_hash	conn_hash;
	struct list_head	blacklist;
@@ -348,6 +346,7 @@ enum {
	HCI_CONN_RSWITCH_PEND,
	HCI_CONN_MODE_CHANGE_PEND,
	HCI_CONN_SCO_SETUP_PEND,
	HCI_CONN_LE_SMP_PEND,
};

static inline void hci_conn_hash_init(struct hci_dev *hdev)
@@ -395,6 +394,22 @@ static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c)
	}
}

static inline unsigned int hci_conn_num(struct hci_dev *hdev, __u8 type)
{
	struct hci_conn_hash *h = &hdev->conn_hash;
	switch (type) {
	case ACL_LINK:
		return h->acl_num;
	case LE_LINK:
		return h->le_num;
	case SCO_LINK:
	case ESCO_LINK:
		return h->sco_num;
	default:
		return 0;
	}
}

static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
								__u16 handle)
{
@@ -475,7 +490,7 @@ static inline void hci_conn_put(struct hci_conn *conn)
{
	if (atomic_dec_and_test(&conn->refcnt)) {
		unsigned long timeo;
		if (conn->type == ACL_LINK) {
		if (conn->type == ACL_LINK || conn->type == LE_LINK) {
			del_timer(&conn->idle_timer);
			if (conn->state == BT_CONNECTED) {
				timeo = msecs_to_jiffies(conn->disc_timeout);
@@ -838,7 +853,7 @@ int mgmt_powered(u16 index, u8 powered);
int mgmt_discoverable(u16 index, u8 discoverable);
int mgmt_connectable(u16 index, u8 connectable);
int mgmt_new_key(u16 index, struct link_key *key, u8 persistent);
int mgmt_connected(u16 index, bdaddr_t *bdaddr);
int mgmt_connected(u16 index, bdaddr_t *bdaddr, u8 link_type);
int mgmt_disconnected(u16 index, bdaddr_t *bdaddr);
int mgmt_disconnect_failed(u16 index);
int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status);
@@ -858,6 +873,8 @@ int mgmt_device_found(u16 index, bdaddr_t *bdaddr, u8 *dev_class, s8 rssi,
								u8 *eir);
int mgmt_remote_name(u16 index, bdaddr_t *bdaddr, u8 *name);
int mgmt_discovering(u16 index, u8 discovering);
int mgmt_device_blocked(u16 index, bdaddr_t *bdaddr);
int mgmt_device_unblocked(u16 index, bdaddr_t *bdaddr);

/* HCI info for socket */
#define hci_pi(sk) ((struct hci_pinfo *) sk)
+1 −7
Original line number Diff line number Diff line
@@ -409,14 +409,8 @@ struct l2cap_conn {

	__u8		disc_reason;

	__u8		preq[7]; /* SMP Pairing Request */
	__u8		prsp[7]; /* SMP Pairing Response */
	__u8		prnd[16]; /* SMP Pairing Random */
	__u8		pcnf[16]; /* SMP Pairing Confirm */
	__u8		tk[16]; /* SMP Temporary Key */
	__u8		smp_key_size;

	struct timer_list security_timer;
	struct smp_chan *smp_chan;

	struct list_head chan_l;
	rwlock_t	chan_lock;
+16 −0
Original line number Diff line number Diff line
@@ -211,6 +211,11 @@ struct mgmt_cp_unblock_device {
	bdaddr_t bdaddr;
} __packed;

#define MGMT_OP_SET_FAST_CONNECTABLE	0x001F
struct mgmt_cp_set_fast_connectable {
	__u8 enable;
} __packed;

#define MGMT_EV_CMD_COMPLETE		0x0001
struct mgmt_ev_cmd_complete {
	__le16 opcode;
@@ -249,6 +254,7 @@ struct mgmt_ev_new_key {
#define MGMT_EV_CONNECTED		0x000B
struct mgmt_ev_connected {
	bdaddr_t bdaddr;
	__u8 link_type;
} __packed;

#define MGMT_EV_DISCONNECTED		0x000C
@@ -301,3 +307,13 @@ struct mgmt_ev_remote_name {
} __packed;

#define MGMT_EV_DISCOVERING		0x0014

#define MGMT_EV_DEVICE_BLOCKED		0x0015
struct mgmt_ev_device_blocked {
	bdaddr_t bdaddr;
} __packed;

#define MGMT_EV_DEVICE_UNBLOCKED	0x0016
struct mgmt_ev_device_unblocked {
	bdaddr_t bdaddr;
} __packed;
+17 −0
Original line number Diff line number Diff line
@@ -115,9 +115,26 @@ struct smp_cmd_security_req {
#define SMP_MIN_ENC_KEY_SIZE		7
#define SMP_MAX_ENC_KEY_SIZE		16

struct smp_chan {
	struct l2cap_conn *conn;
	u8		preq[7]; /* SMP Pairing Request */
	u8		prsp[7]; /* SMP Pairing Response */
	u8              prnd[16]; /* SMP Pairing Random (local) */
	u8              rrnd[16]; /* SMP Pairing Random (remote) */
	u8		pcnf[16]; /* SMP Pairing Confirm */
	u8		tk[16]; /* SMP Temporary Key */
	u8		smp_key_size;
	struct crypto_blkcipher	*tfm;
	struct work_struct confirm;
	struct work_struct random;

};

/* SMP Commands */
int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level);
int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb);
int smp_distribute_keys(struct l2cap_conn *conn, __u8 force);

void smp_chan_destroy(struct l2cap_conn *conn);

#endif /* __SMP_H */
Loading