Commit graph

723 commits

Author SHA1 Message Date
Szymon Janc
256401ed2b tests: Bluetooth: Tester: Add support for PAST
This adds support for BTP commands and events required for running
PAST tests.

struct btp_gap_ev_periodic_transfer_received_ev is also adjusted
to match BTP specification.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2025-06-10 13:28:31 +02:00
Szymon Janc
ad37e04d17 test: Bluetooth: Tester: Fix build with EATT disabled
This allows to disable EATT when needed.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2025-06-10 12:13:01 +02:00
Szymon Czapracki
c91b98c829 tests: Bluetooth: tester: Instructions for btsnoop and RTT logging
Updated the tester README with configuration options required to
build with support for btsnoop and SEGGER RTT log backends. This
helps developers capture logs for debugging and analysis during
Bluetooth testing.

Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
2025-06-06 08:45:23 +02:00
Aleksandr Khromykh
a046f25fe7 tests: bluetooth: tester: fix configuration to use max fwid length
Commit sets max possible number of tx and rx segments
to not adapt them anymore.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-06-05 15:14:35 -05:00
Emil Gydesen
69b722566a tests: Bluetooth: Tester: Audio: Cleanup includes
Update the includes so that only what is actually used is included,
and so that everything is used is includes (IWYU).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-19 16:48:53 +01:00
Emil Gydesen
eeb1d92df4 tests: Bluetooth: Tester: Set controller ACL buffer size
Change the ACL buffer sizes to be a higher value than the
default, as that caused some issues with the CIS established
event.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-09 14:02:10 +02:00
Emil Gydesen
c8cb0426d2 tests: Bluetooth: Tester: Update supported_services
The supported bits were out of date and the response size
was incorrect.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-07 13:31:58 +02:00
Emil Gydesen
18193b86c3 tests: Bluetooth: Tester: Validate PBP features
Add validation of the PBP features in the
pbp_set_public_broadcast_announcement function.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-07 13:31:48 +02:00
Emil Gydesen
181a0238a2 tests: Bluetooth: Tester: Fix bad rsp len of CAP broadcast setup
The btp_cap_broadcast_source_setup_rp was reported with
an invalid length.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-07 13:31:39 +02:00
Emil Gydesen
228d89b433 tests: Bluetooth: Tester: Default to use overlay-bt_ll_sw_split.conf
Default the BT Tester to use the overlay-bt_ll_sw_split.conf for all
Zephyr based configurations.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-07 13:31:20 +02:00
Emil Gydesen
7f0c78210a tests: Bluetooth: Tester: Add new BT controller config
Adds a new BT controller configuration that can be applied
to multiple boards and not specific to the nRF5340 cpunet
as the existing setup uses from hci_ipc.

The config is based on nrf5340_cpunet_iso-bt_ll_sw_split.conf
from hci_ipc sample.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-07 13:31:20 +02:00
Emil Gydesen
b7a85a4ca5 tests: Bluetooth: Tester: Add missing checks for tx in bcast
The stream_started and stream_stopped callbacks are called for
both broadcast sink and source in the BT Tester, and thus
they should check if the stream can send before attempting
to register it for TX (which would otherwise fail).

This also guards the call to btp_send_bis_syced_ev so that
the event is only sent for broadcast sinks.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-07 13:31:09 +02:00
Emil Gydesen
ae4c6fe609 tests: Bluetooth: Tester: Refactor ACSC events for BAP unicast
This commit refactors when the BTP_ASCS_EV_OPERATION_COMPLETED
is sent to the upper tester. Previously it was send
in the stream changed callbacks, but that would send
the events to the BAP Unicast Server when it did not initiate
any changes, and would not properly match when the control
point operation was completed (which happens before the
ASE state changes).

This change makes it easier to determine when an operation was
actually completed, and easier to separate that from a
ASE state change which is another type of event.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-07 11:44:40 +02:00
Emil Gydesen
2263fb8ec7 tests: Bluetooth: tester: Send stream changed event for all states
The ase state changed event was only sent when entering the
streaming state, rather whenever there is a state change.

