Commit graph zephyr/subsys
Author SHA1 Message Date
Emil Gydesen
55e671781d Bluetooth: CAP: Initiator: Fix bad return values in param checks
Some parameter check return paths returned -EINVAL for
a boolean function.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:32:35 -06:00
Emil Gydesen
527d969786 Bluetooth: CAP: Initiator: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:32:35 -06:00
Emil Gydesen
05440203c1 Bluetooth: CAP: Commander: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:31:41 -06:00
Emil Gydesen
cb6bd5b023 Bluetooth: CAP: Commander: Remove invalid check
start_param->subgroups is an array, so it is always
non-NULL.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:31:41 -06:00
Emil Gydesen
7f5c9892f1 Bluetooth: CAP: Acceptor: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:31:03 -06:00
Emil Gydesen
f4ae52137e Bluetooth: BAP: US: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:29:24 -06:00
Emil Gydesen
33a1b4fa62 Bluetooth: BAP: UC: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:29:01 -06:00
Emil Gydesen
449b63ec3e Bluetooth: BAP: Stream: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:28:38 -06:00
Emil Gydesen
0ee0fb838f Bluetooth: BAP: SD: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:28:13 -06:00
Emil Gydesen
b2c19b3ae5 Bluetooth: BAP: Broadcast Source: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:27:53 -06:00
Emil Gydesen
13e00454ff Bluetooth: BAP: Broadcast Sink: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:27:27 -06:00
Emil Gydesen
7005ee0054 Bluetooth: BAP: BA: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:27:04 -06:00
Emil Gydesen
0dc8f915f3 Bluetooth: BAP: BASE: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:26:33 -06:00
Emil Gydesen
4a30f7f27c Bluetooth: ASCS: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:26:12 -06:00
Emil Gydesen
654a2a2105 Bluetooth: Audio: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:25:39 -06:00
Emil Gydesen
9778c5bcc9 Bluetooth: AICS: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 13:25:23 -06:00
Emil Gydesen
a65c3fb171 Bluetooth: BAP: SD: Refactor use of mutex
This commit does the following 2 changes:
1) The return value of k_mutex_lock has been modified to
be treated as a fatal error instead of a simple runtime error.
The reason for this is to avoid having to handle those cases,
and to treat those cases a fatal errors. The timeout for the
mutex should be long enough for any operation within the lock,
and if it isn't, then that should be treated as something that
needs to be fixed, as it is likely a bug. This is also the reason
why the timeout was kept, instead of using K_FOREVER.

2) Ensure that all log statements are done while the log isn't
locked.

The implementation should be reconsidered in terms of application
callbacks, as the current state, where we need to unlock and relock
the mutex so many times does not only risk resolving in cases where
wrong values are set, but is also not very readable nor performant.
Changes to the API will be done in a followup commit, as that requires
more significant changes.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 15:11:09 +01:00
Emil Gydesen
4230213f1f Bluetooth: CAP: Clear params before handover continues
When an unicast initiator procedure or a commander broadcast
procedure is completed and we have handover enabled, the
parameters used need to be cleared before continueing.
This is due to the fact that the parameters are only cleared
on completion, rather than at initialization, and that the
initiator and commander parameters are in a union.
Not clearing the parameters could set some values to an
unknown/unexpected start value.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 15:10:38 +01:00
Josuah Demangeon
5c88168758 usb: host: shell: call usbh_device_set_address()
Instead of calling the low-level function from usbh_ch9.c, call the
higher level function from usbh_device.c to update the address,
making sure that the udev->address and udev->state are updated
appropriately.

Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
2026-02-10 13:02:10 +01:00
Josuah Demangeon
abdc1ff11d usb: host: add a usbh_device_set_address() function
To complement usbh_req_set_address(), add a matching function
usbh_device_set_address() that also takes care of updating the data
structures.

Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
2026-02-10 13:02:10 +01:00
Lingao Meng
c200ff1eb4 fs: nvs: handle power loss during ATE write at sector end
NVS writes an entry by first programming the data area and then writing
the corresponding ATE. If a power loss occurs after the data has been
written but while the ATE is being programmed, and the remaining space
in the sector is only large enough for a single ATE, the ATE may end up
partially written.

1) Power loss while writing the last data ATE, leaving only space for
   a delete ATE but no space for additional data entries:

       [ data ][ data ][ erase ][ ATE ][ ATE ][ erase ] (sector end)
                                  ^^^
In this cases, nvs_startup() scans the sector and fails to find any
erased space usable for data writes, causing failed to mount.

       [ data ][ data ][ erase ][ ATE (Invalid) ][ ATE ][ erase ]
               ^       ^
                    ate_wra
            data_wra

The sector is logically exhausted andshould be closed and garbage
collected.

Detect this condition during startup. If no erased space exists after
the last ATE write, explicitly close the sector and trigger garbage
collection to restore a writable sector.

This completes the missing recovery path for power-loss scenarios
where a sector becomes effectively full due to ATE writes.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2026-02-10 13:01:50 +01:00
Pieter De Gendt
15b86499ce shell: devmem_service: Unmap virtual memory
WHen running the shell devmem dump command and CONFIG_MMU is enabled, the
virtual memory wasn't unmapped.

