int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
int mgmt_index_added(u16 index);
int mgmt_index_removed(u16 index);
+int mgmt_powered(u16 index, u8 powered);
/* HCI info for socket */
#define hci_pi(sk) ((struct hci_pinfo *) sk)
struct mgmt_ev_index_removed {
__le16 index;
} __packed;
+
+#define MGMT_EV_POWERED 0x0006
+struct mgmt_ev_powered {
+ __le16 index;
+ __u8 powered;
+} __packed;
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);
* and no tasks are scheduled. */
hdev->close(hdev);
+ mgmt_powered(hdev->id, 0);
+
/* Clear flags */
hdev->flags = 0;
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));
+}