[PATCH 08/12] Bluetooth: Enable on-the-fly update of broadcast data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Aloisio Almeida Jr <aloisio.almeida@xxxxxxxxxxxxx>

The broadcast data can be updated with no need to re-enable broadcaster
mode.

Signed-off-by: Aloisio Almeida Jr <aloisio.almeida@xxxxxxxxxxxxx>
---
 net/bluetooth/mgmt.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 608e81af..e910b11 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2738,6 +2738,9 @@ static int set_controller_data(struct sock *sk, struct hci_dev *hdev,
 
 	hci_broadcast_data_add(hdev, cp->flags, cp->type, cp->length, cp->data);
 
+	if (test_bit(HCI_BROADCASTER, &hdev->dev_flags))
+		__hci_update_ad(hdev);
+
 	hci_dev_unlock(hdev);
 
 	return cmd_complete(sk, hdev->id, MGMT_OP_SET_CONTROLLER_DATA, 0, NULL,
@@ -2748,6 +2751,7 @@ static int unset_controller_data(struct sock *sk, struct hci_dev *hdev,
 				 void *data, u16 len)
 {
 	struct mgmt_cp_unset_controller_data *cp = data;
+	int removed;
 
 	BT_DBG("%s type:0x%02x", hdev->name, cp->type);
 
@@ -2759,7 +2763,10 @@ static int unset_controller_data(struct sock *sk, struct hci_dev *hdev,
 				  MGMT_STATUS_NOT_POWERED);
 	}
 
-	hci_broadcast_data_remove(hdev, cp->type);
+	removed = hci_broadcast_data_remove(hdev, cp->type);
+
+	if (removed && test_bit(HCI_BROADCASTER, &hdev->dev_flags))
+		__hci_update_ad(hdev);
 
 	hci_dev_unlock(hdev);
 
-- 
1.8.0.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux