Commit 66c417c1 authored by Johan Hedberg's avatar Johan Hedberg Committed by Marcel Holtmann

Bluetooth: Add flag to track the real advertising state

Having a single HCI_ADVERTISING flag is problematic since it tries to
track both the real advertising state and the corresponding mgmt
setting. To make the logic simpler and more reliable add a new flag that
only tracks the actual advertising state that has been written to the
controller.
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent a70f4b5f
...@@ -175,7 +175,7 @@ enum { ...@@ -175,7 +175,7 @@ enum {
HCI_UNCONFIGURED, HCI_UNCONFIGURED,
HCI_USER_CHANNEL, HCI_USER_CHANNEL,
HCI_EXT_CONFIGURED, HCI_EXT_CONFIGURED,
HCI_LE_ADV,
HCI_LE_SCAN, HCI_LE_SCAN,
HCI_SSP_ENABLED, HCI_SSP_ENABLED,
HCI_SC_ENABLED, HCI_SC_ENABLED,
...@@ -200,7 +200,7 @@ enum { ...@@ -200,7 +200,7 @@ enum {
* or the HCI device is closed. * or the HCI device is closed.
*/ */
#define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \ #define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \
BIT(HCI_FAST_CONNECTABLE)) BIT(HCI_FAST_CONNECTABLE) | BIT(HCI_LE_ADV))
/* HCI ioctl defines */ /* HCI ioctl defines */
#define HCIDEVUP _IOW('H', 201, int) #define HCIDEVUP _IOW('H', 201, int)
......
...@@ -1069,11 +1069,15 @@ static void hci_cc_le_set_adv_enable(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -1069,11 +1069,15 @@ static void hci_cc_le_set_adv_enable(struct hci_dev *hdev, struct sk_buff *skb)
if (*sent) { if (*sent) {
struct hci_conn *conn; struct hci_conn *conn;
set_bit(HCI_LE_ADV, &hdev->dev_flags);
conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT); conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT);
if (conn) if (conn)
queue_delayed_work(hdev->workqueue, queue_delayed_work(hdev->workqueue,
&conn->le_conn_timeout, &conn->le_conn_timeout,
conn->conn_timeout); conn->conn_timeout);
} else {
clear_bit(HCI_LE_ADV, &hdev->dev_flags);
} }
mgmt_advertising(hdev, *sent); mgmt_advertising(hdev, *sent);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment