From patchwork Wed Aug 26 20:17:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Winkler X-Patchwork-Id: 11739605 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 C760A13B6 for ; Wed, 26 Aug 2020 20:17:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AB4C7207DF for ; Wed, 26 Aug 2020 20:17:27 +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="kOwGJoJB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726788AbgHZUR1 (ORCPT ); Wed, 26 Aug 2020 16:17:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726609AbgHZURZ (ORCPT ); Wed, 26 Aug 2020 16:17:25 -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 73A1FC061574 for ; Wed, 26 Aug 2020 13:17:25 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id l67so4319214ybb.7 for ; Wed, 26 Aug 2020 13:17:25 -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=x5I31Cx/lCkc6J4SrBA8xYUW95BrqBSHcoi2qMQlDjE=; b=kOwGJoJBl0E1Z7mvvPzizgkigTQAhMdEY9gNuEBwiXhYb2U3fTx6Zdax9uISRnqZpW V/+TPYWoXwyG+QHR6cb7NekVD0O2angGGyrrz1rLNhXN9Ykf1IcboxxBuXj9i5YelPqt rKLlspy2/yOd47/ysP6yd0fzf8ms45tFcgdVKukhkaD/LBxqWlE+lmmV6QS4mxYyP9w4 HdtOoDWRbr5CI2ROwVC+W6Q3dh6MgazSO/2BSRcE+oXeENVGoEDig2KgHCs5z9mQIGU3 3pclPjCg45VUi4+6OLUJQt/PBHw9NvsnlthdoLUYwRMcsuNufCW0MEtBNK3KpimB98Pb lnKA== 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=x5I31Cx/lCkc6J4SrBA8xYUW95BrqBSHcoi2qMQlDjE=; b=phhSZeQP0nKNJP9bLox1ZlUsYgfub05yHcGzyjEg9SNVgQ7c7L9i5aswovabBa3U1x VdDTSu+WxlbOIAhyaPOf/YBgLE6fy4RlyvVZHNvnHrGHQiuK6FcGpUK++RlWw7GGTXPP /msemgQnGb1lZdfdhYHocZ/I8at6J9QNycNDZuyeaeBVNiBfjALpgHYLkNb0+krGmU1s dQ3YTjIMRs9MrnnsLmI4fXwdgrBosCFtI62Nva7K/b8+pA2qs4iCitLcZFNKNub/DSrj tiXuBa8NR958p/JbFNMT9MEocAPS8NX50xKpDCYZfGety1Fy1mZ0DZ2o60IFPWDCnFYN i/1w== X-Gm-Message-State: AOAM531UI+W7WMNxYgeNtl5NB+LUPja3M/pKnoWP9BxPv15V27VRXt78 +PQ8s22UdZOwKqq+udukDz5P0CQUS91A+mrW/VkUTgjcH4vhSun//+zjErp46NlvsXfEh1vlNfE ha5Zc8cZKxHNM+HZ+WX9zcTvDuMFMAKfiPhPjuR/tIJI/YjHKMMe9Thuy5TfTvtuAv1T3dcEzpY IwgNserAbmOvU6UKs7 X-Google-Smtp-Source: ABdhPJyzWubI/t49HfmzVS/EHd+wEmNGrZHrvm1Eq7yUext2ROZJwxBxb4JLb4d56l04MKLJgSlXdCxHxDWDIFWoNNMg X-Received: from danielwinkler-linux.mtv.corp.google.com ([2620:15c:202:201:f693:9fff:fef4:4e59]) (user=danielwinkler job=sendgmr) by 2002:a25:cfcc:: with SMTP id f195mr24607098ybg.490.1598473044641; Wed, 26 Aug 2020 13:17:24 -0700 (PDT) Date: Wed, 26 Aug 2020 13:17:12 -0700 In-Reply-To: <20200826201715.1911816-1-danielwinkler@google.com> Message-Id: <20200826131610.Bluez.v1.1.Idf2f9f409a4df20b466ba723dd9b729275a5afbf@changeid> Mime-Version: 1.0 References: <20200826201715.1911816-1-danielwinkler@google.com> X-Mailer: git-send-email 2.28.0.297.g1956fa8f8d-goog Subject: [Bluez PATCH v1 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 are populated when extended advertising is available only. Reviewed-by: Miao-chen Chou --- lib/mgmt.h | 2 ++ src/advertising.c | 56 +++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 56 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..9853baa4e 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,63 @@ 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 gboolean display_features(const GDBusPropertyTable *property, + void *data) +{ + struct btd_adv_manager *manager = data; + + /* Currently, all displayed features are supported if hardware + * offloading is available, so this is used to determine if we + * should display the feature list + */ + return manager->supported_flags & (MGMT_ADV_FLAG_HW_OFFLOAD); +} + +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, + display_features }, { } }; From patchwork Wed Aug 26 20:17:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Winkler X-Patchwork-Id: 11739607 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 AB98313B6 for ; Wed, 26 Aug 2020 20:17:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 937EB207DF for ; Wed, 26 Aug 2020 20:17:34 +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="o+G+dhR1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726836AbgHZURc (ORCPT ); Wed, 26 Aug 2020 16:17:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726609AbgHZUR3 (ORCPT ); Wed, 26 Aug 2020 16:17:29 -0400 Received: from mail-pf1-x449.google.com (mail-pf1-x449.google.com [IPv6:2607:f8b0:4864:20::449]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1320C061574 for ; Wed, 26 Aug 2020 13:17:28 -0700 (PDT) Received: by mail-pf1-x449.google.com with SMTP id q15so2088424pfu.20 for ; Wed, 26 Aug 2020 13:17:28 -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=8A7xpmrr7m1zruibMkh52mGk5SyAjYE9eZwX3Vft4m0=; b=o+G+dhR1lqYgg39p8K3R5QaTMpv/JQmfFTL/gz67THL2lGfr1NPZ/mE4hG/KTzCyjA hxWtngR7G5cRomyyxV89sqEtaQBW2KAdWyzql/feEWtVccFVfQlh7I5fWlMHKs1+jZwZ w/Fsn/FgRIAVkDNFews/GAadPa9zo9prrGslRJu0kowpZVTUzZ9FucRAJKrifR9h9tG6 QmSBTiDVPCrpuRRcppCKPmqyflV4XvIGppL78hyd2W06dHhnVVJwWSg0WWIqG86Uo0OQ 8UWMcW7au7mpEAhjs/NIz89Rw3xp+7SY3YX2DlF2uoMQEYT0tGXk1Ng/VkLXoRxk98s8 3BIg== 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=8A7xpmrr7m1zruibMkh52mGk5SyAjYE9eZwX3Vft4m0=; b=H6RkaAshGbrmBkcOSX93IEn+VWfsvSiR0wH8VLhldReLlll5Y1A/mgMBOhsnBnN9Fp n8IS3oJheJDU8oDKaInvzyJ+s24Qg5WIQYmPkF/7GIM2ea0BihI3aM+3QRdiouSN54Q+ nFoo9ZbkMyZEqr75M3St8PnrEBnCabw9s/2E8r0k93i/suqn3uA8Q+wHxZHLVbC/oHXQ N7awYvP7hyybmGbkdulYBE3vk9CmRUWWimYl98P39s3XeIm4UcljH2bBYPolFpTS9hoW WsPFWUqSEm9z0UcIZeT8fZYGu24npvFPdlw4AJww0PNFxQHC8QevCesUsM+IshqYtNHd 6K3A== X-Gm-Message-State: AOAM531wdATIiAiBi5miQNP/iH2y4IUY6zBKpVZBqwpigjTVNC7716gR 2iRf1afif7og7WlVxT0ufZ10htorepgfkid4JDX/VWgZ+pyJvqbxsBJaRfGM01T1H8uK/v89IoG iT6z5usilO31pjqGP4n9MkYIZAPJEdr465MMrDahVnjsLE7OV6y0sPUjiuwuw77oCe0yiJhxfZh mJXIdh4izAYncenAfE X-Google-Smtp-Source: ABdhPJz8nNSZI6BVW+zkvDlh3BDmJbMRmDSBx1axTwqMTRb+K8SCDYGQlw/05B/blD4RTMrMcwRjapk0dVDC2rkWbAWe X-Received: from danielwinkler-linux.mtv.corp.google.com ([2620:15c:202:201:f693:9fff:fef4:4e59]) (user=danielwinkler job=sendgmr) by 2002:a17:90a:f290:: with SMTP id fs16mr7472481pjb.35.1598473048230; Wed, 26 Aug 2020 13:17:28 -0700 (PDT) Date: Wed, 26 Aug 2020 13:17:13 -0700 In-Reply-To: <20200826201715.1911816-1-danielwinkler@google.com> Message-Id: <20200826131610.Bluez.v1.2.I33cf8432f94675b635ab429b3125f54048c5b66a@changeid> Mime-Version: 1.0 References: <20200826201715.1911816-1-danielwinkler@google.com> X-Mailer: git-send-email 2.28.0.297.g1956fa8f8d-goog Subject: [Bluez PATCH v1 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 --- 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 Wed Aug 26 20:17:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Winkler X-Patchwork-Id: 11739609 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 2A65414E5 for ; Wed, 26 Aug 2020 20:17:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 137CF2080C for ; Wed, 26 Aug 2020 20:17:35 +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="reDgmPuM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726838AbgHZURe (ORCPT ); Wed, 26 Aug 2020 16:17:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726809AbgHZURc (ORCPT ); Wed, 26 Aug 2020 16:17:32 -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 03030C061574 for ; Wed, 26 Aug 2020 13:17:32 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id y9so4321574ybp.8 for ; Wed, 26 Aug 2020 13:17:31 -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=PiO+YY0khA5TeZgvkhFxD4wUEHIs5J/uidiQhfjjKHI=; b=reDgmPuMQ+/NY3WaTesgR4ekhIsCpfMhaqBC7u9shCaG39NcHh/PJ+v30oAAXnrLqf EY1oWYTVFzrg1aCIJrUkonr6yVUm2yyV0QSFa+Pl5u9jOKS/17rTwttlmBIyo+bvP+4Z HZctOS1VSPohKpnptG1bHTYLo8BUEeJNJR9MAMvEQ9PZyHdq5QD5N9jzVbQjJ+vii5CE BQiaK38wuRVLdBv1KvjZqO40Ck5agfM6v2teYJphFE2l/fYIzN2H/s7hpfxxBfb5eq4B iiV8g612yRV2iHDb6PzNq4Bc0YiwZWe5YM/sGFxYULxgUPxxPEub3scDZ8GFJi2b4II/ 7diw== 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=PiO+YY0khA5TeZgvkhFxD4wUEHIs5J/uidiQhfjjKHI=; b=iL/swBjzT2Fn2Z1+T/h37hw6ldPChQORu+YnmC8vf00MIZFZcxEKzXNo2viuhZexiu iXC2wu8ayAsLvl4q9CydF6D+kg09LXWMSCvuokOdy49EDodLaEMVntQFnkCm0MVPEfNg 2ONgDCqRLi+jhhx57WmugvxIHnGf3ZYFnBe/kHCUqM6YWN75YrppqVLbTbgPv4rVnvPA 8oG6y1m7vHeXaKUSommMpEMK5U9e6TvjYmkHreM7pPj+B7OKgjYSysbr3eAafjrEkhYJ 25rOXa4ow3MSAY/nkND5L5na0iF0Me9HDVqxEgEcYQVze9/tG84WtNX5s8ZplOrR3kNG XSug== X-Gm-Message-State: AOAM532B7bzHnzu5aKQMGz+LOp5+U7E+dfl5W4mLU2OIJKmwIVGwrMJP 7vunmzp2syRPiSbuTIvEe1TBA0XHxdiL2Hf/qDrojuWJDm2CKLlVJaIeyPAn7DgCrjm4lz4afE4 h1R1BxI5VQfhERBf97aFxGFWI9+Tw5Jgj/bI0/XOOS55INzBXasborsrg7sH7JgvyqlpNCEmTEI ZDvZUs63mwfwkNmsNa X-Google-Smtp-Source: ABdhPJxQn2zN2psowCQc40L2uP+d8b3nXR2+p9YtTcRG/X94z2yQ8+jWr1B2tm/znx1G6e8dg1sb3gWI2VkKCLyoQjr6 X-Received: from danielwinkler-linux.mtv.corp.google.com ([2620:15c:202:201:f693:9fff:fef4:4e59]) (user=danielwinkler job=sendgmr) by 2002:a25:c088:: with SMTP id c130mr4441613ybf.356.1598473051199; Wed, 26 Aug 2020 13:17:31 -0700 (PDT) Date: Wed, 26 Aug 2020 13:17:14 -0700 In-Reply-To: <20200826201715.1911816-1-danielwinkler@google.com> Message-Id: <20200826131610.Bluez.v1.3.Ieb6522963e3f54b0d63dd88ed3ce24a8942ed73e@changeid> Mime-Version: 1.0 References: <20200826201715.1911816-1-danielwinkler@google.com> X-Mailer: git-send-email 2.28.0.297.g1956fa8f8d-goog Subject: [Bluez PATCH v1 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 --- doc/advertising-api.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/doc/advertising-api.txt b/doc/advertising-api.txt index b0565eab2..0c07f349e 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 + endpoint will not be populated. + + 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.