Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 369838
b: refs/heads/master
c: c73eee9
h: refs/heads/master
v: v3
  • Loading branch information
Johan Hedberg authored and Gustavo Padovan committed Apr 23, 2013
1 parent 3648579 commit 017a8ea
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 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: 07dc93dd14957dc1faba08f0aadd27b082e35ba2
refs/heads/master: c73eee9172bf061202c75ad4d16506a7efd04d1c
10 changes: 10 additions & 0 deletions trunk/net/bluetooth/hci_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,8 @@ static void bredr_setup(struct hci_request *req)

static void le_setup(struct hci_request *req)
{
struct hci_dev *hdev = req->hdev;

/* Read LE Buffer Size */
hci_req_add(req, HCI_OP_LE_READ_BUFFER_SIZE, 0, NULL);

Expand All @@ -391,6 +393,10 @@ static void le_setup(struct hci_request *req)

/* Read LE Supported States */
hci_req_add(req, HCI_OP_LE_READ_SUPPORTED_STATES, 0, NULL);

/* LE-only controllers have LE implicitly enabled */
if (!lmp_bredr_capable(hdev))
set_bit(HCI_LE_ENABLED, &hdev->dev_flags);
}

static u8 hci_get_inquiry_mode(struct hci_dev *hdev)
Expand Down Expand Up @@ -574,6 +580,10 @@ static void hci_set_le_support(struct hci_request *req)
struct hci_dev *hdev = req->hdev;
struct hci_cp_write_le_host_supported cp;

/* LE-only devices do not support explicit enablement */
if (!lmp_bredr_capable(hdev))
return;

memset(&cp, 0, sizeof(cp));

if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) {
Expand Down
8 changes: 7 additions & 1 deletion trunk/net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1351,6 +1351,11 @@ static int set_le(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
return cmd_status(sk, hdev->id, MGMT_OP_SET_LE,
MGMT_STATUS_INVALID_PARAMS);

/* LE-only devices do not allow toggling LE on/off */
if (!lmp_bredr_capable(hdev))
return cmd_status(sk, hdev->id, MGMT_OP_SET_LE,
MGMT_STATUS_REJECTED);

hci_dev_lock(hdev);

val = !!cp->val;
Expand Down Expand Up @@ -3347,7 +3352,8 @@ static int powered_update_hci(struct hci_dev *hdev)
hci_req_add(&req, HCI_OP_WRITE_SSP_MODE, 1, &ssp);
}

if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) {
if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags) &&
lmp_bredr_capable(hdev)) {
struct hci_cp_write_le_host_supported cp;

cp.le = 1;
Expand Down

0 comments on commit 017a8ea

Please sign in to comment.