When notifying a long (string) value in MCS, each
connection's MTU is taken into account when
(potentially) truncating the notification.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The truncation of the MCS string notifications was incorrect.
As per the MCS specification, the MCS shall send ATT_MTU - 3
if the value cannot fit in the notification.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add a DSB before doing WFE in cpu_sleep(), to ensure the
memory transactions are complete.
Add a note clarifying a dependency for the existing solution
(dependency is satisfied by ARCH code but is good to state
clearly).
Relates to commit f1264b7e47 ("drivers: entropy: nrf5: add
docs and a DSB in get_entropy_isr").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Since we accept buffers from external sources in L2CAP, we need to make
sure that we have enough room in user data to store the metadata necessary
for fragmentation over the HCI link.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Assignment to br_chan should be placed after the call of server->accept().
Otherwise, br_chan will always be a null pointer.
Signed-off-by: Mingjie Shen <shen497@purdue.edu>
Running bsim with Valgrind highlighted a couple of
places where read access to uninitialized memory happens.
Config client rewrites publication parameters with not
initialized uuid pointer. Bitfields those are allocated on
the stack keeps not used area uninitialized too.
Uninitialized area is stored in the persistent memory.
PR fixes that.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
If extended advertiser is used, then advertiser sends callback
quite close to the real tx end time. No necessity to consider
advertisement time in lpn rx delay. It allows lpn to spend
less time in active scanning and save more power. Unfortunately,
legacy advertiser shows very slow precision. It is mandatory to
consider adv time for it. Additionally, unnecessary considering of
the advertisement duration has been removed for receive window in lpn.
It makes scanner window longer for a couple of milliseconds.
This is the responsibility of friend node to configure window that
it can manage.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Previously we would call conn_cleanup for all connections,
however this had multiple problems such as:
-Not destroying conn->tx_pending packets and causing an assert
-Calling conn_cleanup for connectable adv, triggering
disconnected callback
Now we will use bt_conn_set_state to manage the teardown of
connections correctly. First, if in connected or disconnecting,
set state to disconnect complete. Then for all states, set
state to disconnected. This will carry out proper cleanup
and teardown when required.
To do this, it was required to keep the tx_thread open as
this is used in disconnecting teardown, so this has been
moved to below the conn_cleanup_all call.
Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
The client context shall be allocated once paired i.e. encryption is
enabled. This fixes issue that client context was allocated only for
bonded devices and as a result the ATT Unlikely Error was replied to
Control Point operation that paired remote requested.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This renames has_client.ntf_bonded to has_client.ntf_pending as this
field is valid for paired devices an contains the notification state.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The functions allow to return structure holding information of audio
stream endpoint.
Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
The warning was visible even when `bt_le_adv_stop()` was successful, which
is confusing to end-users.
Signed-off-by: Paul Adelsbach <paul@boxsection.org>
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
In the case that the CIS has been setup as bidirectional, and
only one of the directions have an ASE configured yet,
we should only care about valid ISO packets when doing this
check. The reason is that some controllers send HCI ISO data
packets to the host, even if no SDU was sent on the remote
side. This basically means that empty PDUs are sent to the
host as HCI ISO data packets, which we should just ignore.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In the unicast audio streams, there can be a mismatch
between the CIS state and the endpoint state. This
was previously logged, but since this would be logged
continously, we guard it with CONFIG_BT_AUDIO_DEBUG_STREAM_DATA.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Only the receiver of the audio is allowed to send the
receiver start ready command.
Furthermore, this removes the automated transition to the
streaming state on the server, as the server now shall
call bt_audio_stream_start to put the stream into the
streaming state.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
`rp->le_max_num` was passed unchecked into `k_sem_init()`, this could
lead to the value being uninitialized and an unknown behavior.
To fix that issue, the `rp->le_max_num` value is checked the same way as
`bt_dev.le.acl_mtu` was already checked. The same things has been done
for `rp->acl_max_num` and `rp->iso_max_num` in
`read_buffer_size_v2_complete()` function.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
The SC indication can be sent only if the GATT Service Changed is
enabled in the configuration. Change fixes build issues related to
implicit sc_indicate declaration when Service Changed is disabled.
Fixes: #54813
Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
Change removes GATT Client dependency for storing CCC and CF on pairing
complete and identity resolved. These features are needed also if GATT
Client role is disabled.
Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
On bond establishment: save the CF and CCC data that have been written
before the peer was bonded.
On identity resolved: update the CF data to use the peer's identity address
instead of its private address (same as is currently done for the CCC).
Fixes#54770.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Fixes a bug introduced in the previous refactoring: we would always mark
all peers as change-unaware. Now we only do so when the hash has been
recalculated.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Previously, if the app registered a bunch of services at boot before
calling `settings_load()`, then the hash would be silently overwritten.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
The spec says we have to persist the change-aware status of bonded peers
between resets.
This stores it at the end of the CF storage that we currently have.
Fixes#54173
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Store the Client supported features value when it is written to, instead of
only on disconnection/identity resolved.
Works around the situation where a user bonds, CF is written and the device
is abruptly powered off, discarding the CF value, but keeping the bond.
Fixes#54172.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
to send response with code 0x09 = Invalid Configuration Parameter
Value and reason 0x0a = Invalid_ASE_CIS_Mapping.
Previous response code was BT_ASCS_RSP_UNSPECIFIED (0x0e) and
reason BT_ASCS_REASON_NONE (0x00).
Fixes ASCS/SR/SPE/BI-15-C and ASCS/SR/SPE/BI-16-C PTS test cases.
Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
Fixing typo in llcp_lp_cc_established revealed the need for completing
the CIS establishment procedure by additional call to local/remote
check_done function.
Fixed by exposing lr_check_done and rr_check_done with naming update and
calling after injecting the CIS_ESTABLISHED event.
Signed-off-by: Morten Priess <mtpr@oticon.com>
If CIS offset in LL_CIS_IND is less than EVENT_OVERHEAD_START_US, the
controller is not able to establish the CIS in the ACL connection event
specified, but needs to start setup one connection event earlier.
With this commit, if offset is larger than EVENT_OVERHEAD_START_US the
first CIS event can be prepared in due time immediately.
This enables the controller to setup first CIS, even when instant is
equal to the ACL event_counter.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Fix Periodic Advertising time reservation when enabling with
ADI support. As the PDU is updated, use the updated PDU to
calculate the time reservation.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add implementation to schedule BIG events after Periodic
Advertising when Periodic Advertising is enabled after
Extended Advertising has already been enabled.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
As the range of ticker_id has been checked, context specific
get interface be used instead of doing range check again in
ull_hdr_get_cb().
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix auxiliary PDU time reservation calculation to reserve
for possible increase in PDU len due to updates to data in
the Common Extended Header Format of the PDUs.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix assertion due to delayed prepare of first BIG event when
supporting encryption. Crypto calculation introduce extra
processing delay causing the scheduling of first BIG event
to be delayed. Detect such delay and skip to next ISO
interval.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix the access address and radio ready timestamp to derive
the value of the first subevent, so that correct anchor
point reference is used in scheduling subsequent subevents.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix uninitialized CIS LLL structure member variables,
uninitialised CIS acl_handle causes HCI command disallowed
for acl_handle's other than 0x0000.
Initialize other variables like sn, nesn etc. when create
CIS control procedure is performed.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Refactoring the periodic advertisment report receive function
to make the handling of data reassembly more readable.
Signed-off-by: Pierce Lowe <pierce.lowe@nordicsemi.no>
This changes the periodic scanner to drop periodic adv
reports with incomplete data. This avoids incorrect data
being sent to application in the case where the periodic
adv data is not successfully received by the scanner.
Fixes zephyrproject-rtos#54072
Signed-off-by: Pierce Lowe <pierce.lowe@nordicsemi.no>
9.4.2 section, Part C, Vol 3 of the Bluetooth Core specification v5.3
states the following in the case that the device is in non-bondable
mode:
If Security Manager pairing is supported, the Host shall set the
Bonding_Flags to ‘No Bonding’ as defined in [Vol 3] Part H, Section
3.5.1 and bonding information shall not be exchanged or stored.
Fixes#54104
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Redefine mask of host-controlled feature bits to include only features
that are supported by the controller. This fixes a conformance test
failure where setting an unsupported host-controlled feature bit was
not rejected as it should.
Set the Connected Isochronous Streams (Host Support) bit from the host
only if unicast support is configured to avoid failures in
broadcast-only configurations.
Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>