Call the device_unmap function to cleanup virtual memory resources.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-02-10 10:53:32 +01:00
Emil Gydesen
5864564a46 Bluetooth: CCP: Add user_data to bt_ccp_call_control_client_cb
Add a user_data field to bt_ccp_call_control_client_cb. The
field is optional to enable via Kconfig. The field can be used
to provide additional context from the owner of the callback
structure, to the callbacks themselves.

This solves a memory use-after-free issue in the unit tests
where the values from the callback was accessed after they
were released, as the values were just stack allocated.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-10 10:51:43 +01:00
Jay Beavers
03a86f89a1 usb: device_next: fix bInterfaceSubClass for CDC ECM data interface
According to the USB CDC 1.2 specification, section 4.6, the value of
bInterfaceSubClass for the data interface should be 0.

Signed-off-by: Jay Beavers <jay@tolttechnologies.com>
2026-02-10 08:23:40 +01:00
Jay Beavers
4d5477d0f3 bindesc: fix compile error when CONFIG_BINDESC_READ_FLASH disabled
Origin: Original
Fixes: zephyrproject-rtos/zephyr#103444

The get_entry() function uses IS_ENABLED(CONFIG_BINDESC_READ_FLASH) in
an if statement to guard code that accesses struct members (flash_device,
buffer) which are only defined when CONFIG_BINDESC_READ_FLASH is enabled.

While IS_ENABLED() correctly evaluates to 0 when the config is disabled,
the C compiler still performs type-checking on all code paths before
optimization can eliminate the dead branch. This causes a compile error:

  error: 'struct bindesc_handle' has no member named 'flash_device'
  error: 'struct bindesc_handle' has no member named 'buffer'

Fix by using preprocessor #if directive instead of runtime if statement.
This ensures the flash-specific code is excluded during preprocessing
when CONFIG_BINDESC_READ_FLASH is not enabled.

Signed-off-by: Jay Beavers <jay@tolttechnologies.com>
2026-02-10 08:23:22 +01:00
Fabio Baltieri
89e778d5b2 usb: device_next: usbd_cdc_{ecm,ncm}: support promisc mode
Flag the ECM and NCM interfaces as supporting promisc mode. There's no
filtering really so enabling promisc is a noop but pretending to have
support is needed to allow these to be added to a bridge.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2026-02-10 08:22:46 +01:00
Aiden Hu
376d2c3139 usb: uvc: update header for UVC 1.5 compliance
Add input terminal descriptor and CS descriptor header and
extend frame descriptor fields (buffer size, default interval)

Signed-off-by: Aiden Hu <weiwei.hu@nxp.com>
Co-authored-by: Aiden Hu <weiwei.hu@nxp.com>
Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
2026-02-09 16:12:00 -06:00
Josuah Demangeon
9fd1afc6f9 usb: uvc: use max host/device for MAX_FRMIVAL
Compute the maximum of the CONFIG_USBD_VIDEO_MAX_FRMIVAL and
CONFIG_USBH_VIDEO_MAX_FRMIVAL for struct definition, so that
the same struct can be relevant for both host and device
implementation.

Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
Signed-off-by: Aiden Hu <weiwei.hu@nxp.com>
Co-authored-by: Aiden Hu <weiwei.hu@nxp.com>
2026-02-09 16:12:00 -06:00
Josuah Demangeon
69d9f133c4 usb: host: uvc: placeholder implementation
Loop through each of the VideoStreaming and VideoControl descriptor
to parse them. This is meant as a stub for the purpose of testing the
class API.

Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
2026-02-09 16:12:00 -06:00
Vytautas Virvičius
597ec0d8ff modem: backends: uart async close fix
This fixes an issue where the modem pipe is declared closed before it
actually is closed, leading to issues when you try to re-open quickly.

Signed-off-by: Vytautas Virvičius <vytautas@virvicius.dev>
2026-02-09 12:01:33 -06:00
Mathieu Choplain
3d03c55e1d llext: define global mutex using K_MUTEX_DEFINE
Use the appropriate macro K_MUTEX_DEFINE to define the global `llext_lock`
mutex instead of declaring it like a regular variable initialized
using the internal Z_MUTEX_INITIALIZER() helper.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-02-09 12:01:01 -06:00
Chaitanya Tata
7f6d361473 nrf_wifi: Remove nRF71 support
The driver and module now supports nRF70 only, nRF71 support will be
added in the future using a new driver.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2026-02-09 11:59:17 -06:00
Lingao Meng
4364dd9e51 fs: nvs: tighten ATE validation using write order constraints
NVS ATE validation currently relies on CRC8 and coarse boundary checks
against the sector size. Because CRC8 has a non-negligible collision
probability (1/256), a corrupted ATE may occasionally pass CRC
verification while still containing invalid offset or length fields.

Instead of only validating that the referenced data fits within the
sector, this change additionally verifies that the end of the data
region (offset + len) does not exceed the physical position of the ATE
itself.

Due to the append-only write order of NVS, data is always written before
its corresponding ATE. Therefore, any ATE referencing data beyond its
own location is structurally invalid and must be rejected.

