Commit graph

2043 commits

Author SHA1 Message Date
Emil Gydesen 73528a326e Bluetooth: Audio: Shell: Remove increased workqueue stack size
The LC3 in the shell is now done in separate threads with their
own stacks.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-05-16 15:51:45 +02:00
Emil Gydesen f573c3eb01 Bluetooth: Audio: Shell: Fix build errors for USB=n
When CONFIG_USB_DEVICE_STACK=n then the sine wave
generator was enabled, which caused build errors.

This commit fixes those errors and also adds the
nRF5340 as a build target for the USB tests.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-05-16 15:51:45 +02:00
Emil Gydesen a6a14360a9 Bluetooth: BAP: Remove err from recv_state_removed callback
The callback is only ever called when we received a
notification from the BASS server that the receive state is
removed, which cannot contain an error code.
Thus it does not make sense for the callback to have an
error code.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-05-15 14:57:20 +02:00
Troels Nilsson 769409d41c Bluetooth: Controller: Add parameter to ISOALs sdu_write
For vendor datapaths that do not use a netbuffer to write SDUs
into, the callee of sdu_write currently has to keep track itself
of how much data has been written to the current SDU; This is wasteful
since ISOAL already keeps track of that. Add an sdu_written parameter
to the callback to inform the callee how much has been written to the
current SDU already so the callee can write using the correct offset

Signed-off-by: Troels Nilsson <trnn@demant.com>
2024-05-15 09:26:36 +02:00
Johan Hedberg 484fe3f06c Bluetooth: Remove bt_read_static_addr() "hack"
This function was used to shortcut HCI for combined host + controller
builds. It doesn't provide much value and adds complexity to the HCI
driver interface, so just remove it. This means vendor-specific HCI
commands is now the only way for the host to access the same
information.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-05-14 18:21:11 -04:00
Johan Hedberg 18c23daee3 Bluetooth: Kconfig: Merge BT_HCI_VS_EXT into BT_HCI_VS
The naming of these two options was problematic, since it's both of them
are about vendor extensions, even though one has _EXT in the name and
the other doesn't. Just merge one option into the other. This has a
slight overhead on the controller side of enabling some more vendor
features if BT_HCI_VS is enabled, but that should hopefully be
acceptable.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-05-14 18:21:11 -04:00
Emil Gydesen 0f5aa8aa81 Bluetooth: Audio: Shell Remove BT_HAS_PRESET_CONTROL_POINT_NOTIFIABLE
Do not enable BT_HAS_PRESET_CONTROL_POINT_NOTIFIABLE as it
depends on EATT which isn't enabled.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-05-14 18:18:36 -04:00
Théo Battrel 76559f27fd Bluetooth: Host: Map HCI cmd disallowed to errno
Make `bt_hci_cmd_send_sync` return `-EACCES` when receiving
`BT_HCI_ERR_CMD_DISALLOWED`.

Update some tests that were expecting `-EIO` when
getting `BT_HCI_ERR_CMD_DISALLOWED`.

Add a warning in `set_random_address` when getting that new error. This
is done in case someone try to set a new random address while legacy
advertising, scanning or initiating is enabled. This is illegal behavior
according to the Core Spec (see Vol 4, Part E 7.8.4).

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-05-10 17:38:06 +03:00
Rubin Gerritsen e4ea597a77 Bluetooth: Controller: BIG/CIG count based upon app configs
When building ISO applications on a device that has the host
and controller on the same core, the application developer
shouldn't have to set controller specific configurations.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-05-08 09:25:29 -04:00
Théo Battrel b2e235d530 Bluetooth: Remove legacy debug symbols
The `BT_DEBUG_*` Kconfig symbols have been deprecated for more than 2
versions, remove them.

Update code that was still using them.

Remove the Bluetooth specific `Kconfig.template.log_config_bt` and use
`Kconfig.template.log_config_inherit` from the logging subsystem
instead, now that the legacy symbols can be removed.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-05-07 09:49:27 +02:00
Andries Kruithof 6a0cdb4eaa Bluetooth: CAP: Commander Reception start procedure
Add the CAP commander reception start procedure which starts reception
on one or more CAP acceptors

With the implementation of broadcast reception start procedure we also need
some mockups for unit testing

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2024-05-07 09:34:01 +02:00
Ping Wang 6a027634cd Bluetooth: Audio: Shell: adds support for BIS index parameter
When calling bap_broadcast_assistant add_pa_sync, it should only
set the BIS index field as optional parameters and not to whatever
is in the BASE.

If setting BIS index which the BASE does not support, then the
command should be rejected.

This PR fixes https://github.com/zephyrproject-rtos/zephyr/issues/70835

