Commit graph zephyr/subsys/bluetooth
Author SHA1 Message Date
Thomas Hebb
86b9ebadc6 bluetooth: classic: did: Set up logging
This file fails to compile since commit ef7b132bfd ("Bluetooth:
Classic: Fix initialization to support re-initialization"), which added
a LOG_ERR() invocation but didn't setup logging for the file.

Fixes #101810

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
2026-03-02 10:49:56 +01:00
Alberto Escolar Piedras
c77d74fa7d Bluetooth: Classic: Shell: Use ZTESTABLE_STATIC instead of STATIC
Use the ZTESTABLE_STATIC macro to define symbols which need to be
accessible from ztests, instead of redefining STATIC which causes
trouble with some hals.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-02-27 11:50:41 +01:00
Emil Gydesen
49bb9e2034 Bluetooth: ISO: Fix bad sys_get for {c,p}_latency
The fields in the HCI events are 24-bits but were treated
as 16-bit values.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-26 21:24:34 +00:00
Aleksandr Mirlenko
c26eda3b71 bluetooth: host: add support for CS IPT procedures
Add support for CS IPT (Channel Sounding Inline PCT Transfer)
in the Bluetooth host stack.

Changes include:
* definition of new CS IPT HCI opcodes;
* handling of CS IPT control procedures;
* integration with existing CS infrastructure;
* necessary updates to public headers.

Signed-off-by: Aleksandr Mirlenko <aleksandr.mirlenko@nordicsemi.no>
2026-02-26 16:53:17 +00:00
Kyra Lengfeld
354e3cb040 Bluetooth Host: Fix memory leak in ATT prep_pool
Before this we have a memory leak in the prep_pool when reassembly fails
in :c:func:`att_exec_write_rsp`. Now on error the buffer is dequeued and
freed, as are remaining queued prepare buffers.

Signed-off-by: Kyra Lengfeld <kyra.lengfeld@nordicsemi.no>
2026-02-26 12:36:03 +01:00
Shay Gi
fa321c1c2d Bluetooth: Fix typo of supervision
Fixed typos in code of "supervison" to supervision.

Signed-off-by: Shay Gi <s02998491@gmail.com>
2026-02-26 12:32:14 +01:00
Johann Fischer
7158c64690 include: drivers: usb: rename UDC buffer to USB buffer
Rename it to USB buffers so we can use it in host support without
confusion. Keep the UDC_* macros for now, we can deprecate and remove
them later.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2026-02-24 16:01:21 -06:00
Emil Gydesen
dd72c4c711 Bluetooth: BAP: SD: Fix issues with pa sync requests
The implementation only used the receive state's PA sync state
to determine whether to call the PA sync req or PA sync term req,
but that state does not include the syncing state.

Rather than using the receive state's PA sync state, we add a local
boolean to keep track of whether the PA sync was requested, so if
we receive a mod_src with PA sync == BT_BAP_BASS_PA_REQ_NO_SYNC then
we request a termination, even if the PA sync was not established yet.

Some cleanup in the mutex handling was also done as part of this.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-24 15:35:54 +01:00
Szymon Janc
7f044f0a00 Bluetooth: GATT: Fix writable appearance Kconfig choice name
Make sure choice option name is not same as actual config option
that is enabling it. Use _SECURITY suffix for clarity of what
choice is actually about.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2026-02-23 17:00:16 +00:00
Martin Moya
996feaea91 bluetooth: services: cts: Add local time information characteristic
CTS is missing the Local Time Information characteristic and this
commit adds the UUID and the full characteristic to its service.

The peripheral example has been updated as well to use this and
implement it on the example so it is easy to test it out.

Signed-off-by: Martin Moya <moyamartin1@gmail.com>
2026-02-23 16:58:13 +00:00
Vinit Mehta
0d387be9b6 bluetooth: host: add kconfig for evt synchronous buffer pool
- Add kconfig for HCI event synchronous buf pool to allow vendors
to configure buffer count based on the application/host platform
requirements

Signed-off-by: Vinit Mehta <vinit.mehta@nxp.com>
2026-02-23 11:35:42 +00:00
Dipak Shetty
cae71714de bluetooth: services: add Elapsed Time Service support
Added support for elapsed time service (ETS). The service
is introduced currently with the experimental tag.

Signed-off-by: Dipak Shetty <shetty.dipak@gmx.com>
2026-02-20 13:30:34 +01:00
Emil Gydesen
12c30e526a Bluetooth: TBS: Allow join in alerting/dialing state
The TBS spec only specificially disallows join for calls in
the incoming state. The Alerting and Dialing state in Zephyr
were disallowed, but that fails some TBS join tests.

Removed the (implicit) checks for alerting and dialing and
updated the state changer code to be more explicitly so that
all call states, except for incoming, is explicitly handled.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-20 10:11:46 +01:00
Emil Gydesen
dd4a01af48 Bluetooth: TBS: set_uri_scheme_list single string instead of array
Refactor bt_tbs_set_uri_scheme_list to take a single string instead
of an array of URIs. This should not affect applications much
in any way (and may actually be easier to use), but simplifies
the implementation significantly, and reduces memory footprint.

Additionally it also make the client and server more similar
as bt_tbs_client_read_uri_list just returns it as a single
string as well.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-20 10:10:38 +01:00
Emil Gydesen
796ac63086 Bluetooth: PACS: Add missing checks before assert in register
bt_pacs_register would assert if e.g.
CONFIG_BT_PAC_SRC_NOTIFIABLE=y but param.src_pac = false.

Add checks for setting the attributes, only if the parameter
actually enables the characteristics.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-20 10:09:15 +01:00
Gaetan Perrot
951f8d48b0 bluetooth: audio: bap_stream: Fix possible NULL dereference
Avoid dereferencing `stream` in the debug log message when checking
for invalid input parameters.

The previous log printed `stream->ep` and `stream->conn` inside a
combined NULL check, which could trigger static analysis warnings
about a possible NULL pointer dereference.

Align the implementation with the existing pattern used in the file
by logging a generic "Invalid stream" message instead.

No functional change.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2026-02-19 10:04:50 -06:00
Emil Gydesen
b438540a09 Bluetooth: CAP: Log ADV address when starting via handover
When starting adv via handover, we log the address used
for the advertising set for debugging purposes.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-19 10:00:26 -06:00
Radosław Koppel
1fa8739af7 Bluetooth: Host: Conn: Add GAP service validation
Implement the validation if there is exactly one GAP service
in GATT database.
The validation is performed as soon as the GATT database
is available and forbids to enable the Bluetooth if the configuration
is not compatible with the Bluetooth Specification.
The verification may be disabled by the user for better performance
or deliberate implementation that is not compliant with the
specification.

Signed-off-by: Radosław Koppel <r.koppel@k-el.com>
2026-02-19 09:58:49 -06:00
Radosław Koppel
9f33889066 Bluetooth: gap_svc_default: Set user_data for name characteristic to NULL
Set the unused argument of the name characteristic to NULL.
This removes the reference from GAP service to the hci_core.

Signed-off-by: Radosław Koppel <r.koppel@k-el.com>
2026-02-19 09:58:49 -06:00
Radosław Koppel
95e9f27939 Bluetooth: gap_svc_default: Update attribute len checking in write_name
Remove offset form the attribute length checking as the offset
is tested before to be 0.

Signed-off-by: Radosław Koppel <r.koppel@k-el.com>
2026-02-19 09:58:49 -06:00
Radosław Koppel
233495d234 Bluetooth: gap_svc_default: Add BT_ prefix to DEVICE_xxx_GATT_WRITABLE_
Rename the DEVICE_NAME_GATT_WRITABLE_ kconfig options to
BT_DEVICE_NAME_GATT_WRITABLE_.
Rename DEVICE_APPEARANCE_GATT_WRITABLE_AUTHEN to
BT_DEVICE_APPEARANCE_GATT_WRITABLE_AUTHEN.

The old options are marked as deprecated.

Signed-off-by: Radosław Koppel <r.koppel@k-el.com>
2026-02-19 09:58:49 -06:00
Radosław Koppel
e5258ed86d Bluetooth: Host: Extract GAP service from GATT
Remove Generic Access Service implementation from gatt files and move it
into separate file in services directory.
The default service implementation can be disabled by the user in purpose
of providing the GAP implementation directly in the application.

Signed-off-by: Radosław Koppel <r.koppel@k-el.com>
2026-02-19 09:58:49 -06:00
Emil Gydesen
f4492d04e0 Bluetooth: CAP: Add missing NULL checks in acceptor_register
Add missing NULL check for `param` and `svc_inst`

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-19 12:51:41 +01:00
Emil Gydesen
309b5b3c01 Bluetooth: CAP: Add ep conn check in unicast audio start
Add check in valid_unicast_audio_start_param to verify
that the ep connection matches the member_conn.

Instead of declaring the endpoints in the unit tests, we
not define them in the mock unicast client and use the
discover function to get pointers.

This allows for a proper implementation of
bt_bap_unicast_client_has_ep as well as makes the tests more similar
to a normal application.

This change required a significant change in the unicast_stop
unit tests as well, which uncovered a small bug in the implementation.
The bug was fixed as part of this commit.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-17 10:31:09 +01:00
Johan Hedberg
dd37a250b1 Bluetooth: Host: Remove leftover k_poll related code
There's no use of k_poll in the host stack anymore, so remove leftovers
and related definitions.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-02-16 09:03:09 -06:00
Johan Hedberg
39a428c5d9 Bluetooth: Mesh: Add missing select for POLL
The Bluetooth Mesh code depends on k_poll, so it should have the
appropriate select statement in its Kconfig.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-02-16 09:03:09 -06:00
Vinayak Kariappa Chettimada
c4a4937d9f Bluetooth: Controller: Update ll_data_path_tx_pdu_release()
Update ll_data_path_tx_pdu_release() to have return -ENOTSUP
so that the node_tx is released using the fallback method to
use the MFIFO from LLL to ULL_HIGH context.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2026-02-16 11:08:16 +01:00
Vinayak Kariappa Chettimada
23005983dd Bluetooth: Controller: ISO Tx ack data flow review rework
Review rework ISO Tx ack data flow design for context-safety.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2026-02-16 11:08:16 +01:00
Vinayak Kariappa Chettimada
a4f4deef44 Bluetooth: Controller: Fix ISO Tx ack data flow for context-safety
Fix ISO Tx ack data flow design for context-safety.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2026-02-16 11:08:16 +01:00
Vinayak Kariappa Chettimada
d66dd5cde8 Bluetooth: Controller: Fix BIS to unify with CIS TX ack handling
Fix BIS to unify with CIS TX ack handling.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2026-02-16 11:08:16 +01:00
Emil Gydesen
8d904e186b Bluetooth: TBS: Client: Fix reset issue with net_buf
The net_buf was always initialized with net_buf_simple_init_with_data
which was a bit wasteful as we only need to do that once. Since `inst`
is `static`ally allocated, we can check for `.data == NULL`.

Additionally the read callbacks expect the buffer to be 0-initialized
between each usage, which wasn't the case. We can use the `buf.len`
to determine how many bytes we need to reset to `0`.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-13 12:37:31 +01:00
Herman Berget
62e12edb19 Bluetooth: Host: Use HCI VS command to set public addr on bt_enable
The current way of setting the public address using
`bt_hci_driver_api::setup` does not work well in split builds
where host and controller runs on different cores/socs/boards.
This approach requires each HCI driver and each `hci_<transport>`
application to implement the setup and pass the information on
to the next layer.

Zephyr already defines a vendor-specific command that can be used
to set the public address (`bt_hci_cp_vs_write_bd_addr`).
Use this in `bt_enable` after opening the HCI transport and before
initializing the id module. This makes the setup independent of
hci transport and only depends on a controller that implements the
Zephyr HCI VS commands.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2026-02-12 14:29:44 +00:00
Alex Ciascai
cb9f5f8be0 bluetooth: tbs: fix Join opcode result for PTS conformance
Update the Join handler to return BT_TBS_RESULT_CODE_OPERATION_NOT_POSSIBLE

Signed-off-by: Alex Ciascai <ciascai.alexandru@gmail.com>
2026-02-12 14:27:07 +00:00
Evgenii Kosenko
6b1b725ed2 Bluetooth: Shell: Fix GATT UUID race condition with per-operation storage
The static global UUID variable in the GATT shell module was shared across
all concurrent discover and read-by-uuid operations, creating a potential
race condition where one operation could overwrite the UUID before another
completed. Move UUID storage into the per-operation gatt_op_context
structure to isolate UUID state for each operation. This enables safe
concurrent operations without data corruption.

Signed-off-by: Evgenii Kosenko <Evgenii.Kosenko@silabs.com>
2026-02-12 09:30:18 +01:00
Emil Gydesen
971578a123 Bluetooth: TBS: Fix issues with friendly name buffer sizes
The friendly name buffer sizes used the URI length, but since
the friendly name is specifically not an URI that did not make
sense. Added a new Kconfig option to configure the maximum
supported friendly name, which is shared between both TBS
and the TBS client, similar to the other max Kconfig options.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-11 17:47:36 -06:00
Kristoffer Skøien
c966a54549 Bluetooth: BAP: Direction fix
Bugfix, changed from source to sink in bt_bap_unicast_group_reconfig

Signed-off-by: Kristoffer Skøien <kristoffer.skoien@nordicsemi.no>
2026-02-11 16:34:13 +01:00
Emil Gydesen
4fe38bbaed Bluetooth: VOCS: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:42:46 -06:00
Emil Gydesen
257e1eb2e3 Bluetooth: VCP: REND: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:42:24 -06:00
Emil Gydesen
c5061b76ab Bluetooth: VCP: CTLR: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:42:07 -06:00
Emil Gydesen
c6562e70d7 Bluetooth: TMAP: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:41:49 -06:00
Emil Gydesen
8c29bb0b62 Bluetooth: TBS: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:41:28 -06:00
Emil Gydesen
50d57b2cee Bluetooth: TBS: Client: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:41:06 -06:00
Emil Gydesen
8d63fa7eea Bluetooth: PBP: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:40:43 -06:00
Emil Gydesen
ef0726fbc0 Bluetooth: PACS: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:40:21 -06:00
Emil Gydesen
833e3cbbae Bluetooth: MICP: MIC: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:40:03 -06:00
Emil Gydesen
a0eeb3400a Bluetooth: MICP: CTLR: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:39:21 -06:00
Emil Gydesen
4766ca1576 Bluetooth: MCC: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:38:56 -06:00
Emil Gydesen
66a7da33f7 Bluetooth: HAS: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:38:38 -06:00
Emil Gydesen
b1d8341b07 Bluetooth: HAS: Client: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:38:08 -06:00
Emil Gydesen
29cd613a7b Bluetooth: GMAP: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:37:44 -06:00