Commit graph

2,514 commits

Author SHA1 Message Date
Lyle Zhu
e8bbf5c732 tests: tester: Add LOG_* to btp.c for debug purpose
Add `LOG_ERR()` to log all reasons if status is `BTP_STATUS_FAILED`.
Add `LOG_DBG()` to log the excution result of the BTP commander.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-29 11:05:29 +02:00
Lyle Zhu
d973e4e3ce tests: bsim: tester: Add BT tester GAP ISO smoke test
Add test iso_broadcaster for GAP ISO broadcaster.
Add test iso_sync_receiver for GAP ISO sync receiver.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-29 11:05:29 +02:00
Lyle Zhu
eaf1439ea9 Bluetooth: tester: Add event of periodic BIGInfo advertising report
Add event `BTP_GAP_EV_PERIODIC_BIGINFO` to notify the received periodic
BIGInfo advertising report.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-29 11:05:29 +02:00
Lyle Zhu
a7eeea1130 Bluetooth: tester: Support feature ISO broadcaster
Add command `BTP_GAP_CREATE_BIG` to create BIG.

Add command `BTP_GAP_BIS_BROADCAST` to send broadcast data.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-29 11:05:29 +02:00
Lyle Zhu
33fc4a8d2d Bluetooth: tester: Support feature ISO sync receiver
Add command `BTP_GAP_BIG_CREATE_SYNC` to create BIG sync establishment.

Add event `BTP_GAP_EV_BIG_SYNC_ESTABLISHED` to notify the event that
the BIG sync is established.

Add event `BTP_GAP_EV_BIG_SYNC_LOST` to notify the event that the BIG
sync is lost.

Add event `BTP_GAP_EV_BIS_DATA_PATH_SETUP` to notify the event that
the data path of the BIS is setup.

Add event `BTP_GAP_EV_BIS_STREAM_RECEIVED` to notify the received BIS
stream data.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-29 11:05:29 +02:00
Vinayak Kariappa Chettimada
c2eb901ea1 Bluetooth: Controller: Introduce prepare deferred feature
Introduce prepare being deferred due to previous events
desire to continue. In such case the deferred prepare param
will have the defer flag set.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-08-28 19:57:28 +02:00
Pavel Vasilyev
dfe05dd0d7 bluetooth: host: prefix API functions with bt_
Prefix API functions of a module with bt_ to avoid confusion when
reading code.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-08-22 14:50:38 +02:00
Lyle Zhu
f772e3f21d tests: Bluetooth: Add test case test_sdp_discover_with_range
Add a test case test_sdp_discover_with_range to test the ssa request
with attribute ID range with the following test steps.
Step 1, Discover all included attribute IDs,
Step 2, Set the start of range from 0 to (max value + 9) of the
        discovered attribute ID,
Step 3, Set the end of range from start of range to (max value + 9)
        of the discovered attribute ID.
step 4, Send SSA request with the specific attribute ID range,
Step 5, check the discovery result according to the range,
Step 6, repeat step 4 - 5 until the range to
        (max value + 9, max value + 9).

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-22 12:36:09 +02:00
Vinayak Kariappa Chettimada
e4df18b51b Bluetooth: Controller: Fix bt_ctrl to bt_ctlr abbreviation
The Controller is abbreviated as CTLR in contrast to CTRL
which is used in the context of Link Layer Control
Procedures.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-08-21 17:13:30 +02:00
Cheng Chang
a5f25ba7b7 tests: bluetooth: classic: Add test suite l2cap client.
IUT works as a l2cap client with basic mode. The peer device,
l2cap server with basic mode, is a PC with running bumble on it.
This test only performs the function of L2CAP basic mode.
Support multiple l2cap enerties in new shell l2cap_br,
which may support more test function.

In the test suite , there are two groups in test cases.
Group 1 Including case1-case24 focuses on connection and
disconnection around l2cap. The impact of active and passive
acl connectivity, disconnectivity and authentication as well as
disconnection from ACL without l2cap disconnect is tested.

Group2 Including case25-case31 revolves around the basic
 parameters of L2CAPserver configuration, data transfer.
