Commit graph

24,075 commits

Author SHA1 Message Date
Chaitanya Tata
d404fa6879 net: lib: shell: Rejig statistics
Use the newly added API to get specific type of stats (if supported) but
also keep the backwards compatibility.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2025-12-11 16:33:54 -05:00
Chaitanya Tata
f24b902f5e net: l2: ethernet: Add new stats API
Add a new API that takes stat type, the networking stack only needs
NATIVE stats per-packet, it doesn't need to update vendor stats
per-packet. This saves unncessary exchanges in case driver needs to
query the firmware for the vendor stats.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2025-12-11 16:33:54 -05:00
Martin Stumpf
ffb046b797 MCUmgr: OS: fix set datetime millisecond handling
According to the docs the millis were in the format `.SSSSSS`. In
reality though, it only accepted exactly `.SSS`, not `.SS` or `.SSSS`
and specifically also not `.SSSSSS`, contrary to the docs. Further, it did
not fail with an error message but simply produced the wrong value.

With this change it accepts everything from `.` to `.SSSSSS` and
produces the correct result. This is compatible with the previous
behavior, with the documentation and with everything in between.

Signed-off-by: Martin Stumpf <finomnis@gmail.com>
2025-12-11 16:59:35 +01:00
Gilles Devillers
7e139d6bfe net: mqtt: fix log typo
Fix typo in a log message and remove a redundant “error” mention.

Signed-off-by: Gilles Devillers <gildev@gmail.com>
2025-12-11 16:57:33 +01:00
Alberto Escolar Piedras
cc8bb0427a net: latmon: Fix net API use
In d45cd6716b the mayority of the Zephyr
networking code was changed to use the Zephyr native net_/zsock_
prefixed types, but some symbols were forgotten.
Let's change them.

Without these fixes/changes the code still builds in most cases as we are
by now setting CONFIG_NET_NAMESPACE_COMPAT_MODE.
But when this is not set, things will fail to build.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-12-11 16:57:22 +01:00
Simon Piriou
c1091acd09 net: l2: ieee802154: add support for IEEE802154_CFI_DATA_REQUEST
802.15.4 specifies that a device may send a DATA_REQUEST command to the
coordinator after waiting for "macResponseWaitTime", starting after the
acknowledgment to the association request command.

This change adds support to generate DATA_REQUEST frames and sends one
for the association usecase only. The two other usecases, for MLME-POLL
or for beacon-enabled PAN, are not yet supported.

Signed-off-by: Simon Piriou <spiriou31@gmail.com>
2025-12-11 05:50:58 -05:00
Robert Lubos
2565352d11 net: http: server: websocket: Fix truncated string warning on copying
WS_MAGIC is a constant string and when calculating lengths for copying
we always exclude the NULL terminator. In result, using strncpy() for
copying can generate a warning about truncated string, as WS_MAGIC will
always be truncated from the NULL terminator. Therefore replace
strncpy() with memcpy() as it seems more appropriate for this case.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-12-11 05:48:34 -05:00
Cristian Bulacu
510ccd718f net: ip: net_context: Use sin6_scope_id for link-local IPv6 addresses
This commit aims to make use of sin6_scope_id field of net_sockaddr_in6
structure to correctly choose the network interface when destination
address in link-local.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2025-12-11 05:47:48 -05:00
Pisit Sawangvonganan
c5365797ac shell: modules: devmem: utilize sys_put_le(16|32|64) in memory_dump
Replaces direct byte shifting and assignment with `sys_put_le16`,
`sys_put_le32`, and `sys_put_le64` to simplify the `memory_dump` function.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-12-11 09:19:51 +02:00
Pisit Sawangvonganan
ed75a0a293 shell: modules: devmem: use shell_print where applicable
To improve code clarity, use `shell_print` in place of `shell_fprintf`
with `SHELL_NORMAL` where appropriate.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-12-11 09:19:51 +02:00
Stuart Longland
b87498212d shell_uart: Drop superfluous if statement
We're now checking if there is space prior to executing the loop body,
therefore guaranteeing this condition is never going to fire in a
single-threaded context.

Signed-off-by: Stuart Longland <stuartl@vrt.com.au>
2025-12-11 09:19:40 +02:00
Stuart Longland
301c0130b2 shell_uart: Stop polling if buffer is full
Before calling `uart_poll_in`, check we have space to store the character
in the ring buffer beforehand.  If we do, *then* poll for the character.

That way we don't miss out on serial traffic when our ring buffer is full
unless we fill our hardware ring buffer too.

Signed-off-by: Stuart Longland <stuartl@vrt.com.au>
2025-12-11 09:19:40 +02:00
Josuah Demangeon
367c859ee9 usb: device_next: uvc: fix frame interval sorting
The qsort() function takes a callback argument that is having the
same semantics as strcmp(). Fix uvc_compare_frmival_desc() sorting
to make qsort() list frame intervals in increasing values.

