emulator: Add support for BT_HCI_CMD_CHANGE_CONN_PKT_TYPE
Luiz Augusto von Dentz
maintainerPATCH 1/3 emulator: Add support for BT_HCI_CMD_CHANGE_CONN_PKT_TYPE
From: Luiz Augusto von Dentz <[email protected]>
This adds support for BT_HCI_CMD_CHANGE_CONN_PKT_TYPE as well as emit BT_HCI_EVT_CONN_PKT_TYPE_CHANGED when it completes.
--- emulator/btdev.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
emulator/btdev.c +42 -0
@@ -1928,6 +1928,45 @@ static int cmd_pin_code_neg_reply_complete(struct btdev *dev, const void *data,return 0 ; } +static int cmd_change_conn_pkt_type (struct btdev *dev,const void *data, +uint8_t len) +{ +const struct bt_hci_cmd_change_conn_pkt_type *cmd = data; +struct btdev_conn *conn; +uint8_t status =BT_HCI_ERR_SUCCESS ; + + conn =queue_find (dev->conns, match_handle, +UINT_TO_PTR (cpu_to_le16 (cmd->handle))); +if (!conn) + status =BT_HCI_ERR_UNKNOWN_CONN_ID ; + +cmd_status (dev, status,BT_HCI_CMD_CHANGE_CONN_PKT_TYPE ); + +return 0 ; +} + +static int cmd_change_conn_pkt_type_complete (struct btdev *dev, +const void *data,uint8_t len) +{ +const struct bt_hci_cmd_change_conn_pkt_type *cmd = data; +struct bt_hci_evt_conn_pkt_type_changed ev; +struct btdev_conn *conn; + + conn =queue_find (dev->conns, match_handle, +UINT_TO_PTR (cpu_to_le16 (cmd->handle))); +if (!conn) +return 0 ; + +memset (&ev,0 ,sizeof (ev)); + ev.status =BT_HCI_ERR_SUCCESS ; + ev.handle = cmd->handle; + ev.pkt_type = cmd->pkt_type; + +send_event (dev,BT_HCI_EVT_CONN_PKT_TYPE_CHANGED , &ev,sizeof (ev)); + +return 0 ; +} +static int cmd_auth_requested (struct btdev *dev,const void *data,uint8_t len) {cmd_status (dev,BT_HCI_ERR_SUCCESS ,BT_HCI_CMD_AUTH_REQUESTED );
@@ -2789,6 +2828,9 @@ static int cmd_enable_dut_mode(struct btdev *dev, const void *data,CMD (BT_HCI_CMD_PIN_CODE_REQUEST_NEG_REPLY , \ cmd_pin_code_neg_reply, \ cmd_pin_code_neg_reply_complete), \ +CMD (BT_HCI_CMD_CHANGE_CONN_PKT_TYPE , \ + cmd_change_conn_pkt_type, \ + cmd_change_conn_pkt_type_complete), \CMD (BT_HCI_CMD_AUTH_REQUESTED , cmd_auth_requested, \ cmd_auth_requested_complete), \ CMD(BT_HCI_CMD_SET_CONN_ENCRYPT, cmd_set_conn_encrypt, \
Signature · 1 line
2.52.0
Luiz Augusto von Dentz
maintainerPATCH 2/3 emulator: Add support for BT_HCI_CMD_LE_SET_PHY
From: Luiz Augusto von Dentz <[email protected]>
This adds support for BT_HCI_CMD_LE_SET_PHY as well as emit BT_HCI_EVT_LE_PHY_UPDATE_COMPLETE when it completes.
--- emulator/btdev.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+)
emulator/btdev.c +74 -0
@@ -5082,6 +5082,79 @@ static int cmd_set_default_phy(struct btdev *dev, const void *data,return 0 ; } +static int cmd_le_set_phy (struct btdev *dev,const void *data, +uint8_t len) +{ +const struct bt_hci_cmd_le_set_phy *cmd = data; +struct btdev_conn *conn; +uint8_t status; + + conn =queue_find (dev->conns, match_handle, +UINT_TO_PTR (cpu_to_le16 (cmd->handle))); +if (!conn) { + status =BT_HCI_ERR_UNKNOWN_CONN_ID ; + goto done; + } + +if (cmd->all_phys >0x03 || (!(cmd->all_phys &0x01 ) && + (!cmd->tx_phys || cmd->tx_phys >0x07 )) || + (!(cmd->all_phys &0x02 ) && + (!cmd->rx_phys || cmd->rx_phys >0x07 ))) + status =BT_HCI_ERR_INVALID_PARAMETERS ; +else + status =BT_HCI_ERR_SUCCESS ; + +done: +cmd_status (dev, status,BT_HCI_CMD_LE_SET_PHY ); + +return 0 ; +} + +static int cmd_le_set_phy_complete (struct btdev *dev,const void *data, +uint8_t len) +{ +const struct bt_hci_cmd_le_set_phy *cmd = data; +struct bt_hci_evt_le_phy_update_complete ev; +struct btdev_conn *conn; + + conn =queue_find (dev->conns, match_handle, +UINT_TO_PTR (cpu_to_le16 (cmd->handle))); +if (!conn) +return 0 ; + +if (cmd->all_phys >0x03 || (!(cmd->all_phys &0x01 ) && + (!cmd->tx_phys || cmd->tx_phys >0x07 )) || + (!(cmd->all_phys &0x02 ) && + (!cmd->rx_phys || cmd->rx_phys >0x07 ))) +return 0 ; + +memset (&ev,0 ,sizeof (ev)); + ev.handle = cmd->handle; + +/* Use the highest PHY possible */ +if (cmd->tx_phys &BIT (0 )) + ev.tx_phy =0x01 ;/* LE 1M PHY */ + +if (cmd->rx_phys &BIT (0 )) + ev.rx_phy =0x01 ;/* LE 1M PHY */ + +if (cmd->tx_phys &BIT (1 )) + ev.tx_phy |=0x02 ;/* LE 2M PHY */ + +if (cmd->rx_phys &BIT (1 )) + ev.rx_phy |=0x02 ;/* LE 2M PHY */ + +if (cmd->tx_phys &BIT (2 )) + ev.tx_phy |=0x03 ;/* LE CODED PHY */ + +if (cmd->rx_phys &BIT (2 )) + ev.rx_phy |=0x03 ;/* LE CODED PHY */ + +le_meta_event (dev,BT_HCI_EVT_LE_PHY_UPDATE_COMPLETE , &ev,sizeof (ev)); + +return 0 ; +} +static const uint8_t *ext_adv_gen_rpa (const struct btdev *dev,struct le_ext_adv *adv) {
@@ -6335,6 +6408,7 @@ done:#define CMD_LE_50 \ CMD(BT_HCI_CMD_LE_SET_DEFAULT_PHY, cmd_set_default_phy, NULL), \ + CMD(BT_HCI_CMD_LE_SET_PHY, cmd_le_set_phy, cmd_le_set_phy_complete), \ CMD(BT_HCI_CMD_LE_SET_ADV_SET_RAND_ADDR, cmd_set_adv_rand_addr, NULL), \ CMD(BT_HCI_CMD_LE_SET_EXT_ADV_PARAMS, cmd_set_ext_adv_params, NULL), \ CMD(BT_HCI_CMD_LE_SET_EXT_ADV_DATA, cmd_set_ext_adv_data, NULL), \
Signature · 1 line
2.52.0
Luiz Augusto von Dentz
maintainerPATCH 3/3 tools/l2cap-tester: Add tests for setting BT_PHY
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
This adds the following tests that use setsockopt(BT_PHY):
L2CAP BR/EDR Client - Set PHY 1M L2CAP BR/EDR Client - Set PHY 2M L2CAP BR/EDR Client - Set PHY 3M L2CAP BR/EDR Server - Set PHY 1M L2CAP BR/EDR Server - Set PHY 2M L2CAP BR/EDR Server - Set PHY 3M L2CAP LE Client - Set PHY 1M
L2CAP LE Client - Set PHY 2M
L2CAP LE Client - Set PHY Coded L2CAP LE Server - Set PHY 1M
L2CAP LE Server - Set PHY 2M
L2CAP LE Server - Set PHY Coded L2CAP Ext-Flowctl Client - Set PHY 1M L2CAP Ext-Flowctl Client - Set PHY 2M L2CAP Ext-Flowctl Client - Set PHY Coded L2CAP Ext-Flowctl Server - Set PHY 1M L2CAP Ext-Flowctl Server - Set PHY 2M L2CAP Ext-Flowctl Server - Set PHY Coded
--- tools/l2cap-tester.c | 342 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 334 insertions(+), 8 deletions(-)
tools/l2cap-tester.c +334 -8
@@ -109,6 +109,9 @@ struct l2cap_data {/* Expected supported PHYs */ uint32_t phys; + +/* Set PHY */ +uint32_t phy; };static void print_debug (const char *str,void *user_data)
@@ -426,6 +429,35 @@ static const struct l2cap_data client_connect_phy_test_1 = { BT_PHY_EDR_3M_1SLOT | BT_PHY_EDR_3M_3SLOT | BT_PHY_EDR_3M_5SLOT), }; +static const struct l2cap_data client_connect_phy_1m_test = { + .client_psm =0x1001 , + .server_psm =0x1001 , + .phys = (BT_PHY_BR_1M_1SLOT | +BT_PHY_EDR_2M_1SLOT |BT_PHY_EDR_2M_3SLOT |BT_PHY_EDR_2M_5SLOT | +BT_PHY_EDR_3M_1SLOT |BT_PHY_EDR_3M_3SLOT |BT_PHY_EDR_3M_5SLOT ), + .phy =BT_PHY_BR_1M_1SLOT , +}; + +static const struct l2cap_data client_connect_phy_2m_test = { + .client_psm =0x1001 , + .server_psm =0x1001 , + .phys = (BT_PHY_BR_1M_1SLOT | +BT_PHY_EDR_2M_1SLOT |BT_PHY_EDR_2M_3SLOT |BT_PHY_EDR_2M_5SLOT | +BT_PHY_EDR_3M_1SLOT |BT_PHY_EDR_3M_3SLOT |BT_PHY_EDR_3M_5SLOT ), + .phy = (BT_PHY_BR_1M_1SLOT | +BT_PHY_EDR_2M_1SLOT |BT_PHY_EDR_2M_3SLOT |BT_PHY_EDR_2M_5SLOT ), +}; + +static const struct l2cap_data client_connect_phy_3m_test = { + .client_psm =0x1001 , + .server_psm =0x1001 , + .phys = (BT_PHY_BR_1M_1SLOT | +BT_PHY_EDR_2M_1SLOT |BT_PHY_EDR_2M_3SLOT |BT_PHY_EDR_2M_5SLOT | +BT_PHY_EDR_3M_1SLOT |BT_PHY_EDR_3M_3SLOT |BT_PHY_EDR_3M_5SLOT ), + .phy = (BT_PHY_BR_1M_1SLOT | +BT_PHY_EDR_3M_1SLOT |BT_PHY_EDR_3M_3SLOT |BT_PHY_EDR_3M_5SLOT ), +}; +static const struct l2cap_data client_connect_nval_psm_test_1 = { .client_psm =0x1001 , .expect_err =ECONNREFUSED ,
@@ -573,6 +605,44 @@ static const struct l2cap_data l2cap_server_phy_test = { BT_PHY_EDR_3M_1SLOT | BT_PHY_EDR_3M_3SLOT | BT_PHY_EDR_3M_5SLOT), }; +static const struct l2cap_data l2cap_server_phy_1m_test = { + .server_psm =0x1001 , + .send_cmd_code =BT_L2CAP_PDU_CONN_REQ , + .send_cmd = l2cap_connect_req, + .send_cmd_len =sizeof (l2cap_connect_req), + .expect_cmd_code =BT_L2CAP_PDU_CONN_RSP , + .phys = (BT_PHY_BR_1M_1SLOT | +BT_PHY_EDR_2M_1SLOT |BT_PHY_EDR_2M_3SLOT |BT_PHY_EDR_2M_5SLOT | +BT_PHY_EDR_3M_1SLOT |BT_PHY_EDR_3M_3SLOT |BT_PHY_EDR_3M_5SLOT ), + .phy =BT_PHY_BR_1M_1SLOT , +}; + +static const struct l2cap_data l2cap_server_phy_2m_test = { + .server_psm =0x1001 , + .send_cmd_code =BT_L2CAP_PDU_CONN_REQ , + .send_cmd = l2cap_connect_req, + .send_cmd_len =sizeof (l2cap_connect_req), + .expect_cmd_code =BT_L2CAP_PDU_CONN_RSP , + .phys = (BT_PHY_BR_1M_1SLOT | +BT_PHY_EDR_2M_1SLOT |BT_PHY_EDR_2M_3SLOT |BT_PHY_EDR_2M_5SLOT | +BT_PHY_EDR_3M_1SLOT |BT_PHY_EDR_3M_3SLOT |BT_PHY_EDR_3M_5SLOT ), + .phy = (BT_PHY_BR_1M_1SLOT | +BT_PHY_EDR_2M_1SLOT |BT_PHY_EDR_2M_3SLOT |BT_PHY_EDR_2M_5SLOT ), +}; + +static const struct l2cap_data l2cap_server_phy_3m_test = { + .server_psm =0x1001 , + .send_cmd_code =BT_L2CAP_PDU_CONN_REQ , + .send_cmd = l2cap_connect_req, + .send_cmd_len =sizeof (l2cap_connect_req), + .expect_cmd_code =BT_L2CAP_PDU_CONN_RSP , + .phys = (BT_PHY_BR_1M_1SLOT | +BT_PHY_EDR_2M_1SLOT |BT_PHY_EDR_2M_3SLOT |BT_PHY_EDR_2M_5SLOT | +BT_PHY_EDR_3M_1SLOT |BT_PHY_EDR_3M_3SLOT |BT_PHY_EDR_3M_5SLOT ), + .phy = (BT_PHY_BR_1M_1SLOT | +BT_PHY_EDR_3M_1SLOT |BT_PHY_EDR_3M_3SLOT |BT_PHY_EDR_3M_5SLOT ), +}; +static const struct l2cap_data le_client_connect_success_test_1 = { .client_psm =0x0080 , .server_psm =0x0080 ,
@@ -706,6 +776,33 @@ static const struct l2cap_data le_client_connect_phy_2m_coded_test_1 = { BT_PHY_LE_CODED_TX | BT_PHY_LE_CODED_RX), }; +static const struct l2cap_data le_client_set_phy_1m_test = { + .client_psm =0x0080 , + .server_psm =0x0080 , + .phys = (BT_PHY_LE_1M_TX |BT_PHY_LE_1M_RX | +BT_PHY_LE_2M_TX |BT_PHY_LE_2M_RX | +BT_PHY_LE_CODED_TX |BT_PHY_LE_CODED_RX ), + .phy =BT_PHY_LE_1M_TX |BT_PHY_LE_1M_RX , +}; + +static const struct l2cap_data le_client_set_phy_2m_test = { + .client_psm =0x0080 , + .server_psm =0x0080 , + .phys = (BT_PHY_LE_1M_TX |BT_PHY_LE_1M_RX | +BT_PHY_LE_2M_TX |BT_PHY_LE_2M_RX | +BT_PHY_LE_CODED_TX |BT_PHY_LE_CODED_RX ), + .phy =BT_PHY_LE_2M_TX |BT_PHY_LE_2M_RX , +}; + +static const struct l2cap_data le_client_set_phy_coded_test = { + .client_psm =0x0080 , + .server_psm =0x0080 , + .phys = (BT_PHY_LE_1M_TX |BT_PHY_LE_1M_RX | +BT_PHY_LE_2M_TX |BT_PHY_LE_2M_RX | +BT_PHY_LE_CODED_TX |BT_PHY_LE_CODED_RX ), + .phy =BT_PHY_LE_CODED_TX |BT_PHY_LE_CODED_RX , +}; +static uint8_t nonexisting_bdaddr[] = {0x00 ,0xAA ,0x01 ,0x02 ,0x03 ,0x00 };static const struct l2cap_data le_client_close_socket_test_1 = { .client_psm =0x0080 ,
@@ -807,6 +904,48 @@ static const struct l2cap_data le_server_phy_2m_coded_test = { BT_PHY_LE_CODED_TX | BT_PHY_LE_CODED_RX), }; +static const struct l2cap_data le_server_set_phy_1m_test = { + .server_psm =0x0080 , + .send_cmd_code =BT_L2CAP_PDU_LE_CONN_REQ , + .send_cmd = le_connect_req, + .send_cmd_len =sizeof (le_connect_req), + .expect_cmd_code =BT_L2CAP_PDU_LE_CONN_RSP , + .expect_cmd = le_connect_rsp, + .expect_cmd_len =sizeof (le_connect_rsp), + .phys = (BT_PHY_LE_1M_TX |BT_PHY_LE_1M_RX | +BT_PHY_LE_2M_TX |BT_PHY_LE_2M_RX | +BT_PHY_LE_CODED_TX |BT_PHY_LE_CODED_RX ), + .phy =BT_PHY_LE_1M_TX |BT_PHY_LE_1M_RX , +}; + +static const struct l2cap_data le_server_set_phy_2m_test = { + .server_psm =0x0080 , + .send_cmd_code =BT_L2CAP_PDU_LE_CONN_REQ , + .send_cmd = le_connect_req, + .send_cmd_len =sizeof (le_connect_req), + .expect_cmd_code =BT_L2CAP_PDU_LE_CONN_RSP , + .expect_cmd = le_connect_rsp, + .expect_cmd_len =sizeof (le_connect_rsp), + .phys = (BT_PHY_LE_1M_TX |BT_PHY_LE_1M_RX | +BT_PHY_LE_2M_TX |BT_PHY_LE_2M_RX | +BT_PHY_LE_CODED_TX |BT_PHY_LE_CODED_RX ), + .phy =BT_PHY_LE_2M_TX |BT_PHY_LE_2M_RX , +}; + +static const struct l2cap_data le_server_set_phy_coded_test = { + .server_psm =0x0080 , + .send_cmd_code =BT_L2CAP_PDU_LE_CONN_REQ , + .send_cmd = le_connect_req, + .send_cmd_len =sizeof (le_connect_req), + .expect_cmd_code =BT_L2CAP_PDU_LE_CONN_RSP , + .expect_cmd = le_connect_rsp, + .expect_cmd_len =sizeof (le_connect_rsp), + .phys = (BT_PHY_LE_1M_TX |BT_PHY_LE_1M_RX | +BT_PHY_LE_2M_TX |BT_PHY_LE_2M_RX | +BT_PHY_LE_CODED_TX |BT_PHY_LE_CODED_RX ), + .phy =BT_PHY_LE_CODED_TX |BT_PHY_LE_CODED_RX , +}; +static const uint8_t ecred_connect_req[] = {0x80 ,0x00 ,/* PSM */ 0x40 ,0x00 ,/* MTU */ 0x40 ,0x00 ,/* MPS */
@@ -889,6 +1028,48 @@ static const struct l2cap_data ext_flowctl_server_phy_2m_coded_test = { BT_PHY_LE_CODED_TX | BT_PHY_LE_CODED_RX), }; +static const struct l2cap_data ext_flowctl_server_set_phy_1m_test = { + .server_psm =0x0080 , + .send_cmd_code =BT_L2CAP_PDU_ECRED_CONN_REQ , + .send_cmd = ecred_connect_req, + .send_cmd_len =sizeof (ecred_connect_req), + .expect_cmd_code =BT_L2CAP_PDU_ECRED_CONN_RSP , + .expect_cmd = ecred_connect_rsp, + .expect_cmd_len =sizeof (ecred_connect_rsp), + .phys = (BT_PHY_LE_1M_TX |BT_PHY_LE_1M_RX | +BT_PHY_LE_2M_TX |BT_PHY_LE_2M_RX | +BT_PHY_LE_CODED_TX |BT_PHY_LE_CODED_RX ), + .phy =BT_PHY_LE_1M_TX |BT_PHY_LE_1M_RX , +}; + +static const struct l2cap_data ext_flowctl_server_set_phy_2m_test = { + .server_psm =0x0080 , + .send_cmd_code =BT_L2CAP_PDU_ECRED_CONN_REQ , + .send_cmd = ecred_connect_req, + .send_cmd_len =sizeof (ecred_connect_req), + .expect_cmd_code =BT_L2CAP_PDU_ECRED_CONN_RSP , + .expect_cmd = ecred_connect_rsp, + .expect_cmd_len =sizeof (ecred_connect_rsp), + .phys = (BT_PHY_LE_1M_TX |BT_PHY_LE_1M_RX | +BT_PHY_LE_2M_TX |BT_PHY_LE_2M_RX | +BT_PHY_LE_CODED_TX |BT_PHY_LE_CODED_RX ), + .phy =BT_PHY_LE_2M_TX |BT_PHY_LE_2M_RX , +}; + +static const struct l2cap_data ext_flowctl_server_set_phy_coded_test = { + .server_psm =0x0080 , + .send_cmd_code =BT_L2CAP_PDU_ECRED_CONN_REQ , + .send_cmd = ecred_connect_req, + .send_cmd_len =sizeof (ecred_connect_req), + .expect_cmd_code =BT_L2CAP_PDU_ECRED_CONN_RSP , + .expect_cmd = ecred_connect_rsp, + .expect_cmd_len =sizeof (ecred_connect_rsp), + .phys = (BT_PHY_LE_1M_TX |BT_PHY_LE_1M_RX | +BT_PHY_LE_2M_TX |BT_PHY_LE_2M_RX | +BT_PHY_LE_CODED_TX |BT_PHY_LE_CODED_RX ), + .phy =BT_PHY_LE_CODED_TX |BT_PHY_LE_CODED_RX , +}; +static const struct l2cap_data le_att_client_connect_success_test_1 = { .cid =0x0004 , .sec_level =BT_SECURITY_LOW ,
@@ -1031,6 +1212,36 @@ static const struct l2cap_data ext_flowctl_client_phy_2m_coded_test_1 = { BT_PHY_LE_CODED_TX | BT_PHY_LE_CODED_RX), }; +static const struct l2cap_data ext_flowctl_client_set_phy_1m_test = { + .client_psm =0x0080 , + .server_psm =0x0080 , + .mode =BT_MODE_EXT_FLOWCTL , + .phys = (BT_PHY_LE_1M_TX |BT_PHY_LE_1M_RX | +BT_PHY_LE_2M_TX |BT_PHY_LE_2M_RX | +BT_PHY_LE_CODED_TX |BT_PHY_LE_CODED_RX ), + .phy =BT_PHY_LE_1M_TX |BT_PHY_LE_1M_RX , +}; + +static const struct l2cap_data ext_flowctl_client_set_phy_2m_test = { + .client_psm =0x0080 , + .server_psm =0x0080 , + .mode =BT_MODE_EXT_FLOWCTL , + .phys = (BT_PHY_LE_1M_TX |BT_PHY_LE_1M_RX | +BT_PHY_LE_2M_TX |BT_PHY_LE_2M_RX | +BT_PHY_LE_CODED_TX |BT_PHY_LE_CODED_RX ), + .phy =BT_PHY_LE_2M_TX |BT_PHY_LE_2M_RX , +}; + +static const struct l2cap_data ext_flowctl_client_set_phy_coded_test = { + .client_psm =0x0080 , + .server_psm =0x0080 , + .mode =BT_MODE_EXT_FLOWCTL , + .phys = (BT_PHY_LE_1M_TX |BT_PHY_LE_1M_RX | +BT_PHY_LE_2M_TX |BT_PHY_LE_2M_RX | +BT_PHY_LE_CODED_TX |BT_PHY_LE_CODED_RX ), + .phy =BT_PHY_LE_CODED_TX |BT_PHY_LE_CODED_RX , +}; +static void client_cmd_complete (uint16_t opcode,uint8_t status,const void *param,uint8_t len,void *user_data)
@@ -1492,7 +1703,40 @@ static bool check_mtu(struct test_data *data, int sk)return true; } -static bool check_phys (struct test_data *data,int sk) +static gboolean check_phy (gpointer args) +{ +int sk =PTR_TO_INT (args); +struct test_data *data =tester_get_data (); +const struct l2cap_data *l2data = data->test_data; +socklen_t len; + + len =sizeof (data->phys); + data->phys =0 ; + +tester_print ("Checking PHY..." ); + +if (getsockopt (sk,SOL_BLUETOOTH ,BT_PHY , &data->phys, &len) <0 ) { +tester_warn ("getsockopt(BT_PHY): %s (%d)" , +strerror (errno), errno); +tester_test_failed (); + goto done; + } + +if (l2data->phy && l2data->phy != data->phys) { +tester_warn ("phy 0x%08x != 0x%08x" , l2data->phy, data->phys); +tester_test_failed (); + goto done; + } + +tester_test_passed (); + +done: +shutdown (sk,SHUT_WR ); + +return FALSE; +} + +static int check_phys (struct test_data *data,int sk) {const struct l2cap_data *l2data = data->test_data;socklen_t len;
@@ -1503,15 +1747,29 @@ static bool check_phys(struct test_data *data,int sk)if (getsockopt (sk,SOL_BLUETOOTH ,BT_PHY , &data->phys, &len) <0 ) {tester_warn ("getsockopt(BT_PHY): %s (%d)" ,strerror (errno), errno); -return false; +return -errno; }if (l2data->phys && l2data->phys != data->phys) {tester_warn ("phys 0x%08x != 0x%08x" , l2data->phys, data->phys); -return false; +return -EINVAL ; } -return true; +if (l2data->phy) { +if (setsockopt (sk,SOL_BLUETOOTH ,BT_PHY , &l2data->phy, +sizeof (l2data->phy)) <0 ) { +tester_warn ("setsockopt(BT_PHY): %s (%d)" , +strerror (errno), errno); +return -errno; + } + +/* Wait for the PHY to change */ +g_idle_add (check_phy,INT_TO_PTR (sk)); + +return -EINPROGRESS ; + } + +return 0 ; } static gboolean recv_errqueue(GIOChannel *io, GIOCondition cond,
@@ -1689,7 +1947,12 @@ static gboolean l2cap_connect_cb(GIOChannel *io, GIOCondition cond,return FALSE; } -if (!check_phys (data, sk)) { + err =check_phys (data, sk); +if (err <0 ) { +if (err == -EINPROGRESS ) { +g_io_add_watch (io,G_IO_HUP , socket_closed_cb,NULL ); +return FALSE; + }tester_test_failed ();return FALSE; }
@@ -2405,7 +2668,7 @@ static gboolean l2cap_accept_cb(GIOChannel *io, GIOCondition cond, {struct test_data *data =tester_get_data ();const struct l2cap_data *l2data = data->test_data; -int sk; +int sk, err; sk =g_io_channel_unix_get_fd (io);
@@ -2414,7 +2677,12 @@ static gboolean l2cap_accept_cb(GIOChannel *io, GIOCondition cond,return FALSE; } -if (!check_phys (data, sk)) { + err =check_phys (data, sk); +if (err <0 ) { +if (err == -EINPROGRESS ) { +g_io_add_watch (io,G_IO_HUP , socket_closed_cb,NULL ); +return FALSE; + }tester_test_failed ();return FALSE; }
@@ -2532,7 +2800,8 @@ static void client_l2cap_rsp(uint8_t code, const void *data, uint16_t len, }if (!l2data->expect_cmd) { -tester_test_passed (); +if (!l2data->phy) +tester_test_passed ();return ; }
@@ -2547,6 +2816,9 @@ static void client_l2cap_rsp(uint8_t code, const void *data, uint16_t len, goto failed; } +if (l2data->phy) +return ; +tester_test_passed ();return ;
@@ -2771,6 +3043,15 @@ int main(int argc, char *argv[])test_l2cap_bredr ("L2CAP BR/EDR Client - PHY" , &client_connect_phy_test_1, setup_powered_client, test_connect); +test_l2cap_bredr ("L2CAP BR/EDR Client - Set PHY 1M" , + &client_connect_phy_1m_test, + setup_powered_client, test_connect); +test_l2cap_bredr ("L2CAP BR/EDR Client - Set PHY 2M" , + &client_connect_phy_2m_test, + setup_powered_client, test_connect); +test_l2cap_bredr ("L2CAP BR/EDR Client - Set PHY 3M" , + &client_connect_phy_3m_test, + setup_powered_client, test_connect); test_l2cap_bredr("L2CAP BR/EDR Server - Success", &l2cap_server_success_test,
@@ -2811,6 +3092,15 @@ int main(int argc, char *argv[])test_l2cap_bredr ("L2CAP BR/EDR Server - PHY" , &l2cap_server_phy_test, setup_powered_server, test_server); +test_l2cap_bredr ("L2CAP BR/EDR Server - Set PHY 1M" , + &l2cap_server_phy_1m_test, + setup_powered_server, test_server); +test_l2cap_bredr ("L2CAP BR/EDR Server - Set PHY 2M" , + &l2cap_server_phy_2m_test, + setup_powered_server, test_server); +test_l2cap_bredr ("L2CAP BR/EDR Server - Set PHY 3M" , + &l2cap_server_phy_3m_test, + setup_powered_server, test_server);test_l2cap_bredr ("L2CAP BR/EDR Ethtool Get Ts Info - Success" ,NULL , setup_powered_server, test_l2cap_ethtool_get_ts_info);
@@ -2863,6 +3153,15 @@ int main(int argc, char *argv[])test_l2cap_le_52 ("L2CAP LE Client - PHY 2M/Coded" , &le_client_connect_phy_2m_coded_test_1, setup_powered_client, test_connect); +test_l2cap_le_52 ("L2CAP LE Client - Set PHY 1M" , + &le_client_set_phy_1m_test, + setup_powered_client, test_connect); +test_l2cap_le_52 ("L2CAP LE Client - Set PHY 2M" , + &le_client_set_phy_2m_test, + setup_powered_client, test_connect); +test_l2cap_le_52 ("L2CAP LE Client - Set PHY Coded" , + &le_client_set_phy_coded_test, + setup_powered_client, test_connect); test_l2cap_le("L2CAP LE Client - Close socket 1", &le_client_close_socket_test_1,
@@ -2896,6 +3195,15 @@ int main(int argc, char *argv[])test_l2cap_le_52 ("L2CAP LE Server - PHY 2M/Coded" , &le_server_phy_2m_coded_test, setup_powered_server, test_server); +test_l2cap_le_52 ("L2CAP LE Server - Set PHY 1M" , + &le_server_set_phy_1m_test, + setup_powered_server, test_server); +test_l2cap_le_52 ("L2CAP LE Server - Set PHY 2M" , + &le_server_set_phy_2m_test, + setup_powered_server, test_server); +test_l2cap_le_52 ("L2CAP LE Server - Set PHY Coded" , + &le_server_set_phy_coded_test, + setup_powered_server, test_server); test_l2cap_le("L2CAP Ext-Flowctl Client - Success", &ext_flowctl_client_connect_success_test_1,
@@ -2932,6 +3240,15 @@ int main(int argc, char *argv[])test_l2cap_le_52 ("L2CAP Ext-Flowctl Client - PHY 2M/Coded" , &ext_flowctl_client_phy_2m_coded_test_1, setup_powered_client, test_connect); +test_l2cap_le_52 ("L2CAP Ext-Flowctl Client - Set PHY 1M" , + &ext_flowctl_client_set_phy_1m_test, + setup_powered_client, test_connect); +test_l2cap_le_52 ("L2CAP Ext-Flowctl Client - Set PHY 2M" , + &ext_flowctl_client_set_phy_2m_test, + setup_powered_client, test_connect); +test_l2cap_le_52 ("L2CAP Ext-Flowctl Client - Set PHY Coded" , + &ext_flowctl_client_set_phy_coded_test, + setup_powered_client, test_connect); test_l2cap_le("L2CAP Ext-Flowctl Server - Success", &ext_flowctl_server_success_test,
@@ -2945,6 +3262,15 @@ int main(int argc, char *argv[])test_l2cap_le_52 ("L2CAP Ext-Flowctl Server - PHY 2M/Coded" , &ext_flowctl_server_phy_2m_coded_test, setup_powered_server, test_server); +test_l2cap_le_52 ("L2CAP Ext-Flowctl Server - Set PHY 1M" , + &ext_flowctl_server_set_phy_1m_test, + setup_powered_server, test_server); +test_l2cap_le_52 ("L2CAP Ext-Flowctl Server - Set PHY 2M" , + &ext_flowctl_server_set_phy_2m_test, + setup_powered_server, test_server); +test_l2cap_le_52 ("L2CAP Ext-Flowctl Server - Set PHY Coded" , + &ext_flowctl_server_set_phy_coded_test, + setup_powered_server, test_server); test_l2cap_le("L2CAP LE ATT Client - Success", &le_att_client_connect_success_test_1,
Signature · 1 line
2.52.0
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1034336
---Test result---
Test Summary:
CheckPatch PENDING 0.45 seconds GitLint PENDING 0.40 seconds BuildEll PASS 20.18 seconds BluezMake PASS 654.20 seconds MakeCheck PASS 22.02 seconds MakeDistcheck PASS 246.24 seconds CheckValgrind PASS 304.13 seconds CheckSmatch WARNING 353.48 seconds bluezmakeextell PASS 183.24 seconds IncrementalBuild PENDING 0.45 seconds ScanBuild PASS 1034.54 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:emulator/btdev.c:470:29: warning: Variable length array is used.emulator/btdev.c:470:29: warning: Variable length array is used.
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 7 lines · On Wed, 17 Dec 2025 15:41:31 -0500 you wrote:
From: Luiz Augusto von Dentz <[email protected]>
This adds support for
BT_HCI_CMD_CHANGE_CONN_PKT_TYPEas well as emitBT_HCI_EVT_CONN_PKT_TYPE_CHANGEDwhen it completes.--- emulator/btdev.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
Here is the summary with links:
- [BlueZ,v1,1/3] emulator: Add support for BT_HCI_CMD_CHANGE_CONN_PKT_TYPE
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=c599007776a8 - [BlueZ,v1,2/3] emulator: Add support for BT_HCI_CMD_LE_SET_PHY https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=87bafc8d2dd5 - [BlueZ,v1,3/3] tools/l2cap-tester: Add tests for setting BT_PHY https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=a431702e9ec2
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html