Case 25: Test l2cap connection with max MTU(0xffff).But the max mtu
which the stack supports is (CONFIG_BT_BUF_ACL_RX_SIZE - 4U = 196).
Case 26:  Test l2cap multi_channel connection and data tranfer.
Case 27: Test l2cap connection with invaild PSM.
Case 28: Test l2cap re_connect after disconnected.
Case 29: Test l2cap connection with min MTU(0x30).set server mtu = 48,
client mtu=48. l2cap connect successfully,
both server and client mtu should be 48.
Case 30: Test l2cap connection with min MTU(0x30). set server mtu = 48,
client mtu=0x27. l2cap connect fail.
Case 31: Test l2cap connection with min MTU(0x30).set server mtu = 30,
client mtu=48.l2cap connect successfully,
both server and client mtu should be 48.

test_l2cap_client.py is a file containing real test cases.
test_l2cap_common.py is a common file. It encapsulates some
test function functions that are commonly used for test cases.

Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
2025-08-21 13:07:08 +02:00
Lyle Zhu
2df8578c7a Bluetooth: Classic: SDP: Improve SDP discovery response
In current implementation, the attribute of the registered SDP record
will not be included in responding packet if the attribute data length
is more than the MAX payload size(`MIN(SDP_MTU, sad->sdp->chan.tx.mtu)
- sizeof(struct bt_sdp_hdr)`). And it causes the failure of ssa or sa
discovery.

Improve the SDP server to support the case by extending the
continuation state length. A 4 bytes space is extended to store the
attribute offset.

In this way, the attribute can be transmitted in segments according
to the reaming space of the responding buffer.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-18 11:57:23 +02:00
Emil Gydesen
f3a0e276a0 tests: Bluetooth: CAP: Test return early for unicast_group_foreach_stream
Add test that ensures that bt_cap_unicast_group_foreach_stream terminates
correctly if the callback returns true.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-16 10:20:18 +02:00
Emil Gydesen
dd3aa38f2f tests: Bluetooth: BAP: Unittest bt_bap_broadcast_source_foreach_stream
Adds unittests for bt_bap_broadcast_source_foreach_stream.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-16 10:20:10 +02:00
Vinayak Kariappa Chettimada
72dac165d8 Bluetooth: Controller: Use OVERHEAD_XTAL_US from devicetree
Use the external crystal high frequency clock settling value
from devicetree.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-08-15 15:34:00 +02:00
Emil Gydesen
3eb4d79aeb tests: Bluetooth: CAP: Add verification of CAP unicast start callbacks
Add verification of the CAP Unicast Audio Start callback parameters.
There was a missing part in the BAP Unicast Client mock that did not
set the ISO state correctly, which caused the procedures to fail, but
without the verification that was not caught.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-15 10:10:02 +03:00
Lyle Zhu
3a46e25582 Bluetooth: Classic: Shell: Add connectionless command set
Add connectionless shell commands, `register`, `unregister`, and
`send`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-14 10:39:54 +03:00
Jori Rintahaka
0f89b4ab87 tests: bluetooth: tester: add filter list flag to start discovery
Implement Start Discovery command Accept Filter List filtering.
Add a flag to the command's flags field to enable filtering.

Signed-off-by: Jori Rintahaka <jori.rintahaka@silabs.com>
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-08-13 14:33:40 +03:00
Johan Hedberg
811cd87734 tests: Don't use deprecated BT_CTLR Kconfig option
The new option is HAS_BT_CTLR, however since it's a promptless option,
disable the native link layer instead, which most likely was the intended
effect.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-08-12 18:40:20 -04:00
Emil Gydesen
965bcd6312 Bluetooth: CAP: Implement unicast to broadcast handover
Implement the unicast to broadcast handover procedure,
as per the Bluetooth CAP specificiation.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-12 12:35:57 +02:00
Lyle Zhu
ccad303d50 Bluetooth: shell: Add OBEX commands for GOEP
Add commands for GOEP to test OBEX features.

Add command `alloc-buf` and `release-buf` to allocate and release TX
buffer.

Add command set `add-header` to add the OBEX headers to allocated TX
buffer.

Add command set `client` to send OBEX client requests with allocated
TX buffer.

Add command set `server` to send OBEX responses with allocated TX
buffer.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-08 10:43:07 -05:00
Lyle Zhu
8d1b3e9111 Bluetooth: shell: Add transport commands for GOEP
Add commands for GOEP to test transport features.

Add commands for transport over RFCOMM, including `register-rfcomm`,
`connect-rfcomm`, and `disconnect-rfcomm`.

Add commands for transport over L2CAP, including `register-l2cap`,
`connect-l2cap`, and `disconnect-l2cap`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-08-08 10:43:07 -05:00
Johann Fischer
f63a2b70aa tests: bluetooth: shell: remove test bluetooth.shell.cdc_acm
The default integration platform for all test cases is native_sim, but
there has never been a USB device controller available for native_sim
platform. Since legacy device support has been deprecated and all tests
and samples now use the usbd test feature tag, this test cannot be
performed on native_sim.

Remove bluetooth.shell.cdc_acm to resolve CI failures.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-08-07 13:14:08 +02:00
Johann Fischer
891e700ce8 tests: bluetooth: use new USB device stack
Use new USB device stack.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-08-06 11:57:39 -04:00
Sean Madigan
1b7b6af785 bluetooth: host: add frame space update support
This commit adds support for the frame space update feature
to the bluetooth host.

This is mainly just a wrapper around the frame space update
HCI command and event.

Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
2025-08-06 17:11:04 +03:00
Emil Gydesen
a74a524e3b tests: Bluetooth: Tester: Add missing target latency and PHY
The struct bt_audio_codec_cfg recently got new fields that
previously defaulted to
BT_AUDIO_CODEC_CFG_TARGET_LATENCY_BALANCED and
BT_AUDIO_CODEC_CFG_TARGET_PHY_2M but was not set by the BTP
commands.

For now we restore the previous functionality by setting the
values to the same as we did before, until the BTP commands
are changed (if they are changed).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-08-06 12:16:07 +03:00
Yago Fontoura do Rosario
ca06a1d80d Bluetooth: Add configuration to control the dynamic connection callbacks
This commit allows to the user to control the use or not of dynamic
connection callbacks.
The stack is not using the dynamic connection callbacks so they are
only needed if the applications want to use it.
Setting it to true for backwards compatibility.

With dynamic connection callbacks

           FLASH:      176600 B       512 KB     33.68%
             RAM:       27428 B        64 KB     41.85%
        IDT_LIST:          0 GB        32 KB      0.00%

Without dynamic connection callbacks

           FLASH:      176376 B       512 KB     33.64%
             RAM:       27428 B        64 KB     41.85%
        IDT_LIST:          0 GB        32 KB      0.00%

Signed-off-by: Yago Fontoura do Rosario <yafo@demant.com>
2025-08-05 13:28:06 -04:00
Szymon Janc
9a948dc6a9 tests: Bluetooth: Update ICS to TCRL pkg100
No functional changes, only updated required profiles and GATT
depdendencies.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2025-08-04 11:53:55 +01:00
Emil Gydesen
b76f09dc04 Bluetooth: ISO: Fix issue with BIS tx_complete
BIS termination as broadcaster is handled different
than ACL and CIS, and in rare chances the
tx_complete for BIS may not have been completed in
the system workqueue before iso_new was called for the
same bt_conn struct (e.g. via bt_iso_cig_create), which
would perform

k_work_init(&conn->tx_complete_work, tx_complete_work);

but where conn->tx_complete_work still existed in
the system workqueue, which would cause the list
of pending items on the system workqueue to be removed
as the `next` pointer would be NULL.

This also adds an assert in bt_conn_new to prevent this
issue from appearing again.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-07-31 17:14:21 -04:00
Can Wang
afa529e2dc tests: Bluetooth: BR: Disable LOG in smp_general test suite.
Because the WRN logs from LOG module affect the test script
recognizes the string.

Signed-off-by: Can Wang <can.wang@nxp.com>
2025-07-30 17:32:12 -04:00
Mark Wang
995ae9fde4 tests: bluetooth: add key persistence test cases
add key persistence test cases

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-07-30 06:08:39 -04:00
Lyle Zhu
af42036ca6 Bluetooth: Classic: SDP: Improve UUID 128 support
In current implementation, the UUID 128 is not well supported. The
found issue includes,
Issue 1: No clear byte order of the UUID 128 in local SDP record.
Issue 2: No clear byte order of the UUID 128 of the SDP discover
parameter.

For issue 1,
Add the description to note that if the SDP attribute type is
`BT_SDP_UINT128`, `BT_SDP_INT128`, and `BT_SDP_UUID128`, the byte
order should be little-endian.

And swap the 128bit from little-endian to big-endian when responding
the peer SDP discovery request.

