Commit graph

9523 commits

Author SHA1 Message Date
Emil Gydesen
9eb5d0795f Bluetooth: Audio: Rename MICS to MICP
Use the profile abbreviation, MICP, instead of the
service abbreviation, MICS, for the MICP implementation.

The server implementation will use MICP and the client
implementation will use MICP_CLIENT for now, as that will
be updated in a future commit.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-06 10:41:52 +02:00
Emil Gydesen
67e570ea7e Bluetooth: Audio: Rename mics.h the Kconfig to micp
Rename the files to match the name of the profile (MICP)
instead of the service (MICS).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-06 10:41:52 +02:00
Fredrik Danebjer
961bc352f3 Bluetooth: Audio: Fix bad buffer pointer in get_pac_records
This change fixes a buffer use from pointer-by-value to correctly
intended pointer.

Signed-off-by: Fredrik Danebjer <fredrik@danebjer.com>
2022-07-05 19:59:40 +02:00
Emil Gydesen
6cd35242df Bluetooth: Audio: Stop calling broadcast sink syncable when synced
The syncable callback was called whenever we received the BIGInfo
The BIGInfo is, however, received even while synced (as per the
HCI spec). Add a check to stop calling syncable when synced,
and keep the sink->big value updated based on the ISO states.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-05 15:34:24 +00:00
Mariusz Skamra
8c72fe1586 Revert "Bluetooth: Host: Check encryption level for EATT channels"
This reverts commit f3444ce00b.
The check is not needed anymore, as the EATT channels are available on
encrypted link only.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-07-05 12:19:07 +02:00
Mariusz Skamra
a36d64b8d8 Bluetooth: att: Fix EATT channel security requirements
Core Vol 3, Part G, Section 5.3.2 Channel Requirements states that
"The channel shall be encrypted". It does not mention any additional
security requirements that can be specified bt higher layer profiles.
This enables link encryption requirement for EATT channel.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-07-05 12:19:07 +02:00
Emil Gydesen
98ba5ae7d4 Bluetooth: Audio: Fix CSIS SIRK read permissions
The CSIS SIRK should only require encryption,
as mandated by the CSIS spec, and authentication.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-04 16:44:01 +02:00
Emil Gydesen
4afa484fc3 Bluetooth: Audio: Fix PACS UUID issue
We attempted to simply store the UUID in a local variable
before sending it to bt_gatt_notify_uuid, but evidently
the `bt_uuid` struct does not work that way, and it
ended up giving errors.

Fixed by providing the BT_UUID_PACS_X UUIDs directly as
arguments, instead of storing in a local variable first.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-04 16:43:47 +02:00
Emil Gydesen
be85f77293 Bluetooth: Audio: Fix PACS warning if not connected
If we change PACS while not connected, notifying the
change, we would warn about notification not being sent
out, however if not connected that is to be expected.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-04 16:43:47 +02:00
Pavel Vasilyev
867b88635d Bluetooth: Mesh: Don't do bulk tx of seg msgs
In the current implementation of segmented messages transmission, the
transport layer will put as many segments as it can into the advertiser
buffer. If a long segmented message is transmitted, there is a chance
that an ack will be received before the transport layer finishes sending
the first batch of segments. This will trigger retransmissions of those
segments that are marked as missing in the ack, that are also the
segments that are scheduled (or about to be scheduled), but not sent
out by the advertiser yet. Thus, the receiver may receive already
received segments.

This commit changes 2 things:
- it prevents rescheduling transmission of missing segments upon
reception of ack. Thus, ack doesn't cause segments duplication in the
advertiser buffer;
- it doesn't put all segments to the advertiser buffer. Thus, ack that
acknowledges all segments can immediately stop rescheduling segments as
they are already received;

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2022-07-04 14:31:44 +00:00
Aleksander Wasaznik
462f3e2c11 Bluetooth: Host: Refactor tx_notify, simplify locking
The control flow around the irq-lockout used for fetching from
`tx_complete` has been simplified so that there is exactly one
line with irq_unlock that is unconditionally called.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-07-04 16:27:08 +02:00
Aleksander Wasaznik
9339f249dc Bluetooth: Host: Refactor tx_notify, use CONTAINER_OF
The cast from `sys_snode_t` to `struct bt_conn_tx` assumes `node` is the
first field in `struct bt_conn_tx`. It's better to future-proof this by
using `CONTAINER_OF` to locate `node`.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-07-04 16:27:08 +02:00
Grant Ramsay
e27f48b38a Bluetooth: Host: Fix crash if HCI send fails
bt_dev.sent_cmd is unreferenced and assigned NULL within hci_cmd_done().
Calling net_buf_unref() again causes a null pointer dereference

Signed-off-by: Grant Ramsay <grant.ramsay@hotmail.com>
2022-07-04 16:09:17 +02:00
Emil Gydesen
4c471914b9 Bluetooth: Audio: Remove codec from bt_audio_broadcast_sink_sync
The codec (or rather codec configuration) is now taken from the
previously received BASE. This also means that the BASE (with
the codec configurations) is now also stored statically.

When the application attempts to synk to the broadcaster
the stack will lookup the codec configuration based on the
bis index, as a BASE may have multiple subgroups
with multiple codec configurations.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-04 16:08:52 +02:00
Emil Gydesen
6c74c51c9c Bluetooth: Audio: Change context type for BAP shell
The shell module will now use BT_AUDIO_CONTEXT_TYPE_ANY
instead of BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED as that provides
a more flexible solution.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-04 15:59:09 +02:00
Emil Gydesen
68593a105b Bluetooth: PACS: Fix support context if SRC/SNK disabled
If CONFIG_BT_PAC_SNK or CONFIG_BT_PAC_SRC was not enabled, the
function would not build due to missing Kconfig
(CONFIG_BT_PACS_SNK_CONTEXT or CONFIG_BT_PACS_SRC_CONTEXT).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-04 15:59:09 +02:00
Emil Gydesen
3436cc12d6 Bluetooth: Audio: Add guards for calling bt_audio_capabilities
Add guards for calling bt_audio_capabilities when
CONFIG_BT_AUDIO_CAPABILITY=n

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-04 15:59:09 +02:00
Emil Gydesen
2071c66249 Bluetooth: Audio: Disable HAS when unicast_server is disabled
The HAS depends on the unicast server, and should be
disabled in the `no_unicast_server` as well as depend
on the CONFIG_BT_AUDIO_UNICAST_SERVER config.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-04 15:59:09 +02:00
Emil Gydesen
3580147263 Bluetooth: Audio: Fix some bad guards in audio shell
Some functions are only used for the unicast server
but was guarded by CONFIG_BT_AUDIO_UNICAST instead of
CONFIG_BT_AUDIO_UNICAST_SERVER.

Some parts of the unicast-server-only code also had
client specific code that would never be called.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-04 15:59:09 +02:00
Emil Gydesen
bb6c0866d8 Bluetooth: Audio: Add PACS for broadcast sink
Add support for using PACS and/or capabilities for
the broadcast sink role. PACS and capabilities were
originally only supported for the unicast server
role, so the PACS callbacks were moved their own
struct, as if a device supports both the unicast
server role and the broadcast sink role, it will
only have a single PACS instance.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-04 15:59:09 +02:00
Emil Gydesen
3d8c3dfaa3 Bluetooth: Audio: Add parent service requirement if CSIS cnt > 1
If the number of CSIS instances on a device is
above 1, then each shall be included by another
service.

This creates a bit of a chicken and egg issue,
as we can't really register the "parant" service
before the CSIS instance has been registered,
and we thus can't verify if the parent service
pointer is actually another primary service on this
device. The best we can do is add the proper
type and a NULL check.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-04 15:52:58 +02:00
Emil Gydesen
2ab42db41f Bluetooth: Audio: Fix broadcast sink LTV decode length issue
The broadcast sink did not properly decode the LTV data
from the BASE.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-04 12:42:39 +02:00
Kumar Gala
560ccb1f5c bluetooth: controller: openisa/RV32M1: Convert to DEVICE_DT_GET
Move to using DEVICE_DT_GET so we can phase out DT_LABEL.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-02 14:08:04 +02:00
Kumar Gala
ded6f43b0d Bluetooth: controller: nRF5: Convert to DEVICE_DT_GET
Move to using DEVICE_DT_GET so we can phase out DT_LABEL.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-02 14:07:54 +02:00
Vinayak Kariappa Chettimada
9f3d29157d Bluetooth: Controller: Fix radio_tmr_start_now for incorrect start time
Fix radio_tmr_start_now from returning delayed start time
under race conditions where the capture time has elapsed but
the compare has triggered at the same time.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-07-01 16:05:30 +02:00
Mariusz Skamra
cd3c6d0258 Bluetooth: has: Handle reconnection to previously bonded device
This adds sending Active Index notification and Preset Changed
notifications on connection to previously bonded client.