Fix a bug where Windows would not enumerate devices when the video device
have multiple frame interval supported.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-12-10 15:46:09 +00:00
Gang He
2594859a0e bluetooth: host: Add parameter check when creating periodic adv sync
In option of HCI_LE_Periodic_Advertising_Create_Sync, bit 2
depend on Periodic Advertising ADI Support feature.

Signed-off-by: Gang He <ganghe@sifli.com>
2025-12-10 15:44:43 +00:00
Gang He
23d873188b bluetooth: host: scan: Format source code
Run clang-format on scan.c

Signed-off-by: Gang He <ganghe@sifli.com>
2025-12-10 15:44:43 +00:00
Dmitrii Sharshakov
e80b608cd4 settings: tfm_psa: improve code style
Fix SonarQube warnings, move variable declarations to the
top of the block according to Zephyr code style

Signed-off-by: Dmitrii Sharshakov <d3dx12.xx@gmail.com>
2025-12-10 10:33:34 +00:00
Dmitrii Sharshakov
0e04d8a802 settings: tfm_psa: add support for PS backend
Protected Storage is another type of secure (encrypted and
authenticated) storage available using PSA interfaces.

When targeting TF-M builds, allow making use of PS for storing settings

Fixes #94681

Signed-off-by: Dmitrii Sharshakov <d3dx12.xx@gmail.com>
2025-12-10 10:33:34 +00:00
Dmitrii Sharshakov
06eb1473d5 settings: tfm_psa: rename from its
Prepare for extending this backend to also allow storing settings in the
PS (Protected Storage).

Mostly file and kconfig renames, as well as updates
to comments and log messages.

Signed-off-by: Dmitrii Sharshakov <d3dx12.xx@gmail.com>
2025-12-10 10:33:34 +00:00
Vijay Sharma
432d9d2a6b tracing: trace timer calls
Add tracing support for timer expiry and stop function callbacks,
enabling measurement of callback execution duration and facilitating
debugging of cases where callbacks take longer than expected.

Signed-off-by: Vijay Sharma <vijshar@qti.qualcomm.com>
2025-12-09 22:40:13 -05:00
John Chung
d41d915330 pmci: mctp: Fix MCTP USB Packet Length Issue
According to DSP0283 1.0.1, Length byte in MCTP over USB header
fields should start from the "MCTP over USB Header" to the last
byte in the "MCTP packet payload"

Signed-off-by: John Chung <john.chung@arm.com>
2025-12-09 17:13:56 -05:00
Peter Mitsis
d59b2a29b4 sys: sys_heap: Fix _system_heap type
Changes the type used in _system_heap extern declarations to use
k_heap instead of sys_heap.

Fixes #100530

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2025-12-09 17:09:25 -05:00
Anas Nashif
2bfe6c498b tracing: move event ids from uint8_t to uint16_t
We are hitting the limit of 256 events possible with event id right now
defined as uint8_t.

The bandwidth increase is minimal (2 bytes per event) compared to the
payload data, and the scalability benefits far outweigh the costs.

Existing CTF traces with 8-bit IDs won't be compatible.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-12-09 14:55:15 -05:00
Julien Vermillard
eef720ff3f net: lwm2m: add send scheduler helper objects
Introduce the optional OMA 10523/10524 send scheduler extension to manage
cached resources, including control and sampling rule objects, cache
filter with gt/lt/st and pmin/pmax handling, max-age/max-sample limits,
and registration flush helper.
Add an overlay to the LWM2M client sample.
Add a fake humidity sensor.

Signed-off-by: Julien Vermillard <julien@clunkymachines.com>
2025-12-09 09:52:11 -05:00
Lyle Zhu
2571b7efa3 Bluetooth: Classic: HFP_HF: Fix invalid indicator index issue
A invalid indicator index will cause the underflow of the array
`ag_ind` if the indicator index is not returned by AG in the
response of AT command `AT+CIND=?`.

Replace hardcoded `-1` values with HFP_HF_INDICATOR_INVALID constant
for better code readability and maintainability. Add proper bounds
checking to validate indicator indices before accessing the `ag_ind`
array using the `ind_table` mapping.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-12-09 09:51:47 -05:00
Lyle Zhu
75ff93ae21 Bluetooth: Classic: HFP: Fix SCO conn cannot be released issue
There is an issue found that the sco conn cannot be released when the
SCO has been disconnected. The sco conn count is referred in the sco
connected callback due to the `sco_conn` is NULL while `sco_conn`
should not be NULL when the sco connected callback is triggered.

It is a race condition issue where the sco connected callback is
triggered before `sco_conn` is updated. The sco conn reference count
has been referred incorrectly, actually it should not be referred.

