From patchwork Fri Oct 30 09:11:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Howard Chung X-Patchwork-Id: 11868883 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F734C55179 for ; Fri, 30 Oct 2020 09:21:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BEDCA20825 for ; Fri, 30 Oct 2020 09:21:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ZLZYs3yB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726236AbgJ3JVG (ORCPT ); Fri, 30 Oct 2020 05:21:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726166AbgJ3JVF (ORCPT ); Fri, 30 Oct 2020 05:21:05 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DE1AC0613D2 for ; Fri, 30 Oct 2020 02:11:12 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id a12so5595225ybc.20 for ; Fri, 30 Oct 2020 02:11:12 -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=Ro1tGHllJsXx0VhhU/CbeMUu9vrpptndMHkugcz+pvM=; b=ZLZYs3yBGgn6xU5y6g77/GbGk2fRMbwhKeFkM4QQxL0CQzbiGqshNFgFeq3iQhUX+V pdi/hxwbG5xL8oY+2uqrf/0lCEotMyYuBH7O26Yy+mN0dC10fFa7oSS775qQe5eVIxS7 y3W7bngGchi93TRR0xnOjkglvlTdkF/m5r1XOUpd5/bz/YC1/0xWAuAqdE5YHGyzNLoT czy7GqXfqRgWUppLjzg9ugQSCSBXxpwttoTA9zMXhCa9aRn/Gq9+qmPGLKXSA7tUpdNO YsseaqVbfZDC9vkaO+2j0z/xysO6KEAR0mt8xMVQKyROABmlPsjkRSAIhS3yik0TfLI8 ZsMw== 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=Ro1tGHllJsXx0VhhU/CbeMUu9vrpptndMHkugcz+pvM=; b=cb1hSlnejgj6IDtShQKG92W/iHtkwl/vxZdyQEcBLeyMZb7M7lcQKJw9WrARb5lKLc OWN5ZzntkaO5Y1mw9xQkHKTktgHnncUmeBxSwHt3zlI3VFC0lNJhlC6hUxyU09OKGbv6 oEiRfX+OV9/GgU/RVgtWIx4nJZEP7fTP9UCCjtZNqk9VudlyRkfWnGsVZULy1XJbCe7T fmTJwhl0nDPbMRThM3/IqpkHOwgL87g/b+pzaUZs1hw87e6iFEJzL591S/c2o2j8UEVL l2JM/LjXlLGmiY4FerwVch1gM6m6TFFlwY9nZf8Lu36RO4OvfkhPrXBkb8lnnkUyrvqx /WUg== X-Gm-Message-State: AOAM5313mD0Ef7Tn7E+jhglNgZvfGPiIaihyqxq4vpUlpliahoEb66Wt WaxqjFH9pWx7d/+vsgQ54qwHsV6Wd3FYw53bU+U7NaghZYW2iYEDJ8pG362lmeMmTdiqCSj3SUi 5lC9e2FnMrCjX9sSLBnAdhCCUbPrtCOc8bwlQOML1EPm6o5C/MYsNSEnn3Gz7ivXx/F4N88fyCT n3WaNS75CSFKE= X-Google-Smtp-Source: ABdhPJyUsaNovpOuaYuxFmbKWlwunkWLCDoDdIOmLkuXrgHKQEMJS0frcZjEASi5xIhsApBhnsfKBg82MuKyRBQmsw== 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:a25:2311:: with SMTP id j17mr2129360ybj.362.1604049071280; Fri, 30 Oct 2020 02:11:11 -0700 (PDT) Date: Fri, 30 Oct 2020 17:11:00 +0800 Message-Id: <20201030170932.BlueZ.v2.1.I1f083629d41c747a33a3937fbc199ea37dccde12@changeid> Mime-Version: 1.0 X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [BlueZ PATCH v2 1/3] core: Add parmas 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 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 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: From patchwork Fri Oct 30 09:11:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Howard Chung X-Patchwork-Id: 11868887 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3FE6C56201 for ; Fri, 30 Oct 2020 09:21:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 45F4420825 for ; Fri, 30 Oct 2020 09:21:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="IaCjmUwb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726077AbgJ3JVE (ORCPT ); Fri, 30 Oct 2020 05:21:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726083AbgJ3JVE (ORCPT ); Fri, 30 Oct 2020 05:21:04 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CE0CC0613D4 for ; Fri, 30 Oct 2020 02:11:16 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id u13so5531690ybk.9 for ; Fri, 30 Oct 2020 02:11:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=KnDpF4ZW5zBRAqzn7DevZ/tCs2YZnFFcAdaI748CGpI=; b=IaCjmUwbZNkqO+t9ySvwALKn5xlGcVpSwa0hnY8rEPzvM00OxoKLbu4xMTplcnoT26 fbM7SElX2p3oAB4IT9qTGr2WX0G0spjkqmrPhcYvAbWXCqN1429ArihV+qEIW3jzOizt 42LkzlPkIb9aW5tjznBpklnIXSdUIAZU26YxIzE83Ko+sbHS9DTc615EEV1Xh4ghQQfh lRCQwJ8gyPtF7VFPmzWl1r8q2LqLq4a2otcIoxGzGpstZhO13J/AaTyPK0YISjhUSz5f yVvU5KmOfH1zQteX7CgqT8bwUNV9gP664XjjtvxTcrN4RhUtAAQhM20Or4308VsbPEPQ ptiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=KnDpF4ZW5zBRAqzn7DevZ/tCs2YZnFFcAdaI748CGpI=; b=LqYKXtE+RpJtSf2K3Tkf91xV2qbq5VWvbSz9YaDCkY5lFnyKZhtqTCZmRaVLCJfl+c TdLtLpHyN5w5YVViyKdBUl9wtCJMo0TKUnBBdPTj58ObU5FQJdzzsrCYo4aXDr6qi5uX tdjUQQEOZj3A9jUs6RQ7c1vdf3PU7JW3bl8tlttZQ+qz/ZE6/LDQ8YB3zep5kw482yRz eJtYmC2cOlIYb8FMUJ1dSldtjHfCdAAbb/KWkJwKHKFNgPbHgtAJ8EXsngDJ09Uuducf IAyhdF0FwD7jDKe8aW3Hj4hrF64CnytfIpYybsyshTSNiOaz4XqG4xzLQ6MRpxegf2td CXXg== X-Gm-Message-State: AOAM532kjmgzHIUV+Q/RD2ulr3xTdRbv97rmuNb4Q1G1Jj1ZBSaV6LRf /ie+egDKktyv7DKC99Q4YH3ZJiHAZbA8rMGyOlbLbmZdnn3bvCVxznAa6fz/ZeZ7jj2dYUun23z Z77KZi81jYg8xoe574/tgBcTb4YWjOXKvaK7Xu3SyvoYwsMA89rHexVaBIoXDYm+OgemnkQCIm2 p4ICpmlS59CoA= X-Google-Smtp-Source: ABdhPJxeJHgeXhMAvb5hd83iG6BCC1+iegzQU/WgqjTg+d3kQdGAOL3HWmHJHu6UsKErzTKXMr3ZYEGR8xf64K3mJw== 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:a25:3303:: with SMTP id z3mr2196340ybz.9.1604049075179; Fri, 30 Oct 2020 02:11:15 -0700 (PDT) Date: Fri, 30 Oct 2020 17:11:01 +0800 In-Reply-To: <20201030170932.BlueZ.v2.1.I1f083629d41c747a33a3937fbc199ea37dccde12@changeid> Message-Id: <20201030170932.BlueZ.v2.2.Iac5207375d22fb7b96ae4ef73b49ae4ab457219c@changeid> Mime-Version: 1.0 References: <20201030170932.BlueZ.v2.1.I1f083629d41c747a33a3937fbc199ea37dccde12@changeid> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [BlueZ PATCH v2 2/3] core: Add param to disable interleave scan 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 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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: From patchwork Fri Oct 30 09:11:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Howard Chung X-Patchwork-Id: 11868885 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70195C61DD8 for ; Fri, 30 Oct 2020 09:21:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 105DE20825 for ; Fri, 30 Oct 2020 09:21:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ozXyMct5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726242AbgJ3JVG (ORCPT ); Fri, 30 Oct 2020 05:21:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726083AbgJ3JVF (ORCPT ); Fri, 30 Oct 2020 05:21:05 -0400 Received: from mail-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 848C7C0613D6 for ; Fri, 30 Oct 2020 02:11:19 -0700 (PDT) Received: by mail-qk1-x749.google.com with SMTP id w189so3444325qkd.6 for ; Fri, 30 Oct 2020 02:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=lQ4KBfib0ccEaGKQpjcrLjst4wBoAQNNRSPstCq2R1o=; b=ozXyMct52rtlS4r0vot7vhWWI5f0No9Nx8v/Gf8IwXUnU0kCORoSpLWZcjX8/sqKV9 cobtlSbWrgJAbigHZ86OsKG4FUoiLPlXx/sHq7rR4bWBJ5LZOZd7MKopL6CGQGAd9ruT ukDzZo9ZXOZADxsxMPycoohjV5jUb79O+K913Gsre0hJNsGwm5u0qOiqZ+qTQgmh5Ce1 6+cPvyumTzO1FOv/Xuj81MVuZnRyivbuaqc64lzKyCGPPaLZfzfl0zmi90rl/7o1gKet PT4rhdDGf6t+UkBpaeuQlzLdNTei4Y4yYpzmKFBfi2JQ7trW7jnLtI75p0TWk9Gx0xmu bgAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=lQ4KBfib0ccEaGKQpjcrLjst4wBoAQNNRSPstCq2R1o=; b=F3AmQxuWrw19JN8Am4PgA4Lf1NwylMx/pVn3stGlEad3pFvKE/p+KcYInNYUyjkYq6 W63knNZM/bQHGS1DInznF1MY5Oz+0h05XE5zEdPF+apaTuapAmuu42On2ZGG+9Gm/o/K lSTfAaXIfyN/5/DL8V0EPmW/2ERSIPT9bxss9EAWdhSFUf92lqD8O0BJhPxQsqj6aISf GMB/arOEvd4n5mdlm3etsRhh0R9pUFvljQOFz2xIVVELZjV2ZhlT/kjXoLhVmehaX0Vw 8UpDwQYikutLUnCRfwTfCpyJGxReJCri9XldfRp848l6slWr9bi+515UWQGfz2VXH42n xFQw== X-Gm-Message-State: AOAM533qDUoiz8vKBos2ParzpPT/0IY903GIilpcKjM/+AmSsroGeAfp WLMcKHFmchhpiJpUmeO6Ven+EPscUne924yJzsdeacKkNlBuEhFMxL6YoCwT1QTPZSjN0hYTb6t xmBOg7oHOnki1uD/3NQAmDT14zWpapyoZ/OzXv+yly1rOMUQ1f0NofW+JAFXv9kbt7Pak8eVO0a 08oEE7QN8PB9M= X-Google-Smtp-Source: ABdhPJy5tDsrkOagFHTU76W9EUfFocd8ZUfi7sVsQlXrx2P9TCXOyXrc4jOKg7cKc2oAfO2jS8oaNkErNW4GGYoaIg== 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:9064:: with SMTP id o91mr8418367qvo.28.1604049078700; Fri, 30 Oct 2020 02:11:18 -0700 (PDT) Date: Fri, 30 Oct 2020 17:11:02 +0800 In-Reply-To: <20201030170932.BlueZ.v2.1.I1f083629d41c747a33a3937fbc199ea37dccde12@changeid> Message-Id: <20201030170932.BlueZ.v2.3.I22eddcf44e1bec5295c2e162c0477347d2194958@changeid> Mime-Version: 1.0 References: <20201030170932.BlueZ.v2.1.I1f083629d41c747a33a3937fbc199ea37dccde12@changeid> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [BlueZ PATCH v2 3/3] core: Fix mistakes of using mgmt_tlv_add_fixed 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 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Fix mistakes on checking the result of mgmt_tlv_add_fixed. --- (no changes since v1) src/adapter.c | 52 +++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/adapter.c b/src/adapter.c index c7b2e0233639..f4d05f3731df 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -4187,157 +4187,157 @@ static void load_default_system_params(struct btd_adapter *adapter) } if (btd_opts.defaults.br.page_scan_win) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0002, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0002, &btd_opts.defaults.br.page_scan_win)) goto done; } if (btd_opts.defaults.br.scan_type != 0xFFFF) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0003, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0003, &btd_opts.defaults.br.scan_type)) goto done; } if (btd_opts.defaults.br.scan_interval) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0004, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0004, &btd_opts.defaults.br.scan_interval)) goto done; } if (btd_opts.defaults.br.scan_win) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0005, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0005, &btd_opts.defaults.br.scan_win)) goto done; } if (btd_opts.defaults.br.link_supervision_timeout) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0006, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0006, &btd_opts.defaults.br.link_supervision_timeout)) goto done; } if (btd_opts.defaults.br.page_timeout) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0007, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0007, &btd_opts.defaults.br.page_timeout)) goto done; } if (btd_opts.defaults.br.min_sniff_interval) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0008, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0008, &btd_opts.defaults.br.min_sniff_interval)) goto done; } if (btd_opts.defaults.br.max_sniff_interval) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0009, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0009, &btd_opts.defaults.br.max_sniff_interval)) goto done; } if (btd_opts.defaults.le.min_adv_interval) { - if (mgmt_tlv_add_fixed(tlv_list, 0x000a, + if (!mgmt_tlv_add_fixed(tlv_list, 0x000a, &btd_opts.defaults.le.min_adv_interval)) goto done; } if (btd_opts.defaults.le.max_adv_interval) { - if (mgmt_tlv_add_fixed(tlv_list, 0x000b, + if (!mgmt_tlv_add_fixed(tlv_list, 0x000b, &btd_opts.defaults.le.max_adv_interval)) goto done; } if (btd_opts.defaults.le.adv_rotation_interval) { - if (mgmt_tlv_add_fixed(tlv_list, 0x000c, + if (!mgmt_tlv_add_fixed(tlv_list, 0x000c, &btd_opts.defaults.le.adv_rotation_interval)) goto done; } if (btd_opts.defaults.le.scan_interval_autoconnect) { - if (mgmt_tlv_add_fixed(tlv_list, 0x000d, + if (!mgmt_tlv_add_fixed(tlv_list, 0x000d, &btd_opts.defaults.le.scan_interval_autoconnect)) goto done; } if (btd_opts.defaults.le.scan_win_autoconnect) { - if (mgmt_tlv_add_fixed(tlv_list, 0x000e, + if (!mgmt_tlv_add_fixed(tlv_list, 0x000e, &btd_opts.defaults.le.scan_win_autoconnect)) goto done; } if (btd_opts.defaults.le.scan_interval_suspend) { - if (mgmt_tlv_add_fixed(tlv_list, 0x000f, + if (!mgmt_tlv_add_fixed(tlv_list, 0x000f, &btd_opts.defaults.le.scan_interval_suspend)) goto done; } if (btd_opts.defaults.le.scan_win_suspend) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0010, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0010, &btd_opts.defaults.le.scan_win_suspend)) goto done; } if (btd_opts.defaults.le.scan_interval_discovery) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0011, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0011, &btd_opts.defaults.le.scan_interval_discovery)) goto done; } if (btd_opts.defaults.le.scan_win_discovery) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0012, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0012, &btd_opts.defaults.le.scan_win_discovery)) goto done; } if (btd_opts.defaults.le.scan_interval_adv_monitor) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0013, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0013, &btd_opts.defaults.le.scan_interval_adv_monitor)) goto done; } if (btd_opts.defaults.le.scan_win_adv_monitor) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0014, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0014, &btd_opts.defaults.le.scan_win_adv_monitor)) goto done; } if (btd_opts.defaults.le.scan_interval_connect) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0015, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0015, &btd_opts.defaults.le.scan_interval_connect)) goto done; } if (btd_opts.defaults.le.scan_win_connect) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0016, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0016, &btd_opts.defaults.le.scan_win_connect)) goto done; } if (btd_opts.defaults.le.min_conn_interval) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0017, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0017, &btd_opts.defaults.le.min_conn_interval)) goto done; } if (btd_opts.defaults.le.max_conn_interval) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0018, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0018, &btd_opts.defaults.le.max_conn_interval)) goto done; } if (btd_opts.defaults.le.conn_latency) { - if (mgmt_tlv_add_fixed(tlv_list, 0x0019, + if (!mgmt_tlv_add_fixed(tlv_list, 0x0019, &btd_opts.defaults.le.conn_latency)) goto done; } if (btd_opts.defaults.le.conn_lsto) { - if (mgmt_tlv_add_fixed(tlv_list, 0x001a, + if (!mgmt_tlv_add_fixed(tlv_list, 0x001a, &btd_opts.defaults.le.conn_lsto)) goto done; } if (btd_opts.defaults.le.autoconnect_timeout) { - if (mgmt_tlv_add_fixed(tlv_list, 0x001b, + if (!mgmt_tlv_add_fixed(tlv_list, 0x001b, &btd_opts.defaults.le.autoconnect_timeout)) goto done; }