Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 290970
b: refs/heads/master
c: f39799f
h: refs/heads/master
v: v3
  • Loading branch information
Andre Guedes authored and Johan Hedberg committed Feb 19, 2012
1 parent 80c03f4 commit bfdb978
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 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: ea585ab51d3fe2eb2d738c91f83e7c309e76b4fe
refs/heads/master: f39799f5047c4827b200acbf33cd0ba076afd7ed
12 changes: 12 additions & 0 deletions trunk/include/net/bluetooth/hci_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,18 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb,
struct sock *skip_sk);

/* Management interface */
#define MGMT_ADDR_BREDR 0x00
#define MGMT_ADDR_LE_PUBLIC 0x01
#define MGMT_ADDR_LE_RANDOM 0x02
#define MGMT_ADDR_INVALID 0xff

#define DISCOV_TYPE_BREDR (BIT(MGMT_ADDR_BREDR))
#define DISCOV_TYPE_LE (BIT(MGMT_ADDR_LE_PUBLIC) | \
BIT(MGMT_ADDR_LE_RANDOM))
#define DISCOV_TYPE_INTERLEAVED (BIT(MGMT_ADDR_BREDR) | \
BIT(MGMT_ADDR_LE_PUBLIC) | \
BIT(MGMT_ADDR_LE_RANDOM))

int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
int mgmt_index_added(struct hci_dev *hdev);
int mgmt_index_removed(struct hci_dev *hdev);
Expand Down
5 changes: 0 additions & 5 deletions trunk/include/net/bluetooth/mgmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ struct mgmt_hdr {
__le16 len;
} __packed;

#define MGMT_ADDR_BREDR 0x00
#define MGMT_ADDR_LE_PUBLIC 0x01
#define MGMT_ADDR_LE_RANDOM 0x02
#define MGMT_ADDR_INVALID 0xff

struct mgmt_addr_info {
bdaddr_t bdaddr;
__u8 type;
Expand Down
15 changes: 10 additions & 5 deletions trunk/net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -2157,7 +2157,6 @@ static int start_discovery(struct sock *sk, u16 index,
void *data, u16 len)
{
struct mgmt_cp_start_discovery *cp = data;
unsigned long discov_type = cp->type;
struct pending_cmd *cmd;
struct hci_dev *hdev;
int err;
Expand Down Expand Up @@ -2193,14 +2192,20 @@ static int start_discovery(struct sock *sk, u16 index,
goto failed;
}

if (test_bit(MGMT_ADDR_BREDR, &discov_type))
switch (cp->type) {
case DISCOV_TYPE_BREDR:
case DISCOV_TYPE_INTERLEAVED:
err = hci_do_inquiry(hdev, INQUIRY_LEN_BREDR);
else if (test_bit(MGMT_ADDR_LE_PUBLIC, &discov_type) &&
test_bit(MGMT_ADDR_LE_RANDOM, &discov_type))
break;

case DISCOV_TYPE_LE:
err = hci_le_scan(hdev, LE_SCAN_TYPE, LE_SCAN_INT,
LE_SCAN_WIN, LE_SCAN_TIMEOUT_LE_ONLY);
else
break;

default:
err = -EINVAL;
}

if (err < 0)
mgmt_pending_remove(cmd);
Expand Down

0 comments on commit bfdb978

Please sign in to comment.