Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1630014pxb; Thu, 4 Mar 2021 16:57:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJy3e2T0PLACx/ECe7nTaXstv7HQKFR+sc0kDVAPnc5Lq+b/qIwMHTcpAMTLbNrwexR5V/Ao X-Received: by 2002:a02:9083:: with SMTP id x3mr6895064jaf.17.1614905849337; Thu, 04 Mar 2021 16:57:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614905849; cv=none; d=google.com; s=arc-20160816; b=0lxTH68UO/7hVTIc1FmiCVaY3AQWU3ikgNwP2XkWhrfUaJawIlPnYdM1waNWwIkkjD 3Q/rvKBfw8E1m3BvqSoJvgH/PtXxkrg+IdUZ/m+l16R6wWVAr9mTRYrEWdw3tlu5EfT/ 7URGupRnSob+uKsjZDjooVado4YvAmTRRpPptNoXW4d3/v1rUjbzlpPYk0roEPUc9Pwm Y1bSCjZpDU9F9IFwrdRth2m2Bzl55zQH00EMFSxd1IsHymdg24A51Yqd65DECVNP6lVd dL34525jyqZqJHyePr/CleMIQcklETHtEjn2QsYdO6K+pdmuSu1SUAXUjfUp3IXqyoJj YamQ== 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=B4e7SmHOZkqh/Hs71+KSM2Oz1ObvmdMgmfIEeDwkkGs=; b=w5A1gsVM81OwCQyuMqnHw6kxEN+Bpj4WhkfWUzWfYUU9L1prggb/xERxIp+EDIZ91b 3jFxdaLJW1HIBRBNe1gcyAs5iMRfwim+TowWWdNaNlgwCnFL2h91ttedWo4GTlAf1v0B lDjCP63bkRNWi6eKeuphttZCgc6DyjG3GVDY6Vt789TjqOhM/Guxik6RoNW/+LL/qNr/ +K40mcC3dy58PN+kNOugWiDmau2ye6DdQvs9b/G6E7Gr/jQ6EVqNJQ5TUPePCmtpCs9k iwQwKmKGzJWz3Io4BLg3Sc+Fivh8H6XQPBriLSuwJmpQ0yHkBVgOw8WgKn0uzTVKVTSw VwqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=uP9WBDwT; 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 22si925838ioz.62.2021.03.04.16.57.15; Thu, 04 Mar 2021 16:57:29 -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=@google.com header.s=20161025 header.b=uP9WBDwT; 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 S229562AbhCDUZ5 (ORCPT + 99 others); Thu, 4 Mar 2021 15:25:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229650AbhCDUZo (ORCPT ); Thu, 4 Mar 2021 15:25:44 -0500 Received: from mail-qv1-xf4a.google.com (mail-qv1-xf4a.google.com [IPv6:2607:f8b0:4864:20::f4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5E15C061760 for ; Thu, 4 Mar 2021 12:25:03 -0800 (PST) Received: by mail-qv1-xf4a.google.com with SMTP id b15so13343473qvz.15 for ; Thu, 04 Mar 2021 12:25:03 -0800 (PST) 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=B4e7SmHOZkqh/Hs71+KSM2Oz1ObvmdMgmfIEeDwkkGs=; b=uP9WBDwTr7fvhGYU/6XmcCNGc9DWsqPxZk8IOdsFXCTjeeywppawb7h/rEUQzsi7My 8beW924VmkYCCNnmiH0wm9HmBKHYbgeEX9A0M7W5SIdKfP9rqLZ+OgwXQ9ZYkV0BOFMJ l+SLWdaDrykded/R+v/4ARKRRoIShL+SDPY3Z/t2tUejJuk+Yca+XhZCdEyJsf/V6hda h6npmiEoTYIuEubOAKA8HXbnpxqp6jzxsOoaTW8xf41Wz/ZvjMQfmA6dlthAEIpvHQ1E b6EmBy2/8E8/Y8T1hsifS+A578qC3/yZsL3UnpP3fQIqxJh9nYLdE7y+NocvokT7MxTc 9sDQ== 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=B4e7SmHOZkqh/Hs71+KSM2Oz1ObvmdMgmfIEeDwkkGs=; b=APd3Q9p2Hgtz2hV9x8tZEWzfAXZD3GPkCgz6T0j/zB1PAL4V5FfX7W05/I+PCtDbSO NS/Mk4W+It7oiVr7RjKVXHxXQzdxLEF3TC/uSgGWTvH1CngEZyQ9tZTmilmNVKRJqjfV PKq0ePhacucow1ddRp0/hEH5Ppq+IPLoaBZmdduo8S/Q0/DuE1dcSKikLoaAZBZHv2yP ODovzwm0E3UamzKDa5XGARY+hTlUxxV+TVTnzdyrw9ngmMn98GwnboIoH/xSDd6FcVyN E2GGq66PZ18/3QfXzfozXnoP2A5nIBlaVMyGbiEw3Mg+ndz0DQdGCh8948Etp8N1P5YY 6tYg== X-Gm-Message-State: AOAM532MlfKKv4fXKkq7YNOTYDyThbEFH1fwIpeURnqBjI1orYqTWhHb tbIIftAoV0zhxY3UEtWwIH/OD6WD7w+mI9GgvYGjXRF/lQJ2+SOz6i/rBONRaq0yx7V2tUrQ4mH 7T78Nq3Fl69eSx3WWuU7V29SGQ9ph9LUGz/aP0DdzxdVchii6gaTlwccicYZaDQcjY91uNu8NYl DJewACSwZjovyEta5k Sender: "danielwinkler via sendgmr" X-Received: from danielwinkler-linux.mtv.corp.google.com ([2620:15c:202:201:a873:4408:c731:b8f2]) (user=danielwinkler job=sendgmr) by 2002:ad4:4ab0:: with SMTP id i16mr5520768qvx.1.1614889502952; Thu, 04 Mar 2021 12:25:02 -0800 (PST) Date: Thu, 4 Mar 2021 12:24:51 -0800 In-Reply-To: <20210304202452.1998022-1-danielwinkler@google.com> Message-Id: <20210304122005.Bluez.v2.2.I45b896f4512038309cbeab7a01f51e503141edab@changeid> Mime-Version: 1.0 References: <20210304202452.1998022-1-danielwinkler@google.com> X-Mailer: git-send-email 2.30.1.766.gb4fecdf3b7-goog Subject: [Bluez PATCH v2 2/3] advertising: Create and use scannable adv param flag From: Daniel Winkler To: linux-bluetooth@vger.kernel.org, luiz.dentz@gmail.com Cc: chromeos-bluetooth-upstreaming@chromium.org, Daniel Winkler , Alain Michaud , Sonny Sasaka Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org In order for the advertising parameters hci request to indicate that an advertising set uses a scannable PDU, we pass a scannable flag along with the initial parameters MGMT request. Without this patch, a broadcast advertisement with a scan response will either be rejected by the controller, or will ignore the requested scan response. The patch is tested by performing the above and confirming that the scan response is retrievable from a peer as expected. Reviewed-by: Alain Michaud Reviewed-by: Sonny Sasaka --- Changes in v2: - Check kernel supports flag before setting it lib/mgmt.h | 1 + src/advertising.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/mgmt.h b/lib/mgmt.h index 76a03c9c2..7b1b9ab54 100644 --- a/lib/mgmt.h +++ b/lib/mgmt.h @@ -507,6 +507,7 @@ struct mgmt_rp_add_advertising { #define MGMT_ADV_PARAM_TIMEOUT (1 << 13) #define MGMT_ADV_PARAM_INTERVALS (1 << 14) #define MGMT_ADV_PARAM_TX_POWER (1 << 15) +#define MGMT_ADV_PARAM_SCAN_RSP (1 << 16) #define MGMT_OP_REMOVE_ADVERTISING 0x003F struct mgmt_cp_remove_advertising { diff --git a/src/advertising.c b/src/advertising.c index f3dc357a1..cdf06154d 100644 --- a/src/advertising.c +++ b/src/advertising.c @@ -945,7 +945,13 @@ static int refresh_extended_adv(struct btd_adv_client *client, return -EINVAL; } - cp.flags = htobl(flags); + /* Indicate that this instance will be configured as scannable */ + if (client->scan_rsp_len && + client->manager->supported_flags & MGMT_ADV_PARAM_SCAN_RSP) { + flags |= MGMT_ADV_PARAM_SCAN_RSP; + } + + cp.flags = cpu_to_le32(flags); mgmt_ret = mgmt_send(client->manager->mgmt, MGMT_OP_ADD_EXT_ADV_PARAMS, client->manager->mgmt_index, sizeof(cp), &cp, -- 2.30.1.766.gb4fecdf3b7-goog