Replace direct pointer access to `sco_conn` with atomic operations to
prevent race conditions in concurrent SCO connection scenarios.

If the value of `sco_conn` is not NULL when trying to set the return
value of `bt_conn_create_sco()` to `sco_conn`, it means the race
condition occurs. In this situation, discount the sco conn reference
count to fix the issue.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-12-09 09:51:18 -05:00
Tomasz Chyrowicz
764f0d183b img_mgmt: Use absolute address in active partition
Use absolute addresses while determining a running application
partition.

Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
2025-12-09 09:51:07 -05:00
Tomasz Chyrowicz
276ebfcf24 img_util: Use absolute address in active partition
Use absolute addresses while determining a running application
partition.

Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
2025-12-09 09:51:07 -05:00
Dmitrii Sharshakov
8f4f1fa5fa ipc: icmsg: fix unbound for POSIX
Make sure unbound works on nrf5340bsim.

Signed-off-by: Dmitrii Sharshakov <d3dx12.xx@gmail.com>
2025-12-08 15:02:29 -05:00
Ayush Singh
4f98eede4b mcumgr: client: Allow specifying server address
- Currently, it is not possible to use mcumgr client with smp server
  since there is no way to specify smp server address for requests.
- This patch series adds support for creating smp_client_object
  containing information regarding the host server. This design allows
  multiple smp_client_object to exist for the same underlying smp_udp
  transport, making it much easier to use the same udp socket for multiple
  OTAs.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-12-08 11:41:30 -05:00
Pieter De Gendt
3695b2c0ca shell: Add user data argument to shell_set_bypass
Allow passing some context to the shell bypass callback function by
providing a void pointer user data argument.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-12-08 09:39:05 -05:00
Markus Becker
ef5495afa8 net: ocpp: readonly is a bool.
GetConfiguration.conf read_only is a bool according to https://openchargealliance.org/wp-content/uploads/2025/04/OCPP_1.6_documentation.zip.

The Python OCPP implementation reports an error if read_only is reported as an integer: ae716a1507/ocpp/v16/datatypes.py (L73)

Signed-off-by: Markus Becker <markushx@gmail.com>
2025-12-08 09:38:26 -05:00
Ahmad Atoof
82fa487cca modbus: client: change 'EXNO' to '-EIO'
Fix error in Modbus client write response validation.

