Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 291010
b: refs/heads/master
c: 0224d2f
h: refs/heads/master
v: v3
  • Loading branch information
Johan Hedberg committed Feb 21, 2012
1 parent 5efd7f5 commit b624cf9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 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: beadb2bddce5810dc668da156b4c2ca457940250
refs/heads/master: 0224d2fafbbed4ac0cb05d08d3adab506a398451
29 changes: 25 additions & 4 deletions trunk/net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -876,11 +876,20 @@ static int set_discoverable(struct sock *sk, u16 index, void *data, u16 len)
}

if (!hdev_is_powered(hdev)) {
if (cp->val)
set_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
else
clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
bool changed = false;

if (!!cp->val != test_bit(HCI_DISCOVERABLE, &hdev->dev_flags)) {
change_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
changed = true;
}

err = send_settings_rsp(sk, MGMT_OP_SET_DISCOVERABLE, hdev);
if (err < 0)
goto failed;

if (changed)
err = new_settings(hdev, sk);

goto failed;
}

Expand Down Expand Up @@ -938,13 +947,25 @@ static int set_connectable(struct sock *sk, u16 index, void *data, u16 len)
hci_dev_lock(hdev);

if (!hdev_is_powered(hdev)) {
bool changed = false;

if (!!cp->val != test_bit(HCI_CONNECTABLE, &hdev->dev_flags))
changed = true;

if (cp->val)
set_bit(HCI_CONNECTABLE, &hdev->dev_flags);
else {
clear_bit(HCI_CONNECTABLE, &hdev->dev_flags);
clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
}

err = send_settings_rsp(sk, MGMT_OP_SET_CONNECTABLE, hdev);
if (err < 0)
goto failed;

if (changed)
err = new_settings(hdev, sk);

goto failed;
}

Expand Down

0 comments on commit b624cf9

Please sign in to comment.