Commit graph

88 commits

Author SHA1 Message Date
Valerio Setti 32b43564df bt: hci_ecc: add option to use PSA APIs instead of TinyCrypt
This commit adds CONFIG_BT_USE_PSA_API to allow the end
user to prefer PSA APIs over TinyCrypt for crypto operations
in bluetooth. Of course, this is possible only if
a PSA provider is available on the system, i.e.
CONFIG_PSA_CRYPTO_CLIENT is set.

This commit also extends
tests/bluetooth/mesh/basic/bluetooth.mesh.gatt adding a specific
case using PSA.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-06-14 15:41:34 +02:00
Valerio Setti 9032f8d791 bt-crypto: add option to use PSA APIs instead of TinyCrypt
This commit adds CONFIG_BT_USE_PSA_API to allow the end
user to prefer PSA APIs over TinyCrypt for crypto operations
in bluetooth. Of course, this is possible only if
a PSA provider is available on the system, i.e.
CONFIG_PSA_CRYPTO_CLIENT is set.

This commit also extends tests/bluetooth/bt_crypto adding
a test case for PSA.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-06-14 15:41:34 +02:00
Sean Madigan 0b327db097 Bluetooth: Add support for Path Loss Monitoring feature
This commit adds host support for the Path Loss Monitoring
feature see Bluetooth Core specification, Version 5.4,
Vol 6, Part B, Section 4.6.32.

Limited logic is required, just adding a wrapper around the
HCI command and callback for HCI event.

Add new zone - BT_CONN_LE_PATH_LOSS_ZONE_UNAVAILABLE, to
convert 0xFF path loss to a useful zone.

Add new Kconfigs and functionality to the bt shell.

Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
2024-06-07 15:04:11 +02:00
Johan Hedberg d590bcb5e0 Bluetooth: Remove BT_HCI_RESERVE and BT_HCI_RAW_RESERVE
In most cases these were defined as 1. Saving one byte for the rest
doesn't really justify the added complexity that comes with these
options. Removing them also simplifies the interface between HCI
transports/drivers and the host stack, which in turn helps pave the way
for having HCI as a proper Zephyr driver API.

Fixes #71907

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-04-29 11:01:27 +02:00
Emil Gydesen 9553347080 Bluetooth: ISO: Add CONFIG_BT_ISO_{RX/TX}
Add 2 new Kconfig promptless options that are shorthand
for whether the ISO configuration can support RX and TX.

This also applies these new options as guards for existing
and missing code pieces.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-03-02 15:05:39 +01:00
Erwan Gouriou 54d7793e82 drivers: bluethooth: stm32wba: Add HCI driver for STM32WBA
Add HCI Driver for STM32WBA devices.
Based on B91 HCI driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-12-18 17:31:08 +00:00
Kyra Lengfeld 93e5cf6e61 Bluetooth: Host: Add LE Power Control Request Procedure APIs
This commits adds the LE API's for the LE Power Control Request Feature
in Zephyr.

The support of feature is provided with the controller-based feature
selection with BT_CTLR_LE_POWER_CONTROL_SUPPORT and is selectable via
BT_TRANSMIT_POWER_CONTROL.

With the new APIs, the applications will:
get improved reading of local and remote tx power
be aware of changes in remote or local tx power

Defined HCI commands in Core Spec v5.4:
7.8.117 LE Enhanced Read Transmit Power Level command:
improvement to existing local tx power reading.
7.8.118 LE Read Remote Transmit Power Level command:
Remote tx power is read through an event (LE Transmit Power Reporting)
7.8.121 LE Set Transmit Power Reporting Enable command:
Enables local or remote tx power reporting to monitor changes in tx power
7.7.65.33 LE Transmit Power Reporting event

Note: to utilize the Feature fully Nordic-LL-only vendor-specific commands
are needed. These will not be added in RTOS zephyr but instead
implemented in a maintainable way in sdk.