For issue 2,
Add the description to note that if the SDP discovery type is
`Service Search` and `Service Search Attribute`, and UUID is UUID 128,
the passed UUID data of the discovery request parameter should be
represented as the little-endian byte-order sequence.

And swap the 128bit from little-endian to big-endian when packing the
SDP discovery packet.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-07-29 11:21:37 +01:00
Emil Gydesen
220571efcb Bluetooth: CCP: Check conn type before access by index
Ensure that the connection type of the provided bt_conn is
an LE connection.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-07-28 16:45:17 -04:00
Sean Madigan
3adae8bd9a bluetooth: host: Add support for extended feature set feature
This commit adds support for the extended feature set
feature. This includes:
- hci boilerplate
- kconfigs, including one for a max local feature page
- reading remote features is done by a command and callback
- this is not linked into the auto feature request on
connection as this procedure can take quite a few connection
events, and we do not want to delay the user
- added the commands to the bt shell

Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
2025-07-28 08:48:30 -04:00
Anas Nashif
87917a1087 tests: bt: host: mock k_heap_aligned_alloc
unit tests needs mocking for k_heap_aligned_alloc.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-07-20 23:25:14 -04:00
Gaetan Perrot
76260d0eb8 tests: bluetooth: audio: vocs: fix null dereference
Avoid possible null pointer dereference by moving 'vocs->conn = conn'
after null check on 'vocs' in bt_vocs_discover().

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2025-07-19 15:42:32 -04:00
Gaetan Perrot
771d3f0dc2 tests: bluetooth: audio: aics: fix null dereference
Move assignment 'aics->conn = conn' after null check on 'aics' to avoid
undefined behavior.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2025-07-19 15:42:32 -04:00
Gaetan Perrot
2e6ac4d8a7 tests: bluetooth: audio: bap_unicast_client: fix null dereference
Move 'printk' call after null checks on 'stream' and 'stream->ep' to avoid
potential null pointer dereference.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2025-07-19 15:42:32 -04:00
Emil Gydesen
d0958995a3 tests: Bluetooth: Tester: Handle BIGInfo after sync request
In the BAP Broadcast Sink implementation the sync request,
the BIGInfo and the broadcast code can come in any other.
Currently the btp_bap_broadcast_sink_bis_sync would reject
the request if it came before the BIGInfo, but will now
instead store the request and then apply it once the BIGInfo
has been received, as there is not BIGInfo BTP event that the
caller can use.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-07-19 10:17:11 +02:00
Cheng Chang
419cb3da69 tests: bluetooth: classic: Add test suite l2cap.
IUT works as a l2cap server with basic mode. The peer device,
l2cap client with basic mode, is a PC with running `bumble` on it.
This test only performs the function of L2CAP basic mode.
Support multiple l2cap enerties in new shell l2cap_br,
which may support more test function.

In the test suite , there are two groups in test cases.
Group 1 Including case1-case8 focuses on connection and
disconnection around l2cap. The impact of active and passive
acl connectivity, disconnectivity and authentication as well as
disconnection from ACL without l2cap disconnect is tested.

Group2 Including case9-case14 revolves around the basic
 parameters of L2CAPserver configuration, data transfer.
Case 9:   Test l2cap connection with max MTU(0xffff).But the max mtu
which the stack supports is (CONFIG_BT_BUF_ACL_RX_SIZE - 4U = 196).
Case 10: Test l2cap connection with min MTU(0x30),set server mtu = 48,
client mtu = 0xffff, l2cap connect successfully,
client mtu = 0xffff, server mtu = 48.
Case 11: Test l2cap connection with min MTU(0x30),set server mtu < 48,
client mtu = 0xffff, l2cap connect fail.
Case 12: Test l2cap connection with min MTU(0x30),set server mtu = 48,
client mtu<48,l2cap connect successfully,
client mtu=48,server mtu=48.
Case 13: Test l2cap connection with invaild PSM.
Case 14: Test l2cap multi_channel connection and data tranfer.
Case 15: Stress Test. Repeat l2cap connect, disconnect operation.
Case 16: Stress Test. Repeat data transfer in a single connection.
In Case 15 and 16, if enlarging STRESS_TEST_MAX_COUNT and test fail,
you can enlarge timeout in  testcase.yml.

test_l2cap_server.py is a file containing real test cases.
test_l2cap_common.py is a common file. It encapsulates some
test function functions that are commonly used for test cases.

Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
2025-07-19 09:51:31 +02:00
Jiawei Yang
ff112b5e05 tests: Bluetooth: BR: Add test suite RFCOMM_client
IUT works as an RFCOMM Client. The peer device, RFCOMM server, is a PC
running bumble.

