From: Alain Michaud <alainm@chromium.org>
To: linux-bluetooth@vger.kernel.org
Cc: Alain Michaud <alainm@chromium.org>
Subject: [BlueZ PATCH v2] profiles/scanparam: use configured scanparams when available
Date: Fri, 26 Jun 2020 21:21:06 +0000 [thread overview]
Message-ID: <20200626212106.807415-1-alainm@chromium.org> (raw)
This patch updates the scan parameter service to use the configured scan
parameters when available rather than the hardcoded kernel defaults.
---
Changes in v2:
- Fixing checkpatch comment warning.
profiles/scanparam/scan.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/profiles/scanparam/scan.c b/profiles/scanparam/scan.c
index 9e8f57747..d72be3dff 100644
--- a/profiles/scanparam/scan.c
+++ b/profiles/scanparam/scan.c
@@ -45,12 +45,11 @@
#include "src/shared/gatt-db.h"
#include "src/shared/gatt-client.h"
#include "attrib/att.h"
+#include "src/hcid.h"
#define SCAN_INTERVAL_WIN_UUID 0x2A4F
#define SCAN_REFRESH_UUID 0x2A31
-#define SCAN_INTERVAL 0x0060
-#define SCAN_WINDOW 0x0030
#define SERVER_REQUIRES_REFRESH 0x00
struct scan {
@@ -75,8 +74,16 @@ static void write_scan_params(struct scan *scan)
{
uint8_t value[4];
- put_le16(SCAN_INTERVAL, &value[0]);
- put_le16(SCAN_WINDOW, &value[2]);
+ /* Unless scan parameters are configured, use the known kernel default
+ * parameters
+ */
+ put_le16(main_opts.default_params.le_scan_interval_autoconnect ?
+ main_opts.default_params.le_scan_interval_autoconnect :
+ 0x60, &value[0]);
+
+ put_le16(main_opts.default_params.le_scan_win_autoconnect ?
+ main_opts.default_params.le_scan_win_autoconnect :
+ 0x30, &value[2]);
bt_gatt_client_write_without_response(scan->client, scan->iwhandle,
false, value, sizeof(value));
--
2.27.0.212.ge8ba1cc988-goog
reply other threads:[~2020-06-26 21:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200626212106.807415-1-alainm@chromium.org \
--to=alainm@chromium.org \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).