The cmd_csip_set_coordinator_discover_members did not properly
handle the members_found and addr_found values.
It has been modified to run through all known values
before scanning, and set the value appropriately.
This also fixes a minor bug where err = 0 was missing.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add LL_ASSERT_OVERHEAD define to reuse the assertion check
related to increase in actual EVENT_OVERHEAD_START_US value.
Introduce Kconfig option to permit radio event be skipped
when increased prepare callback latencies are measured,
instead of assertion.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix Connected ISO implementation to correctly handle SN,
NESN and payload_count when prepare callback is aborted due
to CPU overhead related latencies.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Move the EVENT_OVERHEAD_START_US verbose assertion to each
state/role LLL implementation so that correct state/role
that is delayed is conveyed in the assertion message.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add -ECANCELED on return from lll_preempt_calc so that
assert check can be placed in the prepare callbacks of the
state/role implementations.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix to not use pre-programmed PPI when NRF_TIMER0 is not
used as the radio event timer.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix CIS create implementation to consider CIG events with
laziness before the new CIS in an already active CIG is
made active.
Previous laziness value of the CIG events is determined and
at the CIG event where the new CIS event_count is calculated
the lazy_active value determined is decremented from the
total lazy value.
Without this fix, event_count of the new active CIS events
where incorrect, causing CIS create resulting in fail to be
established.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Since the acl mtu for mesh is reduced to 37 in PR #59004, there is no
need in BT_L2CAP_TX_MTU to be longer than 33 bytes for mesh.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
If disconnection has been triggered in between the security update and
the call to `smp_pairing_complete` we need to abort the pairing.
The disconnection may have been triggered by `bt_unpair`, in that case
the keys will have been erased and it will lead to an assertion to
continue as if nothing happened.
To resolve this issue, at the beginning of `smp_pairing_complete` the
`status` is set to `BT_SMP_ERR_UNSPECIFIED` if there is no connection.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Instead of setting the default_stream when we initiate
the configure operatio, we set it when it has succeded.
In case that the codec configure fails, the stream should
not really be considered configured as the default.
This also ensures that the default_stream is set when
using the CAP shell commands.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
It may happen that CIS is scheduled in the future and did not started
yet once accepted. When ASE goes to Releasing state in such case
the ISO has to be disconnected, because otherwise ASE will stuck in
releasing state.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Since clear_lc3_sine_data references audio_send_work, it must
be declared before the clear_lc3_sine_data function.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The bt_bap_scan_delegator_find_state did not properly return the
correct receive state due to confusing return value of the
iterator function.
Modify it to use a simple bool.
This fixes all issues with "Failed to find receive state for sink"
when using the Broadcast Sink.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In the CSIP Set Coordinator verify_members we verify that
all members have unique ranks.
This was done as part of the initial loop, but it is
more efficient to do this as a separate loop as we can reduce
the number of items to compare, as well as guarding this properly
by !zero_rank.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fixes 2 issues:
1) The broadcast code would only ever get the first value, even if
the command specified up to 16 values.
2) The broadcast code is not just hex values, so hex2bin does not make
sense, and strlen + memcpy is much simpler.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When the broadcast assistant have found the expected broadcast
source it should stop scanning.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The shell_print was meant to print the address of the broadcast
source along with the broadcast_id.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The bad code field should only be printed when there is an actual
bad code, otherwise it just prints all-0s.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Move BT_CTLR_SCAN_SYNC_ISO_SET to Kconfig from Kconfig.ll_sw_split
This means it can be used by other controllers and alligns with location
of other iso configs - e.g. BT_CTLR_SYNC_ISO_STREAM_COUNT
Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
As per table 4.2 in BAP v1.0.1, the BAP unicast client shall
support at least 2 (> 1) endpoints in either direction if it
supports that direction.
Since Kconfig does not support such requirements (0 || > 1),
this is done using a BUILD_ASSERT.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If the remote responds with and security related error the stack tries
to increase the security level to satisfy the remote permissions.
This fixes missing ATT timer reset on security related ATT Error
Response as the ATT operation is considered as complete.
< ACL Data TX: Handle 0 flags 0x00 dlen 7
ATT: Read Request (0x0a) len 2
Handle: 0x0084
TMAS: Role
> ACL Data RX: Handle 0 flags 0x02 dlen 9
ATT: Error Response (0x01) len 4
Read Request (0x0a)
Handle: 0x0084
Error: Insufficient Authentication (0x05)
TMAS: Role
Error code: 0x05
< ACL Data TX: Handle 0 flags 0x00 dlen 6
SMP: Security Request (0x0b) len 1
Authentication requirement: Bonding, No MITM, SC, No Keypresses
= bt: bt_att: ATT Timeout
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
If connection reference is acquired from `bt_conn_lookup_addr_le` but
`bt_gatt_ccc_cfg_is_matching_conn` return false the connection was not
unreferenced properly. This commit fix the issue by unreferencing the
connection if the condition is false.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
This fixes notification callback that can be called with NULL conn
parameter when peer is being unpaired.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
unpair may be called from bt_unpair where addr is NULL.
One such case is the `bt clear all` shell command which
calls bt_unpair with addr = NULL, and the addr is just forwarded
to unpair which does not check for NULL.
bt_unpair allows for the addr to be NULL to clear all, but only
if SMP is enabled.
Modified the checks in bt_unpair to increase readability
and ensure that unpair is not called with NULL.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This fixes TMAS characteristic permissions.
The characteristic shall have no security related
permissions as per TMAP_v1.0.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
bt_mesh_elem_find can return NULL.
This also gets rid of VLA in bt_mesh_shell_mdl_print_all.
Coverity-CID: 321075
Fixes#59522
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
If the stream is stopped or released, we did not clear the
txing_stream which is what would stop the sine from being
attempted to being sent.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The seq_num in lc3_audio_send_data was updated twice:
Once when calling get_next_seq_num and once at the end
of the function.
This increased the sequence numbers too fast, and made
TX not worker properly.
Modified to only use get_next_seq_num.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In `gatt.c`, the function `bt_gatt_ccc_cfg_conn_lookup()` was not
checking that `conn` was not NULL. That leaded to a NULL pointer
dereferences later in `bt_conn_is_peer_addr_le`.
Fix by checking that `conn` is not NULL.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
If the procedure was called, we print a more specific string
to let the user know that there was not an actual issue.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In the case that the advertising data has both a device name
and a broadcast name, whichever one comes first will be used.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Provisionee shall fail if provisioner sent public key
identicall to OOB public key back.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>