Skip to contentSkip to conversation

Bluetooth: Fix using advertising instance duration as timeout

PATCH In review Luiz Augusto von Dentz 2 participants 4 messages Oct 24, 2019 – Oct 26, 2019

Subsystems (2)
lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/2 Bluetooth: Fix using advertising instance duration as timeout

From: Luiz Augusto von Dentz <[email protected]>

When using LE Set Extended Advertising Enable command the duration refers to the lifetime of instance not the length which is actually controlled by the interval_min and interval_max when setting the parameters.

---
 net/bluetooth/hci_request.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/hci_request.c +1 -1
index 7f6a581b5b7e..3a2ec34c2999 100644
@@ -1690,7 +1690,7 @@ int __hci_req_enable_ext_advertising(struct hci_request *req, u8 instance)
 	 * scheduling it.
 	 */
 	if (adv_instance && adv_instance->duration) {
-		u16 duration = adv_instance->duration * MSEC_PER_SEC;
+		u16 duration = adv_instance->timeout * MSEC_PER_SEC;
 
 		/* Time = N * 10 ms */
 		adv_set->duration = cpu_to_le16(duration / 10);
Signature · 1 line
2.21.0
author maintainer
#1 lore raw

PATCH 2/2 Bluetooth: Fix not using LE_ADV_NONCONN_IND for instance 0

From: Luiz Augusto von Dentz <[email protected]>

Instance 0 is controlled by stack itself and always set the local name in the scan response.

---
 net/bluetooth/hci_request.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
net/bluetooth/hci_request.c +4 -4
index 3a2ec34c2999..ba99c292cf04 100644
@@ -904,9 +904,9 @@ static u8 get_adv_instance_scan_rsp_len(struct hci_dev *hdev, u8 instance)
 {
 	struct adv_info *adv_instance;
 
-	/* Ignore instance 0 */
+	/* Instance 0x00 always set local name */
 	if (instance == 0x00)
-		return 0;
+		return 1;
 
 	adv_instance = hci_find_adv_instance(hdev, instance);
 	if (!adv_instance)
@@ -923,9 +923,9 @@ static u8 get_cur_adv_instance_scan_rsp_len(struct hci_dev *hdev)
 	u8 instance = hdev->cur_adv_instance;
 	struct adv_info *adv_instance;
 
-	/* Ignore instance 0 */
+	/* Instance 0x00 always set local name */
 	if (instance == 0x00)
-		return 0;
+		return 1;
 
 	adv_instance = hci_find_adv_instance(hdev, instance);
 	if (!adv_instance)
Signature · 1 line
2.21.0
maintainer
#2 lore raw

Re: [PATCH 2/2] Bluetooth: Fix not using LE_ADV_NONCONN_IND for instance 0

Hi Luiz,

Quoted 7 lines

Instance 0 is controlled by stack itself and always set the local name in the scan response.

---
net/bluetooth/hci_request.c | 8 ++++----

1 file changed, 4 insertions(+), 4 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel

maintainer
#3 lore raw
In reply to Luiz Augusto von Dentz

Hi Luiz,

Quoted 9 lines

When using LE Set Extended Advertising Enable command the duration refers to the lifetime of instance not the length which is actually controlled by the interval_min and interval_max when setting the parameters.

---
net/bluetooth/hci_request.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel