Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 278567
b: refs/heads/master
c: ba4e564
h: refs/heads/master
i:
  278565: dec153d
  278563: b9142b5
  278559: c448a65
v: v3
  • Loading branch information
Johan Hedberg authored and Gustavo F. Padovan committed Nov 16, 2011
1 parent ee97a78 commit be46ed0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e6d465cb482935c26cb4065a6ab9ce987c067da3
refs/heads/master: ba4e564f60064689661882c84fa2ee63e39b457e
4 changes: 2 additions & 2 deletions trunk/include/net/bluetooth/mgmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@ struct mgmt_cp_set_io_capability {

#define MGMT_OP_PAIR_DEVICE 0x0014
struct mgmt_cp_pair_device {
bdaddr_t bdaddr;
struct mgmt_addr_info addr;
__u8 io_cap;
} __packed;
struct mgmt_rp_pair_device {
bdaddr_t bdaddr;
struct mgmt_addr_info addr;
__u8 status;
} __packed;

Expand Down
13 changes: 6 additions & 7 deletions trunk/net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,8 @@ static void pairing_complete(struct pending_cmd *cmd, u8 status)
struct mgmt_rp_pair_device rp;
struct hci_conn *conn = cmd->user_data;

bacpy(&rp.bdaddr, &conn->dst);
bacpy(&rp.addr.bdaddr, &conn->dst);
rp.addr.type = link_to_mgmt(conn->type, conn->dst_type);
rp.status = status;

cmd_complete(cmd->sk, cmd->index, MGMT_OP_PAIR_DEVICE, &rp, sizeof(rp));
Expand Down Expand Up @@ -1366,7 +1367,6 @@ static int pair_device(struct sock *sk, u16 index, unsigned char *data, u16 len)
struct hci_dev *hdev;
struct mgmt_cp_pair_device *cp;
struct pending_cmd *cmd;
struct adv_entry *entry;
u8 sec_level, auth_type;
struct hci_conn *conn;
int err;
Expand All @@ -1390,12 +1390,11 @@ static int pair_device(struct sock *sk, u16 index, unsigned char *data, u16 len)
else
auth_type = HCI_AT_DEDICATED_BONDING_MITM;

entry = hci_find_adv_entry(hdev, &cp->bdaddr);
if (entry)
conn = hci_connect(hdev, LE_LINK, &cp->bdaddr, sec_level,
if (cp->addr.type == MGMT_ADDR_BREDR)
conn = hci_connect(hdev, ACL_LINK, &cp->addr.bdaddr, sec_level,
auth_type);
else
conn = hci_connect(hdev, ACL_LINK, &cp->bdaddr, sec_level,
conn = hci_connect(hdev, LE_LINK, &cp->addr.bdaddr, sec_level,
auth_type);

if (IS_ERR(conn)) {
Expand All @@ -1417,7 +1416,7 @@ static int pair_device(struct sock *sk, u16 index, unsigned char *data, u16 len)
}

/* For LE, just connecting isn't a proof that the pairing finished */
if (!entry)
if (cp->addr.type == MGMT_ADDR_BREDR)
conn->connect_cfm_cb = pairing_complete_cb;

conn->security_cfm_cb = pairing_complete_cb;
Expand Down

0 comments on commit be46ed0

Please sign in to comment.