Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp857993pxk; Thu, 1 Oct 2020 16:02:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2vN7rfu1AnpO4TQJlQxm/NUnXUa5AI43HeFM66qA5VqGc8ppihtOecR04DVYmhPdewyH+ X-Received: by 2002:a17:906:c205:: with SMTP id d5mr11185451ejz.367.1601593370785; Thu, 01 Oct 2020 16:02:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601593370; cv=none; d=google.com; s=arc-20160816; b=i2m1rc7XgQiFARi0kU4wcpfvaWgRrPLr7XPZNNf5eDqMOF5Pf8kX3r7wIYBNmvcsTo Z4sLWHpa4c7eoEpS9hOnZgRO9TOjY1ixTvv6n8QrtXO+4D/qXYc144ySw+KWWsGDnyYI VPV0KNpoKYPV8OqGPBTS9zym70eClrVK+qBnZ+nmoI1YwO4bNBjQk2pRbXW+Hh6OIL14 psQ0wOsnrXZcvUH/lrbGrQfahnDG4zfXZrTkDdccKprjRhb8PAQXJcwWmFDeNQDEvjKG jxCrZ4544rV8/hwgdHnTIZx6vgj2KfiCo1qadoaY1XETp9kSQdSRKsW2Gnp38ntxyGy2 D5Xg== 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:references:mime-version :message-id:in-reply-to:date:sender:dkim-signature; bh=7hcKSJOws0inHn5BAdCtq4uJyHEUr81OaimuZXQjlLY=; b=Qc8tdMMm1AsAE0qOF2pj2fDzNryahjNxNk3dUv1qPW24JIwuuxYSgPyjlZVchfO/Ie MEokkYuN4ox3sliOSzYlcU0lKWyQYGXUjZuT/lb3mFu9IgKk5eDL+XQODljJ+HsgdZcN Ugz7LNiwAxK8ipNY6H0zE44Xu26L8Ora0GQRHCvhEbs0Y5SCCoDxRwq5gA+7wJWf/U/c IB1VkYeJg3Jif6AovCdAjnhhzVCeoxFbX7ZSlOELE7E12DfYfzCZo6KM2uwQbhHE5uoJ 1ZdYpl4zqMBwYc5o3NgeuQoYBfExqpJGptMXoP1A8GkVN6H3oK7iPxl307kqwEosMncN UknA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=gH6hA2J3; 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 rn21si4429384ejb.69.2020.10.01.16.02.19; Thu, 01 Oct 2020 16:02:50 -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=gH6hA2J3; 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 S1727780AbgJAXCI (ORCPT + 99 others); Thu, 1 Oct 2020 19:02:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733275AbgJAXCG (ORCPT ); Thu, 1 Oct 2020 19:02:06 -0400 Received: from mail-qt1-x84a.google.com (mail-qt1-x84a.google.com [IPv6:2607:f8b0:4864:20::84a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7F8BC0613D0 for ; Thu, 1 Oct 2020 16:02:06 -0700 (PDT) Received: by mail-qt1-x84a.google.com with SMTP id f4so71478qta.12 for ; Thu, 01 Oct 2020 16:02:06 -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=7hcKSJOws0inHn5BAdCtq4uJyHEUr81OaimuZXQjlLY=; b=gH6hA2J3y+eLevsLjTIpYvUJpwJR4MUCbaQDK0ZHJocj+R4jDkHNpNwS06rYwu9rXC WAb8EFfyLkjDe1fIbaQ49/0sTER4ev0rqr3AW3lT4D1ipZVNW0NdDjKM2CeBtbLlzIO3 JF7iguINN5dZT0s4XB2rJx/JtpoUAtmAxIVx8FK5z6Ay7wkaw/cyYDVdNXdL2LOnbN4N Mq+IIcoG5nSuarygt8cA2TSAwWvGNzAkXIlh+9283HZDdhzCfvc8qnYIEOm+SzVZEenw DjmBJfq3Tj+BrGeVHo5uaXT22HYMB4VXJl7QOWjhpE2Zvv+XOkpCiO4UoU4Fxi7CtIqU BhoA== 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=7hcKSJOws0inHn5BAdCtq4uJyHEUr81OaimuZXQjlLY=; b=euuZ9w1HEbuFEncd5oAu0Laeclf68JE285CYKnfT8n/33cbBRNn2q9i1Txh5USEwXH cXxc7S7nxUrj0zHVrUe63uVAr1qsGzjhGoiDanLue7GgDHZQNYanw46Wc/MxEioAs0gW 9ergfeZfNc/7RmvnBaLSxVWtnS6verqG2OtnATYCE9twjMTXnjhG+MMjusaG+XBBjwUD nuOMsEtMG7zRXiJB9h5LJCQWsdG5Zc3lxnEjb4fmTyIpOHRZfUrbDdT6/RZYycGIeV8b JQpGXGUjCUbsiofuPbkjcSQvraS+XdAsG+pzEnN68ULP22/8V07KWNVTE59eAaf4uQzX R3gw== X-Gm-Message-State: AOAM5302qZhvGdPeVW/qpTnpXX9MLVfjh7Qky2Oj/hqOA10jgE8dp7+k kJE7KrRBC12o4hh0GSyAjeefK6+XD5xJxN29g914 Sender: "danielwinkler via sendgmr" X-Received: from danielwinkler-linux.mtv.corp.google.com ([2620:15c:202:201:f693:9fff:fef4:4e59]) (user=danielwinkler job=sendgmr) by 2002:ad4:42c7:: with SMTP id f7mr6689511qvr.11.1601593325815; Thu, 01 Oct 2020 16:02:05 -0700 (PDT) Date: Thu, 1 Oct 2020 16:01:46 -0700 In-Reply-To: <20201001230152.2422908-1-danielwinkler@google.com> Message-Id: <20201001155738.Bluez.v4.4.I50d9faa25e9da6e71d77c83c7d47a5b135e88799@changeid> Mime-Version: 1.0 References: <20201001230152.2422908-1-danielwinkler@google.com> X-Mailer: git-send-email 2.28.0.709.gb0816b6eb0-goog Subject: [Bluez PATCH v4 04/10] advertising: Detect if extended advertising mgmt commands are supported From: Daniel Winkler To: luiz.von.dentz@intel.com Cc: linux-bluetooth@vger.kernel.org, chromeos-bluetooth-upstreaming@chromium.org, Daniel Winkler , Sonny Sasaka , Alain Michaud Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org We need to know if kernel supports the new MGMT interface. To do so, we check the return from adapter's MGMT_OP_READ_COMMANDS call for the new commands. This will later be used to route our requests for new advertisements. The change is tested by manually verifying that the correct MGMT commands are used when the feature is and is not available in kernel. Reviewed-by: Sonny Sasaka Reviewed-by: Alain Michaud --- Changes in v4: None Changes in v3: None Changes in v2: - Uses btd_has_kernel_features to detect kernel command support src/adapter.c | 4 ++++ src/adapter.h | 1 + src/advertising.c | 3 +++ 3 files changed, 8 insertions(+) diff --git a/src/adapter.c b/src/adapter.c index c0053000a..0e035172e 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -9640,6 +9640,10 @@ static void read_commands_complete(uint8_t status, uint16_t length, DBG("kernel supports exp features"); kernel_features |= KERNEL_EXP_FEATURES; break; + case MGMT_OP_ADD_EXT_ADV_PARAMS: + DBG("kernel supports ext adv commands"); + kernel_features |= KERNEL_HAS_EXT_ADV_ADD_CMDS; + break; default: break; } diff --git a/src/adapter.h b/src/adapter.h index dcc574857..ace72affd 100644 --- a/src/adapter.h +++ b/src/adapter.h @@ -233,6 +233,7 @@ enum kernel_features { KERNEL_SET_SYSTEM_CONFIG = 1 << 2, KERNEL_EXP_FEATURES = 1 << 3, KERNEL_HAS_RESUME_EVT = 1 << 4, + KERNEL_HAS_EXT_ADV_ADD_CMDS = 1 << 5, }; bool btd_has_kernel_features(uint32_t feature); diff --git a/src/advertising.c b/src/advertising.c index c03869e50..7c7599552 100644 --- a/src/advertising.c +++ b/src/advertising.c @@ -48,6 +48,7 @@ struct btd_adv_manager { uint8_t max_ads; uint32_t supported_flags; unsigned int instance_bitmap; + bool extended_add_cmds; }; #define AD_TYPE_BROADCAST 0 @@ -1417,6 +1418,8 @@ static struct btd_adv_manager *manager_create(struct btd_adapter *adapter, manager->mgmt_index = btd_adapter_get_index(adapter); manager->clients = queue_new(); manager->supported_flags = MGMT_ADV_FLAG_LOCAL_NAME; + manager->extended_add_cmds = + btd_has_kernel_features(KERNEL_HAS_EXT_ADV_ADD_CMDS); if (!g_dbus_register_interface(btd_get_dbus_connection(), adapter_get_path(manager->adapter), -- 2.28.0.709.gb0816b6eb0-goog