Commit graph

9,930 commits

Author SHA1 Message Date
Emil Gydesen
cb9c64947f Bluetooth: CAP: Add missing failed_conn for reception_start
When cap_commander_broadcast_reception_start is called during the
handover, the failed_conn was not correctly.
It is now being set by cap_commander_broadcast_reception_start
and if that is called via handover, it will be correctly set.
If it is called via bt_cap_commander_broadcast_reception_start
then it will be cleared in case of error.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-10-16 17:14:08 +03:00
Flavio Ceolin
dabe815663 bt: host/classic: Fix possible integer overflow
Invalid header length and cause an integer overflow in
bt_br_acl_recv leading to undesired behavior.

Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
2025-10-15 11:46:13 -04:00
Ludvig Jordet
f998357015 Bluetooth: Mesh: Minor cleanup of prov link close on success
Changes the link close upon success to use the `prov_link_close` helper
function instead of doing it manually, as minor cleanup.

Signed-off-by: Ludvig Jordet <ludvig.jordet@nordicsemi.no>
2025-10-15 11:43:00 -04:00
Ludvig Jordet
1c6f98aaf2 Bluetooth: Mesh: Provisioner closes link on failed
According to MshPrt 5.4.4, The Provisioner, upon receiving the
Provisioning Failed PDU, shall assume that the provisioning failed and
immediately disconnect the provisioning bearer.

Signed-off-by: Ludvig Jordet <ludvig.jordet@nordicsemi.no>
2025-10-15 11:43:00 -04:00
Emil Gydesen
0ebe84cc5a Bluetooth: Host: bt_iso_reset before bt_conn_cleanup_all
Move the call to bt_iso_reset to before bt_conn_cleanup_all.
The reason for this is that bt_conn_cleanup_all will disconnect
all the ACL connections, which will put the CIS in a disconnecting
state, without finalizing them.
This means that if we get a num_completed_packet event between
the call to bt_conn_cleanup_all and before the BT_HCI_OP_RESET
request has been completed, we will trigger an assert in the
hci_num_completed_packets function as the CIS still exists,
but where we would already have cleaned up the pending TX
without telling the controller.

Moving the call to bt_iso_reset means that the CIS will have
been fully terminated at this point, which will prevent
the assert from happening. Since CIS depends on ACLs, this
is also the logical order for resetting them.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-10-15 15:37:21 +03:00
Mark Wang
b3d56349a1 bluetooth: shell: a2dp: use static for functions
add static for functions and variables.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit 1282bf7b8d814ef7a217c6f0c424aa4b2f34d363)
2025-10-15 12:06:56 +03:00
Mark Wang
a1cbaf77a6 bluetooth: shell: a2dp: remove unused function
remove app_configured

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit c0be42f10341ea4a6ed1df152375335a5f514c92)
2025-10-15 12:06:56 +03:00
Mark Wang
e468dd3371 bluetooth: avdtp: add copyright
add copyright to avdtp.c

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit 8761b2884726ccc33f953e4679a3d9c86b17da84)
2025-10-15 12:06:56 +03:00
Mark Wang
ef1b4463aa bluetooth: a2dp: remove the digital hardcode
use the sizeof of struct or variable; use macro to do the data shift.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit d6d567355d08cefd1e11d88563fc300928af4972)
2025-10-15 12:06:56 +03:00
Mark Wang
642dc278d1 bluetooth: a2dp: save configuration when cmd success
In the cmd result callback, save the configuration to stream if result is
success.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit 9a9477fa0214f245a66e24a2edd90132293d5086)
2025-10-15 12:06:56 +03:00
Mark Wang
c8763596c9 bluetooth: avdtp: unify the avdtp error code based on Zephyr err code
get the avdtp error code based on Zephyr err code to make the codes more
clear.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit 1d4d97fdb41791501eb63934f096bcc88cb2da81)
2025-10-15 12:06:56 +03:00
Mark Wang
1032b1e567 bluetooth: a2dp: avoid clearing the cmd req
If the previous cmd req is triggered, the cmd fail to trigger again and
keep the previous cmd req.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit f4197d51b62799748a75c97bd0b68778185ff293)
2025-10-15 12:06:56 +03:00
Mark Wang
eb3af0b9a6 bluetooth: a2dp: remove meaningless if
The `a2dp` is got by `req` through CONTAINER_OF, then the if always is
true.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit 24ef59d835c69a30fe8a8e6569405791532d9e0d)
2025-10-15 12:06:56 +03:00
Mark Wang
d5fb16bd31 bluetooth: a2dp: use avdtp struct to fill data to net buf
avdtp defines the data format by struct, use it to fill net buf.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit a89f4eddac6f13f981f2ca0b94f07edaad104afa)
2025-10-15 12:06:56 +03:00
Mark Wang
8e6a853654 bluetooth: avdtp: check buf tail room
check the buf tail room before adding data to buf.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit 65f8a9e03baf899684198e707170ad17817f7ce5)
2025-10-15 12:06:56 +03:00
Mark Wang
0fd58cc20c bluetooth: a2dp: implement get_config
implement get configuration

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit 54cae2e75bcb7ee38ec4d7c24cef8835e3836a05)
2025-10-15 12:06:56 +03:00
Mark Wang
3d81dc086d bluetooth: a2dp: implement delay report
implement delay report

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-10-15 12:06:56 +03:00
Lyle Zhu
64a544935b Bluetooth: HFP_AG: Fix SLC connected event early notify issue
In current implementation, the SLC connected event will be early
notified. It causes the SLC state of AG is not aligned with the state
of HF.

The SLC connected event should be notified after the procedure of HF
indicators is done if the HF indicators feature is supported by both
devices.

Do not notify the SLC connected event after the AG has successfully
responded with information about how call hold and multiparty services
are supported if the HF indicators feature is supported by both
devices.

Notify the SLC connected event after the procedure of HF indicators is
done.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-10-15 12:06:22 +03:00
Johan Hedberg
3fa1b98c4f Bluetooth: Update TX buffer calculation with auto PHY changes
Make sure to consider both the new peripheral and central Kconfig options
when calculating needed TX buffers.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-10-14 18:53:08 +02:00
Johan Hedberg
30b4c3e438 Bluetooth: Host: Add role-specific auto PHY update options
The BT_AUTO_PHY_UPDATE option was problematic in the sense that it didn't
really allow any kind of fine-tuning of what automation is desired. In
particular, it didn't allow specifying which PHY was the preferred one (it
was hardcoded to 2M) and also didn't allow specifying role-specific
(central vs peripheral) preferences.

To solve this, deprecate the old option, and instead introduce
role-specific options that allow specifying 1M/2M/Coded/None as the
preference. The new options have slightly different defaults than the new:
for central role 2M stays as the preference, however since it's uncommon to
require automated changes on the peripheral side the default is set to
None there.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-10-14 18:53:08 +02:00
Xiang Liu
8e9fa6a273 bluetooth: remove blocking operation in bt_conn_get_info
bt_conn_get_info API is used to retrieve connection-related
information. However, bt_conn_get_info sends the HCI command
BT_HCI_OP_READ_ENCRYPTION_KEY_SIZE to retrieve current
key_size, causing excessive blocking time.

Signed-off-by: Xiang Liu <liuxiang18@xiaomi.com>
2025-10-14 07:45:01 -04:00
Mark Wang
5422e3f21f bluetooth: avdtp: save avdtp session to ep
when ep is configured, the ep is used by the avdtp session, so combine
them together when ep is configured.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-10-14 12:53:27 +03:00
Mark Wang
02c5974e04 bluetooth: a2dp: ep->stream is cleared when stream l2cap is released
ep->stream is cleared when stream l2cap is released, it should not be
cleared by close and abort cmd procedure.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-10-14 12:53:27 +03:00
Mark Wang
39eaec0513 bluetooth: a2dp: improve the stream l2cap release
When signal l2cap is disconnected, use `release_work` to release the
related stream l2cap connections. When releasing the sep's stream l2cap,
use `delay_work` to check the stream l2cap disconnecting result.
Move the stream l2cap disconnecting callback to sep because the chan is
in sep, then use this callback to indicate the sep stream chan is
released and sep is idle.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-10-14 12:53:27 +03:00
Mark Wang
b9dc6a7fde bluetooth: a2dp: remove the aborted stream callback
The `released` callback is enough indicate that the stream is
invalid/released, so remove the `aborted` callback.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-10-14 12:53:27 +03:00
Emil Gydesen
1c004a08c3 Bluetooth: CCP: Client: Add support for get provider name
Add support for getting the remote bearer provider
name.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-10-13 08:43:47 +02:00
Lyle Zhu
3ac4f92625 Bluetooth: Classic: OBEX: Optimize MOPL configuration
Set the MOPL of RX and TX to `BT_OBEX_MIN_MTU` when registering OBEX
server.

Set the TX MOPL to `BT_OBEX_MIN_MTU` when sending OBEX connection
request.

Check if the MOPL of client exceeds MTU of transport when server
receives the connection request.

Check if the MOPL of server exceeds MTU of transport when client
receives the connection response.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-10-10 12:59:56 -04:00
Lyle Zhu
26065ecee3 Bluetooth: Classic: GOEP: Support multiple OBEX sessions
Split the structure `struct bt_obex` into two parts.
Part 1 `struct bt_obex`, it is the common part and shared by all OBEX
sessions which share the same one transport.
Part 2 `struct bt_obex_server` and `struct bt_obex_client`. The
`struct bt_obex_server` is used to manage the OBEX session of server
role. The `struct bt_obex_client` is used to manage the OBEX session
of client role.

Add function `bt_obex_server_register()` to register the OBEX server
with specific uuid.

Add function `bt_obex_server_unregister()` to unregister the OBEX
server.

Add function `bt_obex_make_uuid()` to make UUID.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-10-10 12:59:56 -04:00
Lyle Zhu
6d77949698 Bluetooth: GOEP: Fix L2CAP segmented RX data handling issue
The receiving segmented L2CAP data can not be handled properly. Due to
the `struct bt_l2cap_chan_ops::alloc_buf` is NULL, the partial data
will be notified through callback `struct bt_l2cap_chan_ops::recv`.
The GOEP does not consider this issue and handles it as a completed
packet. It causes the L2CAP disconnecting due to the partial packet
cannot be processed by OBEX.

Add a RX pool, and set `struct bt_l2cap_chan_ops::alloc_buf`. The
L2CAP will allocate the buffer from the pool to buff the segmented
data. Only the completed packet will be notified through
`struct bt_l2cap_chan_ops::recv`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-10-10 12:58:54 -04:00
Christophe Dufaza
60c3de2722 bluetooth: host: remove useless internal flag BT_ADV_PERSIST
Automatic advertiser resumption is publicly deprecated since
Zephyr 4.0 [1].

Options and parameters for this behavior have been removed,
and the internal bit flag BT_ADV_PERSIST is now always false.

The behavior it used to configure (to keep advertising after a
connection has been established as long as there are connections
available) has also been removed.

[1] Bluetooth: Deprecate adv auto-resume #73395

Signed-off-by: Christophe Dufaza <chris@openmarl.org>
2025-10-10 12:56:28 -04:00
Christophe Dufaza
a1dd571f11 bluetooth: host: remove no longer used internal API bt_le_adv_resume()
Automatic advertiser resumption is publicly deprecated since
Zephyr 4.0 [1].

Options and parameters for this behavior have been removed,
as well as all calls to bt_le_adv_resume().

Also remove adv_get_options() whose bt_le_adv_resume()
is the only caller.

[1] Bluetooth: Deprecate adv auto-resume #73395

Signed-off-by: Christophe Dufaza <chris@openmarl.org>
2025-10-10 12:56:28 -04:00
Christophe Dufaza
9b5ad2f8df bluetooth: host: do not attempt to resume terminated advertising sets
Automatic advertiser resumption is publicly deprecated
since Zephyr 4.0 [1].

Options and parameters for this behavior have been removed.

[1] Bluetooth: Deprecate adv auto-resume #73395

Signed-off-by: Christophe Dufaza <chris@openmarl.org>
2025-10-10 12:56:28 -04:00
Christophe Dufaza
731e581174 bluetooth: host: do not resume periodic connectable advertisers
Automatic advertiser resumption is publicly deprecated since
Zephyr 4.0 [1].

Options and parameters for this behavior have been removed.

[1] Bluetooth: Deprecate adv auto-resume #73395

Signed-off-by: Christophe Dufaza <chris@openmarl.org>
2025-10-10 12:56:28 -04:00
Christophe Dufaza
b3a4ff0109 bluetooth: host: do not use freed connection to resume advertising
In bt_conn_unref(), if we remove the last reference to the connection,
we notify listeners that a connection object has been freed
and can be taken, then immediately reuse this freed slot
to resume advertising.

This behavior is source of errors, and automatic advertiser resumption
is publicly deprecated since Zephyr 4.0 [1].

Options and parameters for this behavior have been removed.

[1] Bluetooth: Deprecate adv auto-resume #73395

Signed-off-by: Christophe Dufaza <chris@openmarl.org>
2025-10-10 12:56:28 -04:00
Christophe Dufaza
5762ff5b58 bluetooth: host: remove transitional option _BT_LE_ADV_OPT_ONE_TIME
Automatic advertiser resumption is deprecated since Zephyr 4.0 [1].

To maintain the behavior during the deprecation period, internal
transitional symbols were introduced to replace the deprecated ones
in the implementation:

- _BT_LE_ADV_OPT_CONNECTABLE: same option bit
   as BT_LE_ADV_OPT_CONNECTABLE (deprecated)
- _BT_LE_ADV_CONN_ONE_TIME: same option bit
   as BT_LE_ADV_CONN_ONE_TIME (deprecated)

The only option for connectable advertising is now BT_LE_ADV_OPT_CONN,
whose value is _BT_LE_ADV_OPT_CONNECTABLE|_BT_LE_ADV_OPT_ONE_TIME.

We can assume _BT_LE_ADV_CONN_ONE_TIME is true for connectable
advertisers, and meaningless for non-connectable advertisers.

[1] Bluetooth: Deprecate adv auto-resume #73395

Signed-off-by: Christophe Dufaza <chris@openmarl.org>
2025-10-10 12:56:28 -04:00
Christophe Dufaza
e24d3b92a3 bluetooth: host: remove transitional option _BT_LE_ADV_OPT_CONNECTABLE
Automatic advertiser resumption is deprecated since Zephyr 4.0 [1].

To maintain the behavior during the deprecation period, internal
transitional symbols were introduced to replace the deprecated ones
in the implementation:

- _BT_LE_ADV_OPT_CONNECTABLE: same option bit
   as BT_LE_ADV_OPT_CONNECTABLE (deprecated)
- _BT_LE_ADV_CONN_ONE_TIME: same option bit
   as BT_LE_ADV_CONN_ONE_TIME (deprecated)

The only option for connectable advertising is now BT_LE_ADV_OPT_CONN,
whose value is _BT_LE_ADV_OPT_CONNECTABLE|_BT_LE_ADV_OPT_ONE_TIME.

We can substitute BT_LE_ADV_OPT_CONN for _BT_LE_ADV_OPT_CONNECTABLE
when testing if an advertising set is connectable.

Note: to fix a ClangFormat warning raised by check_compliance.py,
this commit also includes a formatting change next to the lines
actually edited (subsys/bluetooth/host/id.c:810).

[1] Bluetooth: Deprecate adv auto-resume #73395

Signed-off-by: Christophe Dufaza <chris@openmarl.org>
2025-10-10 12:56:28 -04:00
Emil Gydesen
d4afa1989f Bluetooth: Host: Change WRN->DBG for not connect for TX
The bt_conn_tx_processor logged connections not in the
connected state as LOG_WRN, but this is a case that is handled
and could occur during regular behavior.
For this reason the log statement was changed to LOG_DBG,
as the developer/user does not need to worry about it.
Also modifies the statement to log the conn->state for
debugging purposes.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-10-10 12:55:28 -04:00
Make Shi
528e732aad Bluetooth: Shell: BR: Add SDP discovery support for AVRCP CT/TG
Add SDP discovery handlers for AVRCP CT/TG roles and corresponding
discovery parameters and a common result handling function.