Signed-off-by: Ahmad Atoof <aat@trackunit.com>
2025-12-08 09:36:42 -05:00
Mark Wang
6e9eda8e1c bluetooth: a2dp: Replace manual loop with ARRAY_FOR_EACH macro
Replace the manual for loop with the ARRAY_FOR_EACH macro for better code
consistency.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-12-08 06:15:20 -05:00
Jukka Rissanen
32059d7414 usb: next: Change to use network namespaced APIs
Do not use POSIX symbols directly but use network namespaced
APIs instead.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-12-08 06:15:04 -05:00
Jukka Rissanen
c52c206e26 usb: legacy: Change to use network namespaced APIs
Do not use POSIX symbols directly but use network namespaced
APIs instead.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-12-08 06:15:04 -05:00
Thomas Decker
06ba1ed88e shell: modules: app_version_service: fix include app_version.h
Fix include of app_version.h (see PR #63973).

Signed-off-by: Thomas Decker <decker@jb-lighting.de>
2025-12-08 06:13:34 -05:00
Sam Friedman
5d52e10671 net: coap_client: remove lwm2m from blocksize kconfig option
The block-wise transfer block size is not specific to LWM2M.

Signed-off-by: Sam Friedman <sam@golioth.io>
2025-12-08 06:10:47 -05:00
Jun Lai
769ba82aa5 llext: export some symbols
Export these symbols for loadable modules
that use them.

Signed-off-by: Jun Lai <jun.lai@dolby.com>
2025-12-05 13:39:15 +02:00
Cheng Chang
abb707ca36 bluetooth: host: obex: Allow MOPL to exceed MTU for mobile compatibility
When MOPL  exceeds MTU, adjust it to match MTU instead of failing the
connection. This handles the common case where mainstream mobile
operating systems (iPhone and Android) negotiate
MOPL values greater than the RFCOMM or L2CAP MTU.

Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
2025-12-05 10:54:21 +02:00
Marco Widmer
9634425478 net: context: release context mutex before clearing IN_USE flag
A race condition was observed with concurrent net_context_get()
and net_context_unref() calls: If net_context_unref() is interrupted
just after clearing the NET_CONTEXT_IN_USE flag, net_context_get() may
try to reuse the context and reinitialize its mutex through
k_mutex_init(). Once net_context_unref() resumes, it calls
k_mutex_unlock() on the newly initialized mutex, which may lead to the
following assertion:

ASSERTION FAIL [mutex->lock_count > 0U] @ zephyr/kernel/mutex.c

Fix this by unlocking the context mutex before clearing the
NET_CONTEXT_IN_USE flag.

Signed-off-by: Marco Widmer <marco.widmer@bytesatwork.ch>
2025-12-04 17:11:25 -05:00
Nikhil Namjoshi
79a7106f9d net: Initialize unspec_addr to avoid -Werror=maybe-uninitialized
The variable 'unspec_addr' in net_dhcpv6_init() is implicitly
initialized on some platforms and optimization levels, but not
guaranteed to be initialized on all code paths when built with
compiler instrumentation.

This leads to a build failure with the strict
'-Werror=maybe-uninitialized' warning when code coverage flags are
enabled (e.g., via twister --coverage).

```
zephyr/subsys/net/lib/dhcpv6/dhcpv6.c:2325:26: error: ‘unspec_addr’
may be used uninitialized [-Werror=maybe-uninitialized]
         net_ipaddr_copy(&net_sin6(&unspec_addr)->sin6_addr,
```

Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com>
2025-12-04 17:11:17 -05:00
Markus Becker
96944d92f4 net: ocpp: Change Current.OfferedMaximum to Current.Offered
According to
<https://openchargealliance.org/wp-content/uploads/2025/04/OCPP_1.6_documentation.zip>
the Measurand value is called Current.Offered (Maximum current offered
to EV).

Signed-off-by: Markus Becker <markushx@gmail.com>
2025-12-04 14:05:24 -05:00
Emil Gydesen
ff4347571b Bluetooth: BAP: Bcast Source: Add missing use of variable
The broadcast_state variable was not used in
bt_bap_broadcast_source_update_metadata to verify the
state, but broadcast_source_get_state was instead called
twice.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-12-04 14:05:05 -05:00
Emil Gydesen
51946986e6 Bluetooth: BAP: Bcast Source: Refactor bt_bap_broadcast_source_reconfig
Refactor the bt_bap_broadcast_source_reconfig function to be less
complex by splitting the verification into multiple functions.

Additionally, it also fixes a rare, but potential, issue where
some subgroups were updated before a later subgroup would fail
to be updated. Added can_merge_codec_cfg_data to verify correctness
before we attempt to update any subgroups. This new check is also
applied to bt_bap_broadcast_source_create.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-12-04 14:05:05 -05:00
Emil Gydesen
b6e3f8ee5c Bluetooth: BAP: Broadcast source: Reduce complexicty of valid_param
Move the subgroup parameter validation to its own function to
reduce the size and complexity of valid_broadcast_source_param
to make Sonarcube happy.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-12-04 14:05:05 -05:00
Mark Wang
d776d00c42 bluetooth: sbc: move sbc to bluetooth
move sbc to bluetooth because only bluetooth uses it,
change CONFIG_LIBSBC_ENCODER and CONFIG_LIBSBC_DECODER as CONFIG_LIBSBC.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2025-12-04 05:26:00 -05:00
Seppo Takalo
7f1eb218c0 modem: pipe: Don't return EPERM on closed pipe
When working on CMUX power saving, it is typical
that we end up closing the pipe before the last
RX_READY event is handled from workqueue, so we end up
receiving -EPERM which is not really a fatal error.

Pipes recover when they are re-opened. So drop this error
and return zero instead, like modem_pipe_open() and close() does.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2025-12-04 05:24:38 -05:00
Seppo Takalo
437becb0da modem: cmux: Add struct cmux_config into struct cmux
Instead of copying all fields from cmux_config into run-time
struct cmux, just have the configuration structure as a member.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2025-12-04 05:24:38 -05:00
Seppo Takalo
af0a788bd8 drivers: modem: Implement runtime power management for CMUX
CMUX driver can enable the support for idle-timer in
devicetree and can be requested to shut down the pipe
during sleep.

Then UART backend put the actual device into sleep when
pipe is closed.

Waking up is requested by sending data to DLC pipe
or by manually opening the uart_pipe.
Modem may request similar wake-up by a RING interrupt which
would open the same pipe.

When UART is powered and pipe is not closed, CMUX wake-up
procedure is automatic. Either end may initiate the wake-up.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2025-12-04 05:24:38 -05:00
Seppo Takalo
aa408d7184 modem: cmux: Implement Power Saving Control message
Signal powersaving mode for the remote end using PSC command.
Wakes up the remote end from powersaving mode by sending flag characters.

This method is defined in 3GPP TS 27.010.
Sections 5.4.6.3.2 Power Saving Control (PSC) and
5.4.7 Power Control and Wake-up Mechanisms.

Essentially it is one PSC command to indicate a sleep state, and
then repeated flag characters to wake up the remote end or indicate
that we have been woken up.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2025-12-04 05:24:38 -05:00