Commit graph

21541 commits

Author SHA1 Message Date
Ryan McClelland
9f8120528d pm: fix warning for missing initializer
A warning is giving for missing initalizer for field `exit_latency_us`
of `struct pm_state_info`. This adds the additional init fields.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2024-12-09 01:40:18 +01:00
Bas van Loon
44d855391b mgmt: mcumgr: transport: smp: Fix smp_transport_clients list init.
Make sure smp_transport_clients list is only initialized once and
before any transports will try to register and add entries to this
list.

The smp_init() routine was called after smp_init_uart(), causing
the list to be emptied again after registration of the uart client
transport.

Signed-off-by: Bas van Loon <bas@arch-embedded.com>
2024-12-07 11:02:38 +01:00
Jamie McCrae
d68b54752c mgmt: mcumgr: transport: smp_udp: Use k_thread_join
Replaces code that peeked directly into the thread by instead
calling k_thread_join() to check the state of threads

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-12-06 22:22:32 +01:00
Rait Rääk
220c4fffd3 net: ethernet: arp: Fix incorrect adding to the pending queue
k_fifo_put is a macro that expands the call to net_pkt_ref(pending)
multiple times when CONFIG_TRACING is enabled thus causing extra
reference for the pending packet and a memory leak.
Fix by moving the referencing call to a separate line.
Signed-off-by: Rait Rääk <raitraak@gmail.com>
2024-12-06 22:21:31 +01:00
Théo Battrel
30928c21f0 Bluetooth: Host: Remove unnecessary #ifndef
The functions `le_sc_oob_config_set`, `generate_dhkey` and
`display_passkey` in `smp.c` were only defined when
`CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY` was not defined. This created
issues at build time.

Remove the guard as the code calling those functions is not guarded
itself.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-12-06 18:20:21 +01:00
Seppo Takalo
9fa82f0d8d mgmt: smp: Fix race condition by using same work queue
Fix possible race condition where SMP client might
release the network buffer before system worker queue
has processed it.

In smp_client uses shared resources like worker queue
linked list and network buffers without maintaining any
thread safety.

For unknown reasons, retry timeout handling is pushed
into system worker queue while the actual transmission
is handled from SMP work queue.

Fix the issue by using the same SMP work queue
for both delayable timeout handling as well as
transmission handling.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-12-06 18:20:10 +01:00
Robert Lubos
3163325e01 net: sockets: tls: Fix connect timeout error code
In case TLS connect timed out during the handshake, errno was set to
EAGAIN which is unexpected and confusing. Fix this and set the errno
to ETIMEDOUT instead.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-12-06 18:19:54 +01:00
Emil Gydesen
56e7b7708e Bluetooth: Host: Add adv == NULL checks in adv.c
Added null checks for adv pointer in the extended and
periodic advertising functions.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-12-06 15:17:41 +01:00
Emil Gydesen
829519dd6f Bluetooth: BAP: Add broadcast sink callback structs
These callbacks are trigger for changes that affect the entire
broadcast sink, such as the BIG synced and terminated events.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-12-06 15:17:06 +01:00
Emil Gydesen
0ae976166f Bluetooth: CAP: Add broadcast source callback structs
These callbacks are trigger for changes that affect the entire
broadcast source, such as the BIG started and terminated events.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-12-06 15:17:06 +01:00
Emil Gydesen
ab9ee0817d Bluetooth: BAP: Add broadcast source callback structs
These callbacks are trigger for changes that affect the entire
broadcast source, such as the BIG started and terminated events.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-12-06 15:17:06 +01:00
Emil Gydesen
e8bcb29f3f Bluetooth: ISO: Add BIG callbacks
Add callbacks that is called for the entire BIG.
The BIG state is from an HCI perspective a single state change
that we previously only propagated as a state change for each
channel.

However it may be simpler for applications and higher layers
to use BIG changes to trigger their behavior.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-12-06 15:17:06 +01:00
Timothy Keys
b3ffaf4441 Bluetooth: Host: Cancel pending deferred work on disconnect
This fixes an issue that occurred if deferred_work is queued by another
procedure before we run bt_conn_set_state(BT_CONN_DISCONNECTED).
bt_conn_set_state yields to the system work queue in bt_conn_tx_notify,
and then deferred_work runs and handles the disconnected callbacks.
bt_conn_set_state then enqueues another deferred_work which calls the
disconnected callbacks again and causes an assert. k_work_cancel_delayable
will clear queued deferred work when we call
bt_conn_set_state(BT_CONN_DISCONNECTED), guaranteeing that the disconnect
callbacks will only be called once.