Add following test cases:

Case 6, RFCOMM MTU Size Data Send/Receive Test. To verify that the RFCOMM
client can correctly send and receive data packets that are exactly equal
to the negotiated MTU size.

Case 7, RFCOMM Data Transfer Exceeding MTU Size Test. To verify that the
RFCOMM client can reject sending and receiving data packets that exceed
the negotiated MTU size.

Case 8, RFCOMM Disconnect and Reconnect Test. To verify that the RFCOMM
client can properly handle a normal RFCOMM disconnection and successfully
reestablish the connection.

Case 9, RFCOMM Recovery After ACL Disconnection Test. To verify that the
RFCOMM client can properly recover when the underlying ACL connection is
abruptly disconnected, by reestablishing both ACL and RFCOMM connections.

Signed-off-by: Jiawei Yang <jiawei.yang_1@nxp.com>
2025-07-10 10:12:20 -05:00
Mark Wang
a7822079dc tests: bluetooth: add test case that sdp client l2cap connecting fail
test the sdp request callback is called when sdp l2cap connecting fail.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-07-10 10:11:59 -05:00
Can Wang
d56f1e018d tests: Bluetooth: BR: Add test suite of bonding for SMP
IUT works as an SM Initiator/Responder. The peer device,
SM Responder/Initiator, is a PC running bumble on it.

Add shell commands to create and manage L2CAP server and channel with
different security level.

In the test suite, there are 5 test cases. The test matrix combines
each bonding flag:
| Test Case ID | Initiator | Responder | Expected Result |
|--------------|-----------|-----------|-----------------|
| BR_SM_Bonding_INIT_001 | Non-bondable | Non-bondable | Pass |
| BR_SM_Bonding_INIT_005 | General Bonding | General Bonding | Pass |
| BR_SM_Bonding_RSP_010 | Non-bondable | Non-bondable | Pass |
| BR_SM_Bonding_RSP_011 | General Bonding | Non-bondable | Fail |
| BR_SM_Bonding_RSP_014 | General Bonding | General Bonding | Pass |

Signed-off-by: Can Wang <can.wang@nxp.com>
2025-07-10 10:11:38 -05:00
Can Wang
9937be7c30 tests: Bluetooth: BR: Add general test suite for SMP
IUT works as an SM Initiator/Responder. The peer device,
SM Responder/Initiator, is a PC running bumble on it.

Add shell commands to create and manage L2CAP server and channel with
different security level, reboot the board, and transfer data on the
SDP channel.

In the test suite, there are 28 test cases to verify SMP functions.
The test case list is:
- BR_SM_INIT_001: Basic Pairing with No Input No Output Capability
- BR_SM_INIT_002: Pairing with Display Only Capability
- BR_SM_INIT_003: Pairing with Keyboard Only Capability
- BR_SM_INIT_005: L2CAP Connection Failure After Successful Pairing
- BR_SM_INIT_006: L2CAP Server with Incoming Connection
- BR_SM_INIT_008: ACL Disconnection During Pairing
- BR_SM_INIT_011: Repeated Pairing Between Same Devices
- BR_SM_INIT_012: Security Level Escalation
- BR_SM_INIT_013: Multiple Channel Establishment
- BR_SM_INIT_017: Pairing Rejection by Remote Device
- BR_SM_INIT_018: Pairing Timeout
- BR_SM_INIT_021: Authentication Failure during Pairing
- BR_SM_INIT_022: Secure Connection vs. Legacy Pairing Fallback
- BR_SM_INIT_025: Rejection of Weak Pairing Methods
- BR_SM_INIT_028: Reconnection After Key Deletion
- BR_SM_INIT_029: Pairing with Delayed Response
- BR_SM_INIT_030: Stress Testing with Multiple Connect/Disconnect Cycles
- BR_SM_INIT_032: Power Loss Recovery
- BR_SM_INIT_034: Pairing During Active Data Transfer
- BR_SM_INIT_035: Pairing with Very Long PIN/Passkey
- BR_SM_INIT_037: Pairing with Peripheral Requesting Maximum Key Size
- BR_SM_INIT_039: Security Level Downgrade Attempt
- BR_SM_RSP_001: Basic Non-bondable Pairing with No Input No Output
- BR_SM_RSP_002: Display Only with Secure Connection
- BR_SM_RSP_003: Keyboard Only with Dedicated Bonding
- BR_SM_RSP_006: Security Level Enforcement
- BR_SM_RSP_008: L2CAP Connection with Security Level 1
- BR_SM_RSP_009: L2CAP Server with Security Level 2

