Commit graph zephyr/subsys
Author SHA1 Message Date
Josuah Demangeon
7e38871a66 usb: host: store the pointers to the interface association
In addition to storing the interface pointers, also store the pointers
for the interface association. Also add comments to the other fields
of the structs to adapt to a new CI check.

Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
2026-02-05 13:12:58 +00:00
Josuah Demangeon
e103442d25 usb: host: introduce wrappers to access the class function pointers
Add API wrappers around the function pointers in struct usbh_class_api,
while also documenting the USB host class internal API.

Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
2026-02-05 13:12:58 +00:00
Josuah Demangeon
1df78741cc usb: host: add copyright notice to linker script
Add missing copyright notice for the linker script to help with
check_compliance.py.

Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
2026-02-05 13:12:58 +00:00
Mark Wang
9062679c55 bluetooth: shell: a2dp: use 'err' instead of 'ret' for error code
Rename variable 'ret' to 'err' in cmd_send_media() to align with
Zephyr coding conventions for error return values.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2026-02-05 13:01:02 +00:00
Andreas Klinger
22ba487f3d shell: add new command zyclictest
- Name derived from Zephyr cyclictest
- Inspired by Linux realtime test program cyclictest
- Measure latency of interrupt service routine as well as thread with the
  help of the timer interrupt, of which the programmed point of time is
  known.
- Zyclictest thread is running in background while individual application
  under test can be running in foreground.

- The interval can be set up with optional argument -i. It should be at
  least double of expected worst case thread latency to get valid output.
  If this is not met the measurement needs to be repeated.
- The priority can also be set up. It should be the priority of the
  application which should run on the final product.
- The maximum size of the histogram is hard coded to 200 so far.

- After stopping measurement the maximum latency, number of errors /
  overflows and the histogram itself is printed.
- Histogram is printed in a form which is easy to be used by plotting
  programs like GNUplot or Python matplotlib.

- Example: One wants to know what is the expected maximum latency of a
  cooperative task with priority of -10.

  $ zyclictest start -i 400 -p -10

  $ # start your application test cases

  $ zyclictest stop

Count: 547329
                   IRQ  Thread
Max-Latency:        21      27
Errors:              0       0
Overflow:            0       0
Histogram:
...
 23                  0  547306
 24                  0       2
 25                  0       5
 26                  0       5
 27                  0       2

Signed-off-by: Andreas Klinger <ak@it-klinger.de>
2026-02-05 10:27:48 +00:00
Sean Kyer
c273ce7989 cpu_freq: pressure: Introduce pressure policy
Add pressure policy to cpu_freq subsystem. The
pressure policy evaluates system load by accumulating
the priorities of runnable threads to inform P-state
transitions.

As more threads of higher priorities queue as ready
in the scheduluer, the system pressure increases
and the policy may decide to choose a more aggressive
P-state.

Signed-off-by: Sean Kyer <sean.actor@gmail.com>
2026-02-05 10:27:38 +00:00
Sean Kyer
dfb612473c cpu_freq: Avoid unnecessary pstate switching
Enchance the cpu_freq subsystem to remember the latest
pstate and skip calling the pstate_set function if
the next pstate is the same as the last.

Signed-off-by: Sean Kyer <sean.actor@gmail.com>
2026-02-05 10:27:38 +00:00
Kai Cheng
b1adf4afbc Bluetooth: Shell: add inquiry scan parameters command
Add shell command for testing BR/EDR inquiry scan parameters update.
Supports default parameter set and custom parameters via interval/
window/type arguments for inquiry scan configuration.

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
2026-02-05 10:26:46 +00:00
Kai Cheng
1a8c5875e3 Bluetooth: Classic: add inquiry scan parameters update
Implement BR/EDR inquiry scan parameters update functionality with
new API bt_br_inquiry_scan_update_param(). Adds support for setting
inquiry scan interval, window and type via HCI commands. Includes
default parameter set for standard inquiry scanning.

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
2026-02-05 10:26:46 +00:00
Kai Cheng
6af1073d1b Bluetooth: Shell: add page scan parameters command
Add shell command for testing BR/EDR page scan parameters update.
Supports predefined parameter sets (R0, R1, R2 variants) and custom
parameters via interval/window/type arguments.

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
2026-02-05 10:26:46 +00:00
Kai Cheng
8fe282374b Bluetooth: Classic: add page scan parameters update
Implement BR/EDR page scan parameters update functionality with new
API bt_br_page_scan_update_param(). Adds support for setting page scan
interval, window and type (standard/interlaced) via HCI commands.
Includes predefined parameter sets for different Bluetooth versions
and use cases.

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
2026-02-05 10:26:46 +00:00
Kai Cheng
3e065836c4 Bluetooth: Shell: add COD set/get support test shell
This commit implements Class of Device (COD) test shell
functionality for Classic Bluetooth, supporting both
setting and retrieving COD from the controller.

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
2026-02-05 10:26:46 +00:00
Kai Cheng
14158c9d02 Bluetooth: Classic: add COD set/get feature
This commit implements Class of Device (COD) functionality for
Classic Bluetooth, supporting both setting and retrieving COD
from the controller by bt_br_write_cod and bt_br_read_cod.

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
2026-02-05 10:26:46 +00:00
Robert Eichinger
4a99d8b411 net: http-server: handle OPTIONS for dynamic resources
Allow applications to respond to HTTP OPTIONS requests (e.g. CORS pre-
flight) by routing OPTIONS through the same dynamic handler path
as GET/DELETE.

This enables OPTIONS handling for both HTTP/1.1 and HTTP/2.

Signed-off-by: Robert Eichinger <robert.eichinger@bshg.com>
2026-02-05 10:24:26 +00:00
Benjamin Cabé
3905ca579a tests: ztest: use proper essential type in boolean variables assignments
As per Zephyr coding guideline #59, "operands shall not be of an
inappropriate essential type". This makes sure boolean variables are
assigned true/false values, not 1/0.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-02-05 10:20:22 +00:00
Benjamin Cabé
718f88d97f net: lwm2m: use proper essential type in boolean variables assignments
As per Zephyr coding guideline #59, "operands shall not be of an
inappropriate essential type". This makes sure boolean variables are
assigned true/false values, not 1/0.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-02-05 10:20:22 +00:00
Benjamin Cabé
94a873e7c7 instrumentation: use proper essential type in bool variables assignments
As per Zephyr coding guideline #59, "operands shall not be of an
inappropriate essential type". This makes sure boolean variables are
assigned true/false values, not 1/0.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-02-05 10:20:22 +00:00
Benjamin Cabé
0aa07f14c7 Bluetooth: use proper essential type in bool variables assignments
As per Zephyr coding guideline #59, "operands shall not be of an
inappropriate essential type". This makes sure boolean variables are
assigned true/false values, not 1/0.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-02-05 10:20:22 +00:00
Alberto Escolar Piedras
ebd86f93b1 net: mdns_responder: Avoid linking to not available code
When building with CONFIG_NO_OPTIMIZATIONS the compiler will not
optimize create_answer() based on the caller, and will try to call
ipv4/6 code even if not built.
Let's add an extra check in the if before those possibly unavailable
calls to ensure those branches are dropped in this case.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-02-04 15:17:39 +00:00
Somil Gupta
363591c0db net: wifi: add shell support for SAE password parameter
Extend the Wi-Fi shell connect command to allow passing an SAE
password separately from PSK. Previously, the shell stored all
passwords in the PSK field, preventing proper use of SAE credentials
required for WPA3 connections.

This change adds a dedicated option to populate the SAE password
field so that SAE authentication paths can be exercised correctly
from the shell.

Signed-off-by: Somil Gupta <somil24559@iiitd.ac.in>
2026-02-04 13:55:43 +01:00
Somil Gupta
e8b12b4447 net: wifi: fix SAE password length validation
Replace the hardcoded 64 character limit with WIFI_SAE_PSWD_MAX_LEN.

