Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1973997pxb; Mon, 8 Mar 2021 10:41:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJxS7tHryAzFcmKyqNuxI8ZhE5Iy3fSmHLl846rb3Xv+YpuaZwXQaPq5JulbkKQkeQ4AnnkP X-Received: by 2002:a05:6402:b31:: with SMTP id bo17mr23390790edb.113.1615228871893; Mon, 08 Mar 2021 10:41:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615228871; cv=none; d=google.com; s=arc-20160816; b=Yz9hpKFiWnetOxZAkazpSRCxjE+E4SDuQA9MqNFcR8zk5z9i4E39lmIxJ8MpwzGeWy l27W/kfwz0YeTNoqX7ybrVp5YQ/nWE248Cj2HD2huwkknyHb9dITxnO7HIp6AMOZtNZy MdiUNPK/2kTbSHZ5/zeajkikof1LUnv7DTB/NwwmefIt3gZ8S+7zJkICemXxpcAgRYMF vIoZ/KRnEfdvlKYKb1Ca+um30ruzcYy8ghFq/+rfRGPTjSAaaZoo3kFriSHIj920o0QM 7JIMmjBbDZpaLD757s67ps8e+1C7sFkTvXVOx2Ybu4lwupt8U4mFXVNuMmHGWhKi49NK JXbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=WVhzNT0R75Vb776in/lQfHHjf7gKVBYrk5VLjHEXNW0=; b=pisn/A4klH1cQ3O2g3J3DdG/ZAijZcm7g8xxfNzETu27lr48ei4xoAQldecAE56k3L f9F4vvL67mrRSMOvRpJC9qD2Jq+MvS7dQYbaWWkDQilDw9MeuZsBg062o1n5kpO0akUI lTZeeCCLP92aQn+nycsA12kRJS51+kZs4bv1NMaw+/m1L5AKYz57F4GBC+fVpJuNh97x wOxb5TErSjIN3UD8Z3Hwyk5gwc77T4BqXOPmocgclGWoeeycuN13CUlzrlWD32w3oFn4 gHRbRYKct1amEbPhGBfQXw/zDU82dX2VLGnBBjOKwfdRjHajJ4s5WgxbgoWdou/q3FDW CW7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NISlYcVp; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u12si8725004eda.121.2021.03.08.10.40.49; Mon, 08 Mar 2021 10:41:11 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=NISlYcVp; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230173AbhCHSjI (ORCPT + 99 others); Mon, 8 Mar 2021 13:39:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229646AbhCHSii (ORCPT ); Mon, 8 Mar 2021 13:38:38 -0500 Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69E6CC06174A for ; Mon, 8 Mar 2021 10:38:38 -0800 (PST) Received: by mail-oi1-x232.google.com with SMTP id z126so12010056oiz.6 for ; Mon, 08 Mar 2021 10:38:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WVhzNT0R75Vb776in/lQfHHjf7gKVBYrk5VLjHEXNW0=; b=NISlYcVpJPXaSBAysJs4yqTQ4/VKXIUlH6LVjJu0OERd4kgiNFYgk0YVSUYT8dmDJB 1i5mSgjTk1eitrIDEhq8snZd3Ylx3Vx3yLHQnK5kspyI/IHB41Jhdi5b+Mx5g62DI6Xs ie1LSz69C/TadPQevMZwbioWQUNvK4rvNqtaWAawOml9g9LcODhgHO1lKOaxGeb63TF4 hL+FAnMlr9ldZyHIRrQ1FuGxiS742a95bvAkwpIlCDBHXFnQI4JPmTdpsmeHkEB4b72l hHNRU4ED9D0Fk31hBiP2mnR+ZM+qshx1m0abroWXQXjMijrXRSMlJ+rqSzmeAB7+Y6bz TBzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WVhzNT0R75Vb776in/lQfHHjf7gKVBYrk5VLjHEXNW0=; b=eMUELX4XTrEb2jiZb2wmhD6MwfNZ/9IXSE0eRSxDYFCzENGHoc1aJehfp/p9P0htTi TdIIvgaVLpsJsNuTzHVhMPKtKIN4/96zvXZHINDLrVBGhu4ds9xg6p4b4A5Lt6vEfR9e qV2FcLk73ccar5cX64RLxarm5Iuns6p+CTiM7QOUvx++SSU6PiOBXsUUSZResKdNh/vE ROetxsPN7xZyAzp0JIJhGc6GExut0inUc0dkcpwnP7Uu1sI9M901EHvVAskqPwoQ0asa 6YMlRnJJ+ManKcz9r0F+/OOyxPqJcHodS9nnqP9k1eBL7IRW+wy9htJVLJFMp1kbiQ5H zuaQ== X-Gm-Message-State: AOAM532i6Ua4C0f0d00J2GgJyAexp4hUy8nvAgvTU+9cvc0E7C7fiF3D I4BW6pZEvvUuG1Lh1/395AmYSdS9ASiPqKraBgU= X-Received: by 2002:a54:468f:: with SMTP id k15mr162154oic.58.1615228717839; Mon, 08 Mar 2021 10:38:37 -0800 (PST) MIME-Version: 1.0 References: <20210305235217.2382976-1-danielwinkler@google.com> <20210305155113.Bluez.v3.1.Idf2f9f409a4df20b466ba723dd9b729275a5afbf@changeid> In-Reply-To: <20210305155113.Bluez.v3.1.Idf2f9f409a4df20b466ba723dd9b729275a5afbf@changeid> From: Luiz Augusto von Dentz Date: Mon, 8 Mar 2021 10:38:27 -0800 Message-ID: Subject: Re: [Bluez PATCH v3 1/3] advertising: Add SupportedFeatures to LEAdvertisingManager1 To: Daniel Winkler Cc: "linux-bluetooth@vger.kernel.org" , ChromeOS Bluetooth Upstreaming , Miao-chen Chou Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Daniel, On Fri, Mar 5, 2021 at 3:59 PM Daniel Winkler wrote: > > 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 v3: None > 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 76a03c9c2..c0021abd8 100644 > --- a/lib/mgmt.h > +++ b/lib/mgmt.h > @@ -503,6 +503,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_ADV_PARAM_DURATION (1 << 12) > #define MGMT_ADV_PARAM_TIMEOUT (1 << 13) > #define MGMT_ADV_PARAM_INTERVALS (1 << 14) > diff --git a/src/advertising.c b/src/advertising.c > index 15a343e52..dd6008cb9 100644 > --- a/src/advertising.c > +++ b/src/advertising.c > @@ -1616,7 +1616,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; > > @@ -1640,6 +1641,43 @@ 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 gboolean get_supported_cap(const GDBusPropertyTable *property, > DBusMessageIter *iter, void *data) > { > @@ -1678,7 +1716,8 @@ static const GDBusPropertyTable properties[] = { > { "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 }, Missing G_DBUS_PROPERTY_FLAG_EXPERIMENTAL. > { "SupportedCapabilities", "a{sv}", get_supported_cap, NULL, NULL, > G_DBUS_PROPERTY_FLAG_EXPERIMENTAL}, > { } > -- > 2.30.1.766.gb4fecdf3b7-goog > -- Luiz Augusto von Dentz