Signed-off-by: Can Wang <can.wang@nxp.com>
2025-07-10 10:11:22 -05:00
Can Wang
f4257e1318 tests: Bluetooth: BR: Add test suite of SC Only Mode for SMP
IUT works as an SM Initiator/Responder. The peer device,
SM Responder/Initiator, is a PC running bumble on it.

Add shell commands to create and manage L2CAP server and channel with
different security level.

In the test suite, there are 10 test cases. IUT is configured
with Secure Connections Only Mode. The peer device is configured with
Secure Connections Mode or Legacy Mode. The test matrix is:
| Case ID | Secure Connection Option | Security Level | Expected Result |
|---------|--------------------------|----------------|-----------------|
| BR_SM_SC_INIT_005 | SC Only with SC | Level 4 | Pass |
| BR_SM_SC_INIT_006 | SC Only with SC | Level 1 | Fail |
| BR_SM_SC_INIT_007 | SC Only with SC | Level 2 | Fail |
| BR_SM_SC_INIT_008 | SC Only with SC | Level 3 | Fail |
| BR_SM_SC_INIT_009 | SC Only with Legacy | Level 3 | Fail |
| BR_SM_SC_RSP_005 | SC Only with SC | Level 1 | Fail |
| BR_SM_SC_RSP_006 | SC Only with SC | Level 2 | Fail |
| BR_SM_SC_RSP_007 | SC Only with SC | Level 3 | Fail |
| BR_SM_SC_RSP_008 | SC Only with SC | Level 4 | Pass |
| BR_SM_SC_RSP_009 | SC Only with Legacy | Level 3 | Fail |

Signed-off-by: Can Wang <can.wang@nxp.com>
2025-07-10 10:11:01 -05:00
Can Wang
5e8046df2e tests: Bluetooth: BR: Add test suite of IO Capability for SMP
IUT works as an SM Initiator/Responder. The peer device,
SM Responder/Initiator, is a PC running bumble on it.

Add shell commands to create and manage L2CAP server and channel with
different security level.

In the test suite, there are 32 test cases. The peer device is
configured with "Display YesNo" IO capability. The test matrix
combines each local IO capability with each security level requirement:

| Case ID | Local IO Capability | Security Level | Expected Outcome |
|---------|---------------------|----------------|------------------|
| BR_SM_IO_CAP_INIT_001 | No Input No Output | Level 1 | Success |
| BR_SM_IO_CAP_INIT_002 | No Input No Output | Level 2 | Success |
| BR_SM_IO_CAP_INIT_003 | No Input No Output | Level 3 | Failure |
| BR_SM_IO_CAP_INIT_004 | No Input No Output | Level 4 | Failure |
| BR_SM_IO_CAP_INIT_005 | Display Only | Level 1 | Success |
| BR_SM_IO_CAP_INIT_006 | Display Only | Level 2 | Success |
| BR_SM_IO_CAP_INIT_007 | Display Only | Level 3 | Failure |
| BR_SM_IO_CAP_INIT_008 | Display Only | Level 4 | Failure |
| BR_SM_IO_CAP_INIT_009 | Keyboard Only | Level 1 | Success |
| BR_SM_IO_CAP_INIT_010 | Keyboard Only | Level 2 | Success |
| BR_SM_IO_CAP_INIT_011 | Keyboard Only | Level 3 | Success |
| BR_SM_IO_CAP_INIT_012 | Keyboard Only | Level 4 | Success |
| BR_SM_IO_CAP_INIT_013 | Display YesNo | Level 1 | Success |
| BR_SM_IO_CAP_INIT_014 | Display YesNo | Level 2 | Success |
| BR_SM_IO_CAP_INIT_015 | Display YesNo | Level 3 | Success |
| BR_SM_IO_CAP_INIT_016 | Display YesNo | Level 4 | Success |
| BR_SM_IO_CAP_RSP_001 | No input No output | Level 1 | Success |
| BR_SM_IO_CAP_RSP_002 | No input No output | Level 2 | Success |
| BR_SM_IO_CAP_RSP_003 | No input No output | Level 3 | Failure |
| BR_SM_IO_CAP_RSP_004 | No input No output | Level 4 | Failure |
| BR_SM_IO_CAP_RSP_005 | Display Only | Level 1 | Success |
| BR_SM_IO_CAP_RSP_006 | Display Only | Level 2 | Success |
| BR_SM_IO_CAP_RSP_007 | Display Only | Level 3 | Failure |
| BR_SM_IO_CAP_RSP_008 | Display Only | Level 4 | Failure |
| BR_SM_IO_CAP_RSP_009 | Keyboard Only | Level 1 | Success |
| BR_SM_IO_CAP_RSP_010 | Keyboard Only | Level 2 | Success |
| BR_SM_IO_CAP_RSP_011 | Keyboard Only | Level 3 | Success |
| BR_SM_IO_CAP_RSP_012 | Keyboard Only | Level 4 | Success |
| BR_SM_IO_CAP_RSP_013 | Display YesOrNo | Level 1 | Success |
| BR_SM_IO_CAP_RSP_014 | Display YesOrNo | Level 2 | Success |
| BR_SM_IO_CAP_RSP_015 | Display YesOrNo | Level 3 | Success |
| BR_SM_IO_CAP_RSP_016 | Display YesOrNo | Level 4 | Success |

