Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4261101pxj; Mon, 21 Jun 2021 18:02:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLzKHvFDHn4XQUrgK7i+vyZRM68iHsLIyZP7+hIKlLwyGc4mcXBQeg34UpKMi11i4V6Gyt X-Received: by 2002:a92:d24d:: with SMTP id v13mr737468ilg.165.1624323762113; Mon, 21 Jun 2021 18:02:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624323762; cv=none; d=google.com; s=arc-20160816; b=az24ZbwebafuOUmqApmKbhUTY+MVO+2RUx+7D1aauiFECJHf3CGRaPS1WFk1BCLi85 J4uUSzWTJX99EhaDi2peois76CkAwETbYj50pgFyYyPxYK7DPP08OcmC60x/8hhY+lro LnKF9F8ek6Y9v36gln9QaTsumIAmDYy8FenU/Aaqdkv6c6EI3+Ibk1m273qi0OeDwuWy 0vQQz1mgCfmyVRT104t838o0+bHa1X7a5yX+tYA4gaKeFw9Tk9JlQ6I/xQDxgKusqeih cV6oJtH3Luy+PdcKaIieFlHBQDKXCDjphLyTFfRML8VQUsIhsjM3hGGia6HEXnKH0+Ck yxig== 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=GN6ydc4UXI5NjRtotpvKJxy6sBXZgWvQoPhm1Zv+KPddEpwVbu2o2h/NSnJWs/Iu+5 fKYKDTwNl25b0YvkdRyi7ov0crhzy5wF2TTWQakKTpRxaXh/ZVxQoA6vpaIpHEoOzClG QcLEmr0YH3nUWs2uFT7emh4Fiqo3jfGazESFNRddl0xWwiylkiX4DwBLMhnbfyUkdW5Z DG9kAdPl5R9s0kHDW3s7kP+QmzwErkJaNiuf9uSzFlPhR6LWj0SxOBM71KNHkB7yo3CM 16ZIESaPNVuupF5t9TzCswRqMrw7fgLU9qIBVMWyKmU0LLGqDBmLB3WAGVJxS0fCxfso ZLnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=e4dTfHsl; 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 v126si3278249iof.68.2021.06.21.18.02.18; Mon, 21 Jun 2021 18:02:42 -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=e4dTfHsl; 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 S229915AbhFVBDu (ORCPT + 99 others); Mon, 21 Jun 2021 21:03:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230057AbhFVBDu (ORCPT ); Mon, 21 Jun 2021 21:03:50 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 533D0C061756 for ; Mon, 21 Jun 2021 18:01:35 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id a127so4540851pfa.10 for ; Mon, 21 Jun 2021 18:01:35 -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=e4dTfHsl+nmjGfAFuXN3OVEF7HtXde/nRK73JQBVUU6PvovzrvN07dXYnjh8YRrhR7 c/6EdB0WvSPnUjtrckipWUOODZm1cpjYe7oTJ18/zPCdnOUgPav6Nbo2e2bJFEVIeY5P I6bunC4ml/EnR7zwI06suBGrKejVXcEfzpRBnmM1Eec0qLs5wCeDysHzvV12iwidB/Ej xZNoTZf4q5Bj4D3AYoP442N5mtCY2kBI1zchhdJ3DECwyXROLzbv45VWrPS1BAycSCql xdAt2Ado2H1G/QfOA5P9xOSTWWSs4RJ3zWuHKovg646m34jFpRndviGrqhNSYPTEWTIn XjxQ== 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=AoFWComZRgNxISHc3sbF3j2iGIGnwYXzapLfCmXXpRJqGDnS3p+GAbHeINXXQ9Xxw6 4F6CAN8C3w8xIPf25NRDm7qWoDwJDmxyWlcwtbZHLV7F+MwvGD82o9d52aXcXg3TCGXu FVxdnyz6aocTD4AlClaN/i0b1zIFzf2Ga3N84OWxjgRsyeBZIMNh+NwvO+MbomMupIrG WSD6J2tEJl0Ag9G/1HF+QZbDqqvHMd/ku0QYu6fZuws+mx7NDdoxphHPA4TGAHKj3lJm QKp1xyQ80N2yXZkFTfD8MlDX60CvJZQ3rusHSTW1P700Dfc80y1LVN9atarCrLN6/ycA CyUQ== X-Gm-Message-State: AOAM533juPT/M6QeFiUPdENg3SCsRTfaOQISsyx571wygUgo+WM8zQVV R8F3n6/WRR0FXIFv7cJL8tq3GLVkZek= X-Received: by 2002:a63:ff1f:: with SMTP id k31mr1143651pgi.315.1624323694697; Mon, 21 Jun 2021 18:01:34 -0700 (PDT) Received: from han1-mobl3.hsd1.or.comcast.net ([2601:1c0:6a01:d830::512a]) by smtp.gmail.com with ESMTPSA id f28sm17970120pgb.12.2021.06.21.18.01.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jun 2021 18:01:34 -0700 (PDT) From: Tedd Ho-Jeong An To: linux-bluetooth@vger.kernel.org Subject: [BlueZ PATCH 4/5] emulator/bthost: Create ext adv params before setting adv data Date: Mon, 21 Jun 2021 18:01:30 -0700 Message-Id: <20210622010131.427059-4-hj.tedd.an@gmail.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210622010131.427059-1-hj.tedd.an@gmail.com> References: <20210622010131.427059-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