Fixes: HAS/SR/CP/BV-03-C
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-07-01 11:37:02 +02:00
Mariusz Skamra
95255db964 Bluetooth: has: Fix missing supported feature flag
The implementtaion supports dynamic presets i.e. changing it's name,
registration and unregistration of the presets, thus Dynamic Presets
feature flag shall be set.

Fixes: HAS/SR/FEAT/BV-05-C
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-07-01 11:37:02 +02:00
Mariusz Skamra
cf30ac2bfc Bluetooth: has: Add support for Write Preset Name operation
This handles Write Preset Name operation that is used to change the
preset name. This covers as well changing the preset name by server.

Fixes: HAS/SR/CP/BV-04-C
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-07-01 11:37:02 +02:00
Mariusz Skamra
8537e28f66 Bluetooth: has: Fix missing preset lookup call
Fixes null-pointer dereference.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-07-01 11:37:02 +02:00
Mariusz Skamra
2d88e3934f Bluetooth: has: Fix sending invalid opcode error
If preset synchronization is not supported, Preset Sync
Not Supported (0x82) shall be sent in error response.

Fixes: HAS/SR/SPE/BI-04-C, HAS/SR/SPE/BI-05-C, HAS/SR/SPE/BI-06-C
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-07-01 11:37:02 +02:00
Jonathan Rico
3c5bf5089a Bluetooth: host: add dedicated WQ for long-running tasks
Send long-running tasks to a dedicated low-priority workqueue.

This shouldn't increase memory usage since by doing this, we get rid of the
ECC processing thread.

This should fix issues like #43811, since the system workqueue runs at a
cooperative priority, and the new dedicated one runs at a pre-emptible
priority.

Fixes #43811

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2022-06-30 10:31:13 +02:00
Andrzej Głąbek
d06d1397c3 bluetooth: ll_sw: nrf5: Apply workaround for anomalies only when needed
Workaround for nRF52 anomalies 102, 106, and 107 was applied also for
SoCs that were not affected with those, namely nRF52811 and nRF52840.
Since the side effect of this workaround is reduction of sensitivity,
this was highly undesirable.
This commit uses dedicated functions provided by MDK for checking if
a given anomaly applies to the used SoC (and its actual revision) so
that the workaround is applied only when it is really needed.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-06-29 11:57:45 +02:00
Pavel Vasilyev
df31962793 Bluetooth: Mesh: Increase BT RX thread stack size for mesh
New logging system (v2) requires more stack size in deferred mode.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2022-06-29 10:30:45 +02:00
YanBiao Hao
5f5c97a905 Bluetooth: Mesh: model sub status async callback
model sub status async callback

Signed-off-by: YanBiao Hao <haoyanbiao@xiaomi.com>
2022-06-29 10:26:00 +02:00
Andries Kruithof
9eaf102e1b Bluetooth: controller: llcp: fix typo
Fixed a typo: the correct term is 'link layer', not
'linked layer'

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2022-06-29 10:25:37 +02:00
Andries Kruithof
1d1a2f8b57 Bluetooth: controller: llcp: avoid regression errors
The change in this commit is required to avoid regression errors
on EBQ test for the PHY update procedure
When in the peripheral role transmission of data must be resumed
while waiting for the PHY IND response from peer.
In other words: in the LP_PU_STATE_WAIT_TX_ACK_PHY_REQ state
data transmission must resume when acting as peripheral,
but not when in the central role

Following tests are effected
LL/CON/PER/BV-49-C
LL/CON/PER/BV-50-C
LL/CON/PER/BV-52-C
LL/CON/PER/BV-53-C
LL/CON/PER/BV-54-C
LL/CON/PER/BV-55-C
LL/CON/PER/BV-56-C
LL/CON/PER/BV-58-C

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2022-06-29 10:25:37 +02:00
Andries Kruithof
aa80f7da5f Bluetooth: controller: llcp: fix PHY procedure for conformance test
This PR fixes the PHY update procedures for conformance tests when
being a Central
The problem was that data was in the LLL tx queue and was still being
queued before the PHY IND was queued (with a given instant).
As a result by the time the PHY IND was transmitted over the air the
instant was in the past.
The fix is to ensure that the LLL tx queue is empty, and to stop
queueing new data  before queueing the PHY IND