Signed-off-by: Can Wang <can.wang@nxp.com>
2025-07-10 10:10:30 -05:00
Jiawei Yang
bea02a639b tests: Bluetooth: BR: Add test suite RFCOMM_server
IUT works as an RFCOMM Server. The peer device, RFCOMM Client, is a PC
running bumble on it.

Add shell commands to create and manage RFCOMM server with different
flow control mechanisms.

In the test suite, there are seven test cases:
Case 1: RFCOMM Server - Reject RFCOMM Session. IUT should properly
reject incoming RFCOMM session when BR connection is disconnected.
Case 2: RFCOMM Server - Forward compatible with Bluetooth devices that
do not send PN command. IUT should properly handle this case and use
FCON/FCOFF as flow control.
RPN, Test) and send NSC responses
Case 3: RFCOMM Server - Respond to Control Commands After DLC
Establishment. IUT should properly respond to control commands (RLS,
RPN, Test) and send NSC responses.
Case 4: RFCOMM Server - Information Transfer with Aggregate Flow
Control. IUT should handle information transfer with aggregate flow
control and properly issue flow control signals.
Case 5: RFCOMM Server - Information Transfer with Credit Based Flow
Control and Active Disconnection. IUT should handle credit-based flow
control and actively disconnect DLC.
Case 6: RFCOMM Server - Information Transfer with Credit Based Flow
Control and Passive Disconnection. IUT should handle credit-based flow
control and respond to DLC disconnection.

Signed-off-by: Jiawei Yang <jiawei.yang_1@nxp.com>
2025-07-10 10:09:13 -05:00
Olivier Lesage
ef7ede64cc bluetooth: host: Do not try to set NRPA when scanning with identity
Attempting this would fail (assuming the controller is implemented
correctly) because when using legacy commands it is not allowed to
change the device address while scanning.

It also did not make sense. If we have configured the scanner to use
the identity address as own_addr, because the advertiser and scanner
addresses are shared when using legacy commands, setting the adv NRPA
here would overwrite the identity address used by the scanner, which
I assume is not the intention.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2025-07-08 13:37:26 -05:00
Olivier Lesage
43223a1661 bluetooth: host: Fix uninitialized own_addr_type for legacy scan+adv
In 25c993e5b7 a new case was introduced
where own_addr_type is not set by bt_id_set_scan_own_addr properly.

This led to issues for users where increasing their zephyr version
led to failures to start scanning after advertising in the case where
CONFIG_BT_SCAN_WITH_IDENTITY=n and legacy advertising commands are used.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2025-07-08 13:37:26 -05:00
Emil Gydesen
e72e837971 tests: Bluetooth: Tester: VCP BSIM test
Adds BSIM testing of the VCP features of the BT Tester.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-07-01 10:54:09 -10:00
Johan Hedberg
b0bed23fd2 Bluetooth: tests: Use bt_hci_cmd_alloc()
Use bt_hci_cmd_alloc() instead of the soon to be deprecated
bt_hci_cmd_create().

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-06-23 12:44:53 -07:00