Message ID | 20201030170932.BlueZ.v2.1.I1f083629d41c747a33a3937fbc199ea37dccde12@changeid (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [BlueZ,v2,1/3] core: Add parmas to set interleaving durations | expand |
Hi Howard, On Fri, Oct 30, 2020 at 2:11 AM Howard Chung <howardchung@google.com> wrote: > > This patch adds parameters to control the durations of allowlist scan > and no-filter scan when the kernel is doing interleaving scan. > --- > > Changes in v2: > - re-implement on new mgmt_tlv API > > src/adapter.c | 12 ++++++++++++ > src/btd.h | 3 +++ > src/main.c | 12 ++++++++++++ > src/main.conf | 7 +++++++ > 4 files changed, 34 insertions(+) > > diff --git a/src/adapter.c b/src/adapter.c > index cac90b01bdc0..bdfe41d7e88c 100644 > --- a/src/adapter.c > +++ b/src/adapter.c > @@ -4342,6 +4342,18 @@ static void load_default_system_params(struct btd_adapter *adapter) > goto done; > } > > + if (btd_opts.defaults.le.advmon_allowlist_scan_duration) { > + if (!mgmt_tlv_add_fixed(tlv_list, 0x001d, > + &btd_opts.defaults.le.advmon_allowlist_scan_duration)) > + goto done; > + } > + > + if (btd_opts.defaults.le.advmon_no_filter_scan_duration) { > + if (!mgmt_tlv_add_fixed(tlv_list, 0x001e, > + &btd_opts.defaults.le.advmon_no_filter_scan_duration)) > + 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 4cd117538fda..b0df77fe3ab3 100644 > --- a/src/btd.h > +++ b/src/btd.h > @@ -71,6 +71,9 @@ struct btd_le_defaults { > uint16_t conn_latency; > uint16_t conn_lsto; > uint16_t autoconnect_timeout; > + > + uint16_t advmon_allowlist_scan_duration; > + uint16_t advmon_no_filter_scan_duration; > }; > > struct btd_defaults { > diff --git a/src/main.c b/src/main.c > index 0ae45015fbe8..47887a4059a1 100644 > --- a/src/main.c > +++ b/src/main.c > @@ -114,6 +114,8 @@ static const char *le_options[] = { > "ConnectionLatency", > "ConnectionSupervisionTimeout", > "Autoconnecttimeout", > + "AdvMonAllowlistScanDuration", > + "AdvMonNoFilterScanDuration", > NULL > }; > > @@ -497,6 +499,16 @@ static void parse_le_config(GKeyFile *config) > sizeof(btd_opts.defaults.le.autoconnect_timeout), > 0x0001, > 0x4000}, > + { "AdvMonAllowlistScanDuration", > + &btd_opts.defaults.le.advmon_allowlist_scan_duration, > + sizeof(btd_opts.defaults.le.advmon_allowlist_scan_duration), > + 1, > + 10000}, > + { "AdvMonNoFilterScanDuration", > + &btd_opts.defaults.le.advmon_no_filter_scan_duration, > + sizeof(btd_opts.defaults.le.advmon_no_filter_scan_duration), > + 1, > + 10000}, > }; > > if (btd_opts.mode == BT_MODE_BREDR) > diff --git a/src/main.conf b/src/main.conf > index 1b349821294b..a3f2020b04dc 100644 > --- a/src/main.conf > +++ b/src/main.conf > @@ -160,6 +160,13 @@ > #ConnectionSupervisionTimeout= > #Autoconnecttimeout= > > +# Scan duration during interleaving scan. Only used when scanning for ADV > +# monitors. The units are msec. > +# Default: 300 > +#AdvMonAllowlistScanDuration= > +# Default: 500 > +#AdvMonNoFilterScanDuration= > + > [GATT] > # GATT attribute cache. > # Possible values: > -- > 2.29.1.341.ge80a0c044ae-goog Applied, thanks.
diff --git a/src/adapter.c b/src/adapter.c index cac90b01bdc0..bdfe41d7e88c 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -4342,6 +4342,18 @@ static void load_default_system_params(struct btd_adapter *adapter) goto done; } + if (btd_opts.defaults.le.advmon_allowlist_scan_duration) { + if (!mgmt_tlv_add_fixed(tlv_list, 0x001d, + &btd_opts.defaults.le.advmon_allowlist_scan_duration)) + goto done; + } + + if (btd_opts.defaults.le.advmon_no_filter_scan_duration) { + if (!mgmt_tlv_add_fixed(tlv_list, 0x001e, + &btd_opts.defaults.le.advmon_no_filter_scan_duration)) + 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 4cd117538fda..b0df77fe3ab3 100644 --- a/src/btd.h +++ b/src/btd.h @@ -71,6 +71,9 @@ struct btd_le_defaults { uint16_t conn_latency; uint16_t conn_lsto; uint16_t autoconnect_timeout; + + uint16_t advmon_allowlist_scan_duration; + uint16_t advmon_no_filter_scan_duration; }; struct btd_defaults { diff --git a/src/main.c b/src/main.c index 0ae45015fbe8..47887a4059a1 100644 --- a/src/main.c +++ b/src/main.c @@ -114,6 +114,8 @@ static const char *le_options[] = { "ConnectionLatency", "ConnectionSupervisionTimeout", "Autoconnecttimeout", + "AdvMonAllowlistScanDuration", + "AdvMonNoFilterScanDuration", NULL }; @@ -497,6 +499,16 @@ static void parse_le_config(GKeyFile *config) sizeof(btd_opts.defaults.le.autoconnect_timeout), 0x0001, 0x4000}, + { "AdvMonAllowlistScanDuration", + &btd_opts.defaults.le.advmon_allowlist_scan_duration, + sizeof(btd_opts.defaults.le.advmon_allowlist_scan_duration), + 1, + 10000}, + { "AdvMonNoFilterScanDuration", + &btd_opts.defaults.le.advmon_no_filter_scan_duration, + sizeof(btd_opts.defaults.le.advmon_no_filter_scan_duration), + 1, + 10000}, }; if (btd_opts.mode == BT_MODE_BREDR) diff --git a/src/main.conf b/src/main.conf index 1b349821294b..a3f2020b04dc 100644 --- a/src/main.conf +++ b/src/main.conf @@ -160,6 +160,13 @@ #ConnectionSupervisionTimeout= #Autoconnecttimeout= +# Scan duration during interleaving scan. Only used when scanning for ADV +# monitors. The units are msec. +# Default: 300 +#AdvMonAllowlistScanDuration= +# Default: 500 +#AdvMonNoFilterScanDuration= + [GATT] # GATT attribute cache. # Possible values: