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>
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>
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>
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>
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>
add static for functions and variables.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit 1282bf7b8d814ef7a217c6f0c424aa4b2f34d363)
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)
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)
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)
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)
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)
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)
check the buf tail room before adding data to buf.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
(cherry picked from commit 65f8a9e03baf899684198e707170ad17817f7ce5)
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
When `CONFIG_NRF_SYS_EVENT` is enabled, route constant latency requests
through the reference counted API.
Signed-off-by: Jordan Yates <jordan@embeint.com>