Signed-off-by: Kyra Lengfeld <kyra.lengfeld@nordicsemi.no>
2023-11-29 09:59:39 +01:00
Emil Gydesen 856a20bcc6 Bluetooth: Add missing dependency for PAST feature
The PAST sender needs to support periodic advertising
and the PAST receiver needs to support periodic advertising
sync.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-04-04 14:31:17 +02:00
Théo Battrel af01a0f313 Bluetooth: Logging: Move all logging symbols together
Move all Kconfig symbols related to Bluetooth logging into the newly
created `Kconfig.logging`. The logging symbols are now grouped by into a
menu "Bluetooth logging". Closely related symbols are grouped with each
others. For example, audio related logging symbol are found behind a
submenu "Audio" inside the "Bluetooth logging".

The deprecated logging symbols have also been moved in a submenu of
"Bluetooth logging", it's easier to avoid them so.

Behavior of the Bluetooth logging system:

When `LOG` symbol is selected, if Bluetooth is enabled (`BT` symbol
selected), the Bluetooth logging is enabled.

If the user does not set any log level, the Bluetooth logging symbols
will inherit the log level of `BT_LOG_LEVEL`. If the user does not set
the level of `BT_LOG_LEVEL`, the default log level will be the one
defined by the logging subsystem. Which currently is `LOG_LEVEL_INF`.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-03-28 10:33:24 +02:00
Théo Battrel a693b9b33b Bluetooth: Host: Add Encrypted Advertising Data
Create a new Bluetooth library and add Encrypted Advertising Data to it.

Encrypted Advertising Data is a new feature from the Bluetooth Core
Specification 5.4. It provides a way to communicate encrypted data in
advertising, scan response and EIR packets. To do that it introduce a
new advertising data type called `Encrypted Advertising Data`. Also, it
introduce a new characteristic called `Encrypted Data Key Material`,
this provides a way to share the key material.

The library add two main functions `bt_ead_encrypt` and
`bt_ead_decrypt`.

Two helper functions are added to `bluetooth.h`. `bt_data_get_len` and
`bt_data_serialize`, the first one allow the user to get the total size
of a set of `bt_data` structures; the second one generate a spec
compliant bytes array from a `bt_data` structure. The last one is useful
because `bt_ead_encrypt` take as input those kind of bytes array.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-03-21 13:39:09 +02:00
Carles Cufi b90c27238a Bluetooth: crypto: Refactor a few items
After merging #51809, a few things were spotted that needed tweaking.
Among them:

- Rename the folder from bt_crypto to crypto, since the prefix is
  unnecesary
- Remove the include folder
- Remove the path from the global include paths

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-11-10 17:54:14 +02:00
Théo Battrel f16738b62b Bluetooth: Move crypto toolbox functions from smp.c to their own files
Move functions defined in the Cryptographic toolbox of the Bluetooth
specification inside their own files in the following folder:
`zephyr/subsys/bluetooth/bt_crypto`. The functions were previously
implemented in `zephyr/subsys/bluetooth/host/smp.c`.

The cryptographic toolbox functions can now be accessed from outside of the
host.

In addition to that, tests for each cryptographic toolbox functions have
been added.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2022-11-10 09:28:28 +01:00
Erik Brockhoff b3b4b9e322 Bluetooth: controller: implementing SCA update procedure PDU flow
Adding PDU flow and unittest for Sleep clock accuracy procedure

Signed-off-by: Erik Brockhoff <erbr@oticon.com>

wip kconf
2022-11-08 10:44:54 +01:00
Sean Madigan 5b1dd71f3e Bluetooth: kconfig: Add config options for PAST
Add config options specific for periodic advertising sync transfer.

Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
2022-10-17 10:14:10 +02:00
Rubin Gerritsen 860592698b bluetooth: kconfig: Hide host options if not available
When performing a combined host and controller build, there is no point
in presenting the option to enable a given host feature if the
controller does not support it. This reduces the list of presented
features to enable/disable.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2022-06-17 10:49:51 -05:00
Vinayak Kariappa Chettimada 992d133b42 Bluetooth: Increase supported maximum simultaneous connection to 250
Increase the supported maximum simultaneous connection to
250, tested under BabbleSim simulations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-04-04 10:24:34 +02:00
Rubin Gerritsen c17bc7ad2a Bluetooth: Kconfig: Move audio and mesh to be shown under host
These subsystems are part of the host.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2022-03-17 11:12:47 +01:00
Rubin Gerritsen 96a2f56ac6 Bluetooth: Kconfig: No use menu for observer and broadcaster configs
This will ensure that they don't turn up as sub-menus

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2022-03-17 11:12:47 +01:00
Rubin Gerritsen 1e0e2370ac Bluetooth: Kconfig: Move GATT Kconfig to be part of host
This prevents GATT service selection being selectable when compiling
controller only builds.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2022-03-17 11:12:47 +01:00
Gerard Marull-Paretas dffaf5375c kconfig: tweak Kconfig prompts
Tweak some Kconfig prompts after the removal of "Enable...".

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-09 15:35:54 +01:00
Gerard Marull-Paretas 95fb0ded6b kconfig: remove Enable from boolean prompts
According to Kconfig guidelines, boolean prompts must not start with
"Enable...". The following command has been used to automate the changes
in this patch:

sed -i "s/bool \"[Ee]nables\? \(\w\)/bool \"\U\1/g" **/Kconfig*

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-09 15:35:54 +01:00
Lingao Meng 3f3ef659da Bluetooth: Mesh: Add Proxy Client Feature
Add Proxy client feature support.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2022-02-24 13:51:09 -08:00
Jacob Siverskog d3c0692e04 bluetooth: correct kconfig help
bt_conn_get_remote_info contains version fields.

Signed-off-by: Jacob Siverskog <jacob@teenage.engineering>
2021-12-21 18:19:24 +01:00
Emil Gydesen 8251a65575 Bluetooth: Conn: Guard tx_complete_work with CONFIG_BT_CONN_TX
Add new Kconfig BT_CONN_TX which is true if the ACL and
ISO configuration allows for sending data. This is mainly
used to avoid initialization of the tx_complete_work
for ISO sync receiver only builds.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-12-08 08:54:48 -05:00
Kamil Gawor 50ff77fa91 bluetooth: Split configuration into separated Kconfigs
Extracted new Kconfig file for the Extended Advertising
and for the Bluetooth Isochronous Channel from the
Bluetooth subsystem Kconfig.

Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
2021-09-14 09:57:03 +02:00
Kamil Gawor 3f09f94bd2 bluetooth: Add missing choice names in Kconfig
This commit adds missing choice names in Bluetooth
subsystem Kconfig files.

Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
2021-09-14 09:57:03 +02:00
Emil Gydesen c47dae8c6d Bluetooth: ISO: Update connected ISO API
Update the connected ISO API to be more
similar to the broadcast ISO API as well
as the HCI spec.

This updated API allows for more flexibility
and will better support scenarios such as true
wireless setup, as ISO channels and connections
are more independent now.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-24 07:29:11 -04:00
Krzysztof Kopyściński 4f80fe814c Bluetooth: host: introduce timeout in limited advertising
In limited advertising advertising should end after certain timeout.
Previously, limited advertising was just general advertising with
BT_LE_AD_LIMITED flag set. Now, if this flag is set the work is
scheduled, that will disable advertising after timeout.

This affects tests GAP/DISC/LIMM/BV-03-C and GAP/DISC/LIMM/BV-04-C

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-07-29 15:20:54 +02:00
Lingao Meng 40365babaa Bluetooth: Modify kconfig to use related path
Because we use the extended kconfig, we have already
supported relative paths, and it is clearer to use
relative paths in the bluetooth submodules.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-07-20 20:02:34 -04:00
Emil Gydesen a1cf45b26e Bluetooth: ISO: Split connected and broadcast ISO Kconfig
Add a new Kconfig option, BT_ISO_UNICAST, to make it possible
either configure unicast only, broadcast only or both.

