Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5328706pxj; Tue, 22 Jun 2021 21:54:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylOG+o37XgLMY7t+JLjwnKvx0lXz6w7SlZyey38I06TsY8KC2gH/1J/LwpSuw/3o8YnFwO X-Received: by 2002:a17:906:1796:: with SMTP id t22mr7660069eje.304.1624424061042; Tue, 22 Jun 2021 21:54:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624424061; cv=none; d=google.com; s=arc-20160816; b=B2NPcPYueRB2sVxIZnaKnychkjrzwqVDBDHrp4Xiq1gzpqv2gGAPDC+JNjyG/M2zLk dZuEL2VQ7J/Qy9LZzFyUnTPjaUgsmI/FGD27jaOYjly0wi9gaoqzaMQBBGBi/ZfA9gJ+ vnWe/fu/cRpuv+TprFewPBc5QDhIAztfnWJpj1xWalTTuluO2vsGBW+m5yFnifBu68vV aiLofgDgUvedgUHFs1UK2agxlQYU+L+8EIYLgBwb+A0krBQ1UhtpkxP0ZzbYuDAq9+lb AE8fdVfmZKJA4Gl8rscamQMx6/ZcoY1VRUNSqcx8oLqyQahMtq188b+wtRQRcD2ALSU5 wF1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=fijeLYxAajiOMQuAFN30hNSlRkp9xloU3BMCsZB7sQs=; b=Dl7noAMZdk00szX/s6UqEwBiy+kEf1Qzm1rofIvLZ+kswKjd2iJAUp6r3p4ng+0DUG FoIyUkyTMvYj9L3tA3NnSPLO06HqoUWF2uv4F2uhOVEnDZ3aAC/hN9XmgW3bPRX2xQ46 hhoEi91MSFo1A3jLcCB07WnwP72ZzgoFpWNQ1twhdVfqPdD0xOhD7OF66GMC5vY+kOXW 9psMqX5Xm6lcKXQkW3QueEyGYcIOWgGEaUSvXauDkbSbkwtc0yWDHOl6xLWTdoaHwAxK u/zw3D0jKdB7cOPCnRhaNmSaa3qe6mt/MHmQgzidmyTTGJmO+1MIbyDa80a7NoQd4VGf 7oFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZGHwVB8B; 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 c18si4993848ede.436.2021.06.22.21.53.58; Tue, 22 Jun 2021 21:54:21 -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=@gmail.com header.s=20161025 header.b=ZGHwVB8B; 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 S230030AbhFWEwI (ORCPT + 99 others); Wed, 23 Jun 2021 00:52:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbhFWEwG (ORCPT ); Wed, 23 Jun 2021 00:52:06 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E24DDC06175F for ; Tue, 22 Jun 2021 21:49:49 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id p9so737380pgb.1 for ; Tue, 22 Jun 2021 21:49:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=fijeLYxAajiOMQuAFN30hNSlRkp9xloU3BMCsZB7sQs=; b=ZGHwVB8BXii6/bZFD4MPHL/tWRMNRJ4GyOcpweSofQ+NffIcLxYqkIttyp5U/wYa2K GC1b0jPVcdWJ8jGBLFhU5ZyVWk6T2zPzdfkKd8TjOjxYUWOxAmsw+/0vBBgThTtwOVZy YWwNfEK++U9I4c6pbEnC2AgxNGKPDtsWXXFmnYH3WplL7KrJHCAVZ1nFmBxPSYeL3oEy SJx9B/9cOFZaUFmLYcDg4B/Q7xTxAZbSPl2P70kYziKJlSxO1xV97kLOqihCmHDa4Hmf iTm4pT2EkQOvkh+cBclbCla5Yq83a8IITHrTJJgLzkieF8CW6VSKdzLeXOVsi1HG0ViH bCyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fijeLYxAajiOMQuAFN30hNSlRkp9xloU3BMCsZB7sQs=; b=f0w4VTh49qLu6EXA7uCV/KZXMTGANI3M3cdnBUCVimroXsjIdhahbts4OmdFD9JF4I Uu6aZpvxm/42U9CYCvFkVpX31eMTgIvR853NVPWWnfni8TlVDaS0XPkMENyJ5G684YsK oFtUbGrJ/UlZ5TQ2Q/fq+u0MoOyG8U1hjYtV0jXz5yIke/YgqeagVXujVA2THf/SVLTh 12zrYnvpszAYEEVhm6M6PB4k2f2fwXi/TZBftfPxY2MgNJdmQs2dyRuAnMe61RDi2bTc k3/cky+DjR3vdtnVCWE5/89YmgSZPLx7vzedSGU5uSDLyz0Yetk/4FpoQN5OlH0T/KnQ VdoA== X-Gm-Message-State: AOAM530v3QqOwtEGdHsVnwnkOWdqGSC9r5rGD6PQV7dzvFFsHGCZFdge 94qS+exLqGP5XvVTiNV26hDk8qAuv4c= X-Received: by 2002:a63:7d4e:: with SMTP id m14mr2051854pgn.421.1624423789379; Tue, 22 Jun 2021 21:49:49 -0700 (PDT) Received: from han1-mobl3.intel.com ([2601:1c0:6a01:d830::512a]) by smtp.gmail.com with ESMTPSA id c184sm900129pfa.38.2021.06.22.21.49.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 21:49:49 -0700 (PDT) From: Tedd Ho-Jeong An To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH v2 4/5] emulator/bthost: Create ext adv params before setting adv data Date: Tue, 22 Jun 2021 21:49:43 -0700 Message-Id: <20210623044944.602205-4-hj.tedd.an@gmail.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210623044944.602205-1-hj.tedd.an@gmail.com> References: <20210623044944.602205-1-hj.tedd.an@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Tedd Ho-Jeong An Based on the SPEC 5.2 Vol 4, Part E, Section 7.8.54, the LE_Set_Extended_Advertising_Data_Command may be issued after an advertising set identifed by the Advertising_Handle has been created using the HCI_LE_Set_Extended_Advertising_Parameters command. --- emulator/bthost.c | 26 ++++++++++++++++++++------ emulator/bthost.h | 1 + 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/emulator/bthost.c b/emulator/bthost.c index 16934d35a..62f5a1bae 100644 --- a/emulator/bthost.c +++ b/emulator/bthost.c @@ -2549,6 +2549,7 @@ void bthost_set_ext_adv_data(struct bthost *bthost, const uint8_t *data, memset(adv_cp, 0, sizeof(*adv_cp)); memset(adv_cp->data, 0, 31); + adv_cp->handle = 1; adv_cp->operation = 0x03; adv_cp->fragment_preference = 0x01; @@ -2572,20 +2573,33 @@ void bthost_set_adv_enable(struct bthost *bthost, uint8_t enable) send_command(bthost, BT_HCI_CMD_LE_SET_ADV_ENABLE, &enable, 1); } -void bthost_set_ext_adv_enable(struct bthost *bthost, uint8_t enable) +void bthost_set_ext_adv_params(struct bthost *bthost) { struct bt_hci_cmd_le_set_ext_adv_params cp; - struct bt_hci_cmd_le_set_ext_adv_enable cp_enable; memset(&cp, 0, sizeof(cp)); + cp.handle = 0x01; cp.evt_properties = cpu_to_le16(0x0013); send_command(bthost, BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS, &cp, sizeof(cp)); +} + +void bthost_set_ext_adv_enable(struct bthost *bthost, uint8_t enable) +{ + struct bt_hci_cmd_le_set_ext_adv_enable *cp_enable; + struct bt_hci_cmd_ext_adv_set *cp_set; + uint8_t cp[6]; + + memset(cp, 0, 6); + + cp_enable = (struct bt_hci_cmd_le_set_ext_adv_enable *)cp; + cp_set = (struct bt_hci_cmd_ext_adv_set *)(cp + sizeof(*cp_enable)); + + cp_enable->enable = enable; + cp_enable->num_of_sets = 1; + cp_set->handle = 1; - memset(&cp_enable, 0, sizeof(cp_enable)); - cp_enable.enable = enable; - send_command(bthost, BT_HCI_CMD_LE_SET_EXT_ADV_ENABLE, &cp_enable, - sizeof(cp_enable)); + send_command(bthost, BT_HCI_CMD_LE_SET_EXT_ADV_ENABLE, cp, 6); } void bthost_write_ssp_mode(struct bthost *bthost, uint8_t mode) diff --git a/emulator/bthost.h b/emulator/bthost.h index 7e5286df3..5a85b7232 100644 --- a/emulator/bthost.h +++ b/emulator/bthost.h @@ -80,6 +80,7 @@ void bthost_set_adv_enable(struct bthost *bthost, uint8_t enable); void bthost_set_ext_adv_data(struct bthost *bthost, const uint8_t *data, uint8_t len); +void bthost_set_ext_adv_params(struct bthost *bthost); void bthost_set_ext_adv_enable(struct bthost *bthost, uint8_t enable); void bthost_write_ssp_mode(struct bthost *bthost, uint8_t mode); -- 2.26.3