Signed-off-by: Timothy Keys <timothy.keys@nordicsemi.no>
2024-12-06 15:16:43 +01:00
Lyle Zhu
d37402f447 Bluetooth: Shell: BR: Update command sdp-find
Since the function `bt_sdp_discover` has been updated, the caller of
function needs to be updated to avoid the building and functionality
fault.

Add set the parameter `type` to value
`BT_SDP_DISCOVER_SERVICE_SEARCH_ATTR`.

Update the SDP discovery callback function. Make it align with
`bt_sdp_discover_func_t`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-12-06 12:14:29 +01:00
Lyle Zhu
a047113556 Bluetooth: Classic: SDP: Improve SDP discover
Extend the function `bt_sdp_discover` to support service search
transaction and service attribute transaction.

Improve the `session->rec_buf`. If the net buffer cannot be allocated
from the channel, disconnect the SDP session.

Set the `MaximumAttributeByteCount` of the request
`SDP_SERVICE_SEARCH_ATTR_REQ` with the tail room of `session->rec_buf`.

Set the `MaximumAttributeByteCount` of the request `SDP_SERVICE_ATTR_REQ`
with the tail room of `session->rec_buf`.

Set the `MaximumServiceRecordCount` of the request
`SDP_SERVICE_SEARCH_REQ` according to the tail room of
`session->rec_buf`.

Handle the response code `SDP_SERVICE_SEARCH_RSP`, and
`SDP_SERVICE_ATTR_RSP`.

Handle the error `SDP_ERROR_RSP`. Start the next SDP discovery if the
error received.

If there no more request, disconnect the session.

If the request cannot be sent, start the next SDP discovery.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-12-06 12:14:29 +01:00
Gang Li
5a383919a0 net: wifi: change the acquisition of wifi interface
For WiFi interface, uniformly use net_if_get_wifi_sta() and
net_if_get_wifi_sap() APIs to replace net_if_get_first_wifi().

Signed-off-by: Gang Li <gang.li_1@nxp.com>
2024-12-06 06:50:19 +01:00
Pisit Sawangvonganan
aa1a38e2aa bluetooth: shell: refactor shell print to eliminate ctx_shell usage
This change aims to eliminate the dependency on `ctx_shell` in
the Bluetooth `host/shell/*`, making the code more maintainable.
Replaced `shell_*` functions that depended on `ctx_shell` with
the appropriate `bt_shell_*` functions.

The shell-less functions `bt_do_scan_filter_clear_name`, `bt_do_scan_off`,
and `bt_do_connect_le` were added so they can be called without `sh`.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-12-05 22:10:54 +01:00
Pisit Sawangvonganan
471feb2094 bluetooth: shell: replace ctx_shell with sh where applicable
Limit the usage of `ctx_shell` to cases where printing requires it
and `sh` is not available.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-12-05 22:10:54 +01:00
Pisit Sawangvonganan
28ca65de1c bluetooth: shell: add bt_shell_private.c and bt_shell_private.h
Introduced `bt_shell_private.c` and `bt_shell_private.h` to provide
common functions for the Bluetooth `shell_wall_print`.
These functions are equivalent to `shell_fprintf`, `shell_info`,
`shell_print`, `shell_warn`, `shell_error` and `shell_hexdump`
but without requiring the `sh` parameter.

The cost of the newly added `bt_shell_fprintf_info` ... `_error` functions
will be negligible when there are many individual calls that need to pass
both the `sh` and `color` parameters each time.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-12-05 22:10:54 +01:00
Vinayak Kariappa Chettimada
643ad148f1 Bluetooth: Controller: Fix reschedule for ticker that yield
Fix reschedule for ticker that yield such that reduce the
slot window after intersection to include required
ticks_slot, and we do not take the interval of the
colliding ticker provided every expiry increments the
interval by random amount of ticks. This is the case for
primary channel advertising.