This results in some code being moved, but not modified, and
should not effect anything.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-06-22 08:21:00 -04:00
Sylvio Alves a3c35c93ff driver: esp32: add bluetooth support
Add support to BLE and BR/EDR feature.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-04-30 16:51:30 -04:00
Martí Bolívar c3d3b3dbc8 Bluetooth: remove CONFIG_BT_CTLR_TO_HOST_UART_DEV_NAME
This is now unused.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-29 16:33:51 +02:00
Emil Gydesen a264efbcbc Bluetooth: host: Initial support for BIS
Added initial support for BIS (broadcast ISO stream), which
adds support for creating BISes as both broadcaster and receiver,
as well as managing and creating BIGs.

Extends PA sync to handle BIGInfo adveritising reports.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-03-09 08:06:02 -05:00
Emil Gydesen 86f22aa526 Bluetooth: Audio: Move BT audio to new directory
It was decided that the Bluetooth audio subsystem should
be in subsys/bluetooth/audio instead of subsys/bluetooth/host/audio.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-02-16 08:55:17 -05:00
Emil Gydesen c6132c8fdb Bluetooth: Seperate BT_ISO and BT_AUDIO
ISO is a building block for BT_AUDIO but it is not only
useful for AUDIO, and as such should be possible to
enable without enabling BT_AUDIO.

This commit moves iso.c and iso_internal.h to the
host directory (from host/audio) and removes
the CMakeLists.txt.

The /audio directory is left intact for the Kconfig options
it provides, and as a directory for future BLE Audio
content.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-02-15 08:01:34 -05:00
Emil Gydesen 25be47e7a4 Bluetooth: hci_raw: Move BT_ISO to common Kconfig and fix ISO buffers
This commit moves the BT_ISO to a common (host and controller)
Kconfig and fixes the ISO buffers in hci_raw.c

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-02-15 08:01:34 -05:00
Andrew Boie ed7263bf6b bluetooth: add dep on !SMP
The BT code uses co-op thread priorities to implement some
critical sections. This won't work with SMP turned on.
Express this in our configuration ontology, so that it's
not possible for the end user to set up the system in this
way and get crashes or odd behavior.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-10-05 19:33:02 -07:00
Emil Gydesen aea6afe3fa Bluetooth: host: Perodic advertisement synchronization
Added support for syncing to periodic advetisements.
The API and usage is heavily inspired by the extended advertisement
and connection APIs.

Signed-off-by: Emil Gydesen <emil_gydesen@bose.com>
2020-08-11 14:17:19 +02:00
Emil Gydesen 8cf01ab590 Bluetooth: host: Add periodic advertising API
Added API to set periodic adv parameters, periodic adv data
and to enable/disable periodic advertisement.

Signed-off-by: Emil Gydesen <emil_gydesen@bose.com>
2020-08-11 14:17:19 +02:00
Joakim Andersson 91c20e313d Bluetooth: Remove LEGACY_TIMEOUT_API selection from bluetooth
The bluetooth subsystem is now fully compatible with the new timeout
API, so remove the selection of the legacy API.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-30 13:46:48 +03:00
Joakim Andersson d4f22a8216 Bluetooth: host: Add support for multiple advertising set
Add support for multiple advertising set. Move the advertising state
flags to be per advertising set and loop over advertising sets instead
of looking up legacy advertiser set or handle 0.

