From patchwork Thu Apr 23 21:54:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 11506701 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 7887F112C for ; Thu, 23 Apr 2020 21:55:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4A0D120724 for ; Thu, 23 Apr 2020 21:55:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NR1XaqCa" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727027AbgDWVzF (ORCPT ); Thu, 23 Apr 2020 17:55:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726057AbgDWVzF (ORCPT ); Thu, 23 Apr 2020 17:55:05 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D7CCC09B042 for ; Thu, 23 Apr 2020 14:55:05 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id y25so3680002pfn.5 for ; Thu, 23 Apr 2020 14:55:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=lP+631COW6aFNFs0v6TbSms4KI0UWz+drlcU41V6z0I=; b=NR1XaqCaknFYnCe/xYGsa7ZczAJfG6d4PTpGymOqtprAYwqdO5R8JTeXoPCz9660CM sjbH6ZhCtsoMh/uwSxoTQbU563c1BCobVcFljW6ZQ0OC7X3molYoXaUJy80Y8WwKBg10 f0LqrFr5s0YYxOZDiF8tBHT2Mu52d4bk8+3KCQZkhAdS8TiA0c1fVljDdXFGMsG3rkbP rouCnQ+pCzbtAuVsDPONfLtCsrJrbkmdJxESM4V9j8b/YqmOAcQeUITJup3E8NANmzhn YeKMHmsDRF2w5tbSbGbs8y3dRoHsnshNovU/kjX/D0x/rL/t22k0rgrSJrGzfj/X6pFf FjhA== 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:mime-version :content-transfer-encoding; bh=lP+631COW6aFNFs0v6TbSms4KI0UWz+drlcU41V6z0I=; b=lmwK2yo5zXcsATmEsqBUju6Xvz3JDZMEZhZIl7L3Im9HyC0h16M/sZrFdHYrHc05tV 98lian5BepIiboDglYW93ud0Y15VJ74d7kqR0KYDtkHU1amoVrZAcvcAi+4CuJV4MA46 lzwYK4mACXHL6+y2A/H3OE+5wJbXuNb1ipP0MQplinCPOQuKwSjOTKwpbqxg3oNB3GDO IYanBpq+wK2vO+Pc48JLq591KvCnUTpJPSqFA/FdthvzJxF4rn60uURzBf7jJgDqoBRT UkmStxY5Oi5547bW7q4oQXOnxQHTA3TaUr/kkL000y6nQ5daW722bvqNV9KvhYWb31e3 n1sA== X-Gm-Message-State: AGi0Pubf1eWJO23Ewc2Sfv9GVTPVmuAmElALleEosTAzu3eM25dw+seq oQAzHhOx71RDArKI/DK4YBlLTsHgBxs= X-Google-Smtp-Source: APiQypJGS1utbP1Epdh4Ii1cGqkroN8k4bK/Ltax2VXlZP2wis+6l8U7w00Zl50GBWPlsd5MatTR4A== X-Received: by 2002:a62:92:: with SMTP id 140mr5714091pfa.186.1587678903904; Thu, 23 Apr 2020 14:55:03 -0700 (PDT) Received: from localhost.localdomain (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id k12sm2972294pgj.33.2020.04.23.14.55.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 14:55:02 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 1/6] monitor: Remove use of base defines for 5.2 Date: Thu, 23 Apr 2020 14:54:56 -0700 Message-Id: <20200423215501.427266-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.25.3 MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz Use the allocated value directly instead of base value + offset. --- monitor/bt.h | 117 ++++++++++++++++++++++++++------------------------- 1 file changed, 60 insertions(+), 57 deletions(-) diff --git a/monitor/bt.h b/monitor/bt.h index f9ac6b180..39ca1e39a 100644 --- a/monitor/bt.h +++ b/monitor/bt.h @@ -24,11 +24,7 @@ #include -#define BT_HCI_CMD_5_2 0x2060 -#define BT_HCI_BIT_5_2 (8 * 41) + 5 -#define BT_HCI_SUBEVT_5_2 0x19 - -#define BT_LL_CMD_5_2 0x1f +#define BT_HCI_CMD_BIT(_byte, _bit) ((8 * _byte) + _bit) struct bt_ll_hdr { uint8_t preamble; @@ -181,7 +177,7 @@ struct bt_ll_clock_acc { #define BT_LL_CLOCK_ACCURACY_RSP 0x1e -#define BT_LL_CIS_REQ BT_LL_CMD_5_2 +#define BT_LL_CIS_REQ 0x1f struct bt_ll_cis_req { uint8_t cig; uint8_t cis; @@ -204,14 +200,14 @@ struct bt_ll_cis_req { uint16_t conn_event_count; } __attribute__ ((packed)); -#define BT_LL_CIS_RSP BT_LL_CMD_5_2 + 1 +#define BT_LL_CIS_RSP 0x20 struct bt_ll_cis_rsp { uint8_t offset_min[3]; uint8_t offset_max[3]; uint16_t conn_event_count; } __attribute__ ((packed)); -#define BT_LL_CIS_IND BT_LL_CMD_5_2 + 2 +#define BT_LL_CIS_IND 0x21 struct bt_ll_cis_ind { uint32_t addr; uint8_t cis_offset[3]; @@ -220,7 +216,7 @@ struct bt_ll_cis_ind { uint16_t conn_event_count; } __attribute__ ((packed)); -#define BT_LL_CIS_TERMINATE_IND BT_LL_CMD_5_2 + 3 +#define BT_LL_CIS_TERMINATE_IND 0x22 struct bt_ll_cis_term_ind { uint8_t cig; uint8_t cis; @@ -2568,8 +2564,8 @@ struct bt_hci_cmd_default_periodic_adv_sync_trans_params { uint8_t cte_type; } __attribute__ ((packed)); -#define BT_HCI_CMD_LE_READ_BUFFER_SIZE_V2 BT_HCI_CMD_5_2 -#define BT_HCI_BIT_LE_READ_BUFFER_SIZE_V2 BT_HCI_BIT_5_2 +#define BT_HCI_CMD_LE_READ_BUFFER_SIZE_V2 0x2060 +#define BT_HCI_BIT_LE_READ_BUFFER_SIZE_V2 BT_HCI_CMD_BIT(41, 5) struct bt_hci_rsp_le_read_buffer_size_v2 { uint8_t status; uint16_t acl_mtu; @@ -2578,8 +2574,8 @@ struct bt_hci_rsp_le_read_buffer_size_v2 { uint8_t iso_max_pkt; } __attribute__ ((packed)); -#define BT_HCI_CMD_LE_READ_ISO_TX_SYNC BT_HCI_CMD_5_2 + 1 -#define BT_HCI_BIT_LE_READ_ISO_TX_SYNC BT_HCI_BIT_5_2 + 1 +#define BT_HCI_CMD_LE_READ_ISO_TX_SYNC 0x2061 +#define BT_HCI_BIT_LE_READ_ISO_TX_SYNC BT_HCI_CMD_BIT(41, 6) struct bt_hci_cmd_le_read_iso_tx_sync { uint16_t handle; } __attribute__ ((packed)); @@ -2592,8 +2588,8 @@ struct bt_hci_rsp_le_read_iso_tx_sync { uint8_t offset[3]; } __attribute__ ((packed)); -#define BT_HCI_CMD_LE_SET_CIG_PARAMS BT_HCI_CMD_5_2 + 2 -#define BT_HCI_BIT_LE_SET_CIG_PARAMS BT_HCI_BIT_5_2 + 2 +#define BT_HCI_CMD_LE_SET_CIG_PARAMS 0x2062 +#define BT_HCI_BIT_LE_SET_CIG_PARAMS BT_HCI_CMD_BIT(41, 7) struct bt_hci_cis_params { uint8_t cis_id; uint16_t m_sdu; @@ -2624,8 +2620,8 @@ struct bt_hci_rsp_le_set_cig_params { uint16_t handle[0]; } __attribute__ ((packed)); -#define BT_HCI_CMD_LE_SET_CIG_PARAMS_TEST BT_HCI_CMD_5_2 + 3 -#define BT_HCI_BIT_LE_SET_CIG_PARAMS_TEST BT_HCI_BIT_5_2 + 3 +#define BT_HCI_CMD_LE_SET_CIG_PARAMS_TEST 0x2063 +#define BT_HCI_BIT_LE_SET_CIG_PARAMS_TEST BT_HCI_CMD_BIT(42, 0) struct bt_hci_cis_params_test { uint8_t cis_id; uint8_t nse; @@ -2653,8 +2649,8 @@ struct bt_hci_cmd_le_set_cig_params_test { struct bt_hci_cis_params_test cis[0]; } __attribute__ ((packed)); -#define BT_HCI_CMD_LE_CREATE_CIS BT_HCI_CMD_5_2 + 4 -#define BT_HCI_BIT_LE_CREATE_CIS BT_HCI_BIT_5_2 + 4 +#define BT_HCI_CMD_LE_CREATE_CIS 0x2064 +#define BT_HCI_BIT_LE_CREATE_CIS BT_HCI_CMD_BIT(42, 1) struct bt_hci_cis { uint16_t cis_handle; uint16_t acl_handle; @@ -2665,27 +2661,27 @@ struct bt_hci_cmd_le_create_cis { struct bt_hci_cis cis[0]; } __attribute__ ((packed)); -#define BT_HCI_CMD_LE_REMOVE_CIG BT_HCI_CMD_5_2 + 5 -#define BT_HCI_BIT_LE_REMOVE_CIG BT_HCI_BIT_5_2 + 5 +#define BT_HCI_CMD_LE_REMOVE_CIG 0x2065 +#define BT_HCI_BIT_LE_REMOVE_CIG BT_HCI_CMD_BIT(42, 2) struct bt_hci_cmd_le_remove_cig { uint8_t cig_id; } __attribute__ ((packed)); -#define BT_HCI_CMD_LE_ACCEPT_CIS BT_HCI_CMD_5_2 + 6 -#define BT_HCI_BIT_LE_ACCEPT_CIS BT_HCI_BIT_5_2 + 6 +#define BT_HCI_CMD_LE_ACCEPT_CIS 0x2066 +#define BT_HCI_BIT_LE_ACCEPT_CIS BT_HCI_CMD_BIT(42, 3) struct bt_hci_cmd_le_accept_cis { uint16_t handle; } __attribute__ ((packed)); -#define BT_HCI_CMD_LE_REJECT_CIS BT_HCI_CMD_5_2 + 7 -#define BT_HCI_BIT_LE_REJECT_CIS BT_HCI_BIT_5_2 + 7 +#define BT_HCI_CMD_LE_REJECT_CIS 0x2067 +#define BT_HCI_BIT_LE_REJECT_CIS BT_HCI_CMD_BIT(42, 4) struct bt_hci_cmd_le_reject_cis { uint16_t handle; uint8_t reason; } __attribute__ ((packed)); -#define BT_HCI_CMD_LE_CREATE_BIG BT_HCI_CMD_5_2 + 8 -#define BT_HCI_BIT_LE_CREATE_BIG BT_HCI_BIT_5_2 + 8 +#define BT_HCI_CMD_LE_CREATE_BIG 0x2068 +#define BT_HCI_BIT_LE_CREATE_BIG BT_HCI_CMD_BIT(42, 5) struct bt_hci_bis { uint8_t sdu_interval[3]; uint16_t sdu; @@ -2705,8 +2701,8 @@ struct bt_hci_cmd_le_create_big { struct bt_hci_bis bis[0]; } __attribute__ ((packed)); -#define BT_HCI_CMD_LE_CREATE_BIG_TEST BT_HCI_CMD_5_2 + 9 -#define BT_HCI_BIT_LE_CREATE_BIG_TEST BT_HCI_BIT_5_2 + 9 +#define BT_HCI_CMD_LE_CREATE_BIG_TEST 0x2069 +#define BT_HCI_BIT_LE_CREATE_BIG_TEST BT_HCI_CMD_BIT(42, 6) struct bt_hci_bis_test { uint8_t sdu_interval[3]; uint16_t iso_interval; @@ -2731,15 +2727,15 @@ struct bt_hci_cmd_le_create_big_test { struct bt_hci_bis_test bis[0]; } __attribute__ ((packed)); -#define BT_HCI_CMD_LE_TERM_BIG BT_HCI_CMD_5_2 + 10 -#define BT_HCI_BIT_LE_TERM_BIG BT_HCI_BIT_5_2 + 10 +#define BT_HCI_CMD_LE_TERM_BIG 0x206a +#define BT_HCI_BIT_LE_TERM_BIG BT_HCI_CMD_BIT(42, 7) struct bt_hci_cmd_le_term_big { uint8_t big_id; uint8_t reason; } __attribute__ ((packed)); -#define BT_HCI_CMD_LE_BIG_CREATE_SYNC BT_HCI_CMD_5_2 + 11 -#define BT_HCI_BIT_LE_BIG_CREATE_SYNC BT_HCI_BIT_5_2 + 11 +#define BT_HCI_CMD_LE_BIG_CREATE_SYNC 0x206b +#define BT_HCI_BIT_LE_BIG_CREATE_SYNC BT_HCI_CMD_BIT(43, 0) struct bt_hci_bis_sync { } __attribute__ ((packed)); @@ -2754,20 +2750,20 @@ struct bt_hci_cmd_le_big_create_sync { struct bt_hci_bis_sync bis[0]; } __attribute__ ((packed)); -#define BT_HCI_CMD_LE_BIG_TERM_SYNC BT_HCI_CMD_5_2 + 12 -#define BT_HCI_BIT_LE_BIG_TERM_SYNC BT_HCI_BIT_5_2 + 12 +#define BT_HCI_CMD_LE_BIG_TERM_SYNC 0x206c +#define BT_HCI_BIT_LE_BIG_TERM_SYNC BT_HCI_CMD_BIT(43, 1) struct bt_hci_cmd_le_big_term_sync { uint8_t big_id; } __attribute__ ((packed)); -#define BT_HCI_CMD_LE_REQ_PEER_SCA BT_HCI_CMD_5_2 + 13 -#define BT_HCI_BIT_LE_REQ_PEER_SCA BT_HCI_BIT_5_2 + 13 +#define BT_HCI_CMD_LE_REQ_PEER_SCA 0x206d +#define BT_HCI_BIT_LE_REQ_PEER_SCA BT_HCI_CMD_BIT(43, 2) struct bt_hci_cmd_le_req_peer_sca { uint16_t handle; } __attribute__ ((packed)); -#define BT_HCI_CMD_LE_SETUP_ISO_PATH BT_HCI_CMD_5_2 + 14 -#define BT_HCI_BIT_LE_SETUP_ISO_PATH BT_HCI_BIT_5_2 + 14 +#define BT_HCI_CMD_LE_SETUP_ISO_PATH 0x206e +#define BT_HCI_BIT_LE_SETUP_ISO_PATH BT_HCI_CMD_BIT(43, 3) struct bt_hci_cmd_le_setup_iso_path { uint16_t handle; uint8_t direction; @@ -2780,24 +2776,31 @@ struct bt_hci_cmd_le_setup_iso_path { uint8_t codec_cfg[0]; } __attribute__ ((packed)); -#define BT_HCI_CMD_LE_REMOVE_ISO_PATH BT_HCI_CMD_5_2 + 15 -#define BT_HCI_BIT_LE_REMOVE_ISO_PATH BT_HCI_BIT_5_2 + 15 +#define BT_HCI_CMD_LE_REMOVE_ISO_PATH 0x206f +#define BT_HCI_BIT_LE_REMOVE_ISO_PATH BT_HCI_CMD_BIT(43, 4) struct bt_hci_cmd_le_remove_iso_path { uint16_t handle; uint8_t path_dir; } __attribute__ ((packed)); -#define BT_HCI_CMD_LE_ISO_TX_TEST BT_HCI_CMD_5_2 + 16 -#define BT_HCI_BIT_LE_ISO_TX_TEST BT_HCI_BIT_5_2 + 16 +#define BT_HCI_CMD_LE_ISO_TX_TEST 0x2070 +#define BT_HCI_BIT_LE_ISO_TX_TEST BT_HCI_CMD_BIT(43, 5) + +#define BT_HCI_CMD_LE_ISO_RX_TEST 0x2071 +#define BT_HCI_BIT_LE_ISO_RX_TEST BT_HCI_CMD_BIT(43, 6) -#define BT_HCI_CMD_LE_ISO_RX_TEST BT_HCI_CMD_5_2 + 17 -#define BT_HCI_BIT_LE_ISO_RX_TEST BT_HCI_BIT_5_2 + 17 +#define BT_HCI_CMD_LE_ISO_READ_TEST_COUNTER 0x2072 +#define BT_HCI_BIT_LE_ISO_READ_TEST_COUNTER BT_HCI_CMD_BIT(43, 7) -#define BT_HCI_CMD_LE_ISO_READ_TEST_COUNTER BT_HCI_CMD_5_2 + 18 -#define BT_HCI_BIT_LE_ISO_READ_TEST_COUNTER BT_HCI_BIT_5_2 + 18 +#define BT_HCI_CMD_LE_ISO_TEST_END 0x2073 +#define BT_HCI_BIT_LE_ISO_TEST_END BT_HCI_CMD_BIT(44, 0) -#define BT_HCI_CMD_LE_ISO_TEST_END BT_HCI_CMD_5_2 + 19 -#define BT_HCI_BIT_LE_ISO_TEST_END BT_HCI_BIT_5_2 + 19 +#define BT_HCI_CMD_LE_SET_HOST_FEATURE 0x2074 +#define BT_HCI_BIT_LE_SET_HOST_FEATURE BT_HCI_CMD_BIT(44, 1) +struct bt_hci_cmd_le_set_host_feature { + uint8_t bit_number; + uint8_t bit_value; +} __packed; #define BT_HCI_EVT_INQUIRY_COMPLETE 0x01 struct bt_hci_evt_inquiry_complete { @@ -3155,7 +3158,7 @@ struct bt_hci_evt_keypress_notify { #define BT_HCI_EVT_REMOTE_HOST_FEATURES_NOTIFY 0x3d struct bt_hci_evt_remote_host_features_notify { - uint8_t bdaddr[6]; +uint8_t bdaddr[6]; uint8_t features[8]; } __attribute__ ((packed)); @@ -3498,7 +3501,7 @@ struct bt_hci_evt_le_per_adv_sync_trans_rec { uint8_t clock_accuracy; } __attribute__ ((packed)); -#define BT_HCI_EVT_LE_CIS_ESTABLISHED BT_HCI_SUBEVT_5_2 +#define BT_HCI_EVT_LE_CIS_ESTABLISHED 0x19 struct bt_hci_evt_le_cis_established { uint8_t status; uint16_t conn_handle; @@ -3518,7 +3521,7 @@ struct bt_hci_evt_le_cis_established { uint16_t interval; } __attribute__ ((packed)); -#define BT_HCI_EVT_LE_CIS_REQ BT_HCI_SUBEVT_5_2 + 1 +#define BT_HCI_EVT_LE_CIS_REQ 0x1a struct bt_hci_evt_le_cis_req { uint16_t acl_handle; uint16_t cis_handle; @@ -3526,7 +3529,7 @@ struct bt_hci_evt_le_cis_req { uint8_t cis_id; } __attribute__ ((packed)); -#define BT_HCI_EVT_LE_BIG_COMPLETE BT_HCI_SUBEVT_5_2 + 2 +#define BT_HCI_EVT_LE_BIG_COMPLETE 0x1b struct bt_hci_evt_le_big_complete { uint8_t status; uint8_t big_id; @@ -3537,13 +3540,13 @@ struct bt_hci_evt_le_big_complete { uint16_t handle[0]; } __attribute__ ((packed)); -#define BT_HCI_EVT_LE_BIG_TERMINATE BT_HCI_SUBEVT_5_2 + 3 +#define BT_HCI_EVT_LE_BIG_TERMINATE 0x1c struct bt_hci_evt_le_big_terminate { uint8_t reason; uint8_t big_id; } __attribute__ ((packed)); -#define BT_HCI_EVT_LE_BIG_SYNC_ESTABILISHED BT_HCI_SUBEVT_5_2 + 4 +#define BT_HCI_EVT_LE_BIG_SYNC_ESTABILISHED 0x1d struct bt_hci_evt_le_big_sync_estabilished { uint8_t status; uint8_t big_id; @@ -3552,13 +3555,13 @@ struct bt_hci_evt_le_big_sync_estabilished { uint16_t handle[0]; } __attribute__ ((packed)); -#define BT_HCI_EVT_LE_BIG_SYNC_LOST BT_HCI_SUBEVT_5_2 + 5 +#define BT_HCI_EVT_LE_BIG_SYNC_LOST 0x1e struct bt_hci_evt_le_big_sync_lost { uint8_t big_id; uint8_t reason; } __attribute__ ((packed)); -#define BT_HCI_EVT_LE_REQ_PEER_SCA_COMPLETE BT_HCI_SUBEVT_5_2 + 6 +#define BT_HCI_EVT_LE_REQ_PEER_SCA_COMPLETE 0x1f struct bt_hci_evt_le_req_peer_sca_complete { uint8_t status; uint16_t handle; From patchwork Thu Apr 23 21:54:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 11506703 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 DCC8C1667 for ; Thu, 23 Apr 2020 21:55:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C53B020780 for ; Thu, 23 Apr 2020 21:55:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aD9mTfPJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727058AbgDWVzG (ORCPT ); Thu, 23 Apr 2020 17:55:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726071AbgDWVzF (ORCPT ); Thu, 23 Apr 2020 17:55:05 -0400 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A55B4C09B042 for ; Thu, 23 Apr 2020 14:55:05 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id x15so3690594pfa.1 for ; Thu, 23 Apr 2020 14:55:05 -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=yAXh3xoOECbXXgj+ID5ZQOMf1h0nrGV0PRZjaNZf1ig=; b=aD9mTfPJEfI7b3hR0Qk0J4wy4BUcp2u0l8ViaQd8tDewR21RD3+tNZAtIL7a13NG6g RyRJ9tFGBlekLBQCadnsDF5/mfBbnAY/jYe4a2KuVPwgsy8aIjia1yu5CvYUag4Vozq6 LFEbbgREGvK6ECqvOgf8b5aIXdpq2t/6Zdp92farCTL15Hqx2X+zl/M9WNksvS4oH9Yo OhfSt0enFOg+cK+T/8wbyUhd16ZvlJXc6AEeFLff0gtDxCfVQZE9TG+ICTx8Var0gXdp 9qQgNUzlZ6pt0cn+RgX8YgtP3aiA61rdwhPC4JDdpV46+gktDajiPGsJkxYQjFz1QNQn N4MQ== 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=yAXh3xoOECbXXgj+ID5ZQOMf1h0nrGV0PRZjaNZf1ig=; b=IKOU8WDRlHfxBI9JeEMsRkd2ilOup8AQpEZSCvHNwhTmFDP2YvVy/dH7vTvxOgKeZJ GXLTZbumWfkX14vyyTUt4KgkWHbGWVOccHwy53zEM2Lharczto+Ewc9K0LLgjjpr+kZe LUohDhSY4Odj9BsVOl3pR4Mi2mYAXm9qy7kAR1EExWWFGQf1T08RIpv6/TRlrvZpECCj xJfdHYyO02O+GKOzWV1WoRwEH1Yu8Wzsit5Kml1QzJd5E3mwJiS0nZ8M4MSd1yDMWccY hjiizWd5TimvY6V/s54ZXeap9bjaxgGtvaRQ3FbpdFf22gQFWvbTtWPh3zZj+Nl8s1nU z1UQ== X-Gm-Message-State: AGi0PuYiPm9UG20yiYQZtfyaTJSRbBDnfgXp0K9N5OxosLWKRywh2h48 jY9UNO4Gf0JkAWf11Zy2xZadem+s93A= X-Google-Smtp-Source: APiQypKvsJpyqdmgWt3JGf1kX+9GEUvGMohIbNMV+dKeTzIOWB4A8pVHEVWsOgos4+uPuNh5pAKNEQ== X-Received: by 2002:a62:e211:: with SMTP id a17mr5398151pfi.250.1587678904758; Thu, 23 Apr 2020 14:55:04 -0700 (PDT) Received: from localhost.localdomain (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id k12sm2972294pgj.33.2020.04.23.14.55.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 14:55:04 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 2/6] monitor: Add decoding support for HCI LE Set Host Feature Date: Thu, 23 Apr 2020 14:54:57 -0700 Message-Id: <20200423215501.427266-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.25.3 In-Reply-To: <20200423215501.427266-1-luiz.dentz@gmail.com> References: <20200423215501.427266-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This adds decoding support for LE Set Host Feature. --- monitor/packet.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/monitor/packet.c b/monitor/packet.c index 038dd6d17..777a52205 100644 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -8128,6 +8128,21 @@ static void le_req_peer_sca_cmd(const void *data, uint8_t size) print_field("Connection Handle: %d", le16_to_cpu(cmd->handle)); } +static void le_set_host_feature_cmd(const void *data, uint8_t size) +{ + const struct bt_hci_cmd_le_set_host_feature *cmd = data; + uint64_t mask; + + print_field("Bit Number:"); + + mask = print_bitfield(2, cmd->bit_number, features_le); + if (mask) + print_text(COLOR_UNKNOWN_FEATURE_BIT, " Unknown features " + "(0x%16.16" PRIx64 ")", mask); + + print_field("Bit Value: %u", cmd->bit_value); +} + struct opcode_data { uint16_t opcode; int bit; @@ -9041,6 +9056,10 @@ static const struct opcode_data opcode_table[] = { { BT_HCI_CMD_LE_ISO_TEST_END, BT_HCI_BIT_LE_ISO_TEST_END, "LE Isochronous Read Test Counters", NULL, 0, false }, + { BT_HCI_CMD_LE_SET_HOST_FEATURE, BT_HCI_BIT_LE_SET_HOST_FEATURE, + "LE Set Host Feature", le_set_host_feature_cmd, + sizeof(struct bt_hci_cmd_le_set_host_feature), + true, status_rsp, 1, true }, { } }; From patchwork Thu Apr 23 21:54:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 11506705 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 52F31112C for ; Thu, 23 Apr 2020 21:55:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 30E182077D for ; Thu, 23 Apr 2020 21:55:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="g4zQgz/8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727065AbgDWVzH (ORCPT ); Thu, 23 Apr 2020 17:55:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726071AbgDWVzH (ORCPT ); Thu, 23 Apr 2020 17:55:07 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E341C09B042 for ; Thu, 23 Apr 2020 14:55:07 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id t4so2887409plq.12 for ; Thu, 23 Apr 2020 14:55:07 -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=Y3cH/k4X9c9gMMu/uU1sRz7+q1h8kNwjSNhobDRWoWM=; b=g4zQgz/8cIB1j7HDHs9PFu+cOs6Dbw6MndpMvN1+Ca+VkR1jHmPSnlN4t1LHNUumMA K0E//2NeHJyua8OJW+8hMvKJ8Jv9LOxze2kYsfihAMwFHZCZrnru4xqCSY2j/1He4EdD ilsxvaKujrJHWeyt1h3eeNSHVAZZsZOoMhPMeGhrYow8Cd8dtYnw1UixGiMYz2gwSFh+ L+bpPR7DWC5EatPdwzlyHjqtsBEAHyiQJdzU44Vf0zOL6ayBjO6geR8ZHkOZ/H17xLsN nyw/fCwaViinNMhn/AlzY/4K0t26jqT/O85TSFUYDNM9VKND1C0+G773Racv71GglaIn /dBQ== 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=Y3cH/k4X9c9gMMu/uU1sRz7+q1h8kNwjSNhobDRWoWM=; b=Kkm4vlWtM3ISa0eTntUAZenao6ZD2IXYLx2ASSdOspxTUDIZ7myS3Rlc6ryqv8jFly Y9lbek5uzxF9KScQkbGQJ2oTuc9p8HNaJv2VyvgUxyZ8F50DEmj/FRc5iWOQzFFsNxoX Sjja6AEjtMdsqFYnLxkuvSpzpLXoRyCtc7ohieq1HJnzbDeOQmuj5r7zC+y+3nj9sVXA m/C9rKjQam4U7QoxtIhqdlLoLC6oAFfgZJgNuLTC+p+u+QXgBnjGJeLXC4PggjZpeUBG DjOYm0EwnPNxrrYrgz6uqwoUKsp8Qkqy1OjyqnnVx541pg+V78ht2UPGEB8PAPPuJFwu 7cyg== X-Gm-Message-State: AGi0PuaAbCDLVhL4jo26neEF/4g4HvdT5bWywvIWbFzFdKa9gNX/i1Sc 8+1osyWtz24RdUykjolaHD4uMBMEtys= X-Google-Smtp-Source: APiQypJ1khrn3M8QQdPSAOzgE2v80D+wUZ7I/BMxRQy+PXn+Mop7TetRv4+VZy46QcP4JvYeYWFPRg== X-Received: by 2002:a17:90a:324f:: with SMTP id k73mr2937084pjb.195.1587678905880; Thu, 23 Apr 2020 14:55:05 -0700 (PDT) Received: from localhost.localdomain (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id k12sm2972294pgj.33.2020.04.23.14.55.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 14:55:05 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 3/6] emulator: Fix version number of ISO related features Date: Thu, 23 Apr 2020 14:54:58 -0700 Message-Id: <20200423215501.427266-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.25.3 In-Reply-To: <20200423215501.427266-1-luiz.dentz@gmail.com> References: <20200423215501.427266-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz There are part of Bluetooth 5.2 specification not 6.0. --- emulator/btdev.c | 66 +++++++++++++++++++++++------------------------ emulator/btdev.h | 2 +- emulator/hciemu.c | 4 +-- emulator/hciemu.h | 2 +- emulator/vhci.c | 2 +- 5 files changed, 38 insertions(+), 38 deletions(-) diff --git a/emulator/btdev.c b/emulator/btdev.c index 0de273e53..fc2fb2065 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -447,7 +447,7 @@ static void set_le_50_commands(struct btdev *btdev) btdev->commands[38] |= 0x40; /* LE Read Periodic Adv List Size */ } -static void set_le_60_commands(struct btdev *btdev) +static void set_le_52_commands(struct btdev *btdev) { btdev->commands[41] |= 0x20; /* LE Read Buffer Size v2 */ btdev->commands[41] |= 0x40; /* LE Read ISO TX Sync */ @@ -516,9 +516,9 @@ static void set_le_commands(struct btdev *btdev) if (btdev->type >= BTDEV_TYPE_BREDRLE50) set_le_50_commands(btdev); - /* Extra LE commands for >= 6.0 adapters */ - if (btdev->type >= BTDEV_TYPE_BREDRLE60) - set_le_60_commands(btdev); + /* Extra LE commands for >= 5.2 adapters */ + if (btdev->type >= BTDEV_TYPE_BREDRLE52) + set_le_52_commands(btdev); } static void set_bredrle_commands(struct btdev *btdev) @@ -587,7 +587,7 @@ static void set_bredrle_features(struct btdev *btdev) btdev->le_features[1] |= 0x10; /* LE EXT ADV */ } - if (btdev->type >= BTDEV_TYPE_BREDRLE60) { + if (btdev->type >= BTDEV_TYPE_BREDRLE52) { btdev->le_features[3] |= 0x10; /* LE CIS Master */ btdev->le_features[3] |= 0x20; /* LE CIS Slave */ btdev->le_features[3] |= 0x40; /* LE ISO Broadcaster */ @@ -691,7 +691,7 @@ struct btdev *btdev_create(enum btdev_type type, uint16_t id) if (type == BTDEV_TYPE_BREDRLE || type == BTDEV_TYPE_LE || type == BTDEV_TYPE_BREDRLE50 || - type == BTDEV_TYPE_BREDRLE60) { + type == BTDEV_TYPE_BREDRLE52) { btdev->crypto = bt_crypto_new(); if (!btdev->crypto) { free(btdev); @@ -707,7 +707,7 @@ struct btdev *btdev_create(enum btdev_type type, uint16_t id) switch (btdev->type) { case BTDEV_TYPE_BREDRLE: case BTDEV_TYPE_BREDRLE50: - case BTDEV_TYPE_BREDRLE60: + case BTDEV_TYPE_BREDRLE52: btdev->version = 0x09; set_bredrle_features(btdev); set_bredrle_commands(btdev); @@ -3076,7 +3076,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, case BT_HCI_CMD_READ_LE_HOST_SUPPORTED: if (btdev->type != BTDEV_TYPE_BREDRLE && btdev->type != BTDEV_TYPE_BREDRLE50 && - btdev->type != BTDEV_TYPE_BREDRLE60) + btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; rlhs.status = BT_HCI_ERR_SUCCESS; rlhs.supported = btdev->le_supported; @@ -3088,7 +3088,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, if (btdev->type != BTDEV_TYPE_BREDRLE && btdev->type != BTDEV_TYPE_LE && btdev->type != BTDEV_TYPE_BREDRLE50 && - btdev->type != BTDEV_TYPE_BREDRLE60) + btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; wlhs = data; btdev->le_supported = wlhs->supported; @@ -3100,7 +3100,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, case BT_HCI_CMD_READ_SECURE_CONN_SUPPORT: if (btdev->type != BTDEV_TYPE_BREDRLE && btdev->type != BTDEV_TYPE_BREDRLE50 && - btdev->type != BTDEV_TYPE_BREDRLE60) + btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; rscs.status = BT_HCI_ERR_SUCCESS; rscs.support = btdev->secure_conn_support; @@ -3110,7 +3110,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, case BT_HCI_CMD_WRITE_SECURE_CONN_SUPPORT: if (btdev->type != BTDEV_TYPE_BREDRLE && btdev->type != BTDEV_TYPE_BREDRLE50 && - btdev->type != BTDEV_TYPE_BREDRLE60) + btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; wscs = data; btdev->secure_conn_support = wscs->support; @@ -3121,7 +3121,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, case BT_HCI_CMD_READ_LOCAL_OOB_EXT_DATA: if (btdev->type != BTDEV_TYPE_BREDRLE && btdev->type != BTDEV_TYPE_BREDRLE50 && - btdev->type != BTDEV_TYPE_BREDRLE60) + btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; rloed.status = BT_HCI_ERR_SUCCESS; cmd_complete(btdev, opcode, &rloed, sizeof(rloed)); @@ -3130,7 +3130,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, case BT_HCI_CMD_READ_SYNC_TRAIN_PARAMS: if (btdev->type != BTDEV_TYPE_BREDRLE && btdev->type != BTDEV_TYPE_BREDRLE50 && - btdev->type != BTDEV_TYPE_BREDRLE60) + btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; rstp.status = BT_HCI_ERR_SUCCESS; rstp.interval = cpu_to_le16(btdev->sync_train_interval); @@ -3282,7 +3282,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, if (btdev->type != BTDEV_TYPE_BREDRLE && btdev->type != BTDEV_TYPE_BREDR && btdev->type != BTDEV_TYPE_BREDRLE50 && - btdev->type != BTDEV_TYPE_BREDRLE60) + btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; reks = data; read_enc_key_size_complete(btdev, le16_to_cpu(reks->handle)); @@ -3658,7 +3658,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, break; case BT_HCI_CMD_LE_READ_NUM_SUPPORTED_ADV_SETS: if (btdev->type != BTDEV_TYPE_BREDRLE50 && - btdev->type != BTDEV_TYPE_BREDRLE60) + btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; rlrnsas.status = BT_HCI_ERR_SUCCESS; @@ -3668,7 +3668,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, break; case BT_HCI_CMD_LE_SET_ADV_SET_RAND_ADDR: if (btdev->type != BTDEV_TYPE_BREDRLE50 && - btdev->type != BTDEV_TYPE_BREDRLE60) + btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; lsasra = data; @@ -3678,7 +3678,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, break; case BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS: if (btdev->type != BTDEV_TYPE_BREDRLE50 && - btdev->type != BTDEV_TYPE_BREDRLE60) + btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; if (btdev->le_adv_enable) { @@ -3699,7 +3699,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, break; case BT_HCI_CMD_LE_SET_EXT_ADV_ENABLE: if (btdev->type != BTDEV_TYPE_BREDRLE50 && - btdev->type != BTDEV_TYPE_BREDRLE60) + btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; lseae = data; @@ -3715,7 +3715,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, break; case BT_HCI_CMD_LE_SET_EXT_ADV_DATA: if (btdev->type != BTDEV_TYPE_BREDRLE50 && - btdev->type != BTDEV_TYPE_BREDRLE60) + btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; lsead = data; @@ -3726,7 +3726,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, break; case BT_HCI_CMD_LE_SET_EXT_SCAN_RSP_DATA: if (btdev->type != BTDEV_TYPE_BREDRLE50 && - btdev->type != BTDEV_TYPE_BREDRLE60) + btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; lsesrd = data; @@ -3737,7 +3737,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, break; case BT_HCI_CMD_LE_REMOVE_ADV_SET: if (btdev->type != BTDEV_TYPE_BREDRLE50 && - btdev->type != BTDEV_TYPE_BREDRLE60) + btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; status = BT_HCI_ERR_SUCCESS; @@ -3745,7 +3745,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, break; case BT_HCI_CMD_LE_CLEAR_ADV_SETS: if (btdev->type != BTDEV_TYPE_BREDRLE50 && - btdev->type != BTDEV_TYPE_BREDRLE60) + btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; status = BT_HCI_ERR_SUCCESS; @@ -3767,7 +3767,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, break; case BT_HCI_CMD_LE_SET_EXT_SCAN_PARAMS: if (btdev->type != BTDEV_TYPE_BREDRLE50 && - btdev->type != BTDEV_TYPE_BREDRLE60) + btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; lsesp = data; @@ -3790,7 +3790,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, break; case BT_HCI_CMD_LE_SET_EXT_SCAN_ENABLE: if (btdev->type != BTDEV_TYPE_BREDRLE50 && - btdev->type != BTDEV_TYPE_BREDRLE60) + btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; lsese = data; @@ -3805,14 +3805,14 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, break; case BT_HCI_CMD_LE_EXT_CREATE_CONN: if (btdev->type != BTDEV_TYPE_BREDRLE50 && - btdev->type != BTDEV_TYPE_BREDRLE60) + btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; cmd_status(btdev, BT_HCI_ERR_SUCCESS, opcode); break; case BT_HCI_CMD_LE_READ_BUFFER_SIZE_V2: - if (btdev->type != BTDEV_TYPE_BREDRLE60) + if (btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; lrbsv2.status = BT_HCI_ERR_SUCCESS; lrbsv2.acl_mtu = cpu_to_le16(btdev->acl_mtu); @@ -3823,7 +3823,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, break; case BT_HCI_CMD_LE_SET_CIG_PARAMS: - if (btdev->type != BTDEV_TYPE_BREDRLE60) + if (btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; memcpy(&btdev->le_cig, data, len); lscp.params.status = BT_HCI_ERR_SUCCESS; @@ -3834,7 +3834,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, break; case BT_HCI_CMD_LE_CREATE_CIS: - if (btdev->type != BTDEV_TYPE_BREDRLE60) + if (btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; cmd_status(btdev, BT_HCI_ERR_SUCCESS, opcode); @@ -3842,7 +3842,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, break; case BT_HCI_CMD_LE_ACCEPT_CIS: - if (btdev->type != BTDEV_TYPE_BREDRLE60) + if (btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; cmd_status(btdev, BT_HCI_ERR_SUCCESS, opcode); @@ -3851,7 +3851,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, break; case BT_HCI_CMD_LE_REJECT_CIS: - if (btdev->type != BTDEV_TYPE_BREDRLE60) + if (btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; cmd_status(btdev, BT_HCI_ERR_SUCCESS, opcode); @@ -4098,7 +4098,7 @@ static void default_cmd_completion(struct btdev *btdev, uint16_t opcode, break; case BT_HCI_CMD_LE_SET_EXT_SCAN_ENABLE: if (btdev->type != BTDEV_TYPE_BREDRLE50 && - btdev->type != BTDEV_TYPE_BREDRLE60) + btdev->type != BTDEV_TYPE_BREDRLE52) return; lsese = data; if (btdev->le_scan_enable && lsese->enable) @@ -4106,7 +4106,7 @@ static void default_cmd_completion(struct btdev *btdev, uint16_t opcode, break; case BT_HCI_CMD_LE_EXT_CREATE_CONN: if (btdev->type != BTDEV_TYPE_BREDRLE50 && - btdev->type != BTDEV_TYPE_BREDRLE60) + btdev->type != BTDEV_TYPE_BREDRLE52) return; leecc = data; btdev->le_scan_own_addr_type = leecc->own_addr_type; @@ -4114,7 +4114,7 @@ static void default_cmd_completion(struct btdev *btdev, uint16_t opcode, break; case BT_HCI_CMD_LE_CREATE_CIS: if (btdev->type != BTDEV_TYPE_BREDRLE50 && - btdev->type != BTDEV_TYPE_BREDRLE60) + btdev->type != BTDEV_TYPE_BREDRLE52) return; leccis = data; le_cis_request(btdev, leccis); diff --git a/emulator/btdev.h b/emulator/btdev.h index b535930de..a9f71b281 100644 --- a/emulator/btdev.h +++ b/emulator/btdev.h @@ -64,7 +64,7 @@ enum btdev_type { BTDEV_TYPE_AMP, BTDEV_TYPE_BREDR20, BTDEV_TYPE_BREDRLE50, - BTDEV_TYPE_BREDRLE60, + BTDEV_TYPE_BREDRLE52, }; enum btdev_hook_type { diff --git a/emulator/hciemu.c b/emulator/hciemu.c index 23891a2ee..ac861cce2 100644 --- a/emulator/hciemu.c +++ b/emulator/hciemu.c @@ -335,8 +335,8 @@ struct hciemu *hciemu_new(enum hciemu_type type) case HCIEMU_TYPE_BREDRLE50: hciemu->btdev_type = BTDEV_TYPE_BREDRLE50; break; - case HCIEMU_TYPE_BREDRLE60: - hciemu->btdev_type = BTDEV_TYPE_BREDRLE60; + case HCIEMU_TYPE_BREDRLE52: + hciemu->btdev_type = BTDEV_TYPE_BREDRLE52; break; default: return NULL; diff --git a/emulator/hciemu.h b/emulator/hciemu.h index 6f651cb98..4c8858bb6 100644 --- a/emulator/hciemu.h +++ b/emulator/hciemu.h @@ -32,7 +32,7 @@ enum hciemu_type { HCIEMU_TYPE_LE, HCIEMU_TYPE_LEGACY, HCIEMU_TYPE_BREDRLE50, - HCIEMU_TYPE_BREDRLE60, + HCIEMU_TYPE_BREDRLE52, }; enum hciemu_hook_type { diff --git a/emulator/vhci.c b/emulator/vhci.c index 7a69b484e..f79b34f46 100644 --- a/emulator/vhci.c +++ b/emulator/vhci.c @@ -105,7 +105,7 @@ struct vhci *vhci_open(enum vhci_type type) switch (type) { case VHCI_TYPE_BREDRLE: - btdev_type = BTDEV_TYPE_BREDRLE60; + btdev_type = BTDEV_TYPE_BREDRLE52; ctrl_type = HCI_PRIMARY; break; case VHCI_TYPE_BREDR: From patchwork Thu Apr 23 21:54:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 11506709 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 17A7F1667 for ; Thu, 23 Apr 2020 21:55:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 001B620780 for ; Thu, 23 Apr 2020 21:55:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IW98+kaW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727087AbgDWVzJ (ORCPT ); Thu, 23 Apr 2020 17:55:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727069AbgDWVzI (ORCPT ); Thu, 23 Apr 2020 17:55:08 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FFD2C09B043 for ; Thu, 23 Apr 2020 14:55:07 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id a32so3056351pje.5 for ; Thu, 23 Apr 2020 14:55:07 -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=qJVViqJR7g6FgE7qSe5uNjE3YJbXGxCZdT6LNpqcZ7U=; b=IW98+kaWpLLQhRHLqDMLMMPm6Tc9kh03qR0CmoS+4sRCGKSVmfY7hypZEvmSFVkd6x 7f/VGQhTC4SQVHw3QqnRwXV8rTb0fZ4UzbxWV5NEE0595QuYUV4ziog+Y5GlyWmMmhhY XIJX2kGQUAaTuuPUzgp8poZO9d/qqc1N0X89gydpGr7lT1lHdW18PylmzJ23WMch+Roo YGByLYNSU1dEB/7ix5G65wgc0uBpIGkrhibuf0EVcC/wSZvJbN8DSzuFut81I5tx9shJ rocS2m/lUWRphf//hwq7tQwR9EAhQvzgQvBXeqEEonCKeFtByRs+G1FYkfALLCeE7e63 asHQ== 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=qJVViqJR7g6FgE7qSe5uNjE3YJbXGxCZdT6LNpqcZ7U=; b=jpNQcNBw202frV1UxIFnzzCxBDZRAEBuOxCGWCutxcrmM05vyOX6a/66Psz8unR7Wx vUp+3fWsDHaIit4EWxrWLRqa+eJI5gp24rRn1S0ALyEFrJl8AdkXSHE9SmIJ878gLT2q Q05lS8jtRDB7DQdWSeWd2ATVKzERJrNDAm4GartMMKRksIvbq8RKvHpW11LS1yyUm450 ShxOk9qbSw/17X40msvJHwO5FrJThKclOZf4Q6wrVtfPmbyE0t71Dobgxrc526kkPrCu 4n2IzhFKHPkv78WG2/YG38nGVk4V5Y/mABUCBV9VH3lUF6BQ0uCOVTWO58oaecJBvkDg kN6Q== X-Gm-Message-State: AGi0PuamK1kHceVZ3l7EI0BoFMBXSvuySR13XISUaYAgo8/ysVEWssoV rIvWomRdtjM9bTKslL2bcR+aep87SrE= X-Google-Smtp-Source: APiQypJ3HMkRu+/HaoSjflbRmVRRht08YPe/6plahPMT3AWAGbn5qIFU4V6DiSCkLkynVh9xbMg46A== X-Received: by 2002:a17:902:d303:: with SMTP id b3mr5921766plc.12.1587678906804; Thu, 23 Apr 2020 14:55:06 -0700 (PDT) Received: from localhost.localdomain (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id k12sm2972294pgj.33.2020.04.23.14.55.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 14:55:06 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 4/6] emulator: Add support for LE Set Host Feature Date: Thu, 23 Apr 2020 14:54:59 -0700 Message-Id: <20200423215501.427266-4-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.25.3 In-Reply-To: <20200423215501.427266-1-luiz.dentz@gmail.com> References: <20200423215501.427266-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This implements support for LE Set Host Feature --- emulator/btdev.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/emulator/btdev.c b/emulator/btdev.c index fc2fb2065..cd355e73a 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -469,6 +469,7 @@ static void set_le_52_commands(struct btdev *btdev) btdev->commands[43] |= 0x40; /* LE ISO RX Test */ btdev->commands[43] |= 0x80; /* LE ISO Read Test Counter */ btdev->commands[44] |= 0x01; /* LE ISO Test End */ + btdev->commands[44] |= 0x02; /* LE ISO Set Host Feature */ } static void set_le_commands(struct btdev *btdev) @@ -3861,6 +3862,15 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, break; + case BT_HCI_CMD_LE_SET_HOST_FEATURE: + if (btdev->type != BTDEV_TYPE_BREDRLE52) + goto unsupported; + + status = BT_HCI_ERR_SUCCESS; + cmd_complete(btdev, opcode, &status, sizeof(status)); + + break; + default: goto unsupported; } From patchwork Thu Apr 23 21:55:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 11506707 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 C2D6F15AB for ; Thu, 23 Apr 2020 21:55:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AB4372077D for ; Thu, 23 Apr 2020 21:55:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="a6Sj4Hpb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727079AbgDWVzJ (ORCPT ); Thu, 23 Apr 2020 17:55:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726071AbgDWVzI (ORCPT ); Thu, 23 Apr 2020 17:55:08 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93DF7C09B042 for ; Thu, 23 Apr 2020 14:55:08 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id x77so3691627pfc.0 for ; Thu, 23 Apr 2020 14:55:08 -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=w0VM6HpkuAzq7+rMk+7jnjDTZrAvvMg7HoEcEum2Phc=; b=a6Sj4Hpbqi2TgjgDdmp6x4KsPDGr51IwLFoD0gFfyVzXr6PmGWX8zihHH51PEJEd9N lDmFlz9bcWhSSoEjqeYYdHgjW5heGcofTQJPFrqxqJy49kOFRv6biHsK5LiN73/oURzG ClVTU/sx/Z+eJnqdmJcE6e9B0maxR5p6V6z9ZEMYFss+wyCsA3PAGmgFcZTM7WB3pHhD 6zkJsav+hVbhlofgsxwjU21WOwG5z/RnWaMnh4D1+KH/37zoag08IHRdKVTIr4wAw0tx 1yAkN5QhKlnDymNZvqy54sAKKpMuuK/SFAMRW8fHeXyXmpYr3jXnxJ8ztisI3DksgEee A4qw== 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=w0VM6HpkuAzq7+rMk+7jnjDTZrAvvMg7HoEcEum2Phc=; b=GZ6Fx21lS77o5uSrS5VcpKQha4zF9QA2W3aUGMHSFH2HXH7lgFF/7QowpzoCTe91VT 93Bzf66DhHQrzigrj1ogkYfcisB+qGjVsI3R3zEQlLh84TfWlWHnFGBT8ZP0citkThZx qMisLgpbhIw/Yl3BoGaurAB4YGlR1xOS513f+GHcPqx4tGya8hYv/q5mY/i43+j0jTja uSO5b+K/TA9qtgF6iSWUUbl3TZaRUpxAg0T0rAhsl79ZfYoD+XFEcPmPeXl1vNVlsik5 5FaPTeAL2dyiUeycoSc96hb1QQesTcqYCWoiDQN+DP86e5ErsNdvAPLG89vx8iMfj95s v2kg== X-Gm-Message-State: AGi0PuaWI91Y+vpU4WGFY74HM9OwOvE6HnHGdaP2VcKGLLLqrKYxaTW1 D8K6buUzZYDkfKykYdehQ8ZPKLogUe8= X-Google-Smtp-Source: APiQypJMxSA6sgEvRgqq9MA5LpLEiBhDu6ZNdUX9FTs3SYBkQWEVwcOJ5j3HJO2t2mLBUP2pvMf2CQ== X-Received: by 2002:a63:e942:: with SMTP id q2mr5836733pgj.34.1587678907819; Thu, 23 Apr 2020 14:55:07 -0700 (PDT) Received: from localhost.localdomain (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id k12sm2972294pgj.33.2020.04.23.14.55.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 14:55:07 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 5/6] emulator: Add support for LE Setup ISO Data Path Date: Thu, 23 Apr 2020 14:55:00 -0700 Message-Id: <20200423215501.427266-5-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.25.3 In-Reply-To: <20200423215501.427266-1-luiz.dentz@gmail.com> References: <20200423215501.427266-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This implements support for LE Setup ISO Data Path command. --- emulator/btdev.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/emulator/btdev.c b/emulator/btdev.c index cd355e73a..1b3ad6442 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -148,6 +148,7 @@ struct btdev { struct bt_hci_cmd_le_set_cig_params params; struct bt_hci_cis_params cis; } __attribute__ ((packed)) le_cig; + uint8_t le_iso_path[2]; uint8_t le_local_sk256[32]; @@ -2418,6 +2419,38 @@ static void btdev_reset(struct btdev *btdev) btdev->le_adv_enable = 0x00; } +static void le_setup_iso_path(struct btdev *dev, uint16_t handle, + uint8_t dir, uint8_t path) +{ + uint8_t status = BT_HCI_ERR_SUCCESS; + + if (!dev->conn || handle != ISO_HANDLE) { + status = BT_HCI_ERR_UNKNOWN_CONN_ID; + goto done; + } + + /* Only support HCI or disabled paths */ + if (path && path != 0xff) { + status = BT_HCI_ERR_INVALID_PARAMETERS; + goto done; + } + + switch (dir) { + case 0x00: + dev->le_iso_path[0] = path; + break; + case 0x01: + dev->le_iso_path[1] = path; + break; + default: + status = BT_HCI_ERR_INVALID_PARAMETERS; + } + +done: + cmd_complete(dev, BT_HCI_CMD_LE_SETUP_ISO_PATH, &status, + sizeof(status)); +} + static void default_cmd(struct btdev *btdev, uint16_t opcode, const void *data, uint8_t len) { @@ -2541,6 +2574,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, struct bt_hci_rsp_le_set_cig_params params; uint16_t handle; } __attribute__ ((packed)) lscp; + struct bt_hci_cmd_le_setup_iso_path *lesip; uint8_t status, page; switch (opcode) { @@ -3862,6 +3896,17 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, break; + case BT_HCI_CMD_LE_SETUP_ISO_PATH: + if (btdev->type != BTDEV_TYPE_BREDRLE52) + goto unsupported; + + lesip = (void *)data; + + le_setup_iso_path(btdev, le16_to_cpu(lesip->handle), + lesip->direction, lesip->path); + + break; + case BT_HCI_CMD_LE_SET_HOST_FEATURE: if (btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; From patchwork Thu Apr 23 21:55:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 11506711 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 F057E112C for ; Thu, 23 Apr 2020 21:55:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D87CD2077D for ; Thu, 23 Apr 2020 21:55:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="E7WRdzpQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727094AbgDWVzK (ORCPT ); Thu, 23 Apr 2020 17:55:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727069AbgDWVzJ (ORCPT ); Thu, 23 Apr 2020 17:55:09 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA061C09B042 for ; Thu, 23 Apr 2020 14:55:09 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id s18so886151pgl.12 for ; Thu, 23 Apr 2020 14:55:09 -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=KKOb2C9dKqnGrY0+vf6D1MbWO6xCggSYV+3P1ig+TNI=; b=E7WRdzpQsh+6rdSGygAKQylX2O70bAAMaE2PvxJSq/EWKIYcKPH7kO0BhM6LNoSh6o m54APbiw2KQfdyTpq5x/sbntwUmQlXvihk8R86kNEs5SkIZYQL9NOtMpcWr0X39Lo77H 4BL9Waoa4QKKmQYkAqWHcHr8bfD+OV9AWZJa0ncGkdAVnVxUyokoQsNUEpLP02qQ9XBO z6qf+CGyOS+i/wnjyhor5bgljiChZ5nNvoDx4qUGPGQpnK4PLbiV1l81NNrm4QIg1kyy T3ZL0SZ6aNhqydm5Gj8EaXAf2bmXJq/TPkj/PhlIXpPNZ3mzstB4EDSjiCoLBnSfao7Q RV7g== 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=KKOb2C9dKqnGrY0+vf6D1MbWO6xCggSYV+3P1ig+TNI=; b=nFvVuatasTGTaPOwzJ0+BzeU8B54FnpGJuSqBxQER3iZIaW38BdAUU4DziVri4cRha YmcJXcgSw8xWeYYI3A5RVvd4rPxfSMtpSMdGcxNBC4pu03EtHEoL2+qiG/DjMYMlGWIH HvvdQzokK1A3X15uZyZhu5UwdND5OnY0nUjzxXgtFJ9myYg7+FvTxm7jIdCT/geSPIjy mN8j3MbVmlRxn6/kMTk8797SlGWgDa4BQ50rOO1baTaTeWXZp/5XiAe0J9VzHclELHI9 zsaYoHd4QP1kpwjSY6q59UnHl960WEav3lvNY7380Le+z4Ub56R3r6jYWW5QIsxQYRYw SxrQ== X-Gm-Message-State: AGi0PuZpqY9ENk0+5Dtqx2eUpeDfWp/U44WxTT46FDEFrrDsHoRN/B0t 1d1LX/E2BL6VQEkM1ijP1JvkU2mxhb8= X-Google-Smtp-Source: APiQypKpuk7gTHjoFxJNLp97nBQKmQ9Oa/nnDGTpqXEWjNlaeeCYQ+uNLF0pZc3j1Wk72nkxQ8RH1g== X-Received: by 2002:a63:2143:: with SMTP id s3mr5816663pgm.20.1587678908867; Thu, 23 Apr 2020 14:55:08 -0700 (PDT) Received: from localhost.localdomain (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id k12sm2972294pgj.33.2020.04.23.14.55.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 14:55:08 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 6/6] emulator: Add support for LE Remove ISO Data Path Date: Thu, 23 Apr 2020 14:55:01 -0700 Message-Id: <20200423215501.427266-6-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.25.3 In-Reply-To: <20200423215501.427266-1-luiz.dentz@gmail.com> References: <20200423215501.427266-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This implements support for LE Remove ISO Data Path command. --- emulator/btdev.c | 25 +++++++++++++++++++++++++ monitor/bt.h | 2 +- monitor/packet.c | 2 +- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/emulator/btdev.c b/emulator/btdev.c index 1b3ad6442..46d71d77e 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -2508,6 +2508,7 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, const struct bt_hci_le_scan_phy *lsp; const struct bt_hci_cmd_le_set_ext_scan_enable *lsese; const struct bt_hci_cmd_le_reject_cis *lrcis; + const struct bt_hci_cmd_le_remove_iso_path *lerip; struct bt_hci_rsp_read_default_link_policy rdlp; struct bt_hci_rsp_read_stored_link_key rslk; struct bt_hci_rsp_write_stored_link_key wslk; @@ -3907,6 +3908,30 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, break; + case BT_HCI_CMD_LE_REMOVE_ISO_PATH: + if (btdev->type != BTDEV_TYPE_BREDRLE52) + goto unsupported; + + lerip = data; + status = BT_HCI_ERR_SUCCESS; + + if (!btdev->conn || le16_to_cpu(lerip->handle) != ISO_HANDLE) + status = BT_HCI_ERR_UNKNOWN_CONN_ID; + + switch (lerip->direction) { + case 0x00: + btdev->le_iso_path[0] = 0x00; + break; + case 0x01: + btdev->le_iso_path[1] = 0x00; + break; + default: + status = BT_HCI_ERR_INVALID_PARAMETERS; + } + + cmd_complete(btdev, opcode, &status, sizeof(status)); + break; + case BT_HCI_CMD_LE_SET_HOST_FEATURE: if (btdev->type != BTDEV_TYPE_BREDRLE52) goto unsupported; diff --git a/monitor/bt.h b/monitor/bt.h index 39ca1e39a..32ea10ca4 100644 --- a/monitor/bt.h +++ b/monitor/bt.h @@ -2780,7 +2780,7 @@ struct bt_hci_cmd_le_setup_iso_path { #define BT_HCI_BIT_LE_REMOVE_ISO_PATH BT_HCI_CMD_BIT(43, 4) struct bt_hci_cmd_le_remove_iso_path { uint16_t handle; - uint8_t path_dir; + uint8_t direction; } __attribute__ ((packed)); #define BT_HCI_CMD_LE_ISO_TX_TEST 0x2070 diff --git a/monitor/packet.c b/monitor/packet.c index 777a52205..5d8709c42 100644 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -8118,7 +8118,7 @@ static void le_remove_iso_path_cmd(const void *data, uint8_t size) const struct bt_hci_cmd_le_remove_iso_path *cmd = data; print_field("Connection Handle: %d", le16_to_cpu(cmd->handle)); - print_iso_dir("Data Path Direction", cmd->path_dir); + print_iso_dir("Data Path Direction", cmd->direction); } static void le_req_peer_sca_cmd(const void *data, uint8_t size)