[BlueZ PATCH v2 2/3] core: Add param to disable interleave scan

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

 



This patch adds parameter to enable/disable the interleave scan feature.
---

Changes in v2:
- set enable_advmon_interleave_scan to uint8_t

 src/adapter.c | 6 ++++++
 src/btd.h     | 1 +
 src/main.c    | 7 +++++++
 src/main.conf | 6 ++++++
 4 files changed, 20 insertions(+)

diff --git a/src/adapter.c b/src/adapter.c
index bdfe41d7e88c..c7b2e0233639 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -4354,6 +4354,12 @@ static void load_default_system_params(struct btd_adapter *adapter)
 			goto done;
 	}
 
+	if (btd_opts.defaults.le.enable_advmon_interleave_scan != 0xFF) {
+		if (!mgmt_tlv_add_fixed(tlv_list, 0x001f,
+				&btd_opts.defaults.le.enable_advmon_interleave_scan))
+			goto done;
+	}
+
 	err = mgmt_send_tlv(adapter->mgmt, MGMT_OP_SET_DEF_SYSTEM_CONFIG,
 			adapter->dev_id, tlv_list, NULL, NULL, NULL);
 
diff --git a/src/btd.h b/src/btd.h
index b0df77fe3ab3..c98414e35529 100644
--- a/src/btd.h
+++ b/src/btd.h
@@ -74,6 +74,7 @@ struct btd_le_defaults {
 
 	uint16_t	advmon_allowlist_scan_duration;
 	uint16_t	advmon_no_filter_scan_duration;
+	uint8_t		enable_advmon_interleave_scan;
 };
 
 struct btd_defaults {
diff --git a/src/main.c b/src/main.c
index 47887a4059a1..9bbfba2f09c0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -116,6 +116,7 @@ static const char *le_options[] = {
 	"Autoconnecttimeout",
 	"AdvMonAllowlistScanDuration",
 	"AdvMonNoFilterScanDuration",
+	"EnableAdvMonInterleaveScan",
 	NULL
 };
 
@@ -509,6 +510,11 @@ static void parse_le_config(GKeyFile *config)
 		  sizeof(btd_opts.defaults.le.advmon_no_filter_scan_duration),
 		  1,
 		  10000},
+		{ "EnableAdvMonInterleaveScan",
+		  &btd_opts.defaults.le.enable_advmon_interleave_scan,
+		  sizeof(btd_opts.defaults.le.enable_advmon_interleave_scan),
+		  0,
+		  1},
 	};
 
 	if (btd_opts.mode == BT_MODE_BREDR)
@@ -761,6 +767,7 @@ static void init_defaults(void)
 	btd_opts.defaults.num_entries = 0;
 	btd_opts.defaults.br.page_scan_type = 0xFFFF;
 	btd_opts.defaults.br.scan_type = 0xFFFF;
+	btd_opts.defaults.le.enable_advmon_interleave_scan = 0xFF;
 
 	if (sscanf(VERSION, "%hhu.%hhu", &major, &minor) != 2)
 		return;
diff --git a/src/main.conf b/src/main.conf
index a3f2020b04dc..54f6a36bd991 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -167,6 +167,12 @@
 # Default: 500
 #AdvMonNoFilterScanDuration=
 
+# Enable/Disable Advertisement Monitor interleave scan for power saving.
+# 0: disable
+# 1: enable
+# Defaults to 1
+#EnableAdvMonInterleaveScan=
+
 [GATT]
 # GATT attribute cache.
 # Possible values:
-- 
2.29.1.341.ge80a0c044ae-goog




[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