Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eec8d2bc authored by Johan Hedberg's avatar Johan Hedberg Committed by Gustavo Padovan
Browse files

Bluetooth: Add support for set_powered management command



This patch adds a set_powered command to the management interface
through which the powered state of local adapters can be controlled.

Signed-off-by: default avatarJohan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent 5add6af8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -667,7 +667,8 @@ void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode);
void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data);

/* ----- HCI Sockets ----- */
void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb);
void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb,
							struct sock *skip_sk);

/* Management interface */
int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
+10 −0
Original line number Diff line number Diff line
@@ -58,6 +58,16 @@ struct mgmt_rp_read_info {
	__u16 hci_rev;
} __packed;

#define MGMT_OP_SET_POWERED		0x0005
struct mgmt_cp_set_powered {
	__le16 index;
	__u8 powered;
} __packed;
struct mgmt_rp_set_powered {
	__le16 index;
	__u8 powered;
} __packed;

#define MGMT_EV_CMD_COMPLETE		0x0001
struct mgmt_ev_cmd_complete {
	__le16 opcode;
+2 −2
Original line number Diff line number Diff line
@@ -1377,7 +1377,7 @@ static int hci_send_frame(struct sk_buff *skb)
		/* Time stamp */
		__net_timestamp(skb);

		hci_send_to_sock(hdev, skb);
		hci_send_to_sock(hdev, skb, NULL);
	}

	/* Get rid of skb owner, prior to sending to the driver. */
@@ -1767,7 +1767,7 @@ static void hci_rx_task(unsigned long arg)
	while ((skb = skb_dequeue(&hdev->rx_q))) {
		if (atomic_read(&hdev->promisc)) {
			/* Send copy to the sockets */
			hci_send_to_sock(hdev, skb);
			hci_send_to_sock(hdev, skb, NULL);
		}

		if (test_bit(HCI_RAW, &hdev->flags)) {
+1 −1
Original line number Diff line number Diff line
@@ -2083,6 +2083,6 @@ void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data)

	bt_cb(skb)->pkt_type = HCI_EVENT_PKT;
	skb->dev = (void *) hdev;
	hci_send_to_sock(hdev, skb);
	hci_send_to_sock(hdev, skb, NULL);
	kfree_skb(skb);
}
+5 −1
Original line number Diff line number Diff line
@@ -85,7 +85,8 @@ static struct bt_sock_list hci_sk_list = {
};

/* Send frame to RAW socket */
void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb)
void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb,
							struct sock *skip_sk)
{
	struct sock *sk;
	struct hlist_node *node;
@@ -97,6 +98,9 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb)
		struct hci_filter *flt;
		struct sk_buff *nskb;

		if (sk == skip_sk)
			continue;

		if (sk->sk_state != BT_BOUND || hci_pi(sk)->hdev != hdev)
			continue;

Loading