Signed-off-by: Ping Wang <pinw@demant.com>
2024-05-06 17:30:04 +01:00
Ping Wang 291b81bc38 Bluetooth: Audio: Shell: adds support for LESC in the host
The commit adds support for LESC in the host if the controller
does not support the public key generation for ECDH.

Signed-off-by: Ping Wang <pinw@demant.com>
2024-05-06 17:30:04 +01:00
Szymon Janc 37f9cb75cc bluetooth: tester: Add support for OTS
This implemnets OTS service and provides OTS instance with two objects
for behavior valid and invalid test cases. Service implementation is
inspired by peripheral_ots sample.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2024-05-02 16:51:42 +02:00
Omkar Kulkarni 11eed84775 Bluetooth: Mesh: Update models metadata API
This commit updates models metadata API to simplify the usage and
removes the metadata pointer in health server model context.

Signed-off-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
2024-05-01 10:54:50 -04:00
Emil Gydesen 353a05b116 Bluetooth: BAP: Unicast server depend on PACS
When in the BAP unicast server role, at least PAC sink
or PAC source shall be set.

In order to fulfill this new requirement, a few other Kconfig
options had to be changed to a `depends on` from `select` to
avoid recursive Kconfig requirements. This change may require
some applications to update their configurations according
to the migration guide.

The change from `select` to `depends on` is ideal anyhow
as that is the recommended way to add dependencies.

This can checked via the combined BT_PACS Kconfig value.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-30 14:30:45 -04:00
Jonathan Rico bc5d531165 Bluetooth: tests: fix buf tests
Delete tests that did not end up bringing any value.

What ended up happening is busy-work to "make the test pass" without
understanding what's their original purpose.

Worse, the CI change-based testing is broken and doesn't pick them up,
even by PRs modifying the tests themeselves.
See #68008

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-30 16:20:23 +02:00
Rubin Gerritsen ebae4b8cf7 Bluetooth: Controller: Default stream count based upon app configs
When building ISO applications on a device that has the host
and controller on the same core, the application developer
shouldn't have to set controller specific configurations.

Without this change the samples iso_receive and iso_broadcast
will fail to run on NRF52 series devices as the samples
try to set up two streams but the controller is configured
to support only one.

Controller unit tests that were previously only enabling the
controller specific ISO configurations now also enable the
top-level ISO configurations to ensure that the default
stream count is properly configured.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-04-30 11:45:47 +02:00
Troels Nilsson 9b7d176b70 Bluetooth: Controller: Minor cleanup of struct proc_ctx
Remove unused collision field

Change type of done to uint8_t and move it to avoid padding bytes

Signed-off-by: Troels Nilsson <trnn@demant.com>
2024-04-29 15:55:13 +02:00
Emil Gydesen 65e787be58 Bluetooth: BAP: Shell: Add USB out support for the BAP shell
Add USB out support for the BAP shell, so that decoded LC3
data can be sent to the host (e.g. a PC).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-29 11:04:09 +02:00
Théo Battrel 83f090a710 Bluetooth: Test: Update hci_prop_evt
Accept LE Read Max Advertising Data Length command during HCI
initialization.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-04-29 11:02:02 +02:00
Aleksandr Khromykh dad7c31e7f Bluetooth: Mesh: use bt_rand instead of sys_rand
Commit adds using host\controller based random number
generator instead of zephyr driver.
No mesh dependency anymore on zephyr system
random driver.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2024-04-29 11:00:00 +02:00
Théo Battrel 27e8bc65c7 Bluetooth: Tester: Device name in AD instead of SD
With the deprecation of `BT_LE_ADV_OPT_USE_NAME` and
`BT_LE_ADV_OPT_FORCE_NAME_IN_AD` the tester has been updated to not use
the macro adding the device name in the advertising/scan response data
anymore. Instead the name was explicitly added to the scan response
data. But because that part of the tester was using an extended
advertiser and was already adding data in the AD, the name should have
been put in the advertising data and not the scan response data.

The same issue apply to both `btp_cap.c` and `btp_bap_broadcast.c`,
update them to add the device name in the advertising data.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-04-26 09:30:02 +02:00
Joakim Andersson 24264ad4af shell: Improve the default serial backend init level
Improve the default serial backend init level.
The documentation says to be bigger than the init level of the serial
device used. Since serial devices default to the kernel device init
level (50) then put this to default of application level drivers (90).

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
2024-04-24 19:42:23 +00:00
Rubin Gerritsen 237c59585e Bluetooth: Host: Rename bt_conn_state_t states for clarity
To make it easier to understand the code, the following was done:
- Use INITIATING/ADV for state names that are exclusive to central
  or peripheral. Previously it was not necessarily clear that the state
  BT_CONN_CONNECTING was for central only by just looking at where
  it was used. The terms INITIATING/ADV were used in favor
  of central and peripheral as these terms also work for SCO connection
  establishment.
- BT_CONN_CONNECTING_SCAN -> BT_CONN_SCAN_BEFORE_INITIATING
  to make it more clear that we are not scanning and connecting at
  the same time. The new name should make it more clear why we are
  scanning - only with the intention to start the initiator later.
- BT_CONN_CONNECTING_AUTO -> BT_CONN_INITIATING_FILTER_LIST.
  This makes it clear that this state is something different than
  BT_CONN_AUTO_CONNECT.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-04-23 15:31:59 +02:00
Théo Battrel 9400823dcd Bluetooth: Tests: Remove usage of auto name in AD
The advertiser options to automatically add the name in the scan
response and the advertising data will be deprecated.

Update the tests that were relying on those options. A lot of test were
actually not using the name, for those the name have simply been
removed. For the others that were using the name, add it in the
advertising data or the scan response data.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-04-23 12:42:24 +02:00
Théo Battrel ce3141fe6c Bluetooth: Shell: Allow bigger cmd in bsim shell
This is useful if we want to paste a list of multiple command or add
long advertising data for example.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-04-22 06:49:47 -07:00
Emil Gydesen 53fa757cea Bluetooth: Audio: Shell: Add additional controller configs to audio.conf
The configuration file is mostly tested for the nRF53 series
where the controller configuration is usually from the
hci_ipc sample.

This means that the existing audio.conf before this commit
has not really been tested for audio, and were missing a few
configurations to make it work properly.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-18 14:55:49 +02:00
Erik Brockhoff dca085e155 bluetooth: controller: refactor node_rx_pdu for memory optimization
Generic node_rx_hdr struct contains data not used for done event, so this
pdu specific data is moved to node_rx_pdu to minimize memory usage for
MFIFO_done alloc.

This however calls for a considerable write-through replacing the generic
node_rx_hdr with node_rx_pdu when relevant and needed.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2024-04-12 09:19:08 +02:00
Erik Brockhoff ad46ed78d4 bluetooth: controller: fix periph failure to disconnect on proc. collision
If central initiates incompatible procedure after having replied (with
_IND), peripheral fails to disconnect as spec'ed.

Fix by correctly setting the INCOMPAT flag to reserved on IND receipt to
enforce the disconnect.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2024-04-11 16:01:34 +02:00
Dominik Ermel 5a0ecb9641 flash: Move dependency on FLASH_PAGE_LAYOUT where it belongs
The commit adds dependency on Kconfig FLASH_PAGE_LAYOUT to subsystems
that really require it:
 FCB, NVS, LittleFS
and removes direct selection from '*.conf' files where no longer
needed.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-04-10 10:01:40 +02:00
Emil Gydesen 16ec531a5b Bluetooth: Audio: Shell: Disable EATT support
EATT is not properly used by LE audio nor is the
Zephyr implementation very good, so disable for now
or at least until the BSIM tests are passing with it
enabled.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-09 14:21:04 +02:00
Emil Gydesen 6073b630da Bluetooth: Audio: Shell: Increase BAP BA recv state count
Increase the supported receive state count to 4, as
several on-market device have at least 2 and sometimes
more.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-08 09:11:06 -04:00
Emil Gydesen f70ba925ea tests: Bluetooth: CAP Commander Change Microphone mute unittests
Adds unittests for the CAP Commander Change Microphone mute
procedure.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-05 12:21:38 +02:00
Piotr Narajowski 1029800a64 bluetooth: tester: add missing config
Set CONFIG_BT_MAX_PAIRED with same value as in host.
This is needed for CSIP tests with three lower testers:
CSIP/CL/SP/BV-07-C, CSIP/CL/SP/BV-03-C, CSIP/CL/SP/BV-04-C,
CSIP/CL/SPE/BI-01-C

Signed-off-by: Piotr Narajowski <piotr.narajowski@codecoup.pl>
2024-04-02 14:31:30 +01:00
Piotr Narajowski e8d4a68f8e bluetooth: tester: Add CSIS btp command
This commit adds CSIS command to change type of SIRK.
This is needed for CSIS/SR/SP/BV-05-C test case.

Signed-off-by: Piotr Narajowski <piotr.narajowski@codecoup.pl>
2024-03-29 15:57:59 -05:00
Andries Kruithof f967e08364 Bluetooth: audio: test: Refactor unit test
The unittest for cap commander is refactored, so that tests
for volumecontrol is in its own module.
This avoids the problem of having all tests in one huge file.