Signed-off-by: Make Shi <make.shi@nxp.com>
2025-10-09 12:42:45 -04:00
Vinayak Kariappa Chettimada
9b26e967ca Bluetooth: Controller: nRF54L: Fix to improve decryption speed
Fix to improve decryption speed. Decryption starts after
payload reception, hence use fastest mode to decrypt PDUs.
nRF54Lx only supports decryption after payload reception,
this implementation was already there in the code.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-10-09 12:41:43 -04:00
Vinayak Kariappa Chettimada
a5e1f59686 Bluetooth: Controller: Revert relaxed radio packet assignment deadline
Reverts relaxed radio packet assignment deadline as it is
too risky and can cause invalid bits be transmitted and/or
cause MIC failures.

Reverts commit 4dbfb22a7e ("Bluetooth: Controller: Relax
radio packet pointer assignment deadline"), and
commit 230df77993 ("Bluetooth: Controller: Relax radio
packet pointer assignment deadline").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-10-09 12:41:43 -04:00
Vinayak Kariappa Chettimada
1fe79a65a2 Bluetooth: Controller: Use CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET
Use CONFIG_SOC_COMPATIBLE_NRF5340_CPUNET for nRF53 SoC
conditional compilations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-10-09 12:41:43 -04:00
Emil Gydesen
0abb23ffad Bluetooth: ISO: rm extra log statements in chan_send
bt_iso_chan_send and bt_iso_chan_send_ts would log
twice for each TX, which is unncessary. LOG_DBG statements
include the function name by default, so the 2nd log
statement was unncessary, and were removed.

Added logging of the ts in bt_iso_chan_send_ts which
would still make it possible to tell the 2 apart,
even if CONFIG_LOG_FUNC_NAME_PREFIX_DBG=n.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-10-08 18:25:17 -07:00
Vinayak Kariappa Chettimada
7fd5dea9cc Bluetooth: Controller: Cosmetic changes to Link Layer interface
Cosmetic changes to the Link Layer interface header file.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-10-08 15:12:22 -04:00
Vinayak Kariappa Chettimada
8eae0bfbd0 Bluetooth: Controller: Fix single switch timer use in ISO Sync
Fix implementation of Broadcast ISO Synchronized Receiver
using single switch timer to consider minimum compare value
requirement.

This fix reduces latencies to setup radio receptions and
fixes an assertion in lll_sync_iso when radio_tmr_start_us()
is checked for latencies.

Relates to commit 5dfc58cff9 ("Bluetooth: Controller: Fix
single switch timer minimum compare value").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-10-08 15:09:33 -04:00
Emil Gydesen
4b9bc7d11b Bluetooth: Controller: Fix return types for ll_length
ll_length_req_send and ll_length_default_set were defined to return
a uint32_t, but only returned a uint8_t HCI error code and
was the return value was always stored as such.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-10-08 08:45:37 +02:00
Emil Gydesen
2140b55d29 Bluetooth: BAP: Shell: 0-init some global variables
0-init some non-static global variables to avoid
issues with uninitialized values. Also modify
the printing of the broadcast sources found slightly.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-10-07 17:44:19 +03:00
Emil Gydesen
35909d7fdf Bluetooth: CAP: Mark err used for assert as __maybe_unused
If asserts are disabled, then `err` is unused can caused
a compiler warning.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-10-07 12:47:30 +02:00
Jordan Yates
1f3ce818fc bluetooth: controller: ll_sw: nordic: constant latency req
When `CONFIG_NRF_SYS_EVENT` is enabled, route constant latency requests
through the reference counted API.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-10-07 10:59:38 +02:00
Emil Gydesen
6c870b071a Bluetooth: Remove CONFIG_BT_BUF_ACL_RX_COUNT
Remove the deprecated CONFIG_BT_BUF_ACL_RX_COUNT config
as it has been deprecated since 4.1

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-10-06 20:17:14 -04:00
Emil Gydesen
360880b7c7 Bluetooth: Host: Remove bt_le_set_auto_conn
Remove the deprecated function bt_le_set_auto_conn
as it has been deprecated since 4.1.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-10-06 20:01:04 +03:00