Since it is not certain that the advertising set terminated event can
arrive directly after the connection complete event there is currently
a limitation that there can only be one local identity used by
connectable advertisers at a time. This guarantees that we know
the local identity being used in the connection complete event.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-21 12:46:05 +03:00
Luiz Augusto von Dentz 05f0816f93 Bluetooth: hci_raw: Add support for command extention
This adds support for registering a command extention table which is
used to match incoming commands and then pass the buffer to its
function handler.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-04-20 21:59:47 +03:00
Luiz Augusto von Dentz b3ee8be80d Bluetooth: hci_raw: Add support for using H:4 transport
This adds 2 config options which enables hci_raw to work in
H:4 mode and enable it by default automatically.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-04-20 21:59:47 +03:00
Luiz Augusto von Dentz 2534ab11c0 USB: Add driver and PID for Bluetooth H4
This adds USB_PID_BLE_HCI_H4_SAMPLE along with it driver which uses H4
over bulk endpoints.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-04-20 21:59:47 +03:00
Johan Hedberg 71eb56a34c net: buf: Move LEGACY_TIMEOUT_API selection to specific subsystems
The net_buf subsystem is now fully compatible with the new timeout
API, so move the selection of the legacy API to those specific
subsystems that use net_buf and still need converting.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2020-04-03 23:17:53 +03:00
Joakim Andersson 886badc69e Bluetooth: Kconfig: Add kconfig options for extended advertising
Add Kconfig options to enable extendend advertising and scanning
support.
Include option to support both types of advertising
commands in case the controller capabilities is not know or the
controller is pluggable.
Include option to only support legacy advertising API, this is to
support the use-case of advertising using different identity than the
scanner or initiator.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-30 00:38:23 +03:00
Johan Hedberg d67416321e Bluetooth: hci_raw: Add support for specifying buffer headroom
The HCI transport implemented by an application using the HCI raw
interface may have its own buffer headroom requirements. Currently the
available headroom gets completely determined by the selected HCI
driver. E.g. most of the time this is the native controller driver
which doesn't reserve any headroom at all.

To cover for the needs of HCI raw users, add a new Kconfig variable
for the apps to set to whatever they need. Correspondingly, use the
maximum of the HCI driver and HCI raw headroom requirements for the
buffer pool definitions and the headroom initializations.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-11-20 19:29:06 +01:00
Joakim Andersson 667886d63d Bluetooth: Kconfig: Fix host phy and data length update dependency
Fix dependency on the Host to include the PHY update procedure and the
data length update procedure. In a host-only build this feature should
be possible to select without relying on the supported features of the
controller. The host will check support using HCI command to read
attached controller features and commands supported.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-11-19 16:57:18 +01:00
Trond Einar Snekvik c704495807 Bluetooth: Move Company ID config out of ctlr
The Company ID concept is not restricted to the controller, and should
be part of the wider Bluetooth scope, so it can be used on a
controller-less device. It's used in multiple host level modules, most
notably the Bluetooth Mesh and Device Information Service.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2019-11-08 16:16:37 +01:00
Alex Porosanu 57d9411837 bluetooth: kconfig: disable some options for openisa/RV32M1
Some Bluetooth options are currently not supported by the experimental
BLE SW LL implementation done on VEGABoard. As such, hide them from
the user altogether.

The full list of disabled config options is as follows:

- CONFIG_BT_PHY_UPDATE
- CONFIG_BT_DATA_LEN_UPDATE
- CONFIG_BT_HCI_VS
- CONFIG_BT_CTLR_LE_ENC
- CONFIG_BT_CTLR_CONN_PARAM_REQ
- CONFIG_BT_CTLR_EXT_REJ_IND
- CONFIG_BT_CTLR_SLAVE_FEAT_REQ
- CONFIG_BT_CTLR_LE_PING
- CONFIG_BT_CTLR_PRIVACY
- CONFIG_BT_CTLR_EXT_SCAN_FP
- CONFIG_BT_CTLR_CHAN_SEL_2
- CONFIG_BT_CTLR_ADV_EXT
- CONFIG_BT_CTLR_XTAL_ADVANCED
- CONFIG_BT_CTLR_SCHED_ADVANCED
- CONFIG_BT_CTLR_TIFS_HW

Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
2019-11-08 15:38:57 +01:00