Signed-off-by: Somil Gupta <somil24559@iiitd.ac.in>
2026-02-04 13:55:43 +01:00
Benjamin Cabé
14b5485d57 Bluetooth: use proper essential type for boolean variables
As per Zephyr coding guideline #59, "operands shall not be of an
inappropriate essential type". This makes sure boolean variables are
initialized and used with proper essential type (true/false).

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-02-04 13:52:38 +01:00
Jamie McCrae
861079f1fe storage: flash_map: Fix macros for offset/address
Fixes macros that broke after changes were merged which started
using the unit address of partition nodes. This also fixes the
test to ensure devices not starting at 0x0 are properly checked
which previously would silently be unknown

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-02-04 13:51:57 +01:00
Jukka Rissanen
ac0f0ddd4d net: socket: Add helpers to send all data in a buffer
Add helpers for sending all the data in a buffer. This is
only useful for stream sockets like TCP.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-02-03 14:30:56 -06:00
Robert Lubos
ac80abface net: coap: Use dedicated pointer for resource metadata
CoAP .well-known/core handling routine assumed that the "user_data"
pointer in struct coap_resource will be set to a valid struct
coap_core_metadata pointer, or left NULL. This approach is error
prone (application cannot use "user_data" field freely) and renders the
"user_data" field useless for other cases.

Therefore, introduce a separate "metadata" pointer within the struct
coap_resource specifically to configure the resource-related metadata,
and leave "user_data" for the applications to use freely.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-02-03 14:30:02 -06:00
Fin Maaß
a8b71c24f8 fs: fs_stat: handle if it is on a mount point
If fs_stat() is done on a mount point treat
it like it is a directory, instead of leaving it to
the implementation of the filesystem.

The fatfs for example will fail.
That is also the reason `fs cd` from the fs shell
fails, when trying it on a mountpoint with fatfs.

This also makes the behavior of fs_stat() similar to the one
of fs_readdir(). Especially as both functions use the
`struct fs_dirent` to return the informations.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-02-03 14:29:32 -06:00
Brandon Edmonds
939559bc8e sensing: sensor_mgmt: Fix polling in sensing subsys.
The sensing subsystem currently calls fetch and get from a timer ISR
context. A TODO had been previously added to move this to the runtime
thread context, which has been done in this fix.

Signed-off-by: Brandon Edmonds <bedmonds91@gmail.com>
2026-02-03 14:28:15 -06:00
Lauren Murphy
085889e620 llext: sys_mem_blocks as alternate heap implementation
Adds sys_mem_blocks as an alternative implementation
for the heap. Users have reported that k_heap allocating
additional bytes for bookkeeping data when allocating e.g.
a LLEXT_PAGE for an extension region causes them to skip
an entire page for the next allocation. This also causes
problems RE: MPU slot usage. sys_mem_blocks stores bookkeeping
data outside of the memory it allocates from and does not
have this issue.

Note that sys_mem_blocks is only used to allocate extension
regions. Metadata is still stored in a k_heap.

Note also that tracking data for sys_mem_blocks must be stored
per extension, as unlike k_heap it can't deallocate with just
a pointer to the memory.

Further limitations:
* sys_mem_blocks is statically allocated, so this option
  cannot be used with CONFIG_LLEXT_HEAP_DYNAMIC
* A minimum of 1 block must be allocated per region
  regardless of size.
  * If using the MPU / MMU where small allocations are
    rounded up to LLEXT_PAGE regardless, this penalty
    is not quite as noticeable.
* sys_mem_blocks does not support aligned allocations. However,
  by selecting a sufficiently large power of 2 for the
  block size and aligning the backing buffer to the block size,
  any allocation will be automatically aligned for the block size
  and smaller powers of 2. For LLEXT, this means users must select
  a block size equal to or a multiple of the largest
  requested region alignment of regions going on the heap
* If your MPU selects CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT,
  large regions may cause unreasonably large maximum requested
  region alignments
* Block size must also be equal to or a multiple of
  LLEXT_PAGE_SIZE so each allocation is LLEXT page aligned

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2026-02-03 08:22:11 -06:00
Lauren Murphy
3172281e70 llext: add heap implementation kconfig option
Adds a Kconfig option to select LLEXT heap implementation.
Another choice, sys_mem_blocks, will be introduced in the
following commit.

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2026-02-03 08:22:11 -06:00
Lyle Zhu
6e003239e5 Bluetooth: Host: GOEP: force 16-bit FCS for L2CAP ERTM
Set the FCS option to BT_L2CAP_BR_FCS_16BIT for enhanced retransmission
mode in both L2CAP accept and connect paths to work around an
interoperability issue with iPhone devices.

The issue occurs when connecting to iPhone for PBAP or MAP profiles,
where the iPhone expects the 'No FCS' option to be applied but does
not include the 'No FCS' option in its L2CAP_CONFIGURATION_REQ packet.
Forcing 16-bit FCS ensures proper configuration negotiation.

Changes include:
- Set rx.fcs to BT_L2CAP_BR_FCS_16BIT in goep_l2cap_accept()
- Set rx.fcs to BT_L2CAP_BR_FCS_16BIT in
  bt_goep_transport_l2cap_connect()

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-02-03 13:03:09 +01:00
Nicolas Pitre
7fb8f34c87 ztest: fix recursive panic when fatal error occurs pre-kernel
When a fatal error occurs before the kernel is fully initialized
(e.g., during early boot), the ztest fatal error handler would call
k_current_get() which now contains an assertion that fails if called
pre-kernel (added in commit 5ce408b647 ("kernel: assert if
k_current_get is called pre-kernel")). This assertion failure
triggers another panic, creating an infinite recursion that floods
the console with nonsensical values.

Check k_is_pre_kernel() to decide which method to use: _current
directly when pre-kernel (to avoid the k_current_get assertion), or
k_current_get() otherwise for proper userspace and TLS support.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2026-02-03 09:43:42 +01:00
Lyle Zhu
fe68ab16d5 Bluetooth: Classic: HFP AG: skip callback if AG is disconnected
Move state retrieval before error handling to ensure it's always
available for subsequent checks. Add a check to prevent executing
the callback when the AG connection is in a disconnected state.

This prevents potential use-after-free or invalid state access when
the callback is invoked after the AG has been disconnected, improving
the robustness of the notification work handler.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-02-03 09:39:51 +01:00
Paul Wedeck
ee80a68d29 logging: backend: Fix invalid return value in log_backend_net.c
log_backend_net supports both tcp and udp. If no tcp support is
compiled in, line_out will return an invalid number of consumed
bytes (-EINVAL). This patch removes the is_tcp flag if tcp support
is not compiled in and moves the error check into init_net.

Signed-off-by: Paul Wedeck <paulwedeck@gmail.com>
2026-02-03 09:26:20 +01:00
Fin Maaß
f471eb25d0 fs: littlefs: filter automount durring build
filter automount durring build.

Also add the automaticly enabled Kconfig option
CONFIG_FS_LITTLEFS_FSTAB_AUTOMOUNT, similar
to the fat fs and ext2 fs.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-02-02 11:40:12 -06:00
Fin Maaß
3dca26f5a1 fs: ext2: filter automount durring build
filter automount durring build.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-02-02 11:40:12 -06:00
Fin Maaß
82a77b1f3f fs: fatfs: filter automount durring build
filter automount durring build.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-02-02 11:40:12 -06:00
Fin Maaß
9fec4af772 fs: fatfs: enable automount by default if activated in dt
If automount is enabled in the devicetree for
a fatfs, then enable the Kconfig option by default.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-02-02 11:40:12 -06:00
Robert Lubos
476ae94f31 net: sockets: Fix userspace recvmsg() msg_namelen copying
The recvmsg() msg->msg_namelen was not updated if CONFIG_USERSPACE
was enabled.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-02-02 12:57:28 +01:00
Robert Lubos
6514e7bcf9 net: sockets: Set address in TCP recvfrom()
Sender address and address length were not set in recvfrom() when called
for TCP socket. Fix this by reusing the code used to set source address
on accept().

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-02-02 12:57:28 +01:00
Ren Chen
11a23fccb3 pmci: mctp: mctp_i3c_controller: fix missing STOP flag for i3c write msg
This commit adds the missing `I3C_MSG_STOP` flag for i3c
write message.

Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
2026-02-02 10:00:55 +01:00
Ren Chen
0fc925ee6a pmci: mctp: mctp_i3c_target: fix incorrect return code check
The return value greater than 0 from `i3c_target_tx_write()`
indicates the number of bytes written. This patch fixes
the incorrect check.

Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
2026-02-02 10:00:55 +01:00
Gaetan Perrot
7f93ac21c7 settings: settings_zms: make settings_zms_dst and settings_zms_src void
settings_zms_dst() and settings_zms_src() never reports errors and
always returns 0.
The error check at the call site is therefore dead code.

Make the function void and drop the unused error handling.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2026-01-31 17:30:07 +01:00
Ryan Smith
b54d787d3e shell: allow empty prompt
Setting the prompt to the empty string allows it to be hidden. This is the
intent of the shell command 'shell prompt off'. However, in the most recent
change to the prompt handling, this functionality was lost. Presumably,
the check for 'prompt_length == 0' was to avoid a NULL prompt. However,
NULL is already checked for. Remove the zero-length check and restore the
ability to set the prompt to the empty string.

Signed-off-by: Ryan Smith <elryno@elryno.com>
2026-01-31 17:29:18 +01:00
Robert Lubos
5cb214d263 net: ip: Add dependency to NET_NATIVE when reserving FD
Increasing FD count in the system for the network stack (native sockets)
only makes sense if native network stack is enabled. Otherwise, just
make it 0. This makes a difference for example when socket offloading is
used and the offloaded implementation makes its own reservation.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-01-30 18:04:12 +01:00
Karel Blavka
699e7c2ebc shell: add configurable bypass buffer size
The bypass mode in shell.c transfers data in a loop and doesn't need
a large buffer. The previous code conditionally used
CONFIG_SEGGER_RTT_BUFFER_SIZE_DOWN which unnecessarily tied the bypass
buffer size to RTT configuration and could increase stack usage when
RTT buffer is configured larger.

This adds CONFIG_SHELL_BYPASS_READ_BUF_SIZE with a default of 16 bytes,
which is sufficient for the iterative read loop. A build-time assert
ensures the buffer doesn't exceed SHELL_STACK_SIZE.

Fixes: db9dccdc8a

Signed-off-by: Karel Blavka <karel.blavka@hardwario.com>
2026-01-30 18:03:52 +01:00
Cristian Bulacu
a367c439f7 net: l2: openthread: border_router: Split IPV4/IPV6 service init
This commits splits the border router services initialization by
separating the ipv6 related services from ipv4 ones.
As there are cases in which a DHCPv4 server is not present in the
network setup, there is no reason to wait for an IPV4 address before
starting the border router. In this case, only IPV6 functionalities
would be exposed.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2026-01-30 18:03:36 +01:00
Michael Zimmermann
caaa0c696e net: mqtt_sn: udp: fix getting TTL
The length is an input parameter, which tells the kernel how big the
storage is. Depending on the socket implementation in use, not setting this
properly can (and should) fail depending on the value of the stack
variable.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2026-01-30 05:58:15 -06:00
Michael Zimmermann
41f68b6035 net: mqtt_sn: udp: simplify TTL code
5f5db5bf3c added support for IPV6_MULTICAST_HOPS by adding both IPv4 and
IPv6 variants in place where they are used. This made the code a bit
complicated, though. This commit introduces helper functions to solve this.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2026-01-30 05:58:15 -06:00
Ederson de Souza
e16af98a66 subsys/pmci/mctp: Allow UART RX to be stopped
There's a method to enable RX (`mctp_uart_start_rx`), but not one to
stop it. This patch adds `mctp_uart_stop_rx` to do so.

It will be handy at least for tests, as it allows two MCTP endpoints to
share a single UART device - as long as only one has RX enabled - and
"ping-pong" messages between them.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2026-01-30 09:17:39 +01:00
Sumit Batra
124b383945 pmci: mctp_usb: Arm initial OUT and harden disable cleanup
Arm the first OUT transfer when class is enabled
so the host's first write can complete.
On disable, cancel worker, drain FIFO, reset RX parser,
and unblock tx_lock if disconnect occurs mid-transfer.

Signed-off-by: Sumit Batra <sumit.batra@nxp.com>
2026-01-29 16:10:49 -06:00