Following tests are fixed:
LL/CON/CEN/BV-49-C
LL/CON/CEN/BV-50-C
LL/CON/CEN/BV-53-C
LL/CON/CEN/BV-54-C

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2022-06-29 10:25:37 +02:00
Emil Gydesen
c5fc32756a Bluetooth: Audio: Remove hardcoded location and context for LC3 macros
The BT_CODEC_LC3_CONFIG_* macros had a hardcoded location
and context, which makes them a lot less usable.

Updates the macro, and the macros that used them.
This also removes the BT_CODEC_LC3_CONFIG and instead
just uses the BT_CODEC_LC3_CONFIG_N macro, which has
then been renamed to BT_CODEC_LC3_CONFIG.

As an addition, the macros and their input has
also been better documented.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-06-29 10:24:49 +02:00
Thomas Ebert Hansen
d9774bd925 Bluetooth: controller: llcp: fix issue re. version exchange
Complete the remote initiated version exchange if a LL_VERSION_IND is
received while already having responded in an earlier version exchange
procedure.

Clarify comment regarding how to handle this invalid behaviour.

This has been seen when running the LL/CON/CEN/BI-12-C test on EBQ.

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2022-06-28 11:07:43 +02:00
Andries Kruithof
19bf928ffb Bluetooth: controller: llcp: fix DLE related EBQ tests
Calculation of the DLE related parameters (rx/tx octets and time) depend
on the actual phy in use. For this reason the PHY settings must be
initialised before doing the DLE parameter calculations

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2022-06-28 11:07:36 +02:00
Erik Brockhoff
8b1d50b981 Bluetooth: controller: llcp: fix issue re. missing ack of terminate ind
On remote terminate on central the conn clean-up would happen before ack
of terminate ind was sent to peer.
Now clean-up is 'postponed' until subsequent event.
Also now data tx is paused on rx of terminate ind to ensure no data is
tx'ed after rx of terminate ind

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-06-28 11:07:04 +02:00
Erik Brockhoff
8b912f1488 Bluetooth: controller: llcp: fix issue re. missing release of tx node
On disconnect with refactored LLCP, if data tx is paused,
possibly 'waiting' tx nodes would not get released.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-06-28 11:06:41 +02:00
Erik Brockhoff
522e0b5ade Bluetooth: controller: fixing issue re. erroneous DLE changed events
Only apply change to effective DLE times if current max times are too
small to accommodate. Similar to legacy implementation
Update unit tests to new DLE ntf behavior

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-06-28 11:06:15 +02:00
Emil Gydesen
9bc71bdfb6 Bluetooth: Shell: Fix wrong channel for getting iso broadcast len
The length was taken from `iso_chan` instead of `bis_iso_chan`.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-06-24 20:29:28 +02:00
Aleksandr Khromykh
e552b27117 Bluetooth: Mesh: fix pb gatt fast advertising
pb gatt server starts fast advertising for the first 60 seconds.
After that, server goes into slow mode.
When pb gatt and pb adv work in parallel pd gatt changes fast to
slow modes after the first tx frame in pd adv (about 110ms)
since they both are handled in the same thread.
Actually, pb gatt never worked in fast mode
if pb adv was enabled (in most configuration cases).

Signed-off-by: Aleksandr Khromykh <Aleksandr.Khromykh@nordicsemi.no>
2022-06-24 20:26:48 +02:00
Krzysztof Chruscinski
9833ca61c9 logging: Removing v2 suffix from logging names
Renaming objects which had 2 in the name to indicate that
it is v2 specific. Once logging v1 has been removed such
suffixes are redundant.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-23 15:46:37 -04:00
Emil Gydesen
f6eb15d2d5 Bluetooth: Shell: Fix unused iso_rx_qos variable
The iso_rx_qos is only used for unicast audio, as
we do not set the RX QOS for the broadcast sink, nor
can a broadcast source set RX QOS.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-06-23 15:30:23 +03:00
Krzysztof Chruscinski
041f0e5379 all: logging: Remove log_strdup function
Logging v1 has been removed and log_strdup wrapper function is no
longer needed. Removing the function and its use in the tree.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-23 13:42:23 +02:00
Emil Gydesen
e211bd8931 Bluetooth: Audio: Fix ASCS stream->conn cleanup
The stream->conn was never unref'ed on disconnect with
unbonded devices.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-06-23 09:09:45 +02:00
Emil Gydesen
17ca15067a Bluetooth: Audio: Fix issue with sending on bidirectional streams
This commit fixes some issues with setting up and
using bidirectional audio streams.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-06-23 09:09:45 +02:00