This tighter consistency check significantly reduces the likelihood of
accepting corrupted ATEs without introducing additional flash reads or
changing the on-flash format.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2026-02-09 11:57:33 -06:00
Flavio Ceolin
7a3d2b6167 pm: policy_events: Fix variable scope
next_event should not be global. This can cause
linkage conflicts if another file defines a symbol
with the same name.

Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
2026-02-09 09:38:27 +01:00
Andrej Butok
ff8d194fdd soc: nxp: kinetis: fix SOC_SERIES inconsistency
- Fixes Kconfig SOC_SERIES naming for Kinetis SoCs,
  as required by HWMv2.
- Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/69317

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2026-02-06 08:58:07 -06:00
Robert Lubos
5fc367e348 net: coap: Remove invalid 2.00 response code
CoAP response code 2.00 is not defined anywhere in the spec nor
assigned in the IANA registry, therefore it should not be defined
in Zephyr either. Remove the invalid response code and its usage
in tests.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-02-06 08:57:38 -06:00
Fin Maaß
810e79b35b fs: fs_stat: allow using it on root dir
We already allow using `fs_opendir` on the
root dir, so `fs_stat` should also work with it.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-02-06 14:03:17 +01:00
Maciej Sobkowski
61ba3c9cd6 instrumentation: support dynamic triggers
This makes using instrumentation with any sample/board combination
much easier, as it eliminates the need to define a custom dt overlay.
Trigger/stopper functions need to be configured at build time.

Signed-off-by: Maciej Sobkowski <msobkowski@antmicro.com>
2026-02-06 13:53:34 +01:00
Josuah Demangeon
5412bf3265 usb: uvc: move helpers functinos to common/
Move UVC helper functions to a file shared between UVC host and device.
The arrays are not visible anymore from either USB host or device, but
instead accessed through a front-end funciton.

Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
2026-02-06 11:18:45 +01:00
Emil Gydesen
e1ff7805de Bluetooth: VOCS: Client: Replace CHECKIF with if
The usage of CHECKIF has been replaced with a regular
if. The reason for this is that higher layer may depend
on some of the checks defined by the API, and the higher
layers cannot do that properly if the checks can be
removed via a Kconfig option.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-06 11:17:19 +01:00
Johann Fischer
5163ea64fe usb: device_next: hid: do not use false and true in COND_CODE_1
With the C23 standard, false and true are keywords and constants of type
bool with a value of 0 and 1. Though there does not seem to be issues
with GCC version 14, there is a note in the specification that the
spelling of false and true inside expressions that are subject to the #
and ## preprocessing operators is unspecified.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2026-02-05 16:54:58 +01:00
Alberto Escolar Piedras
45fae3de24 usb: host: Correct function prototype
Correct function prototype which causes a compiler warning
and builds to fail due to it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-02-05 16:51:26 +01:00
Josuah Demangeon
a8007b2209 usb: host: add debug logs for the configuration descriptor
The USB host will have to select the appropriate size for the configurtion
descriptor, and the defaults will not be enough for some classes that
encode a lot of information in the configuration descriptor.
Add logging to debug this.

Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
2026-02-05 13:12:58 +00:00
Josuah Demangeon
cdd8bdf239 tests: usb: host: test API using initialization code from USB samples
Add tests making sure the USB Host class APIs introduced build
and run as expected. Use USB device samples common code for
initialization.

Co-authored-by: Johann Fischer <johann.fischer@nordicsemi.no>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
2026-02-05 13:12:58 +00:00
Josuah Demangeon
32c25aa978 usb: host: add a nil entry at the end of configuration descriptor
Allocate a larger size to keep room for a nil descriptor at the end of
the configuration descriptor. This is used to walk through the list of
descriptors until this empty descriptor happens.

Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
2026-02-05 13:12:58 +00:00
Josuah Demangeon
7e455ae0fe usb: host: improve safety of configuration descriptor parsing
Make sure that there is at least enough room for the header before
dereferencing the fields such as bLength.

Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
2026-02-05 13:12:58 +00:00
Josuah Demangeon
29504e2d86 usb: uvc: move the header definition to include/
Move the UVC header with all the definitions from the UVC standard to
share it between USB host and device class implementation.

Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
2026-02-05 13:12:58 +00:00
Josuah Demangeon
92c4d2744e usb: host: introduce usbh_class with init/remove functions
Add functions to probe/remove all classes as part of a new usbh_class.c
and a matching usbh_class.h. These functions are called from the function
usbh_init_device_intl() in usbh_core.c to initialize every class upon
connection of a device. Every class driver provide filters to match the
interfaces of the device.

Co-authored-by: Aiden Hu <weiwei.hu@nxp.com>
Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
2026-02-05 13:12:58 +00:00
Johann Fischer
b71d3223a8 usb: host: add functions to initialize and probe class drivers
Add basic functions to initialize and probe class drivers.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
2026-02-05 13:12:58 +00:00
Johann Fischer
293b5d0271 usb: host: add helpers to parse USB descriptors
Add helpers to parse and validate USB descriptors.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
2026-02-05 13:12:58 +00:00