Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2832023pxk; Mon, 28 Sep 2020 00:44:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnDz5oUuQ0R8RkApgY1m7+SCXarotEZQgMUF196FzmasZlu0QIJ0xQAe33YeCVNMPryUBd X-Received: by 2002:a17:907:72cc:: with SMTP id du12mr422540ejc.150.1601279089560; Mon, 28 Sep 2020 00:44:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601279089; cv=none; d=google.com; s=arc-20160816; b=RW794ycnpqeRZSosLHZMccYlzccFFqa4JUpahoKUKbGzmLI4i2yDxlGU32DDRIRGb2 QcenHwauzHES2aeboTbvDlLAknB0XzInJH5Pe2NYWDsZFi0QLHvJ3amRln1YCkha8Ab0 sAZujBhW89t2csTdlEw048W3FeJoSiYQIGhRTu4Rk4vK98ckUOqDTFwpSmIKnRg+1tjI Qi2hXJx+LVbFQa8LUlEMb1RBgrPF3pB90Ya/BXJvTD3npI9yPf39QbZ1yg7r6Y2A1O6o n/8SH5KNeZsjmxQBo1+8gmiRTF5+pZLAsAY8sOctUn1XUGg3jk3iwaigp0NFyKgaRKk7 hC/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :sender:dkim-signature; bh=mJ5L5MriFE0YUPrbIn/gTQRHRCzqViv38cjaWaeup20=; b=wM+gUbIi9m/BL0lXCFf4jIFwOFoYsrzJ2N5p42phKxf3QQg4PKhmSbH4vtW2qB9y30 e/kUo0TF3DZHory7KIMNwsDcjO0ytGma2AVuNsBwle3cdOmjFwJvb1R2e9EKZgUfOu7B 4vKYvGBPHrF+vjzVXbR09v1TVLYICmgKfb36mhjrq6OXr2/Eto8PlQFngtP+Kj8+A6Qw QgFVDx+DeY8fsy50RBQ77g6PbpIChioD1L4Mps4PpEpBFPdhmT2etT7kwll3omhC85Xs SnhdcTaqJH3RfWQKBJYQY8OLp1Z1NSx+vvksnjY0nRqE9D0bDeqfyqcxt/aLV1u9PWKa 0Qpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hvzD2DDp; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z18si80158edm.355.2020.09.28.00.44.25; Mon, 28 Sep 2020 00:44:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hvzD2DDp; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726572AbgI1HoW (ORCPT + 99 others); Mon, 28 Sep 2020 03:44:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726566AbgI1HoV (ORCPT ); Mon, 28 Sep 2020 03:44:21 -0400 Received: from mail-qv1-xf4a.google.com (mail-qv1-xf4a.google.com [IPv6:2607:f8b0:4864:20::f4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9451AC0613CE for ; Mon, 28 Sep 2020 00:44:21 -0700 (PDT) Received: by mail-qv1-xf4a.google.com with SMTP id i17so119605qvj.22 for ; Mon, 28 Sep 2020 00:44:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=mJ5L5MriFE0YUPrbIn/gTQRHRCzqViv38cjaWaeup20=; b=hvzD2DDpNIZ+kcoW0RtwyoRAxnzDIXg12eF4DnySqx2Zc782VH4TJD/SFxyag5lCy6 H/gzSUqHBA/Nm1h5FAUADwHrgn3O2uiOeNAwJ/esJ3HiUcU9DpGRbtVed5ybBommswqE dSZ3Xy1fYZMUH7fboNfg7RwbiTN8TTOBo+O0NsOtGFceOtbmWVfCbaXhLNjPgV01+3X6 5QGESaB+Ry7JCGKQk4nQF6Cqd9gJjA5UfPivZXxrvz1uOtiFhh83TPOOQkwH7sIJDAYd D3sd4cNa1d/wfuMSh/ud67x70w2MUKYwFmfRfFhtKEOlRn7BQsXFXJJFAu0Y3cP5kYfu y3Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=mJ5L5MriFE0YUPrbIn/gTQRHRCzqViv38cjaWaeup20=; b=TlKHymCVPL6zEZJMa6yXqD4GEIrvVDkdBuwEwlgjdRNBzwrVP7/e2E5cDmbRANFZw0 8YUa4upqOM/Ixs5z5HPlE5ZR3hKS2C933J5y5hCV21KykMqAsSSrl5sl3jJ0NSUoPFTI p/+pxJ8sjv1pbINR90kQkIRieTdy5XxZ8FvF71JFLXQRWgJc12Y9aKS2vqYQG7nyKH5Q lKxL90EyUyA2Qjj7zAqR3DjyenOoDl6jOsfw2iWjOYRlGDbmpMu3iHVuCiUmccpuJ+pY hULuAcZi6bSsSUtS/w/dajPl9kJJrOBYwaiC/XuYr6k3Y6ZXILEh/5pC1G26JdgqScc6 5acQ== X-Gm-Message-State: AOAM532MqrfPzjFtPBgdiyiRG/D3X8nILWjfINQj+Uq2uttsEm7d8jJi kMLRswcsi8UuDgY4p1rpXonaOnnmSXd0x0xwwY5b5T58XiSWfAoPw1d7UUXZpp+Q8n5xwm7aC8X J3j+lINMs9ZHgLxlz3BNagiyxgwJMhN0zJbncpngxXKHNUSRN28WPxajmpBLSj+m9+qDOqN+J7T vxaWpan+Ku0Ak= Sender: "howardchung via sendgmr" X-Received: from howardchung-p920.tpe.corp.google.com ([2401:fa00:1:10:f693:9fff:fef4:4e45]) (user=howardchung job=sendgmr) by 2002:a0c:e892:: with SMTP id b18mr10702414qvo.5.1601279060685; Mon, 28 Sep 2020 00:44:20 -0700 (PDT) Date: Mon, 28 Sep 2020 15:44:01 +0800 Message-Id: <20200928154344.BlueZ.v4.1.I1f083629d41c747a33a3937fbc199ea37dccde12@changeid> Mime-Version: 1.0 X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog Subject: [BlueZ PATCH v4 1/3] core: Add params to set interleaving durations From: Howard Chung To: linux-bluetooth@vger.kernel.org Cc: luiz.dentz@gmail.com, mmandlik@chromium.org, mcchou@chromium.org, alainm@chromium.org, Howard Chung Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This patch adds parameters to control the durations of allowlist scan and no-filter scan when the kernel is doing interleaving scan. --- Changes in v4: - Change type of EnableAdvMonInterleaveScan default to u8 - Add a patch for doc/mgmt-api.txt Changes in v3: - Set EnableAdvMonInterleaveScan default to Disable Changes in v2: - Fix typo in the commit title src/adapter.c | 18 ++++++++++++++++++ src/hcid.h | 3 +++ src/main.c | 10 ++++++++++ src/main.conf | 7 +++++++ 4 files changed, 38 insertions(+) diff --git a/src/adapter.c b/src/adapter.c index c0053000ac19..f072541aad35 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -4418,6 +4418,24 @@ static void load_default_system_params(struct btd_adapter *adapter) len += sizeof(params[i].u16); } + if (main_opts.default_params.advmon_allowlist_scan_duration) { + params[i].entry.type = 0x001d; + params[i].entry.length = sizeof(params[i].u16); + params[i].u16 = + main_opts.default_params.advmon_allowlist_scan_duration; + ++i; + len += sizeof(params[i].u16); + } + + if (main_opts.default_params.advmon_no_filter_scan_duration) { + params[i].entry.type = 0x001e; + params[i].entry.length = sizeof(params[i].u16); + params[i].u16 = + main_opts.default_params.advmon_no_filter_scan_duration; + ++i; + len += sizeof(params[i].u16); + } + err = mgmt_send(adapter->mgmt, MGMT_OP_SET_DEF_SYSTEM_CONFIG, adapter->dev_id, len, params, NULL, NULL, NULL); if (!err) diff --git a/src/hcid.h b/src/hcid.h index 95d4b9665193..713eab8e03ae 100644 --- a/src/hcid.h +++ b/src/hcid.h @@ -80,6 +80,9 @@ struct main_opts { uint16_t le_conn_latency; uint16_t le_conn_lsto; uint16_t le_autoconnect_timeout; + + uint16_t advmon_allowlist_scan_duration; + uint16_t advmon_no_filter_scan_duration; } default_params; diff --git a/src/main.c b/src/main.c index 77be776686a8..38f193a093df 100644 --- a/src/main.c +++ b/src/main.c @@ -110,6 +110,8 @@ static const char *controller_options[] = { "LEConnectionLatency", "LEConnectionSupervisionTimeout", "LEAutoconnecttimeout", + "AdvMonAllowlistScanDuration", + "AdvMonNoFilterScanDuration", NULL }; @@ -421,6 +423,14 @@ static void parse_controller_config(GKeyFile *config) &main_opts.default_params.le_autoconnect_timeout, 0x0001, 0x4000}, + { "AdvMonAllowlistScanDuration", + &main_opts.default_params.advmon_allowlist_scan_duration, + 1, + 10000}, + { "AdvMonNoFilterScanDuration", + &main_opts.default_params.advmon_no_filter_scan_duration, + 1, + 10000}, }; uint16_t i; diff --git a/src/main.conf b/src/main.conf index 8d85702d4316..3b341f44c9cf 100644 --- a/src/main.conf +++ b/src/main.conf @@ -152,6 +152,13 @@ #LEConnectionSupervisionTimeout= #LEAutoconnecttimeout= +# 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.28.0.681.g6f77f65b4e-goog