summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/hci_core.c4
-rw-r--r--net/bluetooth/mgmt.c10
2 files changed, 14 insertions, 0 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index b22ce9f8bf91..c5a78e797bc2 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -535,6 +535,8 @@ int hci_dev_open(__u16 dev)
hci_dev_hold(hdev);
set_bit(HCI_UP, &hdev->flags);
hci_notify(hdev, HCI_DEV_UP);
+ if (!test_bit(HCI_SETUP, &hdev->flags))
+ mgmt_powered(hdev->id, 1);
} else {
/* Init failed, cleanup */
tasklet_kill(&hdev->rx_task);
@@ -616,6 +618,8 @@ static int hci_dev_do_close(struct hci_dev *hdev)
* and no tasks are scheduled. */
hdev->close(hdev);
+ mgmt_powered(hdev->id, 0);
+
/* Clear flags */
hdev->flags = 0;
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index d479e241a9de..f746e19ebec0 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -316,3 +316,13 @@ int mgmt_index_removed(u16 index)
return mgmt_event(MGMT_EV_INDEX_REMOVED, &ev, sizeof(ev));
}
+
+int mgmt_powered(u16 index, u8 powered)
+{
+ struct mgmt_ev_powered ev;
+
+ put_unaligned_le16(index, &ev.index);
+ ev.powered = powered;
+
+ return mgmt_event(MGMT_EV_POWERED, &ev, sizeof(ev));
+}