Fixes commit e1cd5ba77f59 ("Bluetooth: Controller: Fix to
reschedule after overlap when yielding").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-12-05 15:18:11 +01:00
Olivier Lesage
3feb1378d6 bluetooth: host: simplify enums for SNR control
It works the same on both sides, so there's no point having two of
these.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2024-12-05 12:30:09 +01:00
Fin Maaß
e3f935650b dfu: boot: mcuboot: fix boot_is_img_confirmed
Fix image confirmed for Direct XIP.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-12-05 12:29:44 +01:00
Matt Rodgers
ddaeb1379a net: http_server: fix header capture on concurrent http2 streams
Concurrent HTTP POST requests on different HTTP2 concurrent streams
require that the client's header_capture_context is re-used to capture
headers on a second stream before all of the body data has been received
(and sent to the application) on the first stream.

As a result, any captured headers must be sent to the application
callback before any headers can be received on a different stream. In
practice this means that for HTTP2 the application callback is called
for the first time on receiving a headers frame, before any data frames
are received. All subsequent application callbacks will not include the
request header data.

While this mechanism is not necessary for HTTP1, it is also updated to
only send headers in the first application callback for consistency.

Fixes #82273

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2024-12-04 14:13:24 -05:00
Matt Rodgers
f050e0bdb1 net: http_server: store current resource detail at an http2 stream level
To correctly handle concurrent HTTP POST requests via different http2
streams on the same client context, it is necessary to store the
resource detail at an HTTP2 stream level rather than at an HTTP client
level, otherwise only one resource detail can be stored.

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2024-12-04 14:13:24 -05:00
Alexander Lay
d356403664 samples: tracing: update sample app for gpio tracing
Implement a sample app to perform basic GPIO tracing.

Signed-off-by: Alexander Lay <alexanderlay@tenstorrent.com>
Signed-off-by: Yang Xu <yangxu@tenstorrent.com>
2024-12-04 14:12:58 -05:00
Alexander Lay
8f2dd90088 tracing: add gpio tracing support
If GPIO tracing is enabled, then the system will track
various GPIO pin events.

Signed-off-by: Alexander Lay <alexanderlay@tenstorrent.com>
Signed-off-by: Yang Xu <yangxu@tenstorrent.com>
2024-12-04 14:12:58 -05:00
Dawid Niedzwiecki
e9163992cf mgmt: ec_host_cmd: add support for nocache buffers
Some backends use DMA. Usually, DMA doesn't work correctly, when memory
to transfer is cached. Add a config to place the common buffers in the
nocache section.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2024-12-04 16:11:54 +01:00
Dawid Niedzwiecki
d7df7cdba6 mgmt: ec_host_cmd: stm32_spi: fix rx reload for STM32H7 chips
Disable and enable SPI module before every transaction for STM32H7
chips. It is a recommended way in the STM32 RM. In another case, a first
byte of a transaction is always 0x00.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2024-12-04 16:11:54 +01:00
Dawid Niedzwiecki
6294c389ca mgmt: ec_host_cmd: stm32_spi: handle underrun for stm32h7 chips
STM32H7 chips have additional configuration regarding underrun event.
Configure the underrun behaviour correctly to use the underrun pattern
and clear the underrun bit before sending new data.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2024-12-04 16:11:54 +01:00
Dawid Niedzwiecki
21c12786ec mgmt: ec_host_cmd: stm32_spi: fix cs interrupt configuration
Move enabling CS interrupt at the end of the backend configuration,
when everything is ready.

It prevents handling the interrupt, when something is not prepared e.g.
DMA is not configured.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2024-12-04 16:11:54 +01:00
Dawid Niedzwiecki
c7bebc669f mgmt: ec_host_cmd: stm32_spi: fix clock domain support
Fix support for clock domains. Create define that identify if
clock domain was selected in any of the st_stm32_spi_host_cmd nodes.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2024-12-04 16:11:54 +01:00
Dawid Niedzwiecki
5d5c4c1d2f mgmt: ec_host_cmd: add support for all dma versions
Update macro used to get fifo threshold from DTS, to support all
STM32 DMA versions.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2024-12-04 16:11:54 +01:00
Dawid Niedzwiecki
7e5b0d7c3f mgmt: ec_host_cmd: stm32_spi: fix clang-format
Use clang-format for the ec_host_cmd_backend_spi_stm32.c file.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2024-12-04 16:11:54 +01:00
Sergey Korotkov
2ee0e38929 Bluetooth: Host: more secure defaults for key size and legacy pairing
Default the Minimum encryption key size to 16.
Key with reduced size is easier to brut force.
Disable LE legacy pairing by default since it's not secure.

These defaults should suite majority of newly developed applications.
It's better to use sensible more secure defaults,
so applications that really need less secure option consciously change it,
not the other way around.
This may help to prevent downgrade attacks.

Signed-off-by: Sergey Korotkov <sergey.korotkov@nordicsemi.no>
2024-12-04 12:10:54 +01:00
Stine Akredalen
6c0306622e Bluetooth: fix GATT service reregistering
* Fixed issue with reregistering of GATT services.
* Added unit tests covering the GATT reregistering scenario.

Signed-off-by: Stine Åkredalen <stine.akredalen@nordicsemi.no>
2024-12-04 12:10:22 +01:00
Hui Bai
ae7613b2c9 wifi: add hidden SSID configuration support for SoftAP
Added hidden ssid support configuration for AP mode.

Signed-off-by: Hui Bai <hui.bai@nxp.com>
2024-12-04 12:09:59 +01:00
Jukka Rissanen
abad505bde net: sockets: Remove deperecated CONFIG_NET_SOCKETS_POSIX_NAMES
The deprecated CONFIG_NET_SOCKETS_POSIX_NAMES option is removed.
If one wishes to use POSIX API socket calls, then CONFIG_POSIX_API
option needs to be enabled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-12-04 12:09:51 +01:00
Emil Gydesen
a3f4ab6b5e Bluetooth: ISO: Add dbg of create BIG params
Log the create BIG params for debugging purposes.
Also slightly modifies the `qos` struct to use a more
suitable struct to avoid always doing `qos->tx->` and
can now just be `qos->`.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-12-04 12:09:29 +01:00
alperen sener
e653a39ed7 Bluetooth: Mesh: Check that required models exists on the same element
Referring to MshDFU_v1.0 Sections 6.1.1, 6.2.1 and  7.1.1 model
descriptions: DFU/DFD server/clients extend BLOB Transfer root models
and DFD server requires Firmware Update Client on the same element. For
this reason we need to make sure that those main models or root models
exist on the same element. And also firmware update client can not be
forced to be in the first element.

For all model extention call return the error code in case of an error.

Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
2024-12-04 09:23:44 +01:00
Zihao Gao
4557b2f06c Bluetooth: AVRCP: add buffer length protections.
Add sanity checks for AVRCP responses received.

Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
2024-12-03 10:17:09 +01:00
Zihao Gao
cb0b472ccc Bluetooth: AVRCP: fix AVRCP timeout handler.
It is recommended to record the subunit type itself instead of the
subunit ID when validating the transaction. This approach is more
meaningful and less prone to misinterpretation.

Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
2024-12-03 10:17:09 +01:00
Zihao Gao
17897071c1 Bluetooth: AVRCP: implementation for subunit info command.
This patch alllows to acquire the subunit info from the remote device.

Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
2024-12-03 10:17:09 +01:00
Johan Hedberg
8b02141ca7 Bluetooth: Controller: Replace BT_CTLR with HAS_BT_CTLR
Deprecate BT_CTLR, and add a new HAS_BT_CTLR as a virtual option which
specific users (like BT_LL_SW_SPLIT) select. This also means that we can
remove all places that were forcefully enabling the BT_CTLR option, and
instead we now depend on devicetree to get some local LL HCI driver
enabled which in turn also enables the HAS_BT_CTLR option.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2024-12-03 10:16:44 +01:00
Pieter De Gendt
4fb6ce39df drivers: coredump: Place API into iterable section
Add wrapper DEVICE_API macro to all coredump_driver_api instances.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-12-03 02:36:38 +01:00
Pieter De Gendt
29c9b91340 drivers: serial: Place API into iterable section
Add wrapper DEVICE_API macro to all uart_driver_api instances.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-12-02 22:08:56 +00:00
Pieter De Gendt
39a49431c7 drivers: display: Place API into iterable section
Add wrapper DEVICE_API macro to all display_driver_api instances.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-12-02 22:05:41 +00:00
Pieter De Gendt
a553af738d drivers: sensor: Place API into iterable section
Add wrapper DEVICE_API macro to all sensor_driver_api instances.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-12-02 22:04:55 +00:00
Arkadiusz Balys
6464ea88fe net: openthread: Allow a platform to select a Settings backend.
Removed implying of NVS by the NET_L2_OPENTHREAD, and from now a
platform can choose between ZMS and NVS as a settings backend.
NET_L2_OPENTHREAD still requires NVS or ZMS backend so the config
depends on one of those.

Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
2024-12-02 18:18:20 +01:00
Steven Poon
30b30c29a3 net: lib: lwm2m: Fix missing mutex unlock
lwm2m_engine_set() and lwm2m_engine_get() locks
the registry_lock mutex, but this is not unlocked
when setting or getting a time resource where the buffer
lengths are invalid resulting in an early return without
unlocking the mutex. This results in a deadlock when
attempting to lock the registry in another thread.

Signed-off-by: Steven Poon <steven-github@outlook.com>
2024-12-02 14:24:17 +01:00
Dominik Ermel
55c12f2c40 storage: flash map: Add flash_area_sectors
The commit adds flash_area_sectors function that allows to get information
on sector/erase page layout by flash_area object pointer instead of
index.
The only difference between flash_area_sectors and flash_area_get_sectors
is that the later calls flash_area_open internally and as such requires
flash map to be compiled in.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-12-02 09:43:00 +01:00