To allow specifying a different TF-PSA-Crypto paths when using
CONFIG_TF_PSA_CRYPTO_CUSTOM.
This is useful as Mbed TLS automatically compiles with include
directories pointing to TF_PSA_CRYPTO_DIR.
The Kconfig option is made available even when CONFIG_MBEDTLS
is disabled because there are tests that manually make use
of the TF-PSA-Crypto path, and enabling CONFIG_PSA_CRYPTO
makes them crash somehow (at least net.lwm2m.lwm2m_engine
on mps2/an385).
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
Replace the hardcoded calculation of DATA_POOL_COUNT with a new Kconfig
`CONFIG_BTTESTER_L2CAP_DATA_POOL_COUNT`. This allows users to configure
the data pool size based on their specific requirements.
The new configuration is only available if both `BT_CLASSIC` and
`BT_L2CAP_RET_FC` are enabled. And the default value of the configuration
equals to `BT_L2CAP_MAX_WINDOW_SIZE`, with a valid range from
`BT_L2CAP_MAX_WINDOW_SIZE` to `255` (`UINT8_MAX`).
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
One of the tests is purposedly overwriting the stream pointer to NULL.
Which means it is lost and can't be free'd.
To avoid a memory leak warning, let's make sure we free it at the end
of each test by keeping the cap_streams ptr in the fixture.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Apply the U suffix to unsigned integer literal constants used in
contexts involving unsigned types (uint8_t, uint16_t, uint32_t,
uint64_t, size_t, etc.) with coding guideline 40 which requires that
"A u or U suffix shall be applied to all integer constants that are
represented in an unsigned type".
In addition to this requirement, this commit also ads U to any unsigned
literal integer for the sake of completeness.
Changes are limited to literal values in assignments, initializations,
comparisons, and for-loop bounds where the context is unambiguously
unsigned.
Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
bt_conn_lookup_addr_le() increments the reference count of the returned
connection object. get_attr_val() was not calling bt_conn_unref() after
use, causing a connection reference leak.
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
Fix expressions where increment or decrement operators are combined
with other side effects in the same full expression, violating
MISRA-C Rule 13.3.
Separate the increment and decrement operations into standalone
statements to ensure each full expression contains at most one
side effect.
Assisted-by: GitHub Copilot
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The characteristic name and definitions in the TBS spec for
the values are "optional opcodes" instead of "support features".
Additionally, the field is 16-bit, instead of the current 8-bit
in the register parameters.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add missing error checks for any function calls in the
affected files, as that is required by the Zephyr coding guidelines.
Assisted-by: Copilot:claude-sonnet-4.6
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This is the old way of doing things, it's used as a means
to enable PSA Crypto as historically it was the only way.
But other PSA Crypto implementations than Mbed TLS are
available (for example, TF-M) and since CONFIG_PSA_CRYPTO
has been introduced it's what should be used when wanting
to enable PSA Crypto.
The build system automatically takes care of choosing
the correct implementation (and enabling
CONFIG_MBEDTLS_PSA_CRYPTO_C when relevant) under the hood.
Replace all occurrences by `CONFIG_PSA_CRYPTO` instead
(or just remove it in cases where nothing is needed).
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
It doesn't really serve a purpose since the addition of
CONFIG_PSA_CRYPTO.
Replace remaining uses of the former by the latter.
TF-M now implies CONFIG_PSA_CRYPTO the same way as
CONFIG_MBEDTLS because otherwise we get build failures
if we build Mbed TLS without CONFIG_PSA_CRYPTO enabled.
Hopefully we can remove these two in a later PR.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
Add missing license and copyright notices to tests ST boards
configuration and DTS overlay files. See shell commands used in
https://github.com/zephyrproject-rtos/zephyr/pull/107404.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
The provided name `inval_bearer_name` were not correctly set
as too long as it was not properly NULL terminated.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Apply ARG_UNUSED() to unused function arguments as per the Zephyr
coding guidelines
Assisted-by: GitHub Copilot
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Apply the U suffix to unsigned integer literal constants used in
contexts involving unsigned types (uint8_t, uint16_t, uint32_t,
uint64_t, size_t, etc.) with coding guideline 40 which requires that
a U suffix be applied to all unsigned integer constants.
Changes are limited to literal values in assignments, initializations,
comparisons, and for-loop bounds where the context is unambiguously
unsigned.
Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add missing error checks for any function calls in the
affected files, as that is required by the Zephyr coding guidelines.
Assisted-by: Copilot:claude-sonnet-4.6
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Adding BTP_GAP_PAWR_CONFIGURE command to be able support the
following PAwR tests.
Required for following test cases:
GAP/PADV/PAM/BV-02-C
GAP/PADV/PASM/BV-02-C
GAP/PADV/PAST/BV-03-C
GAP/PADV/PAST/BV-04-C
Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
Apply ARG_UNUSED() to unused function arguments as per the Zephyr
coding guidelines
Assisted-by: GitHub Copilot
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The technology values defined in tbs.h are actually defined
in assigned numbers under the HFP. They have been moved to
the assigned_numbers.h file, and name to match the placement
in Assigned Numbers. They have been defined in an enum instead
of multiple #define's, to more easily refer to them.
The callback for reading technology was likewise updated to use
the new enum.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add pytest test scenarios to demonstrate the multi-DUT testing
feature in Twister:
- peripheral_ht/central_ht: verify BLE connection and Health
Thermometer data exchange between two devices
- bluetooth/shell: verify BLE connect/disconnect flow using
shell commands on two devices
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
This adds several new tests for a combination of newly introduced
Kconfig options related to the CSIS set, lock and rank characteristics.
Signed-off-by: Maximilian Zimmermann <gitmz@posteo.de>
Make the Coordinated Set Size, Set Member Lock and Set Member Rank
characteristic optional by adding three new Kconfig options
BT_CSIP_SET_MEMBER_SIZE_SUPPORT, BT_CSIP_SET_MEMBER_LOCK_SUPPORT and
BT_CSIP_SET_MEMBER_RANK_SUPPORT. Also updates the existing examples
and tests to compile correctly.
Signed-off-by: Maximilian Zimmermann <gitmz@posteo.de>
Instead of defining the same arguments in all 3 CAP files,
we declare them in audio.h and initiate them in either
the initiator or commander, depending on their use.
The reason for this change, is that the CAP Handover API
require several of the parameter to be globally/statically
allocated, and cannot just rely on stack allocated parameters.
By doing this, we can use the same argument among the
CAP shell modules, while keeping the memory usage down.
This has the additional postive effect that we do not allocate
some of these arrays, which can be quite larger, on the stack.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Check that we can create up to CONFIG_BT_ID_MAX IDs and
that deleting an ID allows us to create another one.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add checks to verify the valid length of broadcast names
in codec_cfg and codec_cap, both in terms of size in octets,
but also in terms of length in characters.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add checks to verify the valid length of broadcast names
in codec_cfg and codec_cap, both in terms of size in octets,
but also in terms of length in characters.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
MISRA-C requires essentially boolean types in control flow.
Convert all if/while conditions using err or ret
as implicit booleans to explicit comparisons:
- if (err) -> if (err != 0)
- Same rules applied to while statements and ret variable
Also fix typos found during review:
- Fix "Failed to ser security level" -> "Failed to set security
level" in pacs_notify_client_test.c (4 places) and
csip_notify_client_test.c (2 places)
- Fix "Bluetoot" -> "Bluetooth" typo in media_controller_test.c
- Fix format/argument mismatch in bap_scan_delegator_test.c:
add missing `i` argument to FAIL() call
Assisted-by: GitHub Copilot
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Disable the second uart in the xterm-native-shell overlay
(we do not need to UARTS, but having them both connected will confuse
users)
Fix the run-bsim script. It had rotten and had quite many issues,
let's fix them:
* Fix the build command example so it actually builds and is configured
in a sensible way given how this script uses the executable
(if we attach to the uart a terminal it should be in its own pty)
(there is no global xterm-native-shell snippet)
* When stopping a possible previous bsim simulation, let's only stop
the one we launch from this script, not any running in the computer
* Do not run the bsim handbrake from inside their artifacts folders, but
from the installation folder (BSIM_OUT_PATH/bin)
* Add a timeout to stop the simulation after 1 hour so it does not linger
forever
* Set LD_LIBRARY_PATH, as we are running the device .exe from an arbitrary
folder
* Use the Execute bsim shell utility function, so we stop all programs
in the background with Ctrl+C instead of letting them linger.
* Add explanation of the used command line parameters
* In the parameters to zephyr.exe:
* Do not set the random seed unnecessarily (it is already a valid value)
* Do not ask to wait for something to attach to the uart (we are telling
the executable to automatically do it)
* Set a small maxium synchronization delay with the phy (10ms) so the
simulation appears fluid for interactive use
* Don't pushd when changing directory, we are in a subshell and will not
popd
* Set the handbrake in actual real time instead of 10x. Set a small period
for the handbrake, so the simulation feels fluid.
* Add a call wait_for_background_jobs so we wait for all programs in the
background.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Make the qos parameter of the BAP can CAP APIs const,
as they are now only used as one-time parameters, and not stored.
This also means that any uses of this can place the qos
parameter in the stack, rather than static memory.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add Message Access Profile (MAP) shell command support to the
Bluetooth shell module.
Add map.c to the CMakeLists.txt build configuration when
CONFIG_BT_MAP is enabled, allowing MAP shell commands to be
compiled into the shell module.
Enable MAP configuration options in the Bluetooth shell test
configuration, including both MCE (Messaging Client Equipment)
and MSE (Messaging Server Equipment) functionality.
This enables testing and demonstration of MAP profile features
through the Bluetooth shell interface.
Signed-off-by: Can Wang <can.wang@nxp.com>
Add Phone Book Access Profile (PBAP) implementation for Bluetooth Classic,
supporting both Phone Book Client Equipment (PCE) and Phone Book Server
Equipment (PSE) roles.
PBAP enables remote access to phone book data stored on a device,
allowing clients to retrieve contact information, call history, and
other phonebook-related data.
Key features:
- PCE (client) and PSE (server) role support
- RFCOMM and L2CAP transport layer support
- Pull phone book, vCard listing, and vCard entry operations
- Set phone book navigation (up/down/root)
- Abort operation support
- OBEX authentication (challenge-response with MD5)
- Application parameters for filtering and formatting
- SDP service registration and discovery
- Single Response Mode (SRM) support for GOEP v2
- Configurable PSE features (download, browsing, database identifier,
folder version counters, vCard selector, enhanced missed calls, etc.)
- Configurable PSE repositories (local phonebook, SIM, speed dial,
favorites)
The implementation includes:
- Core PBAP protocol handling (subsys/bluetooth/host/classic/pbap.c)
- Public API header (include/zephyr/bluetooth/classic/pbap.h)
- Internal definitions (subsys/bluetooth/host/classic/pbap_internal.h)
- Shell commands for testing and demonstration
(subsys/bluetooth/host/classic/shell/pbap.c)
- Comprehensive shell documentation with usage examples
(doc/connectivity/bluetooth/shell/classic/pbap.rst)
- Kconfig options for feature and repository configuration
- Build system integration (CMakeLists.txt)
- Logging support
Authentication uses PSA Crypto API (MD5) for nonce generation and
response digest calculation.
Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
There's no need for bt_dev.random_addr to be a bt_addr_le_t, since the type
is always implicitly random. Change it to bt_addr_t and make the necessary
updates to the host code as well as host unit tests.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Implement proper handling and storage of the broadcast code for encrypted
BTP BAP broadcast sink sync. This ensures the broadcast code is correctly
passed to the controller, allowing encrypted broadcast audio tests to pass.
Signed-off-by: Alex Ciascai <alexandru.ciascai@nordicsemi.no>
Add tests to verify antenna switch pattern validation when only
BT_HCI_LE_AOD_CTE_RSP_2US is set. The existing tests use all CTE
types combined, which means a regression specific to AoD 2US would
not be caught.
Signed-off-by: Andre Viegas <andreviegas@piscodeluz.org>
Assisted-by: Claude:claude-opus-4.6 ForgeQL
Update btp_vcp.c to manage volume controller instances per connection
using the connection index. With this change, the VCP tester can
handle multiple LT connections independently, ensuring correct
behavior in multi-IUT test scenarios.
Signed-off-by: Alex Ciascai <alexandru.ciascai@nordicsemi.no>
Fixed issue where an aborted CAP commander procedure would
never get past bt_cap_common_proc_all_handled and thus never
call the callback with an error, e.g. if the remote CAP
Acceptor rejects a request.
The fix required a significant refactor of the broadcast
part of the CAP commander, as it was fundamentally flawed.
The biggest change is that the implementation now uses both
the receive state notification as well as the write responses
to determine completeneess. Additionally, it also handles
notifications not initiated from our write requests, i.e.
it is now more similar to an event based procedure rather
than a linear one. This also means that when the callbacks
for the start and stop procedures are now called, we have
receive the events (notifications) from the remote CAP
acceptors that they are actually synced (or not synced) to
the broadcasts.
Since the broadcast reception start and stop now waits
for the receive state to be updated, a change in the
Handover implementation was also done.
To test the solution 2 new test cases were added,
and the existing tests were modified to allow for the
new expected behavior.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
ASE ID was not set in stream configured callback causing
BTP_ASCS_EV_OPERATION_COMPLETED event to miss proper ASE ID.
This leads to excesive timeouts in AutoPTS BAP tests.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
Take advantage of the new string conversion helpers to avoid having to
declare explicit on-stack variables.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
The Bluetooth stack has until now had private helpers to return an inline
pointer to a string - something which can be useful e.g. as part of
printk()/printf() call parameters. The reason these were never made public
is that they are not safe when a format string contains more than one
invocation of these.
This commit introduces replacement APIs which allocate an on-stack buffer,
thereby allowing arbitrary number of calls within the parameters of an
output formatting call. The new APIs are defines, since the solution uses
an encapsulating struct to force an on-stack copy, which then requires a
translation to access the struct-internal string member variable.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Make the codec_cfg parameter of the BAP can CAP APIs const,
as they are now only used as one-time parameters, and not stored.
This also means that any uses of this can place the codec_cfg
parameter in the stack, rather than static memory.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The pointer represent the codec configuration
for a stream based on the ASE or broadcast configuration,
and serves as a read-only value. Changing it to `const` makes
this more clear.
Some minor changes were done to existing code to help
support this change.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>