Due to their small size the tests for registering callbacks and
discovery haven't been put into their own module.

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2024-03-26 09:46:50 +00:00
Aleksander Wasaznik ebd176905a Bluetooth: testlib: add bt_testlib_disconnect
This is a convenience function.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-03-22 10:25:07 +01:00
Aleksander Wasaznik 89c9491804 Bluetooth: testlib: add bt_testlib_conn_wait_free
This function waits for a free connection slot. It should be used to
slow down a busy loop trying to obtains a connection slot.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-03-22 10:25:07 +01:00
Aleksander Wasaznik c84c9beece Bluetooth: testlib: Add bt_testlib_conn_unindex
This function obtains a reference to a connection object by its index.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-03-22 10:25:07 +01:00
Aleksander Wasaznik dd038b4405 Bluetooth: testlib: Support BT_SMP=n
This is the minimal change to make compilation with `BT_SMP=n` work.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-03-22 10:25:07 +01:00
Emil Gydesen 0dcf3c197e Bluetooth: Audio: Increase PA sync timeouts
Increase the timeouts to be 60 instead of 6.
The reason for this is that some controllers (like the Zephyr
controller) will reserve some of these to ensure stability,
and in fact with skip = 5 and retry = 6, it would still
send the PA reports at every interval.

To accomodate a higher timeout value, the functions used to
convert PA intervals to PA timeouts have been updated.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-03-21 15:24:14 +01:00
Alperen Şener de41005fe9 tests: bluetooth: Update ICS for Mesh v1.1, DFU v1.0 and MBT v1.0
Mesh v1.1, DFU v1.0 and MBT v1.0 are supported by default in the stack.
In this regard, this commit updates the ICS file and Launch Studio
Project file to reflect supported features.

Signed-off-by: Alperen Şener <alperen.sener@nordicsemi.no>
2024-03-21 12:40:07 +01:00
Aleksander Wasaznik f82a86c21b Bluetooth: testlib: bt_testlib_connect: better error logs
Changes to logging:
 - Don't log "Connected" if there was an error.
 - Identify the relevant bt_conn object in log messages by its index.
 - Special case non-fatal errors:
  - Failure due to out of free conn object is INF.
 - Improve transparancy of error messages:
  - For errno, include the name of the API.
  - For HCI errors, include the common prefix of the symbols
    'BT_HCI_ERR_' so they are easier to look up.

This change includes some light refactoring to make the code more
understandable, but does not change any behavior.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-03-19 21:15:44 -05:00
Alberto Escolar Piedras 68975aa837 tests/bluetooth: Use hwmv2 native targets identifiers
For the 64 bit targets, change identifiers to the new hwmv2 ones.
And remove redundant overlays (which were equal for the 32
and 64 bit versions)

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-15 16:13:12 +01:00
Vinayak Kariappa Chettimada d435acf28d Bluetooth: Controller: Fix CIS accept fails with unsupp parameters
Fix CIS accepted by Host being failed in the Controller with
reason 0x20 Unsupported LL Parameter Value, by relaxing the
check that the ACL connection is sufficiently placed such
that the time reservation using in the Controller
implementation does not overlap with the CIG event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-03-15 09:40:13 +00:00
Théo Battrel 4a55bc00f0 Bluetooth: Shell: Add support for EAD
Add new commands to manage the Encrypted Advertising Data feature.

Overview of those new commands:

- `bt encrypted-ad set-keys`: set key materials (session key and
  initialisation vector) used for encrypted and decryption of EAD;
- `bt encrypted-ad add-ad`: store a given advertising data structure;
- `bt encrypted-ad add-ead`: encrypt the given advertising data
  structres and store the generated AD structure;
- `bt encrypted-ad commit-ad`: set the AD of the selected advertiser
  with the stored AD;
- `bt encrypted-ad clear-ad`: remove all stored AD;
- `bt encrypted-ad decrypt-scan`: decrypt data using the previously set
  key materials when receiving AD with type `0x31`.

The documentation of the Bluetooth Shell has been updated to include
those new commands.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-03-13 18:51:03 +02:00
Jonathan Rico f3f42d363b Bluetooth: shell: add bsim runner script
Spawns n instances of the bt-shell in separate xterm windows.

Assumes in-tree build of the shell, can optionally specify another .exe
image.

Also add snippet for that use-case (`-S xterm-native-shell`).

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-03-13 18:47:50 +02:00
Emil Gydesen 6f405f6b80 tests: Bluetooth: CAP Commander Change Microphone Gain unittests
Adds unittests for the CAP Commander Change Microphone Gain
procedure.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-03-12 17:56:09 +00:00
Aleksandr Khromykh aa87ed5d8a Bluetooth: Mesh: make models metadata const
Commit adds const qualifier to models metadata.
Specification claims: Composition Metadata Page 0
shall not change during a term of a node on the network.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2024-03-11 09:26:12 +01:00