From patchwork Tue Sep 1 22:00:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Winkler X-Patchwork-Id: 11749533 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B2B95618 for ; Tue, 1 Sep 2020 22:00:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 97C19207EA for ; Tue, 1 Sep 2020 22:00:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="EQylgbEd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729939AbgIAWAl (ORCPT ); Tue, 1 Sep 2020 18:00:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729681AbgIAWAk (ORCPT ); Tue, 1 Sep 2020 18:00:40 -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 6D2FBC061244 for ; Tue, 1 Sep 2020 15:00:40 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 207so2709766ybd.13 for ; Tue, 01 Sep 2020 15:00:40 -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=2pjMPOzpNyrqpjBIOCKze3A6gHCruyIibRIu9fK5k6E=; b=EQylgbEdbO1jIvVdRLO+ImoHZ9mFEHlMeaavDVLhjcc3l7m87tDHb4HHNz1Z2P2i+g N2MEMYiBg+XR5jIEgZf9ETFF7FRYcOu2eKQuxBUvh3MT+GM9Q329hNUWKUfYUz0099RY uSkimyDPd73QRg0/puz5lHgjhiTUN3gZ71V+9U79QcCcYrVmY9qCXoFcw7bAAMYnMdzk oxVbA7qEbkKARRvu03V8ZHN1K8A+yJAdX95DUBwP9bts0n9FuPhTONHSR5ZAcGWCREkt bnoIS9YRQF81mZusnrYlfVJhfXt2ogwYOU6dwKAjPAXfknu+MGFR479LE3uwZQQThdDs c1YA== 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=2pjMPOzpNyrqpjBIOCKze3A6gHCruyIibRIu9fK5k6E=; b=BqjotgAD5zy8UG3V0zY+MoSwtutno8OiHV5GVLN16lwNkbKakDfspSUYlNEIx9OOrI 2H620Eh0CtetntLOZylgofp06pGQ05mE+kAmO13qPWY4g27MFUp4+W3uxS0LJccYkXFP z5fq2D2LOqHgMzcU0XinTm5vOmFOQGUvDq3DUB+Wgngf1nNosFlSIFFr6mgGw7nxfgip vamkHhex545PurRWUz8ATEOu4WqeFTjy8EVPxTcxHhv8T0yy0GGfkSIAETWT7xY0zXd6 A/0n75R5ha2LZ9TzcaEdIVsyQ+Mhcxd15Obr97jf9NdhkAk/y8RWoBX7fBOleGb941xT sGAA== X-Gm-Message-State: AOAM5310kUK7I26l52QGYxHaAbi6GXW+/o+sCkIcZGZc4DhDF5N2VUDy Rnid3y/B5HT4p3Ul4Cmx8+9m5HWaiZmMtSRq6kG8diTBENBMB7gKowFOr3H+wCdyCLqEJm6eTaJ sbuP4wI86khEAhfCM5iKAynooGEFkQFucQAw31JjO+KykyI3jyQklZ9vUPPs/oJANxAFGN3RUvi wvnqSZWcxYGcsBrDRY X-Google-Smtp-Source: ABdhPJwvgDTHCt9+Zhqq30zNVMjzllK0eBLoZmQ9eVV6p5GGviZkHkwTAf/eku4F7uA9uPwULTCFFrqURi4kYvxTpJ+Z X-Received: from danielwinkler-linux.mtv.corp.google.com ([2620:15c:202:201:f693:9fff:fef4:4e59]) (user=danielwinkler job=sendgmr) by 2002:a25:c7cd:: with SMTP id w196mr5350640ybe.351.1598997639598; Tue, 01 Sep 2020 15:00:39 -0700 (PDT) Date: Tue, 1 Sep 2020 15:00:22 -0700 In-Reply-To: <20200901220024.662941-1-danielwinkler@google.com> Message-Id: <20200901145820.Bluez.v2.1.Idf2f9f409a4df20b466ba723dd9b729275a5afbf@changeid> Mime-Version: 1.0 References: <20200901220024.662941-1-danielwinkler@google.com> X-Mailer: git-send-email 2.28.0.402.g5ffc5be6b7-goog Subject: [Bluez PATCH v2 1/3] advertising: Add SupportedFeatures to LEAdvertisingManager1 From: Daniel Winkler To: linux-bluetooth@vger.kernel.org Cc: chromeos-bluetooth-upstreaming@chromium.org, Daniel Winkler , Miao-chen Chou Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org The new SupportedFeatures member tells advertising clients whether the platform has hardware support for advertising or capability to set tx power of advertisements. Additionally, fix small typo in "secondary_exists" function name. Change is tested on hatch and kukui chromebooks by using dbus-send to verify that SupportedFeatures always exists, and is only populated when extended advertising is available. Reviewed-by: Miao-chen Chou --- Changes in v2: - Expose empty SupportedFeatures if no support available lib/mgmt.h | 2 ++ src/advertising.c | 43 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/lib/mgmt.h b/lib/mgmt.h index a800bcab4..38182e576 100644 --- a/lib/mgmt.h +++ b/lib/mgmt.h @@ -516,6 +516,8 @@ struct mgmt_rp_add_advertising { #define MGMT_ADV_FLAG_SEC_1M (1 << 7) #define MGMT_ADV_FLAG_SEC_2M (1 << 8) #define MGMT_ADV_FLAG_SEC_CODED (1 << 9) +#define MGMT_ADV_FLAG_CAN_SET_TX_POWER (1 << 10) +#define MGMT_ADV_FLAG_HW_OFFLOAD (1 << 11) #define MGMT_OP_REMOVE_ADVERTISING 0x003F struct mgmt_cp_remove_advertising { diff --git a/src/advertising.c b/src/advertising.c index e5f25948d..518d0a80a 100644 --- a/src/advertising.c +++ b/src/advertising.c @@ -1321,7 +1321,8 @@ static void append_secondary(struct btd_adv_manager *manager, } } -static gboolean secondary_exits(const GDBusPropertyTable *property, void *data) +static gboolean secondary_exists(const GDBusPropertyTable *property, + void *data) { struct btd_adv_manager *manager = data; @@ -1345,12 +1346,50 @@ static gboolean get_supported_secondary(const GDBusPropertyTable *property, return TRUE; } +static struct adv_feature { + int flag; + const char *name; +} features[] = { + { MGMT_ADV_FLAG_CAN_SET_TX_POWER, "CanSetTxPower" }, + { MGMT_ADV_FLAG_HW_OFFLOAD, "HardwareOffload" }, + { }, +}; + +static void append_features(struct btd_adv_manager *manager, + DBusMessageIter *iter) +{ + struct adv_feature *feat; + + for (feat = features; feat->name; feat++) { + if (manager->supported_flags & feat->flag) + dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, + &feat->name); + } +} + +static gboolean get_supported_features(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct btd_adv_manager *manager = data; + DBusMessageIter entry; + + dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, + DBUS_TYPE_STRING_AS_STRING, &entry); + + append_features(manager, &entry); + + dbus_message_iter_close_container(iter, &entry); + + return TRUE; +} + static const GDBusPropertyTable properties[] = { { "ActiveInstances", "y", get_active_instances, NULL, NULL }, { "SupportedInstances", "y", get_instances, NULL, NULL }, { "SupportedIncludes", "as", get_supported_includes, NULL, NULL }, { "SupportedSecondaryChannels", "as", get_supported_secondary, NULL, - secondary_exits }, + secondary_exists }, + { "SupportedFeatures", "as", get_supported_features, NULL, NULL }, { } }; From patchwork Tue Sep 1 22:00:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Winkler X-Patchwork-Id: 11749535 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 721B6618 for ; Tue, 1 Sep 2020 22:00:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 567A3206C0 for ; Tue, 1 Sep 2020 22:00:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="mJOq3nud" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729949AbgIAWAr (ORCPT ); Tue, 1 Sep 2020 18:00:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729681AbgIAWAp (ORCPT ); Tue, 1 Sep 2020 18:00:45 -0400 Received: from mail-qk1-x74a.google.com (mail-qk1-x74a.google.com [IPv6:2607:f8b0:4864:20::74a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1705C061244 for ; Tue, 1 Sep 2020 15:00:45 -0700 (PDT) Received: by mail-qk1-x74a.google.com with SMTP id v16so1942555qka.18 for ; Tue, 01 Sep 2020 15:00:45 -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=hnl7tu+tFkxi4drosybbGZuJGk8hlqywEjZu+JdyxrI=; b=mJOq3nudhJLOQ/5by+6oaYDoAD9icfuqJh7bQE4kcsBrqbUSzqC3dmptvZz+L1Evk4 0aMAKBGLlld7PZtqcTgztVG5gst5lxULxb6NPiWPG9CfuQmBbkp9XIb3xNMW2ZmaG6TA HGBgaaosWcIWW1ftmC/wyDFiDYN0bmYGjsmWgKH4KhuXsvDPuV43tG2TePhLsRXsA/Gy S7nDTvZzMkmCmKPmxmwflQAIvhelZr2ODhntJLWZPvt4KcP6wXuzCiXowT+09HZR+pCp cvx+DZti7y4ck8JsvYsOrRtC34ge3mPy5QamMZht5vE8nLy1bd5W28kNTEbfS8qIz14b NUyw== 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=hnl7tu+tFkxi4drosybbGZuJGk8hlqywEjZu+JdyxrI=; b=s/chXl1IGbtQEdUnf4I2gjgr/0hOIjiOB+mfEO5Y2UY4Ij18w311KHZbhOQakyhlGd KoskxAVs8evjAqVl9RPahgRsApUkcJB/ZXeQp7URvqrR5eteiPoHM8nboukJw2CokT2l AwrR8uc6EYipfBdCjuui+u1Gr5+KXV68HKlcGH503RzBhiR6+BrGogP07PXGlKq3qsWW kut8XnB3WG8mwiJkH7d7xKsxAS6lk5BpwbbZJqQFhS6Ad3jfxIVp9P8GTuPv65QVKPrF Cr9G8/oLbBDqfglFpTW92sTmfYR+s7giEGS5MtNiRXkNizHVLiRa/mesA04tglM9Qi9+ 2PTA== X-Gm-Message-State: AOAM531PdJHvjLveIEvPeMVTBZrH7fKz1jtg6TqjLtsVh3UtDP3NhKt7 cH1Dn6KBnNp+zmyo1liZLMClbVt0WYucIgBMVdF9a3hc/pq5l7xhF2FHx5zb61DcKZpv93B2DS4 QnbH74U7sBNXIirR798f7dX2qH91b7ZrnbSXxODekFfQguD2YCvE8NsdnBDLsAnvTTf2K5VU6iq NkWJIR/C9STJTkF2EA X-Google-Smtp-Source: ABdhPJzjWAmiSZ7Y7fqkGLzJzJAoY7cYni0t4CuOky31bwC5OEEZQVg/AyHWkEhxFA0yXLsVDnm4tb4OxBswIDBY8T/D X-Received: from danielwinkler-linux.mtv.corp.google.com ([2620:15c:202:201:f693:9fff:fef4:4e59]) (user=danielwinkler job=sendgmr) by 2002:a05:6214:1146:: with SMTP id b6mr3638038qvt.135.1598997644794; Tue, 01 Sep 2020 15:00:44 -0700 (PDT) Date: Tue, 1 Sep 2020 15:00:23 -0700 In-Reply-To: <20200901220024.662941-1-danielwinkler@google.com> Message-Id: <20200901145820.Bluez.v2.2.I33cf8432f94675b635ab429b3125f54048c5b66a@changeid> Mime-Version: 1.0 References: <20200901220024.662941-1-danielwinkler@google.com> X-Mailer: git-send-email 2.28.0.402.g5ffc5be6b7-goog Subject: [Bluez PATCH v2 2/3] advertising: Add adv SupportedFeatures to bluetoothctl From: Daniel Winkler To: linux-bluetooth@vger.kernel.org Cc: chromeos-bluetooth-upstreaming@chromium.org, Daniel Winkler , Miao-chen Chou Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This change adds SupportedFeatures to be shown in "show" option of bluetoothctl. It was tested with and without kernel support for features to verify that they are shown or not shown correctly. Change was tested by verifying SupportedFeatures were populated correctly in bluetoothctl on hatch and kukui chromebooks Reviewed-by: Miao-chen Chou --- Changes in v2: None client/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/client/main.c b/client/main.c index da877b546..6368cd516 100644 --- a/client/main.c +++ b/client/main.c @@ -933,6 +933,7 @@ static void cmd_show(int argc, char *argv[]) print_property(adapter->ad_proxy, "SupportedInstances"); print_property(adapter->ad_proxy, "SupportedIncludes"); print_property(adapter->ad_proxy, "SupportedSecondaryChannels"); + print_property(adapter->ad_proxy, "SupportedFeatures"); } return bt_shell_noninteractive_quit(EXIT_SUCCESS); From patchwork Tue Sep 1 22:00:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Winkler X-Patchwork-Id: 11749537 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9AC5A618 for ; Tue, 1 Sep 2020 22:00:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 488BB2083B for ; Tue, 1 Sep 2020 22:00:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="WWlbmm+h" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729631AbgIAWAu (ORCPT ); Tue, 1 Sep 2020 18:00:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729681AbgIAWAt (ORCPT ); Tue, 1 Sep 2020 18:00:49 -0400 Received: from mail-qv1-xf49.google.com (mail-qv1-xf49.google.com [IPv6:2607:f8b0:4864:20::f49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3BBCC061244 for ; Tue, 1 Sep 2020 15:00:48 -0700 (PDT) Received: by mail-qv1-xf49.google.com with SMTP id l1so2039675qvr.0 for ; Tue, 01 Sep 2020 15:00:48 -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=CcdNWU+86e5xTiOf7ah/MgfDcwkOxV/DvzlKs8nXLOM=; b=WWlbmm+hACMBMvxtgXeSsmeHJwZDYmBCs29VdHN+qjg60j+XqPybqlx6kj70U0k1Xl LgBfgCqJMrFtcJEkYtXSpGPt9aEC4HYt3lGj3qmTI1ORSs3/TXAOCqp0qROKh97nILE4 J72uySrAIj3aQQxF2GqX9s0oF02RxG7Cn9VLPDC9kvbSACFJc/QPNJiWcnHo4CplQ+ss Ut8Gvu7oC09CAQuNb7C2S/hmEolbeCPMtMT5DmkqhrESEWH+DPBTfY3no8Y18WoCpkEL NuN4RtyrEiUIdpgXAiSeok3Eb2t+GNaLtznwWo5KNwbNhAGpbTs5OgCvZbd5WsthE+Rd 0H4g== 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=CcdNWU+86e5xTiOf7ah/MgfDcwkOxV/DvzlKs8nXLOM=; b=rGIF20GH/Ecwm5q5zKnrl/2fNDjEmn2wf4bEwpf9UPyMcdLwRcvrqAoN8/KwGGsH+T LLgELlwm0by0L3y63oiVNAlpVJREcFn8BlBx1od3zkSTj5CGtrFDZjjU8/WyI16zCbc5 E/ZlNHrCy7iYUGoP7Vv6/OVW1NxeS0zRAcl/wommHmDT/SxVm/yp2MTHqZjFTVg09ogt 9E3OdTM/NTuUjy7QwP6w84VPEsd0usNUBnPPOXfjctPqMico8q6oc+4l2iT+EfQWTKDt K0vUZfRong5VvIqt5si4zCoY4LyDW1chCm2Aqs5c4mdLFQtgjQsHVEzmct24vmNlHAX0 NH6A== X-Gm-Message-State: AOAM533HzuQI/WWiL2ChRqFR5xq0V94DYQQwy9mA37UvhtZys0cMCcvP SW1siH5jq413/YD5b9AjozwcUQA9q44tYf8qJY5J2axkiB3UbzJ2zlHzkpTpCxYVNDUpa1x6ez+ 04Dxl0nj6Iy8MqDM0QplA9Am17Zq/w5Hocf9AumBjsAHO3+4bJOfU6/SvLl7Afe1bgRm+Yx5R0b ypC1u7DjLDvy2xuXdm X-Google-Smtp-Source: ABdhPJyJIYbHREBmZyiDaangNcbGagLACibNHazu9a2hX9ZSdgcqqdmUj4XCHPOxI3b/EPaX0f3a8UY+7HCGpSp7gFqb X-Received: from danielwinkler-linux.mtv.corp.google.com ([2620:15c:202:201:f693:9fff:fef4:4e59]) (user=danielwinkler job=sendgmr) by 2002:a0c:a342:: with SMTP id u60mr4111883qvu.2.1598997648082; Tue, 01 Sep 2020 15:00:48 -0700 (PDT) Date: Tue, 1 Sep 2020 15:00:24 -0700 In-Reply-To: <20200901220024.662941-1-danielwinkler@google.com> Message-Id: <20200901145820.Bluez.v2.3.Ieb6522963e3f54b0d63dd88ed3ce24a8942ed73e@changeid> Mime-Version: 1.0 References: <20200901220024.662941-1-danielwinkler@google.com> X-Mailer: git-send-email 2.28.0.402.g5ffc5be6b7-goog Subject: [Bluez PATCH v2 3/3] advertising: Add adv SupportedFeatures to doc From: Daniel Winkler To: linux-bluetooth@vger.kernel.org Cc: chromeos-bluetooth-upstreaming@chromium.org, Daniel Winkler , Miao-chen Chou Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Reviewed-by: Miao-chen Chou --- Changes in v2: - Doc: Expect empty SupportedFeatures if no support available doc/advertising-api.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/doc/advertising-api.txt b/doc/advertising-api.txt index b0565eab2..90a8a47f6 100644 --- a/doc/advertising-api.txt +++ b/doc/advertising-api.txt @@ -209,3 +209,21 @@ Properties byte ActiveInstances Possible values: "1M" "2M" "Coded" + + array{string} SupportedFeatures [readonly, optional] + + List of supported platform features. If no features + are available on the platform, the SupportedFeatures + array will be empty. + + Possible values: "CanSetTxPower" + + Indicates whether platform can + specify tx power on each + advertising instance. + + "HardwareOffload" + + Indicates whether multiple + advertising will be offloaded + to the controller.