This commit sends the event for all ASE/stream state changes.
To make it clear that these are called in the callbacks,
the callbacks have all been suffixed with _cb.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-07 11:44:40 +02:00
Emil Gydesen
c2178bc25e tests: Bluetooth: Tester: Update README to rst and add text
Update the README file to be .rst instead of (implied) .md
and update the text w.r.t. supported profiles and services,
and how to build for LE Audio.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-07 10:29:24 +02:00
Emil Gydesen
4d848ebdb1 tests: Bluetooth: Tester: Fix synced typos
Fixed typos syned -> synced and syced -> synced.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-29 02:42:32 +02:00
Emil Gydesen
72d9a37159 tests: Bluetooth: Tester: Cleanup includes
Update the includes so that only what is actually used is included,
and so that everything is used is includes (IWYU).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-24 10:39:21 +02:00
Lyle Zhu
e454b0d678 Bluetooth: tester: Support board mimxrt1170_evk@B/mimxrt1176/cm7
Add test case bluetooth.general.tester_br_edr.

Add overlay `zephyr,sram` and `zephyr,uart-pipe` for the board.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-24 10:38:45 +02:00
Lyle Zhu
539a28312a Bluetooth: tester: Add project configuration for BR
Set following configuration by default,
CONFIG_BT_CLASSIC=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_SMP=y
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
CONFIG_BT_PAGE_TIMEOUT=0xFFFF

When building the project, the argument `--extra-conf prj_br.conf`
needs to be appended for BR.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-24 10:38:45 +02:00
Lyle Zhu
065762cd2d Bluetooth: tester: Add BTP event encryption change
Report encryption change event when callback `le_security_changed` is
triggered.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-24 10:38:45 +02:00
Lyle Zhu
424364ded0 Bluetooth: tester: Support l2cap connect rsp insuff secure authen
If the L2CAP connection response of command `listen` is
`BTP_L2CAP_CONNECTION_RESPONSE_INSUFF_SEC_AUTHEN`, set the security
level of L2CAP server to level 4.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-24 10:38:45 +02:00
Lyle Zhu
ba55e9d7c0 Bluetooth: tester: Ignore error -EBUSY of bt_conn_set_security
The error code `-EBUSY` of `bt_conn_set_security` means the
pairing/encryption procedure is ongoing. Ignore the error code.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-24 10:38:45 +02:00
Lyle Zhu
81b8f8d265 Bluetooth: tester: Add command pair_v2 for BTP GAP
Compare with BTP GAP pair, the pair_v2 add more arguments, including
security mode, security level, and flags.

The argument `security mode` is used to set the security mode.

The argument `security level` is used to set the security level of the
specific security mode.

The argument `flags` is used to add additional setting, such as flag
`BTP_GAP_PAIR_V2_FLAG_FORCE_PAIR` is used to force the pairing
procedure.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-24 10:38:45 +02:00
Lyle Zhu
1f73bd7312 Bluetooth: tester: Support BR L2CAP connect and disconnect BTP command
Change the channel id rage of BR L2CAP channel to
`ARRAY_SIZE(channels)` ~ `ARRAY_SIZE(channels) + CHANNELS`. The
unified channel ID can help identify whether the channel is BR or BLE
L2CAP channel.

When the address type of L2CAP connect command is
`BTP_BR_ADDRESS_TYPE`, create BR L2CAP channel connect request.

And if the channel ID falls into the range `ARRAY_SIZE(channels)`
~ `ARRAY_SIZE(channels) + CHANNELS` of L2CAP disconnect command,
create BR L2CAP disconnect request.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-24 10:38:45 +02:00
Lyle Zhu
4fdc79d1e3 Bluetooth: tester: Support BR connect and disconnect features
Create BR connect if the address type is `BTP_BR_ADDRESS_TYPE` when
handling BTP GAP `connect` command.

Disconnect BR connect if the address type is `BTP_BR_ADDRESS_TYPE`
when handling BTP GAP `disconnect` command.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-24 10:38:45 +02:00
Lyle Zhu
71f81660d4 Bluetooth: tester: Enable GAP discover feature for BR
Call `bt_br_discovery_cb_register` to register discovery callbacks.

Define a buffer br_adv_buf to report br discovery result.

Report device found event if discovery received callback triggered.

Start BR device discovery procedure if command `start_discovery` is
received.

Stop BR device discovery procedure if command `stop_discovery` is
received.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-24 10:38:45 +02:00
Lyle Zhu
2cae2622ae Bluetooth: tester: Support pincode request for BR
Set the pin code request callback `auth_pincode_entry`.

If `highsec` is false, call `bt_conn_auth_pincode_entry` with pin code
"0000".
If `highsec` is true, call `bt_conn_auth_pincode_entry` with pin code
"0000000000000000".

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-24 10:38:45 +02:00
Lyle Zhu
05d6174c98 Bluetooth: tester: Support BR L2CAP listen mode
If cp->transport is BTP_L2CAP_TRANSPORT_BREDR, register BR L2CAP
server.

If cp->transport is not one of BTP_L2CAP_TRANSPORT_BREDR and
BTP_L2CAP_TRANSPORT_LE, return error code BTP_STATUS_FAILED.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-24 10:38:45 +02:00
Lyle Zhu
d083825cee Bluetooth: tester: GAP: Support BR connection
According to the connection type of connection, get the appropriate
peer address.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-24 10:38:45 +02:00
Lyle Zhu
4611c402e2 Bluetooth: tester: Support BR for security related commands
Look up the BR connection if the address type is BTP_BR_ADDRESS_TYPE.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-24 10:38:45 +02:00
Lyle Zhu
096fbb0c52 Bluetooth: tester: Add BR address type BTP_BR_ADDRESS_TYPE
The address type `BTP_BR_ADDRESS_TYPE=0xe0` of LE address is used to
mark as BR address.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-24 10:38:45 +02:00
Lyle Zhu
c667eb5aca Bluetooth: tester: Support connectable mode for classic
Disable connectable mode for classic if `cp->connectable` is false.

Enable connectable mode for classic if `cp->connectable` is true.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-24 10:38:45 +02:00
Lyle Zhu
353580a764 Bluetooth: tester: Support general and limited discoverable for classic
Disable discoverable mode if `cp->discoverable` is
`BTP_GAP_NON_DISCOVERABLE`.

Set general discoverable mode if `cp->discoverable` is
`BTP_GAP_GENERAL_DISCOVERABLE`.

Set limited discoverable mode if `cp->discoverable` is
`BTP_GAP_LIMITED_DISCOVERABLE`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-24 10:38:45 +02:00
Lyle Zhu
ba44d90a6a Bluetooth: tester: Set setting BREDR and SSP if classic is enabled
Set the supported settings `BTP_GAP_SETTINGS_BREDR` and
`BTP_GAP_SETTINGS_SSP` if the Bluetooth classic is enabled.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-04-24 10:38:45 +02:00
Greg Leach
2aff40b1b1 tests: Add BL54L15/L15u DVK support
Adds support for the BL54L15 and BL54L15u DVK boards.

Signed-off-by: Greg Leach <greg.leach@ezurio.com>
2025-04-23 15:02:20 +02:00
Emil Gydesen
4cffba7c08 tests: Bluetooth: tester: BAP: Fix wrong wrong bcast rsp sizes
Several responses had incorrect sizes, which this commit fixes.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-19 11:48:16 +02:00
Emil Gydesen
0270704bcb tests: Bluetooth: Tester: Fix bad check for valid RX
The check was incorrect, and only reported invalid ISO
packages instead of valid.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-09 15:23:39 +02:00
alperen sener
08459ec165 tests: bluetooth: tester: Fix MESH/SR/PRB/PNID/BV-02-C test case
Private node identity advertisements must stop immediately when
ordered by PTS. To do so; adding enabled parameter to
btp_priv_node_id_get_cmd.

Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
2025-04-09 11:43:29 +02:00
Szymon Janc
ddedff7155 tests: bluetooth: tester: Add helper for supported commands response
This makes sure that supported commands are reported correctly.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2025-04-08 17:37:33 +02:00
Emil Gydesen
d8e771ded9 tests: Bluetooth: Add BT Tester GAP smoke test
Add a babblesim test of the BT Tester doing a GAP smoke test
connecting 2 BT testers using BTP.

The purpose of this is to further increase the test coverage
of the BT Tester in CI, as it is only being built, and runtime
errors are typically not caught.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-08 10:49:00 +02:00
Matthias Hauser
941a5489d3 dts: boards: we: add board Ophelia-IV
add new board Ophelia-IV

Signed-off-by: Matthias Hauser <matthias.hauser@we-online.de>
2025-04-03 13:16:05 +02:00
Emil Gydesen
26e74f75b6 tests: Bluetooth: Tester: Fix typo in PBP announcement
Fixes typo in the event name.
Changes the struct to also use _ev instead of _rp as it
is an event and not a response.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-31 19:48:25 -04:00
Evgenii Kosenko
c8e28d15b8 bluetooth: tester: btp_gap: adds set rpa timeout cmd
Adds BTP_GAP_SET_RPA_TIMEOUT command to btp, it allows dynamically set
Resolvable Private Address timeout.

Signed-off-by: Evgenii Kosenko <Evgenii.Kosenko@silabs.com>
2025-03-24 15:09:53 +01:00
Emil Gydesen
69b6679613 Bluetooth: tester: Fix name of btp_ascs_ase_found_ev
The event is a BAP event, and has been renamed to
btp_bap_ase_found_ev.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-23 13:19:51 +01:00
Emil Gydesen
f783e54160 tests: Bluetooth: Tester: Add mutex for uart_send
Since tester_send_with_index may be called in different threads,
we need to guard the 2 calls to uart_send to avoid
sending partial btp message from 2 or more threads.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-20 14:23:02 +01:00
Alexander Svensen
33b4faed9c test: bluetooth: tester: Fix regression in PBP
- Allocate source in PBP first time adv is created
- Only set_adv_data in adv_setup if ext_adv already exists
- Fixes regression in PTS for PBP tests

Signed-off-by: Alexander Svensen <alexander.svensen@nordicsemi.no>
2025-03-17 13:57:41 +01:00
Emil Gydesen
bd254eea25 tests: Bluetooth: Tester: Fix bad memset in btb_bap_broadcast
btp_bap_broadcast_local_source_free used &source, but since
source was already a pointer, it should just use source.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-14 01:02:22 +01:00
Emil Gydesen
b2310b69bb tests: Bluetooth: Tester: Do not send MICP Mute ev on write cb
When the BT Tester gets the write response, it should not send
the state change event, as the write response may come
before the notifications, and in which case the state may
not have changed.

The BT Tester should always wait for the state change notification
before sending the event.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-13 10:49:35 +01:00
Emil Gydesen
5918427278 Bluetooth: Host: Make bt_le_addr_is_bonded public
Some GATT services and profiles define specific behavior
based on whether the remote device is bonded or not.
The internal function, bt_addr_le_is_bonded, is the
only function to do this, but it was kept internal,
and could thus not be used for those services
without including hci_core.h.

The function has been moved to the public API
so that application can determine if a remote
address is bonded or not, and has been renamed
to not use the bt_addr namespace, but rather the
bt_le.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-13 10:48:19 +01:00
Alberto Escolar Piedras
cb53e40ff9 drivers uart_native_posix: rename to native_pty and support N instances
Rename the driver from uart_native_posix to uart_native_pty.
Including renaming the DTS compatible, and kconfig options, deprecating
the old ones.

And refactor the driver, generalizing it, so we can have any number of
instances.
Note that, unfortunately generalizing to N instances cannot be done
without a degree of backwards compatibility breakage: This driver was
born with all its configuration and selection of the instances based on
kconfig.
When the driver was made to use DT, it was done in a way that required
both DT and kconfig needing to manually coherently enable the 2nd UART.
This has now been fixed, which it means only DT is used to decide how
many instances are avaliable, and UART_NATIVE_POSIX_PORT_1_ENABLE is
just ignored.

Including:
* Deprecate UART_NATIVE_WAIT_PTS_READY_ENABLE: the options is always on
  now as it has no practical drawbacks.
* Deprecate UART_NATIVE_POSIX_PORT_1_ENABLE: DTS intanciation defines it
  being available now.
* Rename a few functions and in general shorten pseudo-tty/pseudo-
  terminal to PTY instead of PTTY.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-11 18:54:02 +01:00