* [PATCH] Bluetooth: Fix changing advertising setting while LE is connected
@ 2013-10-08 13:52 johan.hedberg
2013-10-08 14:49 ` Marcel Holtmann
0 siblings, 1 reply; 2+ messages in thread
From: johan.hedberg @ 2013-10-08 13:52 UTC (permalink / raw)
To: linux-bluetooth
From: Johan Hedberg <johan.hedberg@intel.com>
We only (re)enable advertising when LE is disconnected. Trying to enable
advertising using mgmt_set_advertising while connected should simply
change the flag but not do anything else (until the connection gets
dropped). This patch fixes this by making an LE connection lookup to
determine whether there are any connected devices or not.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
net/bluetooth/mgmt.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 4070bb0..a9d7506 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3264,7 +3264,13 @@ static int set_advertising(struct sock *sk, struct hci_dev *hdev, void *data, u1
val = !!cp->val;
enabled = test_bit(HCI_ADVERTISING, &hdev->dev_flags);
- if (!hdev_is_powered(hdev) || val == enabled) {
+ /* The following conditions are ones which mean that we should
+ * not do any HCI communication but directly send a mgmt
+ * response to user space (after toggling the flag if
+ * necessary).
+ */
+ if (!hdev_is_powered(hdev) || val == enabled ||
+ hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECTED)) {
bool changed = false;
if (val != test_bit(HCI_ADVERTISING, &hdev->dev_flags)) {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] Bluetooth: Fix changing advertising setting while LE is connected
2013-10-08 13:52 [PATCH] Bluetooth: Fix changing advertising setting while LE is connected johan.hedberg
@ 2013-10-08 14:49 ` Marcel Holtmann
0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2013-10-08 14:49 UTC (permalink / raw)
To: johan.hedberg; +Cc: linux-bluetooth
Hi Johan,
> We only (re)enable advertising when LE is disconnected. Trying to enable
> advertising using mgmt_set_advertising while connected should simply
> change the flag but not do anything else (until the connection gets
> dropped). This patch fixes this by making an LE connection lookup to
> determine whether there are any connected devices or not.
>
> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
> ---
> net/bluetooth/mgmt.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-08 14:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-08 13:52 [PATCH] Bluetooth: Fix changing advertising setting while LE is connected johan.hedberg
2013-10-08 14:49 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox